Live-Streaming Data into Python to find 'focus' [resolved]

Deniz_OeDeniz_Oe Austria
edited March 2020 in Software

Hey guys!
So I understood that with LSL you can create a stream of data and that data can then be used in Python.
But what if I want to use the data stream "live" in python, and react to a certain signal?
So ultimately I want to rebuild the "focused/not focused" program described here:
https://www.instructables.com/id/Send-Focus-Data-From-OpenBCI-GUI-to-Arduino/
So if I get a predominant alpha wave on 01 and/or 02 I want to immediately react and do something (easiest thing is to print a message in the python prompt...)
thankful for any input!
Best,
Deniz

Comments

  • retiututretiutut Louisiana, USA

    Hey @Deniz_Oe, I am the author of the Instructable! :)

    Theoretically, this can all be done inside Python without the GUI, though this is much more difficult than the instructable. You could use:

    • pyOpenBCI or Brainflow for signal acquisition
    • Perform FFT on Fp1 and Fp2
    • Compare Alpha and Beta waves from these two locations
    • Output boolean result (focused/not focused)

    Another (easy) way is to use the GUI and make an LSL stream:

    • Send "Focus" output from the GUI to a Python script over LSL or UDP using the Networking Widget
    • Using GUI v4.2.0, set "# Chan" to 1
    • Run your Python script with PyLSL and it will receive the data

    https://github.com/OpenBCI/OpenBCI_GUI/blob/master/Networking-Test-Kit/LSL/lslStreamTest.py

Sign In or Register to comment.