UKOLN Dev » brain-computer interface http://blogs.ukoln.ac.uk/ukolndev Developer Labs Mon, 16 Dec 2013 00:09:02 +0000 en-US hourly 1 http://wordpress.org/?v=3.5.2 Blink detection and attention evaluation: the NeuroSky MindWave http://blogs.ukoln.ac.uk/ukolndev/2011/12/14/blink-detection-and-attention-evaluation-the-neurosky-mindwave/?utm_source=rss&utm_medium=rss&utm_campaign=blink-detection-and-attention-evaluation-the-neurosky-mindwave http://blogs.ukoln.ac.uk/ukolndev/2011/12/14/blink-detection-and-attention-evaluation-the-neurosky-mindwave/#comments Tue, 13 Dec 2011 23:00:13 +0000 Emma Tonkin http://blogs.ukoln.ac.uk/ukolndev/?p=1238 Hardware for UX evaluation

As part of Project Sunflower, we took various approaches to interface evaluation. Alongside heuristic evaluation, walkthroughs and so forth, we also used various bits of hardware to support trials. This post describes setup and sample code for the NeuroSky MindWave, an inexpensive BCI (brain-computer interface – think ‘electroencephalogram’, or ‘brain wave monitoring’) that uses a single sensor placed on the forehead to measure eye blinks, ‘attention’ and ‘meditation’. These two latter variables shouldn’t be taken at (scuse the pun) face value; according to a report by Travis Ross, they’re based on a proprietary algorithm, with attention reported to relate to beta waves, hence linked to wakefulness/focus, and meditation linked to alpha waves – level of calm. Vague, admittedly, but then these devices are priced for and in large part targeted at the consumer market. If you’ve ever seen those Mattel Jedi force-trainer toys, those are based around the same technology.

Setup

Having installed the software prerequisites and drivers, the next thing is to run the Thinkgear Connector. This is an extremely helpful little piece of kit, which listens to the USB radio link and makes the sensor data available to applications. This reduces the connection step to a couple of lines of code. Since the Thinkgear Connector will return JSON upon request, the data packets are easy to parse.

Code

import sys
import json
import time
from telnetlib import Telnet

tn=Telnet('localhost',13854);
start=time.clock();

i=0;
# app registration step (in this instance unnecessary)
# tn.write('{"appName": "Example", "appKey": "9f54141b4b4c567c558d3a76cb8d715cbde03096"}');
tn.write('{"enableRawOutput": true, "format": "Json"}');

outfile="null";
if len(sys.argv)>1:
        outfile=sys.argv[len(sys.argv)-1];
        outfptr=open(outfile,'w');

# default values
eSenseDict={'attention':0, 'meditation':0};
waveDict={'lowGamma':0, 'highGamma':0, 'highAlpha':0, 'delta':0, 'highBeta':0, 'lowAlpha':0, 'lowBeta':0, 'theta':0};
signalLevel=0;

while i

Example output

The code as written above produces very simple CSV output, which has the benefit of being very easy to plot using something like Gnuplot:

plot "test-output.log" using 1:3 with lines, "" using 1:4 with lines, "" using 1:5 with lines

Graph of three variables: working on a language problem.

Some sensor data captured: subject was working on a language problem. Red

Sensor data. Activity: Watching TV

Sensor data captured: individual was watching TV. Red

Note: the number of blinks captured is low enough that the chances are that the MindWave is not picking up all blink events.

]]>
http://blogs.ukoln.ac.uk/ukolndev/2011/12/14/blink-detection-and-attention-evaluation-the-neurosky-mindwave/feed/ 0