stimulus integration

edited August 2014 in Hardware
Greetings, I do work on auditory responses in the brain. I need to integrate auditory signals with brainwaves, such that in my EEG recording I know when the subject hears a specific sound. For past experiments with biosemi and neuroscan systems, I've used a computer program (MaxMSP) to play a sound (like a drum beat) and send a signal via serial port to the EEG system. The EEG system creates an additional channel in the recording to accommodate these external triggers which is at the same sample rate as the brain signals with a consistent latency value.

Does the openBCI system have a way to accept other signals at the hardware level? They could be analog or digital in nature. Or will I have to find a way to integrate them at the software level on my computer?

Comments

  • The native system does not inherrently have a manner for external 3rd-party stimulus integration (e.g. triggers).

    Generally, the idea is that you se the same program for data acquisition and stimulation.

    one classic way to get around this is to sacrifice one of the ADC lines and use that to record your triggers... may need to be careful that the output is pulled down into a reasonable range (mV at most) to avoid topping out the amp.

  • Hi!  Great question regarding integration of outside signals for the purpose of synchronization.  A couple of options are available:

    1) Sacrifice one of the EEG inputs.  This will give you sample-accurate synchronization

    2) Use one of the free analog-input pins on the Arduino/ChipKit microprocessor.  Being Arduino compatible means that you can read and change the software as you desire.  So, you can add an AnalogRead() command every time an EEG sample is being sent to the PC.

    With the older OpenBCI V1 board, I did this to keep track of my video stimulation for my own ERP studies...


    Chip


  • Thanks for the replies! Looking forward to actually getting a system to start playing around with these options.
  • biomurphbiomurph Brooklyn, NY
    It's possible to dedicate one of the ADS1299 inputs to record a trigger event.
    More useful is to use one of the broken out pins of the ATmega or PIC.
    Take a look at the Hardware documentation in our DOCS page (find the DOCS tab at the top of our home page)

    We are making a tutorial example about adding external event triggers ;)

  • wjcroftwjcroft Mount Shasta, CA
    Here's the cool tutorial Joel put together on external triggers,

    http://docs.openbci.com/tutorials/04-External_Trigger_32bit_Example

  • Tutorial is fine, if you need just one trigger. In most cases in ERP studies you need at least two different markers (oddball paradigm) or even more. I´m just making ERP research, where I need four markers at the same time. How can I fix  it? Should I use 4-5 PIC pins with respective amount of optoisolated input channels?

    Any ideas?



  • There're five PIC pins exported to connectors on the OpenBCI. You could add optocouplers and use these.
    Alternatively, you could use an encoder, e.g. 8-3 M74HC148, to encode upto eight markers onto 3 lines.
    You'd still need optocouplers.
    Note that you also need to encode the read markers onto the auxiliary stream.

    Hope this helps,
    D
  • biomurphbiomurph Brooklyn, NY
    @qwer1304

    It could be possible to connect via one of the ADC pins on the PIC. That way a trigger could 'send' a variety of voltage levels that would be decoded on the board. Integrating an external, isolated system for this is not trivial, but possible.

    We have some folks here working on a software trigger, sent via the Dongle to the board from the computer running the protocol. We have found that there is a latency issue that might not make it useful for ERP studies. Documentation is coming on the Community page. The code example that can do the Serial Trigger is here
    It is known that there is a latency using this, but we don't know exactly what it is. 
  • edited February 2016
    @biomurph
    If you're getting into software triggers, then consider a more general solution to sync OpenBCI and PC clocks similar to how it's done in LSL. See here and links therefrom.
  • LSL sounds good! Could it be possible to port for OpenBCI  and some open source presentation software too? Then OpenBCI would be a serious alternative for commercial ERP systems.
  • @biomurph To send the trigger to OpenBCI you need to grab the serial. But the serial is used for sending EEG samples to host. How do you split the ownership of the serial at the host side? I.e., sending a trigger while OpenBCI_GUI receives samples?
    Thx,
    D
  • biomurphbiomurph Brooklyn, NY
    @qwer1304
    The serial port is a bi-directional UART. The software running on the PC can send a serial byte at any time. The way the radios work, the PC side can only send the serial byte after it receives from the board radio. In the case of streaming data, the board is sending data at 250SPS (every 4mS). In this case, any serial data that the Dongle radio gets from the PC, it will send back to the board very soon. (there is always a touch of latency...) In the case of the Serial_Trigger code, when the PC send a back-tick '`' the board recognizes it as a trigger, and inserts a flag into the very next data packet.


    We are working on a comprehensive overhaul of the Radio code, and this will allow us to include time-stamp data to sync the board and PC which will make any computer-side triggering much easier
  • @biomurph
    The question was about sending triggers while receiving EEG data in OpenBCI GUI.
    Since the GUI grabs the COM port to OpenBCI, it seems impossible to send triggers over that port from another process.
    Have you modified the GUI so that it's possible to send triggers from it?

  • biomurphbiomurph Brooklyn, NY
    @qwer1304
    We have not modified the GUI, but it should automatically send any key press that is not part of an existing command. That's why we use the '`' character. 

    If you want a separate software to send the trigger, then you will need to have that software control the serial port. Only one software can control the serial port at one time.
  • Triggers should be tied to the different stimuli presented by presentation software like OpenEXP or Presentation. Otherwise there is no sense to use any triggers at all. 

    What can we do? Can we start recording to SDcard with Python script directly from OpenEXP? Or is there any presentation - acquiring -software, which can control OpenBCI hardware?

    JJ


  • wjcroftwjcroft Mount Shasta, CA
    @jussijaatinen, you can send arbitrary OpenBCI firmware command keys with Jeremy @jfrey 's Python driver. So that would include the command to start/stop SDcard recording.

  • @biomurph
    That's a nice "hidden" feature I didn't know about! ;)
    Perhaps worth adding to documentation?
  • edited August 2017
    Hi everyone, I recently purchased the OpenVIBE 15 board and I would like to use it for a Science Fair experiment.  For the experiment I need to get "stimulations"/"markers" into the data.  I have read all the posts I can find and the Tutorial on the Serial Trigger that @biomurph ;referenced.  Unfortunately I need a number of different markers.

    What I am thinking of doing is the following:
    - Disabling the accelrometer data
    - Using the OpenBCI_32bit_Serial_Trigger software make a small change that when the OpenBCI GUI sends sends two characters  '~n' the value of 'n' is inserted into the data stream in one of the AUX channels as a stimulation (using this new 3.x..x function  OpenBCI_32bit_Library::sendChannelDataWithTimeAndRawAux(void))
    - Change the OpenBCI_GUI to accept triggers (keyboard or through serial/sockets.UDP) to accept "markers" and and send the '~n' command over the serial port

    Does this sound right?  Has anyone else done this?  Are there easier ways to do this?  
    Thanks for  your help 


Sign In or Register to comment.