Fun With MindFlex

For this valentines day, my wife got me a MindFlex from Mattel. I have been wanting one of these since they have been on the market. It is a really interesting game where you control a foam ball with your mind. The ball will rise with the more focused you are. Letting your mind wonder and as Morphius likes to say “free your mind”, the ball will lower.

MindFlex doesn’t read your thoughts, rather it picks up on level of activity. There has been fuss about the legitimacy of how this thing works. The popular video of it being placed on a foam head with a damp cloth gives readings. If you would do the same with a medical grade EEG, you would receive random values.

MindFlex uses a NeuroSky chip to compute the brain data. You can have 8 channels of raw wave activity:

Along with connection quality, and the proprietary attention and meditation values.

Inspired by Eric Mika’s post, I set out to replicate and extend his project. He wrote a library to get the data using an Arduino. He also wrote graphic software to aid in the visuals of the activity in your mind.  Eric go’s into better detail about the data the chip gives off. He has a video about the hardware hack, and it is very informative.

Basically, you need a shared ground and a wire extending the Tx pin for the NeuroSky chip circuit. Using images from this teardown of the MindFlex I point out which pins they are. This is in the left pod of the headset:

Ground

Tx Pin

I have affixed the Arduino to the headset using Velcro, opposed to zip ties. Also I have noticed it is better for the usb port to be facing the back of the head when you wear it. This keeps the cords away from your face. Here are some pictures of the finished mod:

Top View

Front View

My Inspector Mazy, she aproves.

After copying the BrainLibrary into the Arduinos lib, I loaded the BrainSerialOut example that came with the library, I immediately  got python reading from the COM port. The data comes as a string containing 11 values: signal strength, attention, meditation, delta, theta, low alpha, high alpha, low beta, high beta, low gamma, high gamma.

When the signal strength is at 0 it is at its strongest. The next two values are the ones I am interested in. If the signal strength isn’t strong enough, you will not get the attention or meditative values.

The next step on my list was to make this data available to what ever can handle sockets like Blender, Android, Iphone, and I think Flash can even handle sockets.

I wrote a server in Python2.6 to forward the data to any connection. It takes the headset a few seconds to give good data. I have also noticed, the connection signal can be finicky.

import serial, sys, socket

s = serial.Serial('COM8')

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('',1002))

while 1:
 sock.listen(5)
 conn, addr = sock.accept()
 while 1:
     try:
         sread = s.readline()
         conn.send(sread)
     except:
         print "connection at %s lost" % addr
         break

Next was to write a quick game using my new toy. I chose PyGame because it was easy to get going quickly. I plan to switch to 3d when I have the time for it. The game uses the attention value to light a match. There is also a bar on the left side representing the activity in the users mind. Future work includes snuffing the flame with meditative values.

Advertisements

About Tech B.

I am currently employed as a tech support rep for Frontier DSL internet and Dail-Up service. If you live on the East Coast and have Frontier or the old Verizon, you may have spoken with me at one point. I do side jobs programming and building things for people. I know Python better than any language in my toolbox. I can also develop Android Apps, which are Java based. Other languages include C , VB/VB.NET, some C#, PBASIC, Batch, Javascript, and some PHP. I love microcontrollers and interfacing with the outside world. I am currently working with Arduinos, which are amazing. Also I can work with the Basic Stamp family of microcontrollers; future development includes FPGA and embedded Linux. I was going to school, but have financial issues at the moment that are keeping me from the books. I plan on going back in the next couple semesters and finishing up my Associates in IT, then perusing a BS in computer science.
This entry was posted in Uncategorized and tagged , , , , , , , , , , , . Bookmark the permalink.

11 Responses to Fun With MindFlex

  1. Vanessa says:

    Cool babe. I’m glad you are enjoying the gift. And you are so smart I just don’t know what to do with you half the time. I love you!

  2. danbertner says:

    im having a problem with the signal strength. it begins to fluctuate only when i reset the mindflex for 4 seconds…. then consistantly stays at 200…on or off my head.

    any suggestions?

    • Tech B. says:

      Check all batteries, reposition the headset, or clean the nodes.

      Some people have a really hard time getting the signal strength, my wife couldn’t hold a steady signal either.
      Have other people try it and see what kind of results they get.

    • azraelzqq says:

      ever figure out why it was doing this? im having the same issue

  3. talmai says:

    quick question: is there a way to get the wireless signal without the hardware hack? I’m trying to read data as is…

    • Tech B. says:

      I haven’t tried. But in the image labeled “Ground”, there is a small module that looks like the radio for the wireless. You might be able to figure out something there.

  4. Great review! Look forward to your other posts.

  5. Erin Van Patten says:

    hey there. you seem VERY knowledgeable about this game. If you can help, I’d appreciate it. We just bought this for our daughter for Christmas. She was SO excited. We went to go play and the headset will not calibrate when she has it on. It does w/my husband. I have yet to try myself, but I’m afraid it’ll work and she’ll be even more bummed out that it doesn’t work for only her–it’s her gift! She’s SO disapointed and we’ve jiggled, and adjusted and switched on and off. Not sure what else we can try.
    Any suggestions??

    • Tech B. says:

      You can try to clean the pads on the headset and also where they will be placed with alcohol. Make sure fresh batteries are in the base and headset.

      As a last resort you can put it on someone it works on, then put it on her. I’ve noticed at times mine wouldn’t work until I wore it a little bit. It was selective with my wife too.

      The only downside is it’s not “guaranteed” to work with anyone. Just make sure her mind is engaged while trying it out.

      That’s about the best advice I can give. You can try the StarWars Force Trainer also. Not sure if made by Mattel, but they both us NeuroSky chips so it’s authentic EEG.

      Good luck.

  6. morlok says:

    My contribution to the community, Mindflex duel hack, 50Hz conversion, and output raw.

    http://morloklabs.blogspot.com/2011/12/mindflex-duel-hacking-conversion-50hz-y.html

  7. Ancy Mathai says:

    sir
    When doing project with mindflex headset i faced problem in getting the data at serial monitor after soldering .I have used ground connection from the near the T pin …
    It is the project shown here : http://frontiernerds.com/brain-hack
    when it is time to start getting data in serial monitor it just shows nothing…
    i double checked the connections i soldered and everything is good…
    the code is this :

    // Arduino Brain Library – Brain Serial Test

    // Description: Grabs brain data from the serial RX pin and sends CSV out over the TX pin (Half duplex.)
    // More info: https://github.com/kitschpatrol/Arduino-Brain-Library
    // Author: Eric Mika, 2010 revised in 2014

    #include

    // Set up the brain parser, pass it the hardware serial object you want to listen on.
    Brain brain(Serial);

    void setup() {
    // Start the hardware serial.
    Serial.begin(9600);
    }

    void loop() {
    // Expect packets about once per second.
    // The .readCSV() function returns a string (well, char*) listing the most recent brain data, in the following format:
    // “signal strength, attention, meditation, delta, theta, low alpha, high alpha, low beta, high beta, low gamma, high gamma”

    if (brain.update()) {
    Serial.println(brain.readErrors());
    Serial.println(brain.readCSV());
    }
    }

    I used Roboduino–arduino-1.0.1

    Please help in solving this issue.

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