Controlling things with your mind is awesome. Unfortunately, EEG headsets like the NeuroSky MyndWave are a bit too pricey if you just want to experiment. Last year, I wanted to see what I could control with my brain on a student's budget.
I came across FrontierNerd's Brain Hack tutorial, which gave me a good comparison of the EEG headsets and their capabilities. I tried out their tutorial and hacked a MindFlex headset using an Arduino. It was fun to do, but it still required a cable to be attached, limited mobility, and looked hacked together.
I had a serial bluetooth module HC-06 lying around and decided to see if I could integrate the two and skip the Arduino altogether. Turns out, it works almost as good as the commercially available NeuroSky MyndWave for a quarter of the cost, and looks completely unmodified!
Finally, I came across a wonderful open source application by Trent Brooks that forwards your EEG signals on via OSC so you can use it in your MAX/MSP, Processing, or other projects.
In this tutorial, I'm going to show you what to buy, what to solder, and how to get your Bluetooth EEG headset up and running.
This is a relatively safe and easy hack to pull off, especially because we're using a commercially available toy and adding a Bluetooth module to it. However, I do not claim to know how this device fully works and take no responsibility for any harm that this project may incur.
While browsing Instructables, I noticed that arpuss had put up a tutorial using the MindFlex and the HC-06 but goes several steps further to pull raw data from it by switching the MindWave chipset into a different mode by sending a series of hex codes at 57600 baud on boot-up. That's awesome! Check his post out here.
Step 1: Gather parts
What you'll need:
Step 2: Open up the MindFlex
There should be two sides to the headset. One side contains the batteries and the other contains the switch and electronics. You're going to want to open up the side that has the switch on it.
Remove the 4 screws on the black side of the headset to get access to the circuit board.
Once inside, you will also want to remove the 2 screws attaching the circuit board to the housing.
At this point, you can warm up your soldering iron, because you're going to need it in the next step.
Step 3: Solder
Look through the photos to make sure you have a good sense of what needs to be soldered. You'll only need to solder 3 wires, which connect to the Bluetooth module's GND (Ground), RXD (Receive), and VCC (Power) pins. The first two are on the front of the MindFlex PCB, and the last one is located on the back where the switch is.
For the curious, the TXD pin on the HC-06 is used for transmitting serial commands back, the State pin goes HIGH when on and used as a power indicator for an external LED or micro-controller, and the EN pin is used to reprogram the module with different names or baud rates.
Your Bluetooth module should come with a few female-female jumper wires. You can cut and strip them to solder on to the MindFlex, but just make sure that the plug lines up with the HC-06 properly. If your module did not come with jumper wires, you can solder spare wires to the MindFlex and the HC-06.
The Bluetooth module has a built-in power regulator and can take anywhere from 3.3v to 5v. This is perfect because the MindFlex takes 3AAA batteries at 1.5V each when fully charged, which provides about 4.5v. Soldering the VCC pin to the switch means that the Bluetooth module powers on using the same switch and power supply as the MindFlex. The MindFlex also communicates with the base station using a daughterboard that communicates via Serial UART. Soldering the "T" pin to the HC-06's RXD pin means that the Bluetooth module will siphon off the serial commands and pass it wirelessly over Bluetooth as if it was directly connected via a cable.
Step 4: Insulate, test, and repack
We're almost there. The next step is to insulate the board to prevent any shorts before you cram everything back into the case. Cover any exposed component or leads on the HC-06 with electrical tape. Check the photos, you should have something similar to my setup.
Put batteries into the other side of the headset and turn it on. The red LED on the outside of the headset should tell you that the headset is receiving power, and the lights on the Bluetooth module should tell you that the Bluetooth module is functioning properly. If not, immediately turn it off and check your wiring.
Once everything is working, arrange the Bluetooth module inside the case, replace the screws and you have a working single-channel Bluetooth EEG headset!
Next step will be getting it paired with your computer and reading brainwaves.
Step 5: Pair with your computer
It's time to pair this with your computer. I'm running OSX Mavericks 10.9 so your screens may look different if using an older version.
If you are using Windows, check this out for pairing instructions.
The default name of your Bluetooth module should be HC-06. I have modified the name of my module to MindWaveMobile using an Arduino. Check out this tutorial if you want to do that.
The default passcode for the HC-06 should be '1234'.
Step 6: Read data using BrainWaveOSC
Download Trent Book's BrainWaveOSC for your platform and unzip it to a folder.
Before you run the application, you'll need to do is identify how your system sees your bluetooth device.
You need to find the COM port that the bluetooth device is attached to. I'm not running windows, but this may help.
The easiest way to find this is to open up your terminal and type in ls /dev/tty.*
This will give you a list of serial devices detected by your system. Your should look like /dev/HC-06-DevA
Once you find your device, open up the settings.xml file located in the Data folder of BrainWaveOSC.
The 4th line should read something like COM6 in between the tags. Change that to your device string that you found earlier. It should look like /dev/HC-06-DevA
Open up BrainWaveOSC and watch your brainwaves!
After you open the application, it should start with a red panel on the left and turn green once it starts receiving data. That's it, you are reading your brainwaves from the prefrontal cortex of your brain, which usually deals with logic!
About EEG and how this all works:
EEG stands for Electro Encephalography, which basically it means it reads small changes in electrical activity in your brain as your neurons fire. This is usually represented in a series of frequency bands, also called power bands. You may have heard of them: Delta, Theta, Alpha, Alpha, Beta, and Gamma waves. These frequencies have been known to correlate with activities such as blinking, sleep, stress, and so on if you observe them over a long period of time.
What can it do?
Most of the time, your power bands are going to be all over the place and probably not make any sense. Your brain is extremely complex and this device is a very simple EEG reader. It's called a single-channel dry sensor because it only has one node attached to your forehead and doesn't take any conductive gel to connect. You may have seen much more complex versions of this in hospitals with over 40 sensors located all over.
However, NeuroSky - the manufacturer of the chip inside the MindFlex - has implemented mystery algorithms that can "learn" at least two things about you. Your Attention level and Meditation level. The chipset spits out values for these between 0 and 100. This means that your Attention level goes up when concentrating really hard on say, a math problem. Or raising your Meditation level by closing your eyes and relaxing your mind.
We can use Attention and Mediation to do some cool things, like triggering an action whenever one of those exceeds a preset threshold.
I've posted another Instructable here to show you how to use the OSC messages to throw a Hadouken in Street Fighter. Enjoy! :)
This program is written in OpenFrameworks by Trent Brooks and is used to parse the data coming from EEG headsets and rebroadcast the values back out through OpenSoundControl (OSC). This makes it easy to pass EEG data to other applications for creative purposes like controlling a quadcopter.