Xojo: ABThinkGear – Mind Reading with the computer

Using the MindWave in Xojo

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)
  end if

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

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

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”

Happy programming!


Click here to Donation if you like my work


About Alwaysbusy

My name is Alain Bailleul and I'm the Senior Software Architect/Engineer at One-Two. I like to experiment with new technologies, Computer Vision and A.I. My projects are programmed in B4X , Xojo, C#, java, HTML, CSS and JavaScript. View all posts by Alwaysbusy

2 responses to “Xojo: ABThinkGear – Mind Reading with the computer

  • MZ

    The .dll only works with Windows?
    Do you have a version for Mac OS X, too?

    Before I buy a “MindWave” for testing it: Does the code in github include everything I need? Or do I have buy or develop something on my own?

    • Alwaysbusy

      Sorry for the delay. I was on holiday 🙂

      The dll does only work for Windows, but from what I recall, I think there was also a .dylib in the SDK. If so, you’ll need to write the OSX declares to this dylib yourself, similar as I did for the Windows dll.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: