You have no items in your shopping cart.

Subtotal: 0.00

Interfacing Mindwave Mobile with Arduino

Mindwave mobile

<pMindwave mobile, Neuro sky is the manufacturer of Mindwave mobile. The NeuroSky biosensor platform provides a powerful foundation for the development of a variety of applications that promote Mind health such as improved focus, concentration, working memory and acuity. Other uses include meditation and relaxation monitoring or improved educational processes. Our low cost, complete OEM solution is a high-performance bio-signal on a single chip solution for accurate Mind activity detection and processing.

Bluetooth Module (HC-05)

It's a high performance Bluetooth module HC-05. This is a standalone BTM-05 Bluetooth module. Its works as TTL Master/Slave Transceiver module with serial UART protocol for communication. Designed by Full speed Bluetooth operation with full piconet support. It allows you to achieve the industry's highest levels of sensitivity, accuracy, with lowest power consumption.

Demonstration Video

 

PROJECT DESCRIPTION

 

Connecting wires:

The connecting wires are both sides having female type, because Arduino and HC-05 models are having male type connector for interfacing.

HC-05 Module data communication:

  • Serial Interface UART

 

Configuration of HC-05:

  • Its configure as master mode
  • Mindwave Kit act as slave device

 

Hardware's:

  • Mindwave mobile Kit
  • Arduino Board
  • HC-05 Bluetooth Module
  • USB cable (for Arduino)
  • Connecting Wires.

 

Software's:

  • Cool Term ,X-CTU (any serial communication software)
  • Arduino 1.0.5-r2

 

Front view of HC-05 Module





Rear view of HC-05 Module





Find the Unique number of your Mindwave Device



1. Select your Mindwave device



Right click → Properties → Bluetooth Then know your Unique Identifier Number (Note it)





Example: This module Unique no =9cb7,0d,89e51c

 

Diagram for HC-05 Bluetooth Module with Arduino:

 

Method 1 for AT Commands





Note: Here the Arduino Board used only for USB to UART converter. So don't want to download any source code (Sketch) to board.

Real view of Arduino with HC-05 Module





Modes of HC-05 Bluetooth Module:

 

How to HC-05 Module Enter into Command mode:

Press and Hold the Push switch in HC-05 Module at few secs, when its power ON (In between OFF state to ON state).

If HC-05 Module in Command mode means, the LED blink at low toggle (blinking slowly).

 

Buadrate for Command Mode

In command mode the HC-05 Module works in 38400 buadrate (fixed buadrate).

 

How to HC-05 Module Enter into Data mode:

In default state, theHC-05 Module works as a Data mode operation.

If HC-05 Module in Data mode means, the LED blink at High toggle.

 

Buadrate for Data Mode

In Data mode the HC-05 Module works in variable buadrate.

 

AT Commands for HC-05 Module Initialize for Mindwave Kit

First Enter into command mode, after then enter the following commands for HC-05 Module to communicate our Mindwave Kit.

1. AT+NAME=”PANTECH”

2. AT+UART=”57600,0,0”

3. AT+ROLE=”1”

4. AT+PSWD=”1234”

5. AT+CMODE=”0”

6. AT+BIND=”XXXX,YY,ZZZZZZ” (Mindwave Unique Number)

7. AT+IAC=”9E8B33”

8. AT+CLASS=”0”

9. AT+INQM=”1,9,48”



Verification commands for HC-05 Module

1. AT

OK

2. AT+UART?

UART:57600,0,0
OK

3. AT+ROLE?

+ROLE:1

OK

4. AT+PSWD?

+PSWD:1234

OK

5. AT+CMODE?

+CMODE:0

OK

6. AT+BIND?

BIND:9cb7:0d:89e51c

OK

7. AT+IAC?

IAC:9E8B33

OK

8. AT+INQM?

+INQM:1,7,48

OK

Note1: For using above AT commands don't use “(Double quotes) only enter In-between commands from double quotes. After the end of every command press “Enter Key”

 

Open serial communication software

(Here we have to use Flashmagic software)

1. Select your Port and set Baudrate is 38400





2. Enter the AT commands (Initialize)





3. Enter the AT commands (Verification)





Some Tips about HC-05 Module Configuration

1. HC-05 Module configure as Mater device and Mindwave kit act as Slave device

2. And the HC-05 Module was configuring as Specific address mode. Therefore it's Pair with only the specific device

3. Here the specific device is our Mindwave kit (Using BIND AT command, we configured the Mindwave unique no to HC-05).

4. So the Mindwave and HC-05 Module automatically paired, when we switch ON the both device.

 

INTERFACING ARDUINO WITH MINDWAVE KIT

 

Connection Diagram





Steps to follow

1. Switch ON the Mindwave kit and unpaired the last connections, then OFF the Mindwave device.

2. Program (Upload the sketch) the “Mindwave with Arduino” source code to Arduino Board using Arduino compiler.

3. Open the “Serial Monitor” in Arduino compiler with 57600 baudrate.

4. Make all the connection as per the above image, and then switch ON the Arduino Board.

5. After the 7 Seconds, switch ON the Mindwave device.

6. Now the Mindwave device and Arduino Board will pair automatically.

7. Wear the Mindwave device in Head, and give the attention.

8. Check the LED variation with respect your attention level.

9. And also see the Serial Monitor to know your Poor quality and attention levels.

 

Real view1 of Arduino with Mindwave Kit





Upload the sketch to Arduino board





LED's Output (variation w.r.t Attention level)





Serial Monitor Output





Program for Interfacing Arduino with Mindwave Kit

 

Title: Mindwave with Arduino

////////////////////////////////////////////////////////////////////////
// Arduino Bluetooth Interface with Brainsense
// 
// This is example code provided by Pantech Prolabs. and is provided
// license free.
////////////////////////////////////////////////////////////////////////

#define LED 13
#define BAUDRATE 57600
#define DEBUGOUTPUT 0

#define GREENLED1  3
#define GREENLED2  4
#define GREENLED3  5
#define YELLOWLED1 6
#define YELLOWLED2 7
#define YELLOWLED3 8
#define YELLOWLED4 9
#define REDLED1    10
#define REDLED2    11
#define REDLED3    12

#define powercontrol 10

// checksum variables
byte generatedChecksum = 0;
byte checksum = 0; 
int payloadLength = 0;
byte payloadData[64] = {0};
byte poorQuality = 0;
byte attention = 0;
byte meditation = 0;

// system variables
long lastReceivedPacket = 0;
boolean bigPacket = false;

//////////////////////////
// Microprocessor Setup //
//////////////////////////
void setup() 

{
  pinMode(GREENLED1, OUTPUT);
  pinMode(GREENLED2, OUTPUT);
  pinMode(GREENLED3, OUTPUT);
  pinMode(YELLOWLED1, OUTPUT);
  pinMode(YELLOWLED2, OUTPUT);
  pinMode(YELLOWLED3, OUTPUT);
  pinMode(YELLOWLED4, OUTPUT);
  pinMode(REDLED1, OUTPUT);
  pinMode(REDLED2, OUTPUT);
  pinMode(REDLED3, OUTPUT);

  pinMode(LED, OUTPUT);
  Serial.begin(BAUDRATE);           // USB
}

////////////////////////////////
// Read data from Serial UART //
////////////////////////////////
byte ReadOneByte() 

{
  int ByteRead;
  while(!Serial.available());
  ByteRead = Serial.read();

#if DEBUGOUTPUT  
  Serial.print((char)ByteRead);   // echo the same byte out the USB serial (for debug purposes)
#endif

  return ByteRead;
}

/////////////
//MAIN LOOP//
/////////////
void loop() 

{
  // Look for sync bytes
  if(ReadOneByte() == 170) 
  {
    if(ReadOneByte() == 170) 
    {
        payloadLength = ReadOneByte();
      
        if(payloadLength > 169)                      //Payload length can not be greater than 169
        return;
        generatedChecksum = 0;        
        for(int i = 0; i < payloadLength; i++) 
        {  
        payloadData[i] = ReadOneByte();            //Read payload into memory
        generatedChecksum += payloadData[i];
        }   

        checksum = ReadOneByte();                      //Read checksum byte from stream      
        generatedChecksum = 255 - generatedChecksum;   //Take one's compliment of generated checksum

        if(checksum == generatedChecksum) 
        {    
          poorQuality = 200;
          attention = 0;
          meditation = 0;

          for(int i = 0; i < payloadLength; i++) 
          {                                          // Parse the payload
          switch (payloadData[i]) 
          {
          case 2:
            i++;            
            poorQuality = payloadData[i];
            bigPacket = true;            
            break;
          case 4:
            i++;
            attention = payloadData[i];                        
            break;
          case 5:
            i++;
            meditation = payloadData[i];
            break;
          case 0x80:
            i = i + 3;
            break;
          case 0x83:
            i = i + 25;      
            break;
          default:
            break;
          } // switch
        } // for loop

#if !DEBUGOUTPUT

        // *** Add your code here ***

        if(bigPacket) 
        {
          if(poorQuality == 0)
             digitalWrite(LED, HIGH);
          else
            digitalWrite(LED, LOW);
          
          Serial.print("PoorQuality: ");
          Serial.print(poorQuality, DEC);
          Serial.print(" Attention: ");
          Serial.print(attention, DEC);
          Serial.print(" Time since last packet: ");
          Serial.print(millis() - lastReceivedPacket, DEC);
          lastReceivedPacket = millis();
          Serial.print("\n");

          switch(attention / 10) 
          {
          case 0:
            digitalWrite(GREENLED1, HIGH);
            digitalWrite(GREENLED2, LOW);
            digitalWrite(GREENLED3, LOW);
            digitalWrite(YELLOWLED1, LOW);
            digitalWrite(YELLOWLED2, LOW);
            digitalWrite(YELLOWLED3, LOW);
            digitalWrite(YELLOWLED4, LOW);
            digitalWrite(REDLED1, LOW);
            digitalWrite(REDLED2, LOW);
            digitalWrite(REDLED3, LOW);           
            break;
          case 1:
            digitalWrite(GREENLED1, HIGH);
            digitalWrite(GREENLED2, HIGH);
            digitalWrite(GREENLED3, LOW);
            digitalWrite(YELLOWLED1, LOW);
            digitalWrite(YELLOWLED2, LOW);
            digitalWrite(YELLOWLED3, LOW);
            digitalWrite(YELLOWLED4, LOW);
            digitalWrite(REDLED1, LOW);
            digitalWrite(REDLED2, LOW);
            digitalWrite(REDLED3, LOW);
            break;
          case 2:
            digitalWrite(GREENLED1, HIGH);
            digitalWrite(GREENLED2, HIGH);
            digitalWrite(GREENLED3, HIGH);
            digitalWrite(YELLOWLED1, LOW);
            digitalWrite(YELLOWLED2, LOW);
            digitalWrite(YELLOWLED3, LOW);
            digitalWrite(YELLOWLED4, LOW);
            digitalWrite(REDLED1, LOW);
            digitalWrite(REDLED2, LOW);
            digitalWrite(REDLED3, LOW);
            break;
          case 3:              
            digitalWrite(GREENLED1, HIGH);
            digitalWrite(GREENLED2, HIGH);
            digitalWrite(GREENLED3, HIGH);              
            digitalWrite(YELLOWLED1, HIGH);
            digitalWrite(YELLOWLED2, LOW);
            digitalWrite(YELLOWLED3, LOW);
            digitalWrite(YELLOWLED4, LOW);
            digitalWrite(REDLED1, LOW);
            digitalWrite(REDLED2, LOW);
            digitalWrite(REDLED3, LOW);             
            break;
          case 4:
            digitalWrite(GREENLED1, HIGH);
            digitalWrite(GREENLED2, HIGH);
            digitalWrite(GREENLED3, HIGH);              
            digitalWrite(YELLOWLED1, HIGH);
            digitalWrite(YELLOWLED2, HIGH);
            digitalWrite(YELLOWLED3, LOW);
            digitalWrite(YELLOWLED4, LOW);
            digitalWrite(REDLED1, LOW);
            digitalWrite(REDLED2, LOW);
            digitalWrite(REDLED3, LOW);              
            break;
          case 5:
            digitalWrite(GREENLED1, HIGH);
            digitalWrite(GREENLED2, HIGH);
            digitalWrite(GREENLED3, HIGH);              
            digitalWrite(YELLOWLED1, HIGH);
            digitalWrite(YELLOWLED2, HIGH);
            digitalWrite(YELLOWLED3, HIGH);
            digitalWrite(YELLOWLED4, LOW);
            digitalWrite(REDLED1, LOW);
            digitalWrite(REDLED2, LOW);
            digitalWrite(REDLED3, LOW);               
            break;
          case 6:              
            digitalWrite(GREENLED1, HIGH);
            digitalWrite(GREENLED2, HIGH);
            digitalWrite(GREENLED3, HIGH);              
            digitalWrite(YELLOWLED1, HIGH);
            digitalWrite(YELLOWLED2, HIGH);
            digitalWrite(YELLOWLED3, HIGH);
            digitalWrite(YELLOWLED4, HIGH);
            digitalWrite(REDLED1, LOW);
            digitalWrite(REDLED2, LOW);
            digitalWrite(REDLED3, LOW);              
            break;
          case 7:
            digitalWrite(GREENLED1, HIGH);
            digitalWrite(GREENLED2, HIGH);
            digitalWrite(GREENLED3, HIGH);              
            digitalWrite(YELLOWLED1, HIGH);
            digitalWrite(YELLOWLED2, HIGH);
            digitalWrite(YELLOWLED3, HIGH);
            digitalWrite(YELLOWLED4, HIGH);
            digitalWrite(REDLED1, HIGH);
            digitalWrite(REDLED2, LOW);
            digitalWrite(REDLED3, LOW);              
            break;    
          case 8:
            digitalWrite(GREENLED1, HIGH);
            digitalWrite(GREENLED2, HIGH);
            digitalWrite(GREENLED3, HIGH);              
            digitalWrite(YELLOWLED1, HIGH);
            digitalWrite(YELLOWLED2, HIGH);
            digitalWrite(YELLOWLED3, HIGH);
            digitalWrite(YELLOWLED4, HIGH);
            digitalWrite(REDLED1, HIGH);
            digitalWrite(REDLED2, HIGH);
            digitalWrite(REDLED3, LOW);
            break;
          case 9:
            digitalWrite(GREENLED1, HIGH);
            digitalWrite(GREENLED2, HIGH);
            digitalWrite(GREENLED3, HIGH);              
            digitalWrite(YELLOWLED1, HIGH);
            digitalWrite(YELLOWLED2, HIGH);
            digitalWrite(YELLOWLED3, HIGH);
            digitalWrite(YELLOWLED4, HIGH);
            digitalWrite(REDLED1, HIGH);
            digitalWrite(REDLED2, HIGH); 
            digitalWrite(REDLED3, HIGH);
            break;
          case 10:
            digitalWrite(GREENLED1, HIGH);
            digitalWrite(GREENLED2, HIGH);
            digitalWrite(GREENLED3, HIGH);              
            digitalWrite(YELLOWLED1, HIGH);
            digitalWrite(YELLOWLED2, HIGH);
            digitalWrite(YELLOWLED3, HIGH);
            digitalWrite(YELLOWLED4, HIGH);
            digitalWrite(REDLED1, HIGH);
            digitalWrite(REDLED2, HIGH); 
            digitalWrite(REDLED3, HIGH);
            break;           
          }                     
        }
#endif        
        bigPacket = false;        
      }
      else {
        // Checksum Error
      }  // end if else for checksum
    } // end if read 0xAA byte
  } // end if read 0xAA byte
}

DIAGRAM FOR HC-05 WITH ARDUINO (WITH SKETCH)

 

Method 2 for AT Commands

 

Connection Diagram





Steps to Follow

1. Make connections as per the connection diagram.

2. Program (Upload the sketch) the” HC-05 with Arduino” source code to Arduino board using Arduino compiler

3. Open the “Serial monitor” with buadrate of 9600.

4. Type the AT commands and click Enter in Serial monitor

 

Serial Monitor Screen





Program for HC-05 with Arduino Board

 

Title: HC-05 with Arduino

/*
AUTHOR: Hazim Bitar (techbitar)
DATE: Aug 29, 2013
LICENSE: Public domain (use at your own risk)
CONTACT: techbitar at gmail dot com (techbitar.com)

*/

#include 

SoftwareSerial BTSerial(10, 11); // RX | TX

void setup()
{
  pinMode(9, OUTPUT);  // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
  digitalWrite(9, HIGH);
  Serial.begin(9600);
  Serial.println("Enter AT commands:");
  BTSerial.begin(38400);  // HC-05 default speed in AT command more
}

void loop()
{

  // Keep reading from HC-05 and send to Arduino Serial Monitor
  if (BTSerial.available())
    Serial.write(BTSerial.read());

  // Keep reading from Arduino Serial Monitor and send to HC-05
  if (Serial.available())
    BTSerial.write(Serial.read());
}

Reference Video Links

Getting Started with Mindwave mobile Using MATLAB