Giter Club home page Giter Club logo

mindwave's Introduction

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

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.