Concentration / Blink Monitoring Code

Hi, I'm working with a group of junior school students (9 year olds) who are trying to use an OpenBCI board Ganglion + headset for a control application as part of their school STEM program. To integrate to their hardware I'm hoping to be able to run some code on a raspberry pi that we can capture key events - I was hoping for concentration measurement (threshold) but eye blinks or anything else that the kids can clearly understand to enable an "interface" would work.

We've had some (limited) success at identifying eye blinks from the GUI, and even more limited success with trying to use the old GUI and the "concentration" measurement, but I'm really looking for something we can directly grab in code without the GUI (python, javascript, whatever is going really!) so that the kids can easily write their code to just act on the signal as they're controlling hardware from a Raspberry pi based on the input. Hoping to get to a state where they can integrate this with their existing code using something like:

IF blink THEN...
Or
IF concentration > X THEN

If anybody knows of a code repo that would do enable that using the I would really appreciate it!

Comments

  • retiututretiutut Louisiana, USA
    edited September 2020

    We will be bringing back the Focus widget to GUI v5 in the near future, since BrainFlow now has some basic metrics!

    It should be possible to:
    1. Fork the BrainFlow repo onto the Raspberry Pi
    2. Follow build instructions and compile directly on Raspberry Pi. This is the important step, since ARM version is not available for download (too many to support).
    3. Install the BrainFlow Python binding that you have just built
    4. Try BrainFlow Python EEG Metrics example, found here: https://brainflow.readthedocs.io/en/stable/Examples.html#python-eeg-metrics
    5. Refine code and methods so that students can observe simple code that works!

    Take Care,
    RW

  • wjcroftwjcroft Mount Shasta, CA

    Thanks Richard, the new Brainflow metrics deserve some tutorial, demo, video material as well.

    Matt, the other widely used 'easy' EEG 'event' scenario is just the increase in alpha band with eyes closed. There are many other threads showing this. The GUI widgets can expose this increase, and send to another app.

    William

  • retiututretiutut Louisiana, USA

    Thanks Richard, the new Brainflow metrics deserve some tutorial, demo, video material as well.

    Agreed! Hoping to create and publish this process in the near future.

  • For what it is worth, I am also a newbie and I am working on a blink detector as a first project to understand more about EEG signals. I wrote up a bunch of notes with observations (and unanswered questions) that might help others who are also just learning about the format of the data. It is published as a google document here: https://docs.google.com/document/d/e/2PACX-1vRLrSJ5_AQQrGyTv6i0D7oFCRaB64YrMeafIKz-MDPHujbHUKWzLHfwpGS3v1_DBzJ12078qxyXF76P/pub

    There is some sample code at the end of the notes I have used with limited success for blink detection. The algorithm uses simple statistics on the raw time series data without any frequency domain processing, so it is easy to understand the logic. It does not work very well unless the signal is clean, so would also love to see some notes or tutorials for beginners on how to process and interpret the raw data 'properly'.

    Thanks
    GB

  • wjcroftwjcroft Mount Shasta, CA

    Appendix 1 in this document, shows blink detection algorithm, as well as other artifact rejection algorithms.

    https://openbci.com/forum/index.php?p=/discussion/comment/6679/#Comment_6679

Sign In or Register to comment.