Previous topic

psychopy.gui - create dialogue boxes

Next topic

Cedrus (response boxes)

This Page

Quick links

psychopy.hardware - hardware interfaces

PsychoPy can access a wide range of external hardware. For some devices the interface has already been created in the following sub-packages of PsychoPy. For others you may need to write the code to access the serial port etc. manually.


psychopy.hardware.findPhotometer(ports=None, device=None)

Try to find a connected photometer/photospectrometer!

PsychoPy will sweep a series of serial ports trying to open them. If a port successfully opens then it will try to issue a command to the device. If it responds with one of the expected values then it is assumed to be the appropriate device.

ports : a list of ports to search

Each port can be a string (e.g. ‘COM1’, ‘’/dev/tty.Keyspan1.1’) or a number (for win32 comports only). If none are provided then PsychoPy will sweep COM0-10 on win32 and search known likely port names on macOS and Linux.

device : string giving expected device (e.g. ‘PR650’, ‘PR655’,

‘LS100’, ‘LS110’). If this is not given then an attempt will be made to find a device of any type, but this often fails


  • An object representing the first photometer found
  • None if the ports didn’t yield a valid response
  • None if there were not even any valid ports (suggesting a driver not being installed)


# sweeps ports 0 to 10 searching for a PR655
photom = findPhotometer(device='PR655')
if hasattr(photom, 'getSpectrum'):
    # can retrieve spectrum (e.g. a PR650)