Matlab Code to Read Attention using Mindwave Mobile

Call for Price

In neurosky Mindwave mobile and Mindwave ,The unsigned one-byte data reports the current eSense Attention meter of the user, which indicates the intensity of a user’s level of mental “focus” or “attention”, t which occurs during intense concentration and directed (stable) mental activity. Its value ranges from 0 to 100. Distractions, wandering thoughts, lack of focus, or anxiety may lower the Attention meter levels.

SKU: Attention-using-Mindwave-Mobile-MiniProject Category:

Description

Matlab Code to Read Attention using Mindwave mobile

ThinkGear™ is the technology inside every NeuroSky product or partner product that enables a device to interface with the wearers’ brainwaves.The ThinkGear Connector (TGC) runs as a background process on your computer and is responsible for directing headset data from the serial port to an open network socket. It includes the thinkgear module and eeg sensor that touches the forehead (fp1 of the electrode postion recommended by 10/20 electrode system), and the reference points located on the ear clip. Thinkgear module(TGAM1) contains the onboard chip that processes all of the data and provides this data to software and applications in digital form.It is available on both Windows and Macintosh, any language or framework that contains a socket library should be able to communicate with it. Both the raw brainwaves and the eSense Meters (Attention and Meditation) and eyeblink are calculated on the ThinkGear chip.

Demonstration Video

 

 

ATTENTION eSense

In neurosky Mindwave mobile and Mindwave ,The unsigned one-byte data reports the current eSense Attention meter of the user, which indicates the intensity of a user’s level of mental “focus” or “attention”, t which occurs during intense concentration and directed (stable) mental activity. Its value ranges from 0 to 100. Distractions, wandering thoughts, lack of focus, or anxiety may lower the Attention meter levels.

By default, output of this Data Value is enabled. It is typically output once a second.

The API declaration for

TG_DATA_ATTENTION = 2;
Matlab code to read attention using Mindwave mobile
%Clear Screen
clc;
%Clear Variables
clear all;
%Close figures
close all;
%Preallocate buffer
data_att = zeros(1,256);
%Comport Selection
portnum1 = 7;
%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_ATTENTION = 2;
%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' );
i=0;
j=0;
%To display in Command Window
disp('Reading Brainwaves');
figure;
while i < 20
if (calllib('Thinkgear','TG_ReadPackets',connectionId1,1) == 1) %if a packet was read...
if (calllib('Thinkgear','TG_GetValueStatus',connectionId1,TG_DATA_ATTENTION ) ~= 0)
j = j + 1;
i = i + 1;
%Read attention Valus from thinkgear packets
data_att(j) = calllib('Thinkgear','TG_GetValue',connectionId1,TG_DATA_ATTENTION );
%To display in Command Window
disp(data_att(j));
%Plot Graph
plot(data_att);
title('Attention');
%Delay to display graph
pause(1);
end
end
end
%To display in Command Window
disp('Loop Completed')
%Release the comm port
calllib('Thinkgear', 'TG_FreeConnection', connectionId1 );

Additional information

Weight 1.000000 kg

Reviews

There are no reviews yet.

Be the first to review “Matlab Code to Read Attention using Mindwave Mobile”

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.