psychopy.org | Reference | Downloads | Github

Send TTL from psychopy to BrainAmp EEG system


#1

Hello,

I’m doing an EEG experiment using PsychPy and BrainVision Software. The computers are connected via parallel port (BrainVision trigger box).
The task consists in images presentation.

I dont’ know how to send a trigger from psychopy to the BrainAmp… and a bit clueless.
I try to insert a I/O parallel port component, defining like that the element of the component


And i insert a code as done by others post on similar topic.

Unfortunately, it doesn’t work.

I’d be grateful for any suggestions about what I can try.
Thank you,

Aurore


#2

If you are using the Trigger Box by Brain Products (see here: https://www.brainproducts.com/productdetails.php?id=55), then you are not using the parallel port and hence a parallel port component will not work.

The trigger box is emulating a serial port (COM port on Windows) and you have to send trigger signals via serial port. I am not experienced with the “Builder” but perhaps you can insert a code component. See the official example by Brain Products below:

import serial
import time
import threading

Connected = True
PulseWidth = 0.01

def ReadThread(port):
    while Connected:
        if port.inWaiting() > 0:
            print "0x%X"%ord(port.read(1))

# Open the Windows device manager, search for the "TriggerBox VirtualSerial Port (COM6)"
# in "Ports /COM & LPT)" and enter the COM port number in the constructor.
port = serial.Serial("COM6")

# Start the read thread
thread = threading.Thread(target=ReadThread, args=(port,))
thread.start()

# Set the port to an initial state
port.write([0x00])
time.sleep(PulseWidth)

# Set Bit 0, Pin 2 of the Output(to Amp) connector
port.write([0x01])
time.sleep(PulseWidth)

# Reset Bit 0, Pin 2 of the Output(to Amp) connector
port.write([0x00])
time.sleep(PulseWidth)

# Reset the port to its default state
port.write([0xFF])
time.sleep(PulseWidth)

# Terminate the read thread
Connected = False
thread.join(1.0)

# Close the serial port
port.close()

#3

Thank you very much for your answer.

I will try this.

Aurore.