Blink detection and attention evaluation: the NeuroSky MindWave
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
Note: the number of blinks captured is low enough that the chances are that the MindWave is not picking up all blink events.