BioSemi USB Trigger Interface with PsychToolBox on Linux

Hello everyone,

Has anyone used the BioSemi USB trigger interface (BioSemi EEG ECG EMG BSPM NEURO amplifiers systems) to send triggers from PsychToolBox running on a Linux computer to a BioSemi amplifier? Our lab is currently transitioning to using PTB on a Linux computer as the stimulus presentation system for EEG experiments and, before we buy the cable, we are wondering if anyone has experience using this BioSemi USB trigger interface or other similar devices and would have any advice on this matter. Thank you so much!


No practical experience with this at all - didn’t know it exists. But from the page you linked it seems to use a FTDI USB-Serial converter internally, and these are generally well supported under Linux, so unless you’d get very unlucky it should just work. This also suggests it should work, although the advice there doesn’t apply here, but as proof of concept:

Ofc. you wouldn’t use Matlab’s serial() command to connect to the serial port, but our IOPort driver with superior timing. If you need more assistance, please get a community membership with priority support. If not, still get one if your lab can afford it, to support PTB’s upkeep, and my ability to still give free advice like this occasionally.


You may consider our toy RTBox, rather than their trigger interface:

RTBox not only sends event markers easily, but also automatically sends button events to the EEG system.
The only extra part will be a cable from RTBox to the EEG system that will have different pin mapping for different EEG system.

1 Like


We use a LabJack U3 to communicate with our BioSemi systems under Windows and Linux. This replaces the old Parallel Port rather than the serial port though… but we have found it quite simple.

Hi Dagmar,

Might you have some kind of primer and/or sample code for getting the LabJack working on Windows. I’ve been using the LabJack with a Python-based exp control software on the Mac for years, but I’m now trying to transition my lab to PTB running on Windows. Ultimately, I’ll probably present from Linux, but will be using Windows in the short-term. I have the drivers installed and can control the LJ using the LJ Control Panel, but haven’t been able to control it from Matlab. Any tips would be most appreciated.


1 Like

If you use the LabJack T4, then they use a unified LJM API and the same code works well cross-platform. I use the T4’s very cool ability to run code (it has a Lua runtime and can run a command-response server), so that I can send commands asynchronously from PTB and let the LabJack deal with any timing (for example if one uses a variable-length TTL to control a reward system). See the details on the wiki:

For the LabJack U3/U6 they use the exodriver on Linux/macOS and I also share some code for that, but on Windows they use a different driver and I never bothered to work out how to access it.

I assume that an Arduino would also work just as well and would be cross-platform, and I have some code to handle that too:

I found super fast and low variability command-response times with PTB’s IOPort and the legacy hardware interface from Mathworks: Serial port interface code -- a performance comparison

xiangrui’s RTBox should also work well cross-platform, but I think you already have a LabJack?

Thanks, Ian. This is all very helpful. I do already have the LabJack U3, which is what I had been using to send codes to my BioSemi EEG system. I’ll reach out to the LabJack folks and see if they can point me in the right direction regarding the Windows driver. If not, the Arduino might be the most attractive alternative. Thanks again!

1 Like

Youl could use audio square waves as triggers. For such a solution, there’s a description of how to make a DIY trigger box here:

That box uses the BioSemi Ergo input, which I’m not sure is present on all BioSemi systems. But I think it’s an elegant solution, in that to my understanding it uses the same analogue to digital converters as are used for the BioSemi electrodes. It doesn’t require any code or drivers, but just needs an audio square wave output synchronised with events from your stimulus generating computer. You then program your analysis code (e.g. in MATLAB or Python) to look for EEG events whenever the square wave trigger is present.

An alternative, also using audio square waves, is to build a trigger box which works via the USB2 receiver on the BioSemi. I find this a bit unusual, in that the BioSemi employ a USB2 to parallel port converter, perhaps for historical reasons. And I’m guessing that the jitter issues introduced by the ADC in such a trigger box might be different (might be better or worse, depending on your ADC!) than using the BioSemi ADCs. Whatever, this is the solution my university uses. The lab has many published papers using that type of home-made trigger.

You can buy trigger boxes from BioSemi as well, but they’re quite expensive (“Ergo Optical” on this page: Analog input box holders adhesive disks signa gel elefix syringe respiration belt galvanic skin response GSR Temperature sensor Plethysmograph strain gage eye tracker Cambridge)

What kind of EEG stimuli are you using?

For auditory stimulus, it is a good idea to convert audio signal as trigger for EEG, and it takes care of the potential audio signal delay or, more importantly, variation. For other stimulus, in my opinion, audio converted trigger is introducing timing uncertainty, while a simple serial port over USB can have <1ms accuracy.

They have a Windows driver and some MATLAB code available, and one of the great benefits of Labjack as a small company are they are super friendly and helpful folks; they have always solved any problem I have…

1 Like

Yes, I was thinking specifically of EEG experiments with auditory stimuli :wink:

With video cassettes, it used to be that you could be sure of audio being synchronised consistently with video. That reliability seems to be broken now though – I routinely experience sync issues between digital video and audio, and the problem seems to be getting worse not better :frowning:

So, if the EEG stimuli are visual, a solution other than the one I suggested may well be more suitable.

One solution for video (I’m thinking out loud here!) would be to embed the trigger as a black/white box in a small and hidden corner of the video display. You’d create video stimuli such that changes in the trigger are synchronised with your video events. You can then be sure that the trigger is appearing at the same time your video stimuli become visible to the participant – synchronisation at this point in time is perfect. The difficulty is in converting the LCD or OLED display trigger output into something the BioSemi will accept as an input. You could use a photodiode. I just checked, and rise/fall time (10% to 90%) is in the nanosecond or picosecond range. With some analogue processing, that might make a usable input for the BioSemi?

This is probably overkill for most experiments though. It could be fiddly to rig up as well. I’m sure there are more practical solutions for video. Would be interested to learn about them, in case I ever need to use video stimuli.