I’m currently trying to have my experiment to work with a serial port trigger but I have limited test time and it’s a bit frustrating that their documentation and previous solutions are not properly working…
I agree that is definitely frustrating that the PsychoPy documentation does not seem to be valid. In my case, the serial port was actually a pstbox, so I was able to utilize ioHub and receive triggers and button responses this way. My code resembles the code from this post on E-prime button boxes (Using an E-Prime Button Box - #7 by richard). I’ve also heard from others at my institution that using the serial python library also works with some specific settings in place, though I have limited experience with this.
Hope this helps (and hope the PsychoPy team can update the fMRI trigger documentation at some point soon)!
I’ve brought this to the attention of the team, so hopefully it will get updated soon. It’s not my area, so not something I can help with directly. Have you tried the new Builder components?
From my understanding of the documentation, the Serial Out component works by sending the trigger to another device (like an EEG), not receiving one.
In our case what we were looking for is a proper way to start the experiment after receiving a trigger from the fMRI. In my case I’ve been testing the serial python library but I’m still struggling to detect any input from the serial port.
import serial
import time
port = serial.Serial('COM4', 9600) # Change to correct COM port and baud rate.
time.sleep(1) #Give the device some time to wake up
Thanks for bringing it to our attention about the docs! These are, as you’ve pointed out, outdated now. Once we’ve got a working solution here I can update those.
Hi Kimberley, thanks for your answer! I tried using Begin Experiment:
import serial
port = serial.Serial('COM4', 9600)
and Each Frame:
input = port.readline()
with a text component to display the input during the experiment, but no input was received.
The same serial port works well with another software, so we don’t know where the problem might be. I think we’ll probably resort to doing a manual trigger when the fMRI acquisition begins and take that into account when we analyze the results.
In many of our setups we have the port read just at the beginning of the routine to launch things.
Before you resort to manual triggering, do you have any response boxes on the system that are otherwise catching the TR pulse trigger? Like a Current Design 932 box, PST Chronos, Biopac, or Cedrus?
It might be possible to use those as a keyboard emulator to start your experiment.