301 Moved Permanently

301 Moved Permanently

arduino_tutorial.txt · Last modified: 2014/05/06 19:55 (external edit)

MindWave and Arduino


  • Interfaces with the MindWave with the RF USB dongle for stand-alone operation
  • Acquiring the Attention and Meditation eSense values from the data stream.
  • Displaying your Attention level using LEDs


NOTE: Completing this tutorial will VOID your warranty. The USB dongle will no longer work with your computer. Please visit store.neurosky.com to purchase replacement dongles


This step-by-step guide is intended to quickly get a typical Arduino board user up and running with the MindWave. This guide will show how to setup quickly for communication with the MindWave and gives example code to parse the output stream. The parsed output stream can then be used to perform various tasks such as to control the speed of a motor, to light up LEDs, and to control the position of a servo motor, etc.

Interfacing to the MindWave

Interfacing to the MindWave requires the user to hack the USB dongle.The following describes easiest way to quickly get up and running using an Arduino board. The Arduino is sold by a vendor listed in the sources section. The MindWave and USB dongle are available at the NeuroSky Store.

Required Materials

This application requires the following materials:

  • MindWave
  • Arduino Diecimila or Duemilanove
  • RF USB dongle
  • Arduino development environment
  • Avago HDSP-4832 10-Element LED bar graph array
  • 4 75Ω resistors
  • 6 74Ω resistors
  • Breadboard
  • SparkFun BOB-08745 Level Converter
  • 12V Power Source (included with Arduino Board)

System Overview

The system uses the Aduino's hardware UART for both USB communication and Bluetooth communication. After the system is up and running, the Arduino may be detached from the computer and run independently.

The basic programming flow is as follows:

  1. Connect the dongle to the Arduino board..
  2. Connect the LED array to the Arduino board.
  3. Download the provided example code into the Arduino board using the Arduino development environment.
  4. Power up the whole system and observe the Attention eSense value on the LED array.

Detailed Instructions

Connecting the dongle to the Arduino Board

Connecting the dongle to the Arduino Board requires removing the plastic covering from the dongle and soldering wires to 4 of the pins.

  1. Remove the plastic covering from the USB dongle.
  2. Once the cover is off, you should see the board shown below (Note: Bottom View Orientation)
    Dongle Schematic
  3. Find the 4 pins, located in the center of the board.
  4. Starting at the end with the ‘ + ‘ sign the pin assignments are:
    1. Pin 1 (starting at +): 3.0 V Power
    2. Pin 2 : TX
    3. Pin 3 : RX
    4. Pin 4 : Ground
  5. Solder wires to these 4 pins, leaving enough wire to make the necessary adjustments.
  6. Connect the boards together, according to the schematic shown below
    Circuit Schematic

Cutting Traces on the dongle

In order to for the dongle to properly receive the TX signal from the Arduino, two traces on the board must be cut. Looking at the dongle from the top, there are two traces leading from the TX and RX pins to the CH340 chip. With an X-Acto knife, cut these two traces. After the traces have been cut, check the connections with a DMM to ensure that the CH340 chip (pins 3 &4) is no longer connected to the TX and RX pins. NOTE: You will not be able to use the USB dongle with a computer after cutting the traces

Powering the Arduino

The Arduino may be powered by USB, by battery, or by an external power supply. Please see the Arduino hardware page here http://arduino.cc/en/Main/Hardware for more information.

Getting started with the Arduino development environment

Please see Arduino Getting Started guide here http://arduino.cc/en/Guide/HomePage

Arduino Code Description

Arduino code is based on the C/C++ language and requires very little else to get started. All the details or regular microprocessor development such as processor clock speed, programming speed, clock sources, etc. are all initialized by the Arduino core. With this in mind, the Arduino system will still be able to perform much of the required tasks with no problem at all. The simplicity of using the microprocessor peripherals combined with the C language along with the sample code provided provides for very quick interface to the MindSet. The user is encouraged to extend the Arduino code by appending code after the indicated section where the packet has been checked for a valid checksum.

Thereafter, the user may use the eSense values to do one of many things possible. Some of which is to control the brightness of an LED, the height of an object, etc.

The bulk of the code is used for parsing the packet data. For further information, see the MindSet Communication Protocol document in the MindSet Development tools (MDT). The MDT is available at the NeuroSky Store for free. http://store.neurosky.com

Syncing the Arduino Board

  1. Open Mind_Wave.pde
  2. Tools > Board > Arduino Diecimila
  3. In Control Panel > Select Device Manager
    1. Look in “Ports” to see which COM port the USB Serial Port is connected to
  4. Tools > Serial Port > Select the corresponding COM port

Running Mind_Wave.pde

  1. Once you have synced the program and your board, disconnect the TX and RX lines coming out of the Arduino
  2. File > Upload to I/O Board
  3. Once the program displays “Done Uploading”, you can disconnect the USB serial port and run the Arduino from independent power source.
  4. Reconnect TX and RX lines.
  5. Power up the Arduino Board via power source
  6. Arduino should have green PWR LED lit and dongle should have red LED lit
  7. Turn on Mindwave Headset
  8. Hit “Reset” button to pair the MindWave to the dongle.
  9. Once connected MindWave LED and dongle LED will both turn blue.
  10. Enjoy observing your Attention eSense value on the LED array.

Switching to Attention/Meditation Mode

The default eSense reading in Mind_Wave.pde is attention. To switch the program to measure your meditation level, requires changing a few lines of code. Inside the pde file, locate the code shown below.
Arduino Code (partial)

Inside these lines of code, replace “attention” with “meditation” to operate in meditation. If you are switching back to attention mode, replace “meditation” with “attention”.

The code can be downloaded here:

Mind_Wave. Note that this is in a docx format. Simply rename the extension from docx to pde and run the program.

Material Sources

The Arduino board can be obtained from:

Sparkfun Electronics
6175 Longbow Drive, 
Suite 200

Boulder, CO 80301

More information about the Arduino can be found here: http://www.arduino.cc

301 Moved Permanently

301 Moved Permanently