You have no items in your shopping cart.

Subtotal: 0.00

Controlling LED with your Brain Meditation using Brainwave Starter kit and Arduino platform

Features

  • Interfacing the MindWave Mobile with an Arduino board using HC-05 Bluetooth module
  • Acquiring the Meditation eSense values from the data stream.
  • LED controlled by Meditation level of mindwaves.
  • Display the Meditation levels in serial monitor.

 

Introduction

This step-by-step guide is intended to quickly get a typical Arduino board user up and running with the MindWave Mobile. This guide will show how to setup the HC-05 Bluetooth Module quickly for communication with the MindWave Mobile 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.

Demonstration Video

Required Materials

This application requires the following materials:

 

Hardware's:

  • Mindwave Mobile Device
  • Arduino Board
  • HC-05 Bluetooth Module
  • USB cable (for Arduino)
  • Connecting Wires.
  • Bluetooth dongle, if your computer does not have internal bluetooth capabilities

 

Software's

  • Software's

 

Project Materials





Connection Diagram



 

Note: Keep the Rx (Pin1) line in Open connection

 

Steps to follow [Output at LED and Serial Monitor]

 

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

2. Program (Upload the sketch) the “Mindwave_Arduino_Meditation_LED_UART” 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 connection diagram, and then switch ON the Arduino Board.

5. After the 7 Seconds when arduino board was ON, 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 Meditation.

8. Check the LED (D13) variation with respect your Meditation level.

9. And also see the Serial Monitor to know your Meditation levels.

 

Steps to follow [Output at LED only]

 

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

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

3. Make all the connection as per the connection diagram, and then switch ON the Arduino Board.

4. After the 7 Seconds when arduino board was ON, switch ON the Mindwave device.

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

6. Wear the Mindwave device in Head, and give the Meditation.

7. Check the LED (D13) variation with respect your Meditation level.

 

Real View of Arduino with Mindwave mobile



 

Some Tips about Project

 

  • The Indication LED of Mindwave device glow continuously in blue color, when it’s paired with arduino HC-05 module.
  • If blue LED in blinking conditions means, it’s not pair with device.
  • The Mindwave mobile and HC-05 module automatically paired, when we switch ON the both device.
  • Before sketch the program, you have to disconnect the Tx and Rx lines (Keep in Open connection).

 

Output Details

 

The LED (D13) becomes ON, when you give High Meditation. It’s become OFF, when you give next High Meditation, like that every High Meditation you can change the state of LED.

 

Upload the sketch to Arduino board





Serial Monitor Output





Program for Mindwave_Arduino_Meditation_LED_UART

//                                                           //
//    Program       : Brainsense with Arduino                //
//    Interfacing   : HC-05 Bluetooth Module                 //
//    Output        : LED Control using Meditation           //

#define BAUDRATE 57600
#define LED 13

byte payloadData[32] = {0};
byte Meditation[5]={0};
byte checksum=0;
byte generatedchecksum=0;
int  Plength,Temp;
int  Med_Avg=0,On_Flag=1,Off_Flag=0;
int  k=0;
signed int  j=0;


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

byte ReadOneByte()           // One Byte Read Function
{
  int ByteRead;
  while(!Serial.available());
  ByteRead = Serial.read();
  return ByteRead;
}

void loop()                     // Main Function
{
  while (1)
  {
    if(ReadOneByte() == 170)        // AA 1 st Sync data
    {
      if(ReadOneByte() == 170)      // AA 2 st Sync data
      {
        Plength = ReadOneByte();
        if(Plength == 32)   // Big Packet
        { 
          generatedchecksum = 0;
          for(int i = 0; i < Plength; i++) 
          {  
            payloadData[i]     = ReadOneByte();      //Read payload into memory
            generatedchecksum  += payloadData[i] ;
          }
          generatedchecksum = 255 - generatedchecksum;
          checksum  = ReadOneByte();
        
          if(checksum == generatedchecksum)        // Varify Checksum
          {             
            if (payloadData[30]==5)
            { 
              if (j<4)
               {
                 Meditation [k] = payloadData[31];
                 Temp += Meditation [k];
                 j++;
               }
               else
               {
                 Med_Avg = Temp/4;
                 
                 if (Med_Avg>80)
                 {
                   if(On_Flag==1)
                   {
                     digitalWrite(LED, HIGH);
                     On_Flag=0;
                     Off_Flag=1;
                   }
                   else if(Off_Flag==1)
                   {
                     digitalWrite(LED, LOW);
                     On_Flag=1;
                     Off_Flag=0;
                   }
                 }
                 j=0;
                 Temp=0;
               }
            }
           } 
         }
       }
     }         
   } 
}

Reference Documents Links

Interfacing Mindwave Mobile with Arduino

 

Reference Video Links

 

Interfacing Mindwave Mobile with Arduino

Configure HC 05 Bluetooth Module

Find the Mindwave IP address

Getting Started with MINDWAVE MOBILE Using MATLAB