Help generating event marker on EEG using serial port pulse

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): macOS Mojave 10.14.6
PsychoPy version (e.g. 1.84.x): 3.1.3
Standard Standalone? (y/n) y
What are you trying to achieve?: I am running a behavioural task while participants have an EEG recording. The task presents a 1 second tone, and then instructs participants to move their (left or right) hand for 15 seconds. I would like to generate an event marker (audio tone, 15seconds of moving) signal from the computer that can be inputted to the EEG amplifier as a separate channel.

To do this, I think I need to use pyserial functions as I am using a Mac laptop without a parallel port. I therefore would imagine that I need the following electronics circuit:
Macā€“> Usb cable --> I/O DAQ box (I have a NI USB-6009) --> cable to EEG amplifier input

Can anyone please advise on a) whether this is even possible and b) any code I might need to include as I donā€™t think I can use the ā€˜Parallel out I/Oā€™ component in the builder.
Thankyou

What did you try to make it work?: Nothing really- I am new to this and looking for guidance!

What specifically went wrong when you tried that?:
Include pasted full error message if possible. ā€œThat didnā€™t workā€ is not enough information.

1 Like

Hi @Amber_Roguski, yes this is possible. Both LabJack and LabHackers USB2TTL8 are supported in PsychoPy through the Parallel Port component. Also, it is easy to manually code e.g., for LabHackers you would use pyserial. E.g., from their website, it is as simple as:

import serial
s = serial.Serial('COM3', baudrate=128000, timeout=0.01)
s.write('WRITE 255\n')    # ON
s.write('WRITE 0\n')      # OFF
1 Like

Hi @dvbridges
Thankyou for your quick reply. I have a National Instruments USB-6009 DAQ box available to me, do you think this would also work?
Many thanks
Amber

Yes, looks like it is possible with the nidaqmx Python library:

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019Pf1SAE&l=en-GB
https://nidaqmx-python.readthedocs.io/en/latest/

A call for help: having downloaded NI DAQmx and pip installed the python nidaqmx module, I am struggling with making a simple pulse generator as seen with the LackJack example above.

If anyone can advise or help I would really appreciate it!

Amber