Blink LED with your Eye blink data using Brainwave Starter kit and Arduino

Call for Price

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.

SKU: Eye-blink-Brainwavet-Arduino-MiniProject Category:

Description

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

Features

☞Interfacing the Mindwave Mobile with an Arduino board using HC-05 Bluetooth module

☞Acquiring the EEG data and eSense values from the data stream.

☞LED controlled by Eye blink level of Mindwave device.

☞Display the Eye blink levels in serial monitor.

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

☞Arduino 1.0.5-r2

Project Materials

Connection Diagram

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

Steps to follow [Output at LED only]

☞Switch ON the Mindwave Mobile and unpaired the last connections, then OFF the Mindwave device.

☞Program (Upload the sketch) the “Mindwave_Arduino_Eye Blink_LED” source code to Arduino Board using Arduino compiler.

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

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

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

☞Wear the Mindwave device in Head, and blink your eyes.

☞For Mindwave device need calibration to detect the eye blink values in EEG data. So far we have to wait few minutes (approximately 2 min) for calibration.

☞After calibration, D13 LED becomes high initially, and then it will blink with respect our Eye blink levels.

Real View of Arduino with HC-05 Module

Noisy EEG Raw data wave (Before Calibration)

EEG Raw data wave (After Calibration)

EEG Raw data wave (When Eye Blink occurs)

Some Tips about Project

☞The Indication LED ofMindwave 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).

☞If calibrations will take more times means, you have to ensure your Mindwave headset (may its wear improperly).

Output Details

The LED (D13) becomes Blink, when your eyes are blink usingMindwave device.

Upload the sketch to Arduino board

Program for Mindwave_Arduino_Eye Blink_LED

Title: Mindwave_Arduino_ Eye Blink _LED

    %Clear Screen
    clc;
    %Clear Variables
    clear all;
    %Close figures
    close all; 
    
    a=imread('blink.jpg');
    %Preallocate buffer
    data_blink = zeros(1,256);    

    %Comport Selection
    portnum1 = 19;  
    %COM Port #
    comPortName1 = sprintf('\\\\.\\COM%d', portnum1);


    % Baud rate for use with TG_Connect() and TG_SetBaudrate().
    TG_BAUD_115200  =   115200;

    % Data format for use with TG_Connect() and TG_SetDataFormat().
    TG_STREAM_PACKETS =     0;
    % Data type that can be requested from TG_GetValue().
    
    TG_DATA_BLINK_STRENGTH = 37;
    
    %load thinkgear dll
    loadlibrary('Thinkgear.dll');
    
    %To display in Command Window
    fprintf('Thinkgear.dll loaded\n');
    
    
    %get dll version
    dllVersion = calllib('Thinkgear', 'TG_GetDriverVersion');
    
    %To display in command window
    fprintf('ThinkGear DLL version: %d\n', dllVersion );

    % Get a connection ID handle to ThinkGear
    connectionId1 = calllib('Thinkgear', 'TG_GetNewConnectionId');
    if ( connectionId1 < 0 )
        error( sprintf( 'ERROR: TG_GetNewConnectionId() returned %d.\n', connectionId1 ) );
    end;


    % Attempt to connect the connection ID handle to serial port "COM3"
    errCode = calllib('Thinkgear', 'TG_Connect',  connectionId1,comPortName1,TG_BAUD_115200,TG_STREAM_PACKETS );
    if ( errCode < 0 )
        error( sprintf( 'ERROR: TG_Connect() returned %d.\n', errCode ) );
    end

    fprintf( 'Connected.  Reading Packets...\n' );

    if(calllib('Thinkgear','TG_EnableBlinkDetection',connectionId1,1)==0)
        disp('blinkdetectenabled');
    end
    
    i=0;
    j=0;
   
    %To display in Command Window

    disp('Reading Brainwaves');

    
    while i < 40
        if (calllib('Thinkgear','TG_ReadPackets',connectionId1,1) == 1)   %if a packet was read...
            if (calllib('Thinkgear','TG_GetValueStatus',connectionId1,TG_DATA_BLINK_STRENGTH) ~= 0) 
                j = j + 1;
                i = i + 1;
                %Read attention Valus from thinkgear packets
                data_blink(j) = calllib('Thinkgear','TG_GetValue',connectionId1,TG_DATA_BLINK_STRENGTH );
                %To display in Command Window
                disp(data_blink(j));
                %Plot Graph
                figure;
                imshow(a);                
                title('Blink Strength');
                %Delay to display graph
                pause(1);
                close all;
            end
       end
    end
    
    %To display in Command Window
    disp('Loop Completed')
    %Release the comm port
    calllib('Thinkgear', 'TG_FreeConnection', connectionId1 );

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

Additional information

Weight 0.100000 kg

Reviews

There are no reviews yet.

Be the first to review “Blink LED with your Eye blink data using Brainwave Starter kit and Arduino”

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.