Placing triggers in data with button press

KCDTylerKCDTyler Melbourne, Australia
edited February 2018 in Cyton
Hi all,

I need to send triggers to mark external events while recording with the OpenBCI. Eg, to mark eyes open, eyes closed, and a variety of other subjective states. 

I understand that you can just use the PROG button the OpenBCI board for this?

I have had a search around the tutorials and forum, but am still a little in the dark about this.
I understand that with the most recent firmware (I bought my OpenBCI Cyton in August 2017) there is no need to program the board, and that it will be able to read button pushes without adding further code?

In this case, can you just press the PROG button and a channel will register that button press???

Can anyone point me in the right direction on this, I really need a bit more instruction that I can see on the tutorial.

Also, ideally, I would have an external button box. I will look into this.  
I see this tutorial on external button boxes:

But that button box seems to need an external power supply, which is not recommended.
Is there an alternative way of creating and using an external button box to send triggers, which is safer and easier than bunging your finger into the boards PROG button any time something happens?

Thanks in advance folks!


«1

Comments

  • edited December 2017
    @KCDTyler

    Update your cyton firmware to 3.1.0 and you can do this from the new 3.2.0 GUI at the click of the button!

    Here is a tweet with a photo of what it looks like

    With the press of a button you can read from five digtial IO pins, one of which D17, is hooked up to the PROG button!!!!!

    Also you can hook up an external button to any of the other inputs as well, there are four others.

    This marker is automatically entered into the openbci output data file.

    I would love a contribution from you as an update to the docs page you posted so we can teach others how to do this!

    v3.1.0 Cyton Firmware: https://github.com/OpenBCI/OpenBCI_32bit_Library/releases/tag/v3.1.0
    Cyton programming tutorial: http://docs.openbci.com/Hardware/05-Cyton_Board_Programming_Tutorial

    v3.2.0 OpenBCI GUI: https://github.com/OpenBCI/OpenBCI_GUI/releases/tag/v3.2.0
    Installing the OpenBCI GUI tutorial: http://docs.openbci.com/OpenBCI Software/01-OpenBCI_GUI




  • KCDTylerKCDTyler Melbourne, Australia
    Great! I hadn't realised it was going to be that simple.

    I will have a go at this shortly and may also see if I can rig up an external button box. 

    Will let you know how it goes.

    Cheers,
  • Hi @KCDTyler and @pushtheworld!

    I'm trying to setup an external trigger for a P300 and have also been confused about how to do this. I think I understand what to do now based on both of your posts. Please let me know if I've understood correctly. The marker will send through an LSL stream too, correct? I'm thinking about analyzing 

    1. I'll setup the circuit shown on the external trigger page from OpenBCI (external triggering the harder way) as I have the components to do that and I'll be using a computer plugged into the wall as we run the P300 paradigm.
    2. I'll then plug in the external trigger to pin 1, then external ground to pin 2 of the optoisolator. Then I'll take a wire from pin 5 and put it into D17, and a wire from pin 4 to the digital ground on the Cyton. Lastly, I'll take a wire from pin 6 and plug it into VDD, which is next to GND.
    3. I'll have OpenBCI GUI, Hub, up and running. Dongle will be plugged in and then board will be turned on. I'll press the program button and make sure the digital inputs on the Cyton are on via the widget in the GUI.
    4. I'll start streaming on the GUI. Then I'll run the paradigm and (I think) should be able to observe the markers in the time series view of the GUI.

    Please let me know if this is the correct method to go about this, or if I need to take additional steps.

  • I apologize, I misread the diagram. For step 2, I should've said that I'll take another wire from pin 5 (along with the resistor of course) and plug that into VDD, not a wire from pin 6.

    We're doing this to try and observe the delay of the trigger. We're thinking about creating a paradigm to try and extract information about motivation from the brain.
  • > The marker will send through an LSL stream too, correct?

    No. You should open an issue for this I think.

    > Please let me know if this is the correct method to go about this, or if I need to take additional steps.

    Your setup is good. I had trouble following the "step 2". I'm a visual learner so send a diagram if you want! Maybe use an SD card as well so you can ensure that you don't loose any data in-case a packet is dropped over the air.


  • Sure, here's the breadboard image: image
    And here's the picture of the diagram:
    image
    The only thing I'm worried about is that on that page (http://docs.openbci.com/Tutorials/06-External_Trigger_Cyton_Example) there are more instructions, but I'm guessing that only applies to people with Firmware 1.x.x, right?

    Thanks for the response! Can't wait to test it out with the P300 this week.
  • KCDTylerKCDTyler Melbourne, Australia
    Hey Push the world,

    Just getting back to this now. 

    Where in the data do the triggers show up, from a push of the PROG button?

    Do they show up in separate channels? or actually in the data in channels N1 to N8 (for Cyton)?

    You mention five digtial IO pins, one of which D17.
    Can you explain how this relates to the 12 pins on the Cyton board? (eg, N1 to N8, plus SRB, BIAS etc?)

    I recorded some EEG while pressing the PROG button, but don't see any clear triggers in the data.
    I do have quite a new Cyton board with recent firmware, so I don't think its a case of needing to update anything.

    Thanks,
    Kaelasha




  • Hey!

    > I am really keen to start using triggers in my data

    Go for it! You may have to update your firmware, I would assume yours is out of date.

    >
    I thought from what you had written that you actually physically press
    the PROG button on the Cyton board? Is that the case?

    Yes.

    > If so, where in the data are the triggers latter to be found?

    They are sent with the actual sample data, where the accelerometer normally goes. They will be extracted into the output data file in the GUI too.

    > Lastly, how do I find out what firmware version I have?

    You should use the terminal on Arduino to send a 'v' and the version will be returned in the serial terminal. https://learn.sparkfun.com/tutorials/terminal-basics/arduino-serial-monitor-windows-mac-linux

    > You mention five digtial IO pins, one of which D17. Can you explain how this relates to the 12 pins on the Cyton board? (eg, N1 to N8, plus SRB, BIAS etc?)

    They are located on the top of the board and are accessible via the black headers on the lower right side of the board if you were looking top down at your Cyton!

    > I recorded some EEG while pressing the PROG button, but don't see any clear triggers in the data.

    Did you change the board mode with the GUI?
  • KCDTylerKCDTyler Melbourne, Australia
    Hi all,

    With a now functional upgrade of my Cyton firmware, I am able to insert triggers in the data with a push of the PROG button. Yay!

    These triggers show up as square waves in the 12th column of the .txt file produced, and I can see the D17 digital IO circle in the Digital Read section of the GUI going from '0' to '1' when I physically press the PROG button. 

    So far so good. 

    The D17 digital IO circle in the GUI does appear to respond quite slowly though. I'd estimate the the '0' changes to '1' about 500 ms after I actually press the PROG button. 

    Does anyone know if there is any real lag in the data, between a push of the PROG button, and the resulting trigger being placed in the data?
    If so, how much lag would there be between a physical button press and the trigger in the data?

    Obviously timing is pretty important in a lot of EEG studies. 

    Thanks in advance people. I have found this forum to be really helpful. 

  • edited March 2018
    Does anyone know if there is any real lag in the data, between a
    push of the PROG button, and the resulting trigger being placed in the
    data?
    If so, how much lag would there be between a physical button press and the trigger in the data?

    You need to change your serial port driver settings! Check around the forum for the numerous other times people have had to do this for your Opersting System. You wan tot lower your latency down to 64ms from 500ms and that lag will disapear!

    That button press is recorded with the next time a sample is read though, so it's entered into the stream at the right time.
  • Can you explain in detail how to modify the serial port to avoid delay?@pushtheworld
  • Many Thanks@wjcroft. If I make these change, the delay of D17 or D18 will not appear?
  • wjcroftwjcroft Mount Shasta, CA
    As AJ said, "That button press is recorded with the next time a sample is read though, so it's entered into the stream at the right time."
  • @zhanglei there is no delay to when the marker is actually entered into the stream, there is a delay from when that data gets to your computer, so it appears there is a delay in the button press although there is no delay in the output file for example!
  • @wjcroftpushtheworld, I push the button PROG on the board, and I find the data is 3.140 in the Aux, but I want to know why the 3.14 is so many. That is right? The 3.14 shouldn't only one? Thank you your replay.
  • Do you mean you see the 3.14 in multiple data samples? Remember that the push button is not debounced and that each sample occurs every 4ms, such that if the button is held down for 8ms, the 3.14 will be shown in two samples.
  • imageAccording to your replay, my sample rate is 125, and every data can be get  every 8ms, so I only push the button and isn't held on. I think the 3.14 should have two.
  • image
    This picture is show the results. The 3.14 is so many.
  • alitosalitos México
    edited March 2018
    Can anyone help me?

    Where is the board mode option in the GUI?

    Regards
  •  @pushtheworld. Icount the number of the 3.14, it has 50 or 51. Many thanks for your reply.
  • @pushtheworld. Icount the number of the 3.14, it has 50 or 51. Many thanks for your reply.
  • I'm gonna write a guide for this today.

    @zhanglei well are you looking at raw output from the GUI? where there are only eight channels each row and two rows make a 16 channel sample? If that is the case then the button is held down for 200ms which sounds like a fast button press. If you really want to verify this, hook up an arduino of something similar to the digital input and hold the pin high for 8 ms and then send the pin low.
  • @alitos

    I posted a new guide for triggers and will add in some screen shots tomorrow

    http://docs.openbci.com/Tutorials/06-External_Trigger_Cyton_Example
  • alitosalitos México
    edited March 2018
    I will read it.

    Thanks so much @pushtheworld!

    Best regards sincerely
  • Another question is that if I want to set three  mark or trigger in the data stream, how can sove it?@pushtheworld.
    Thank you very much.
  • @zhanglei

    If you want to see this three then you simply need to connect to either D11, D12, D13, D17 or D18. As in you can see up to five!

    Does this make sense?


Sign In or Register to comment.