Timestamps to sync stimulus and EEG vs external hardware trigger
I'm working on a P300-based appilcation where data should be synced with the stimulus displayed on the screen. I can't use hardware triggers.
I read the EEG data from the serial port and have a high precision timmer that logs the exact time when the stimulus is displayed. I can also log the exact time when the first eeg data is received or when the request to start openBCI is sent (after writting 's' to the serial port to start OpenBCI).
What would be the best way to sync eeg with the stimulus?
Is it possible to get the internal clock of OpenBCI for each sample? Or at certain controlled times during the session (I see some sort of timestamp at Cyton data format but I am not sure how to use it, any help will be appreciated if that's the best method).
Comments
I am using high precision timers to control and log the stimulus.
I am currently using LSL but for simplicity for the users I'd rather have a standalone app.
I can log the time when start is sent to OpenBCI and when first sample is received. Not sure if that will help. I also have the packet counter.
Maybe latency could be estimated sending several pulses (if that's possible) to the board and comparing it with the log timestamps (from the computer)? Could that compensate jitter?
Any idea how openvibe or LSL works?
To put the board on analog mode, what do you recommend?
- modify the DefaultBoard example & upload it via Android IDE to have the board on Analog mode by default
Or
- send '/2' at the begining. I assume the process should be: OpenPort > send '/2' -> wait for success message (documentation says I should receive a message but I just receive 'success'?) -> send 'b' to start streaming ->read data. Does that seem correct?
The latest openBCI GUI v.3.3.1 worked for me. The beta version (v 4.0.2 and 4.0.3) did not work. I was getting random values, both for digital and analog modes.
The other problem I had was that the board was resetting and switching to default mode(accelerometer mode). I have a standalone app so I send now the '/2' command and wait to receive the 'success' message before starting the stream.
With a resistor of 10k, I get values ~300 for a black image and ~800 for a white image. I set the threshold to 550.