Serial USB Port EMS trigger to Brain product

OS (e.g. Win11):
PsychoPy version (e.g. 3.2.2023):
Standard Standalone? (y/n) If not then what?:
**What are you trying to achieve?:Sending trigger via EMS trigger box

Hi guys, I’m totally new with psychopy and I’m trying to use a GEMSTR19007 (the exact name of my device) to send a marker to my EEG. The device is connected via USB port. I added in my builder a serial port out but I’m not sure about how and where to add the code to import the device and make it works. Is there a way to not code and just use the builder? I also have a python file to read the device but when I tried to import it in the before experiment routine it fails.

Is there someone who can help me please? I’m stuck

Hi guys now my trigger box is working and I can send an input from psychopy to EEG.
I just set the following in the custom code “before the experiment”:
from UseTriggerBox import *
import time

Now I need support to understand how I can define different markers depending on the condition and the type of response. I have the following code string:

print(“send TTL”)

What should I add or change to ask psychopy to print:

  • session number (as reported in experiment info)
  • The current block (1 out of 8) of the task
  • The response key (e.g. print 1 if response is correct; 0 if response is not correct; 2 if not response);

Is there someone which can help me please?

Hi There,

If you have a spreadsheet listing the trials for your experiment, you can add a column e.g. “triggerval” and replace the “8” in your code snippet with triggerval.

In general, I would suggest not using the time.sleep(0.2) in a code snippet, as it could damage the timing of your experiment. Instead if you have in the Begin Routine tab:

trigger_offest_sent = 0

and then in the each frame tab have something like

if t > 0.2 and trigger_offset_sent == 0:
    trigger_offest_sent = 1

That shoudla chieve the same thing but using PsychoPy’s clocks to control timing.

Hope this helps,

Thank you Becca, usually in writeport I can set the channel to send the TTL. For instance, if I write:


I will send a TTL to the channel 1 of my Trigger box. So I’m wondering, if I set triggerval (and the spreadsheet) in the writeport, how can psychopy chose the channel to send the output?