Triggering and PCI-DIO 24

Dear PsychoPy Community,

I have just started using PsychoPy and am new to coding in general. I am currently have Digital IO PCI card (PCI-DIO 24 from Measurement Computing), in a Dell Optiplex 9010. Previously, we have used this chip to send pulses or triggers to a Biopac EEG amplifier (we used a program called superlab, vr 4), though I have been unable to figure out how to do this with PsychoPy (or python).

I have found an IO button in the builder, though it only seems to give me options for built in parallel ports or a lab jack. I was wondering if there were those among the community who could point me in the direction of how I might use python/psychopy to send signalsto the PCI board so that it could send pulses to the amplifier.

Apologies if this is something that has been talked about before, and/or if this is totally the wrong place to put such a question.

Thank you all in advance!!!

Best,

Reza

Yes, you’ll need to use Python to talk to the specific library that the company provides to interface with their particular hardware.

This seems like a starting point to resources on that:

I haven’t looked at that, but in essence, you would need to install their universal library and also their Python package that can interface with it. You’ll need to tell PsychoPy about that Python package as follows:

http://www.psychopy.org/recipes/addCustomModules.html

and then you should simply be able use the functions of that library, within your own PsychoPy code, or likely even within a code component from inside PsychoPy Builder.

If you make progress with this, please update us here, as this will be a useful pointer to anything else using these systems.

Dear Michael,

Thank you for the information. I will get the libraries installed on the computer and work through the examples!

I will post an update once I get it working, or if I hit any other roadblocks.

Thanks again for the help!

Best,

Reza

I know this thread is old, but I was having a similar issue so I thought I would comment on it here. We are using a Windows desktop and a USB-DIO24 from Measurement Computing to communicate with our EEG amplifiers and software. These are the steps we took:

  • Hook-up your hardware
  • Use InstaCal from Measurement Computing to configure your DIO24 (basically giving your board a number)
  • Use pip to install Measurement Computing’s ‘Universal Library’ API for Python. (https://github.com/mccdaq/mcculw)
  • In your PsychoPy experiment, add a code component and use it to import the libraries and to initialize the board. We did this in the ‘Before Experiment’ tab:
from mcculw import ul
from mcculw.enums import DigitalPortType, DigitalIODirection

# Set some initial values
board_num = 0

try:
    # Configure the port for the board
    ul.d_config_port(board_num, DigitalPortType.FIRSTPORTB, DigitalIODirection.OUT)
    
except ULError as e:
    codeMsg = 'Error: ' + str(e.errorcode) + ' (' + e.message + ')'
  • In the appropriate place (e.g., in the ‘Begin Routine’ tab of the code component), place the code to write out the trigger signal:
try:
    # The last argument is the byte value that you want to write to the port
    ul.d_out(board_num, DigitalPortType.FIRSTPORTB, 255)
    
except ULError as e:
    codeMsg = 'Write Error: ' + str(e.errorcode) + ' (' + e.message + ')'

That should be it! Note that there are different default ports (FIRSTPORTA, FIRSTPORTB, AUXPORT, etc.) but we only had luck with ‘B’. It might be that other boards are different?