OS (e.g. Win10): Win10 64-bit
PsychoPy version (e.g. 1.84.x): v3.0.6
Standard Standalone? (y/n) If not then what?: Yes
What are you trying to achieve?:
Use labjack U12 to send event markers/triggers (via DB25 port)
What did you try to make it work?:
I modified code for labjack U3 in order to make it work for U12 as follows:
# Initialize components for Routine "stimuli"
import u12
p_port = u12.U12()
p_port.status = None
# *p_port* updates
if t >= jitter and p_port.status == NOT_STARTED:
# keep track of start time/frame for later
p_port.tStart = t
p_port.frameNStart = frameN # exact frame index
p_port.status = STARTED
win.callOnFlip(p_port.eDigitalOut, channel=0, state=1, writeD=1)
frameRemains = jitter + 6- win.monitorFramePeriod * 0.75 # most of one frame period left
if p_port.status == STARTED and t >= frameRemains:
p_port.status = FINISHED
win.callOnFlip(p_port.eDigitalOut, channel=0, state=0, writeD=1)
Today I managed to borrow a Biopac device to test the script and it seems working fine.
What specifically went wrong when you tried that?:
However, my concern remains: according to U12 datasheet (
link) eDigitalOut function requires 14~20ms to excute, so there may be a variable delay in sending event markers. I wonder whether using U3 would encounter a similar issue (and how to minimize the consequence of this delay)?
wondering if you got this working, or if anyone has opinions on the U3 vs. U12?
Hi Brian. Sorry for the delayed response.
U12 can be used to send triggers, but it is inappropriate for ERP settings in which intervals between two triggers are short (the DigitalOut function used by U12 needs 16~20ms to excute, see https://labjack.com/forums/u12/execution-time-low-level-functions-specifically-rawdio-u12). Besides, U12 sometimes seems to produce a strong line noise (haven’t confirmed it yet). So I’ll recommend using U3.
1 Like
great - thank you. that makes sense about the delay. we will be doing biopac for EDA, etc. in addition to ERP, so U3 will likely work best.
I assume on Biopac’s end you use sequential “event marking” to read in whatever PsychoPy sends? I see a lot of code on here for sending event markers from psychopy, but I don’t see much talk about how Biopac picks it up. Just thought you may have some insight before I go digging too much. Cheers!
As far as I can recall - yes. I used the DB25 port on the side panel of MP150 to connect with the computer running psychopy. Then on the data acquisition computer, I set several digital channels in AcqKnowledge (when creating template files) to pick up markers (one channel for each type of marker). No coding is needed on Biopac’s end as far as I can recall.
Here are some information about the DB25 port and digital channels (page 7-8) https://www.biopac.com/wp-content/uploads/MP150-Systems.pdf
PS: Unlike U12, U3 has a DB15 port, so we had to wire digital lines by ourselves.
(see also EEG Triggers via Labjack: How to do the Parallel Port DB25 connection)
1 Like
Thanks for that. Yes our plan is to use Labjack U3 wired to a breakout board, which connects via DB25 to the MP160. (Following the instructions here). Good to hear there is no coding on Biopac’s end; I will poke around in AcqKnowledge as soon as the labjack arrives. Cheers.