Skip to content

Mindwave Mobile EEG headset basic parser with eye-blink detection.

License

Notifications You must be signed in to change notification settings

AK-Homberger/Mindwave

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mindwave Mobile Parser

Simple parser for Mindwave Mobile EEG headsets.

Headset

This is a fork from orgicus master branch: https://github.com/orgicus/Mindwave

The new version includes now also eye blink detection!

How to install the library

  1. Download the library
  2. Unzip Mindwave-master.zip and rename the Mindwave-master folder to Mindwave
  3. Move the freshly renamed Mindwave folder into the Documents/Arduino/libraries and restart Arduino

Alternatively, you can simply copy the two files "Mindwave.h" and "Mindwave.cpp" to your sketch folder.

How to use the library

If you're using the Serial class and simply want to get the attention/meditation values, it's as simple as shown below.

The example includes also eye blink detection. Single and double blink detection is implemented.

In the example a HC-05 Bluetooth module is connected to Serial2 on an ESP32. But it should work for all Arduino/ESP boards using the Serial class.

Here is explained how to prepare the HC-05 for connecting to the headset.

#include "Arduino.h"
#include "Mindwave.h"

Mindwave mindwave;

void setup() {
  Serial.begin(115200);
  Serial.println("Start");
  Serial2.begin(MINDWAVE_BAUDRATE);
}

void onMindwaveBlink() {
 if (mindwave.blink() == 1) {
    Serial.println();
    Serial.println("Single Blink!");
    Serial.println();   
  }
  
  if (mindwave.blink() == 2) {
    Serial.println();
    Serial.println("Double Blink!");
    Serial.println();
  }
}

void onMindwaveData() {
  Serial.print("Quality: ");
  Serial.println(mindwave.quality());
  Serial.print("Attention: ");
  Serial.println(mindwave.attention());
  Serial.print("Meditation: ");
  Serial.println(mindwave.meditation());  
  Serial.println();
}

void loop() {
  //mindwave.update(Serial2, onMindwaveData);    // This works without blink detection 
  mindwave.update(Serial2, onMindwaveData, onMindwaveBlink); // This with blink detection. onMindwaveBlink is an optional parameter.
}

For more examples go to Arduino > File > Examples > Mindwave

Notes

The code is mostly based on the official NeuroSky wiki article and the ThinkGear protocol specs

Blink detection is based on the code shown here: orgicus#5

About

Mindwave Mobile EEG headset basic parser with eye-blink detection.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 100.0%