PsychoPy + BrainFlow, and markers [resolved]

paulasaavedrapaulasaavedra Argentina
edited August 31 in Cyton

Hi everyone! I am new to Open BCI and need help. I want to record EEG signals, send stimuli via Psychopy, and read data from the Cyton board via BrainFlow.

The problem is: how can I send a marker signal to know when a stimulus starts and when it ends in my data record?

I have read that a signal can be sent to the Cyton board at the same time that psychopy starts a visual stimulus and then after acquiring all the data I could also see the marker signal.

Any kind of help would be appreciated.
Thank you

Comments

  • wjcroftwjcroft Mount Shasta, CA

    Paula, hi.

    Cyton has 8 EEG data channels and 3 'Aux' channels that can record trigger / marker information. These Aux channels can be set to either 'digital' (0V or 3.3V) or 'analog' (10 bit value in that same 0 to 3.3V range). See:

    https://docs.openbci.com/Cyton/CytonExternal/
    https://docs.openbci.com/Cyton/CytonSDK/#board-mode

    By default the Aux channels are recording the accelerometer (x, y, z) values. Board mode commands switch to use trigger signals.

    William

  • Thanks for the reply William. I would like to do exactly that but without external hardware.
    I have a script with visual stimuli with Psychopy. On the other hand, I read the cyton data with BrainFlow.
    I would like to be able to synchronize the times since I sent a stimulus with Psychopy and when I read the data with BrainFlow. I understand that it can be done with LSL but I have not found how to do it. Could you help me?
    Thank you!
    Paula

  • wjcroftwjcroft Mount Shasta, CA

    The most accurate method for alignment of markers / triggers is using the Aux channels described above. For example by painting onto your monitor screen (say in the lower right), a small square which illuminates at marker time. This is then picked up with a photo sensitive element (taped to the screen) and captured by the Cyton in real time. Links above give some tips.

    Time stamps or time markers are another approach. But often require careful calibration to determine inherent delays in system buffering between the different elements of your setup. For example, such delays can occur in the operating system, in device driver(s), in radio channel (RFduino's in dongle and mainboard), in latencies imposed by other processes running on the CPU, etc. etc.

    William

  • Thanks William. You have helped me a lot!
    Paula

  • Hi Paula
    The method described by @wjcroft is the best if you need perfect synchronization of markers with eeg. I also use Psychopy but I send markers via Arduino and LSL. The delay is just a few miliseconds but photoresisitor is a must. If you just send markers directly from Psychopy, expect variable time errors (20-30ms). You can check my repo: https://github.com/marles77/openbci-brainflow-lsl
    Marcin

  • @marles77 thanks for share. Do you send a trigger via LSL? that's what i need to do. I have thought that the best option is to send it through the channels of the accelerometer, so as not to lose one of the eight recording channels. Have you tried it?

    Thanks

  • @paulasaavedra, I send both the trigger and EEG signal via separate LSL streams and merge them in Lab Recorder (it writes everything to one XDF file). I did not try to use accelerometer channels because I need several different triggers and I can connect as many photoresistors to Arduino as I want. Plus I can modify their thresholds etc. without reprogramming the Cyton. The downside of this solution is slight desynchronisation (<5ms). So, I realize that it is not a perfect solution but it is sufficient in my case. Mind that changing FTDI default latency is also important https://docs.openbci.com/GettingStarted/Boards/CytonGS/.
    Marcin

  • Thanks for your help!

Sign In or Register to comment.