Processing-based visualizer for NeuroSky EEG brainwave data output from the Arduino Brain library.
Brain Grapher is a proof of concept for visualizing brainwave data over time. It reads comma-separated serial packets from an Arduino connected to a hacked MindFlex EEG headset, then displays signal quality, attention, meditation, and eight EEG power bands.
The interface provides per-channel graph toggles, four rendering modes, local or global scaling, a time-scale slider, and a connection-quality indicator.
- Processing, historically tested with version 3.0.2. Compatibility with newer versions has not been verified.
- ControlP5 GUI Library 2.2.5 is included with this project in the
/codefolder. No separate installation is needed. - An Arduino connected over USB and a compatible EEG headset. The Arduino Brain library provides the expected serial output, and the hardware tutorial explains the MindFlex setup.
- Install the Arduino Brain library and upload its BrainSerialTest example to your Arduino.
- Download or clone this repository.
- Open BrainGrapher/BrainGrapher.pde in the Processing editor. Keep the other
.pdefiles and thecodefolder together insideBrainGrapher.
The sketch prints the available serial ports and their indices in Processing's console when it starts. Find your Arduino in that list, then change the index in setup() to match:
serial = new Serial(this, Serial.list()[0], 9600);For example, use Serial.list()[1] for the port listed as [1]. Run the sketch again after changing the index. The Arduino must send data at 9600 baud. Close other applications using that serial port, including the Arduino Serial Monitor.
Each packet contains 11 comma-separated integers in this order, followed by a newline:
signal quality,attention,meditation,delta,theta,low alpha,high alpha,low beta,high beta,low gamma,high gamma
Signal quality ranges from 0 (good signal) to 200 (no signal). Attention and meditation range from 0 to 100. The remaining eight values represent EEG power bands.
The sketch skips the first three packets to avoid initialization noise. When signal quality is 200, it zeros the eight EEG power values.
Created by Eric Mika at NYU ITP in spring 2010. Revised in spring 2012 for Processing and ControlP5 updates, in early 2014 to bundle dependencies and update ControlP5, and in spring 2016 to support Processing 3 and ControlP5 2.2.5.
The repository was originally named Processing-Brain-Grapher, became BrainGrapher in 2014, and is now hosted at kitschpatrol/brain-grapher.
The bundled ControlP5 library is covered by its own license.
