Using the MindWave in Xojo
Use the force Luke… In Xojo! ABThinkGear is a wrapper around the ThinkGear engine to use the NeuroSky Mindwave device in Xojo. The wrapper is Windows only.
The MindWave is a cheap mind reader device ($79.99) you can buy online e.g. here. It can do some very basic mind wave readings, so don’t expect it to recognize thoughts or so.
– Raw signal
– Neuroscience defined EEG power spectrum (Alpha, Beta, etc.)
– eSense meter for Attention
– eSense meter for Meditation
– eSense Blink Detection
– On-head detection
But still, it’s a fun little thing to play with!
As always, I tried to build an easy to use framework. Here is the structure:
The actual wrapper around the DLL.
A class containing all the data of one reading (Attention, Meditation, Blinkstrenght, Alpha, Beta, etc…)
A thread that polls the data from the device. The data of a MindWave device is only updated once a second, so the poll happens also only once every second. This is the class you’ll use in Xojo the most.
Some code on the use of the framework:
First we need to initialize the MindWave:
if not MyThinkGear.Connect("COM9", BAUD_57600, true) then
MsgBox "Could not connect to headset!"
' enable the blink detection
dim ret as boolean = MyThinkGear.EnableBlinkDetection(true)
The ABThinkGear class has only one event:
ThinkGearChanged(State as ABThinkGearState)
In this event you receive a State containing all the data of the last reading. It is then up to you to do something useful with this data. In the attached demo, I displayed the incoming data.
Mindwave incoming data display in Xojo
You get quite a bit of info (although not that accurate as it only uses one sensor):
Properties of the ABThinkGearState class
But you can for example start interpreting the data. e.g. if the Attention level is above 80 (in a range of 0 to 100) you could consider performing a certain action.
A couple of days ago, a project using Google Glass was shown doing exactly that. When the attention level reaches a certain point, they take a picture with Glass. On the next attention peak, they post it to twitter. But this can be done now also with Xojo! (take a picture with the webcam, send it to some social media site using the RESt api, et voila!
Here is a video of the Glass project:
The source code of the framework and Demo can be downloaded from http://gorgeousapps.com/ABThinkGear.zip
This framework will be part of the ABXVision framework later.
Cogito ergo sum
“I think, therefore I am”
Click here to if you like my work