Sending Trigger Pulse to PC port
Hello,
I have recently got my hands on an openBCI R&D Kit and a ultracortex v3. I am using an FPGA for my stimulus presentation (for more precise timing especially in SSVEP and cVEP studies) and I generate a trigger signal from the FPGA as well. With other EEG measuring devices (I've used biopac and brain products) I just feed the amplifiers with my generated trigger through a parallel port on the amplifier itself. There is no other way as their software is not open source nor they have a way to directly stream data into matlab. With openBCI there are guides on how to send trigger signal to the board and there to PC, just like these traditional amplifiers. But I wonder if there is a way to send the trigger pulses directly to PC simultaneous with the EEG data stream coming from the oBCI board?
Thank you for this awesome project!
Best,
Yigit
Comments
@yttuncel
> So I'm %100 sure trigger is generated at the same time instant the stimulus is generated
There is no delay from when the stimulus is actually show to the user though? All monitors have refresh rates which happen most of the time at best 60Hz, or every 15ms.
onward...
I believe the python LSL implementation is adding the time stamp as it arrives from the serial port which happens as flushes once the buffer is full, then then a chunk of data get's brought in.
Note: As far as I know OpenBCI_Python DOES NOT HAVE ANY FIRMWARE V2 FEATURES.
Check out this table called Firmware Version 2.0.0 (Fall 2016 to Now) under Binary Format. See all those different "Stop Bytes"? That's how I was able to solve the time sync issue. You can see in this easy to read node code section how I send the packets to different functions based on that final four bits.
The original V1 firmware was unable to send different stop bytes, so I rewrote the radio firmware to pass through an extra four bits which could designate what type of packet was coming through.
Now checkout the node time sync example. There you can see the node is resyncing every second. You can also read about the time sync strategy in detail in this short write up.
The actual source code for making the time sync possible can be found here in a private node code function. I actually talk about that difference in time stamp problem from serial flush and how I over came that along with a pretty print all in the comments in that function.
With the node code you would get your 16 bits of aux data in a nice buffer in a nice JSON object.
Here is the code I used to validate the time syncing, it may help you. I used an Arduino to send a pulse to the Board, thinking that's something like your FPGA.
Good luck
You could also TCP into Matlab from node. would love to see an example of that!