Coder Social home page Coder Social logo

eegkit / openbci-brainflow-lsl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marles77/openbci-brainflow-lsl

0.0 0.0 0.0 341 KB

Use BrainFlow to read data from Open BCI board and send it as Lab Streaming Layer streams

License: MIT License

C++ 12.18% Python 87.82%

openbci-brainflow-lsl's Introduction

OpenBCI-Brainflow-LSL


Uses Python, BrainFlow, and pylsl to read data from Open BCI board and send it as Lab Streaming Layer (LSL) streams.

Dependencies

Install dependencies in your environment with:

pip install --upgrade numpy brainflow pylsl pyserial PyYAML

Usage

Steps:

  1. Set up your own settings file. An example of such file is included in this repo as settings8.yml. If you are not going to use Arduino as a source of triggers, just comment out lines 25-33. To see what channel commands (sent to Cyton board) mean, go to Cyton channels commands. A full description can be found in Open BCI docs. In this examplary file only channels 1-6 are powered up. Default commands are defined as a constant in obci_brainflow_lsl.py
  2. Set up your EEG (and Arduino if needed), check signal quality using OpenBCI GUI
  3. Run the script with a command including one required argument --set with the name of a YAML file containing settings: python obci_brainflow_lsl.py --set settings8.yml and continue with the steps (initiating the session, sending commands, commencing the stream) until the LSL stream is established
  4. Record all your LSL streams (continuous data and markers) using e.g. Lab Recorder to one *.XDF file
  5. View and analyze your data using free software e.g. EEGLab or Python MNE library

My Cyton setup:

Channel nr Electrode(s) position Cyton Board Pin Board command
1 -VEOG Bottom N1P x1040100X
+VEOG Top N1P
2 Fz Bottom N2P x2060110X
3 C3 Bottom N3P x3060110X
4 C4 Bottom N4P x4060110X
5 P3 Bottom N5P x5060110X
6 P4 Bottom N6P x6060110X
7 - - x7161000X
8 - - x8161000X
REF A1 Bottom SRB (SRB2) -
BIAS AFz Bottom BIAS -

My Arduino circuit:

Features

The script (written in Python 3.8) enables to stream in parallel several types of data via LSL:

  • Open BCI board channels such as EXG/EEG and AUX (accelerometer; if you want to use it, just uncomment line 13 in the settings file)
  • Triggers/markers from serial port connected to Arduino board, e.g. photosensors, switch etc. (an example of a simple sketch is included in trigger_photo.ino file)

Limitations and known issues

The script has been tested only on Windows with Cyton + Dongle and Cyton + Daisy + Dongle, for now. Any feedback from tests performed on other platforms will be much appreciated.

Acknowledgments

This program is based on a script originally created by @retiutut. I was also inspired by a similar project OpenBCI_LSL


Cyton channels commands

CHANNEL POWER_DOWN GAIN_SET INPUT_TYPE_SET BIAS_SET SRB2_SET SRB1_SET
x 1-8* 0-1 0-6 0-7 0-1 0-1 0-1 X
0 Gain 1 0 NORMAL
1 Gain 2 1 SHORTED
2 Gain 4 2 BIAS_MEAS
3 Gain 6 3 MVDD
4 Gain 8 4 TEMP
5 Gain 12 5 TESTSIG
6 Gain 24 6 BIAS_DRP
7 BIAS_DRN
x 1 0 4 0 0 0 0 X
x 2 0 6 0 1 1 0 X
x 7 1 6 1 0 0 0 X

*channels 9-16 are labeled Q,W,E,R,T,Y,U,I

openbci-brainflow-lsl's People

Contributors

marles77 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.