Replacing Parallel Port Signaling with USB

Many psychological and neuroscientific experimental paradigms require triggering various devices.  For example, it is common to send triggers to mark the timing of events to psychophysical recording equipment (e.g., skin conductance, HR, EEG, eye-tracking, etc.).  It is also common to trigger other equipment to deliver experimental stimuli.  This could be to signal a machine to deliver pain, juice, or shocks.  Most of these devices rely on parallel port signaling, which is an antiquated technology that is no longer available on many modern day computing systems.  Unfortunately, most of the commonly used equipment (e.g., biopac, eyelink, medoc pathways) do not yet include an option for digital signaling outside of a parallel port connection.


In our ljlab we have recently switched to using a digitial I/O that connects via USB to the stimulus computer and have created two parallel port cords that can independently send separate triggers to different devices.  There are several types of these digital I/O devices such as labjack and measurement computing.  I have used devices from both companies, but have had an overall better experience with labjack so far.  We have purchased the U3-LV ($108) with the extra CB-25 terminal board attachment ($29).  We have attached 8 pins (FIO0-FIO7) to cat5 cables and grounds to a 25 pin parallel port connector and pins (EIO0-EIO7) and grounds to a separate parallel port connector.  This allows us to send two separate 8-bit binary signals to different devices.  Each of these parallel port connectors could also be split if some devices will be receiving the same signal.  Additional details about the hardware setup can be found here.


The next question is how to get your favorite stimulus delivery software to interface with the labjack.  Our lab uses a variety of software (e.g., eprime 2.0, psychtoolbox, psychopy, and presentation) running on both windows and macintosh computers so we have implemented several different options.  We typically need to send separate triggers to our medoc pathways pain delivery system and our biopac MP150 recording system. We have found that that labjack performs very well on both our windows and mac computers with a latency of approximately 8ms.  We typically need to simultaneously trigger a specific pain intensity to the medoc pathways system and a trigger to the biopac psychophysiology system.

First you need to install drivers for the labjack.  We are using the drivers provided by labjack for eprime in windows and the labjack exodriver for libusb on the mac installed via homebrew (e.g., brew install libusb exodriver –universal).

For eprime, we have created a function that is placed inside the user script.  You then need to insert an initialization command in an inline script (e.g.,InitLabJack) and then call the labjack trigger function (e.g., TriggerLJ(Trigger1, Trigger2 (optional), “rev_channel” (optional))).  This software is available in our github repository.  If you are triggering a medoc pathways system you need to make sure that you reverse the binary code.  We have an option to do this in your call.


'trigger 46 degree temp and set all eprime triggers to 1
TriggerLJ(46, "rev_channel", 255)

For psychtoolbox, we are using an objected-oriented matlab function created by iandol available from his opticka github repository.  This labJack class has a lot of functionality, but so far we have only been using the SetDIOValue method.  The author has documentation about the available methods here.

% initialize
lj = labJack('verbose',false)  

% send binary signal of 46 to medoc and binary signal of all 1's to biopac

% reset all triggers to 0

There is also a nice toolbox called labjackpython that works well for making calls from PsychoPY.

For an alternative approach see Chris Rorden’s StimSync and advice on using the Measurement Computing 1208 data acquisition device.

Please let us know if you have any additional questions, run into any problems, or find additional resources to share.