Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
September 23, 2020 08:21 pm GMT

Using BrainFlow with the Neurosity headset

The Neurosity OS features a full JavaScript SDK for web apps. But what if you want to use other awesome programming languages to get brainwaves?

Enter BrainFlow.

BrainFlow is multi-purpose biosensor library that provides a uniform data acquisition API for many devices.

You can use BrainFlow in Python, Java, C#, C++, R, Matlab, and Julia.

BrainFlow is ideal for:

  • Research
  • Unity Integration
  • Unreal Engine Integration
  • Neuroscience Experiments

Enabling BrainFlow

1) Open Neurosity's Developer Console
2) Go to Settings by clicking the gear icon next to your device's name
3) Enable Open Sound Control (OSC)

Alt Text

The OS running on your Neurosity device is now streaming data to BrainFlow via OSC.

We recommend disabling OSC if you are not using BrainFlow as it will consume extra battery life.

Installing BrainFlow

In this example we'll use Python 3 to work with BrainFlow.

Install the latest release from PYPI with the following command in terminal:

python -m pip install brainflow

For installation instruction for other languages, please visit the BrainFlow docs.

Getting real-time brainwaves

Next, create a new file called brainflow.py and add the following snippet to it:

import brainflowfrom brainflow.board_shim import BoardShim, BrainFlowInputParamsfrom brainflow.data_filter import DataFilter, FilterTypes, AggOperationsdef main ():    board_id = 13; # Neurosity Notion Board ID    params = BrainFlowInputParams ()    params.board_id = board_id    BoardShim.enable_dev_board_logger ()    board = BoardShim (board_id, params)    board.prepare_session ()    board.start_stream ()    data = board.get_board_data ()    board.stop_stream ()    board.release_session ()    print (data)if __name__ == "__main__":    main ()

Run the code via terminal.

python3 brainflow.py

And finally, you should see the data in the terminal.

... [-2.27709781e+05 -2.27785156e+05 -2.27140344e+05 -2.26998656e+05  -2.27617781e+05 -2.27845906e+05 -2.27248578e+05 -2.26956891e+05  -2.27517125e+05 -2.27874938e+05 -2.27355188e+05 -2.26924359e+05  -2.27395156e+05 -2.27880234e+05 -2.27474953e+05 -2.26928188e+05  -2.27283438e+05 -2.27850938e+05 -2.27579297e+05 -2.26961781e+05  -2.27188766e+05 -2.27806875e+05 -2.27681078e+05 -2.27022875e+05  -2.27094812e+05] [-3.49463312e+05 -3.49478594e+05 -3.49025500e+05 -3.48958906e+05  -3.49402500e+05 -3.49527812e+05 -3.49097719e+05 -3.48925125e+05  -3.49332969e+05 -3.49551812e+05 -3.49167250e+05 -3.48893688e+05  -3.49243031e+05 -3.49560875e+05 -3.49251094e+05 -3.48890188e+05  -3.49161750e+05 -3.49542906e+05 -3.49322031e+05 -3.48906938e+05  -3.49094312e+05 -3.49517031e+05 -3.49395438e+05 -3.48944156e+05  -3.49023562e+05]

For other Python code examples like writing to a file, data transforms, and signal filtering, check out these examples.

EEG Notebooks

Alt Text

The amazing EEG Notebooks project by the NeuroTechX community now supports the Neurosity Notion device via BrainFlow.

EEG-Notebooks is a collection of classic EEG experiments, implemented in Python 3 and Jupyter notebooks. The goal is to make cognitive neuroscience and neurotechnology more accessible, affordable, and scalable.

With EEG Notebooks you can explore BCI methods such as Visual N170, P300, SSVEP, and more.

Give it a try!

GitHub logo NeuroTechX / eeg-notebooks

A collection of classic EEG experiments implemented with Python and Jupyter notebooks


Original Link: https://dev.to/neurosity/using-brainflow-with-the-neurosity-headset-2kof

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To