How to Hack Toy EEGs
Arturo Vidich, Sofy Yuditskaya, and I needed a way to read brains for our Mental Block project last fall. After looking at the options, we decided that hacking a toy EEG would be the cheapest / fastest way to get the data we wanted. Here’s how we did it.
The Options
A non-exhaustive list of the consumer-level options for building a brain-computer interface:
![]() Open EEG |
![]() Force Trainer |
![]() Mind Flex |
![]() MindSet |
|
| Description | Plans and software for building an EEG from scratch | Levitating ball game from Uncle Milton | Levitating ball game from Mattel | Official headset from NeuroSky |
| Attention / Meditation Values | No | Yes | Yes | Yes |
| EEG Power Band Values | Yes (roll your own FFT) | No | Yes | Yes |
| Raw wave values | Yes | No | No | Yes |
| Cost | $200+ | $75 (street) | $80 (street) | $200 |
Open EEG offers a wealth of hardware schematics, notes, and free software for building your own EEG system. It’s a great project, but the trouble is that the hardware costs add up quickly, and there isn’t a plug-and-play implementation comparable to the EEG toys.
The Nerosky MindSet is a reasonable deal as well — it’s wireless, supported, and plays nicely with the company’s free developer tools.
For our purposes, though, it was still a bit spendy. Since NeuroSky supplies the EEG chip and hardware for the Force Trainer and Mind Flex toys, these options represent a cheaper (if less convenient) way to get the same data. The silicon may be the same between the three, but our tests show that each runs slightly different firmware which accounts for some variations in data output. The Force Trainer, for example, doesn’t output EEG power band values — the Mind Flex does. The MindSet, unlike the toys, also gives you access to raw wave data. However, since we’d probably end up running an FFT on the wave anyway (and that’s essentially what the EEG power bands represent), we didn’t particularly miss this data in our work with the Mind Flex.
Given all of this, I think the Mind Flex represents a sweet spot on the price / performance curve. It gives you almost all of the data the Mind Set for less than half the cost. The hack and accompanying software presented below works fine for the Force Trainer as well, but you’ll end up with less data since the EEG power values are disabled in the Force Trainer’s firmware from the factory.
Of course, the Mind Flex is supposed to be a black-box toy, not an officially supported development platform — so in order to access the actual sensor data for use in other contexts, we’ll need to make some hardware modifications and write some software to help things along. Here’s how.
But first, the inevitable caveat: Use extreme caution when working with any kind of voltage around your brain, particularly when wall power is involved. The risks are small, but to be on the safe side you should only plug the Arduino + Mind Flex combo into a laptop running on batteries alone. (My thanks to Viadd for pointing out this risk in the comments.) Also, performing the modifications outlined below means that you’ll void your warranty. If you make a mistake you could damage the unit beyond repair. The modifications aren’t easily reversible, and they may interfere with the toy’s original ball-levitating functionality.
However, I’ve confirmed that when the hack is executed properly, the toy will continue to function — and perhaps more interestingly, you can skim data from the NeuroSky chip without interfering with gameplay. In this way, we’ve confirmed that the status lights and ball-levitating fan in the Mind Flex are simply mapped to the “Attention” value coming out of the NeuroSky chip.
The Hardware
Here’s the basic layout of the Mind Flex hardware. Most of the action is in the headband, which holds the EEG hardware. A micro controller in the headband parses data from the EEG chip and sends updates wirelessly to a base station, where a fan levitates the ball and several LEDs illuminate to represent your current attention level.

This schematic immediately suggests several approaches to data extraction. The most common strategy we’ve seen is to use the LEDs on the base station to get a rough sense of the current attention level. This is nice and simple, but five levels of attention just doesn’t provide the granularity we were looking for.
A quick aside: Unlike the Mind Flex, the Force Trainer has some header pins (probably for programming / testing / debugging) which seem like an ideal place to grab some data. Others have reported success with this approach. We could never get it to work.
We decided to take a higher-level approach by grabbing serial data directly from the NeuroSky EEG chip and cutting the rest of the game hardware out of the loop, leaving a schematic that looks more like this:

The Hack
Parts list:
- 1 x Mind Flex
- 3 x AAA batteries for the headset
- 1 x Arduino (any variety), with USB cable
- 2 x 12” lengths of solid core hookup wire (around #22 or #24 gauge is best).
- A PC or Mac to monitor the serial data
Software list:
- Arduino Brain Library (download here)
- Optional: Processing Brain Visualizer (download here, it will help to have Processing as well)
- Optional (required for the visualizer): controlP5 Processing GUI Library (download here)
The video below walks through the whole process. Detailed instructions and additional commentary follow after the video.
Step-by-step:
1. Disassembly.
Grab a screwdriver and crack open the left pod of the Mind Flex headset. (The right pod holds the batteries.)
2. The T Pin.
The NeuroSky Board is the small daughterboard towards the bottom of the headset. If you look closely, you should see conveniently labeled T and R pins — these are the pins the EEG board uses to communicate serially to the microcontroller on the main board, and they’re the pins we’ll use to eavesdrop on the brain data. Solder a length of wire (carefully) to the “T” pin. Thin wire is fine, we used #24 gauge. Be careful not to short the neighboring pins.
3. Common ground.
Your Arduino will want to share ground with the Mind Flex circuit. Solder another length of wire to ground — any grounding point will do, but using the large solder pad where the battery’s ground connection arrives at the board makes the job easier. A note on power: We’ve found the Mind Flex to be inordinately sensitive to power… our initial hope was to power the NeuroSky board from the Arduino’s 3.3v supply, but this proved unreliable. For now we’re sticking with the factory configuration and powering the Arduino and Mind Flex independently.
4. Strain relief and wire routing.
We used a dab of hot glue to act as strain relief for the new wires, and drilled a hole in the case for the two wires to poke through after the case was closed. This step is optional.
5. Hook up the Arduino.
The wire from the Mind Flex’s “T” pin goes into the Arduino’s RX pin. The ground goes… to ground. You may wish to secure the Arduino to the side of the Mind Flex as a matter of convenience. (We used zip ties.)
That’s the extent of the hardware hack. Now on to the software. The data from the NeuroSky is not in a particularly friendly format. It’s a stream of raw bytes that will need to be parsed before they’ll make any sense. Fate is on our side: the packets coming from the Mind Flex match the structure from NeuroSky’s official Mindset documentation. (See the mindset_communications_protocol.pdf document in the Mindset developer kit if you’re interested.) You don’t need to worry about this, since I’ve written an Arduino library that makes the parsing process as painless as possible.
Essentially, the library takes the raw byte data from the NeuroSky chip, and turns it into a nice ASCII string of comma-separated values.
6. Load up the Arduino.
Download and install the Arduino Brain Library — it’s available here. Open the BrainSerialOut example and upload it to your board. (You may need to disconnect the RX pin during the upload.) The example code looks like this:
- #include <Brain.h>
- // 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.readCSV());
- }
- }
7. Test.
Turn on the Mind Flex, make sure the Arduino is plugged into your computer, and then open up the Serial Monitor. If all went well, you should see the following:
Here’s how the CSV breaks down: “signal strength, attention, meditation, delta, theta, low alpha, high alpha, low beta, high beta, low gamma, high gamma”
(More on what these values are supposed to mean later in the article. Also, note that if you are hacking a Force Trainer instead of a Mind Flex, you will only see the first three values — signal strength, attention, and meditation.)
If you put the unit on your head, you should see the “signal strength” value drop to 0 (confusingly, this means the connection is good), and the rest of the numbers start to fluctuate.
8. Visualize.
As exciting as the serial monitor is, you might think, “Surely there’s a more intuitive way to visualize this data!” You’re in luck: I’ve written a quick, open-source visualizer in Processing which graphs your brain activity over time (download). It’s designed to work with the BrainSerialOut Arduino code you’ve already loaded.
Download the code, and then open up the brain_grapher.pde file in Processing. With the Mind Flex plugged in via USB and powered on, go ahead and run the Processing sketch. (Just make sure the Arduino IDE’s serial monitor is closed, otherwise Processing won’t be able to read from the Mind Flex.) You may need to change the index of the serial list array in the brain_grapher.pde file, in case your Arduino is not the first serial object on your machine:
serial = new Serial(this, Serial.list()[0], 9600);
You should end up with a screen like this:
About the data
So what, exactly, do the numbers coming in from the NeuroSky chip mean?
The Mind Flex (but not the Froce Trainer) provide eight values representing the amount of electrical activity at different frequencies. This data is heavily filtered / amplified, so where a conventional medical-grade EEG would give you absolute voltage values for each band, NeuroSky instead gives you relative measurements which aren’t easily mapped to real-world units. A run down of the frequencies involved follows, along with a grossly oversimplified summary of the associated mental states.
- Delta (1-3Hz): sleep
- Theta (4-7Hz): relaxed, meditative
- Low Alpha (8-9Hz): eyes closed, relaxed
- High Alpha (10-12Hz)
- Low Beta (13-17Hz): alert, focused
- High Beta (18-30Hz)
- Low Gamma (31-40Hz): multi-sensory processing
- High Gamma (41-50Hz)
In addition to these power-band values, the NeuroSky chip provides a pair of proprietary, black-box data values dubbed “attention” and “mediation”. These are intended to provide an easily-grokked reduction of the brainwave data, and it’s what the Force Trainer and Mind Flex actually use to control the game state. We’re a bit skeptical of these values, since NeuroSky won’t disclose how they work, but a white paper they’ve released suggests that the values are at least statistically distinguishable from nonsense.
Here’s the company line on each value:
Attention:
Indicates the intensity of a user’s level of mental “focus” or “attention”, such as that which occurs during intense concentration and directed (but stable) mental activity. Distractions, wandering thoughts, lack of focus, or anxiety may lower the Attention meter levels.
Meditation:
Indicates the level of a user’s mental “calmness” or “relaxation”. Meditation is related to reduced activity by the active mental processes in the brain, and it has long been an observed effect that closing one’s eyes turns off the mental activities which process images from the eyes, so closing the eyes is often an effective method for increasing the Meditation meter level. Distractions, wandering thoughts, anxiety, agitation, and sensory stimuli may lower the Meditation meter levels.
At least that’s how it’s supposed to work. We’ve found that the degree of mental control over the signal varies from person to person. Ian Cleary, a peer of ours at ITP, used the Mind Flex in a recent project. He reports that about half of the people who tried the game were able to exercise control by consciously changing their mental state.
The most reasonable test of the device’s legitimacy would be a comparison with a medical-grade EEG. While we have not been able to test this ourselves, NeuroSky has published the results of such a comparison. Their findings suggest that the the NeuroSky chip delivers a comparable signal. Of course, NeuroSky has a significant stake in a positive outcome for this sort of test.
And there you have it. If you’d like to develop hardware or software around this data, I recommend reading the documentation that comes with the brain library for more information — or browse through the visualizer source to see how to work with the serial data. If you make something interesting using these techniques, I’d love to hear about it.














Viadd:
Neat. But,
I would be reticent to make electrical contact between my brain and something plugged into the wall socket. Options:
a) Use only a laptop on batteries for the computer (and hope that everybody who uses this knows to not to use it on a plugged in computer). b) Use the T line to drive an optical isolator instead of plugging it directly into the Arduino. c) See if the wireless link can be connected directly to the Neurosky chip instead of passing through the microcontroller, and you can wire in to the basestation. d) Live (or not) dangerously
But yeah.
Eric Mika:
Viadd, that's a very reasonable point.
Granted, you're probably in more danger crossing the street than plugging this into a 5V usb socket and risking a chain of catastrophic hardware failures, but it's absolutely worth taking the precautions you've suggested.
I'll add a note to the tutorial.
Also, using the wireless connection that's already sitting in the Mind Flex would be a great solution to this issue. However, I haven't explored this option since my original application for this hack involved a battery-powered Arduino (sans laptop) with no line-voltage power sources anywhere in the circuit.
Ian S:
Awesome! Do you think it would it be possible to tap into the base station instead? Then you wouldn't need the whole wire-hanging-off-my-head thing.
epokh:
Yes did some work with EEG singal processing. Always makw sure the sensors are opto-isolated from the power line. You can have a look at some schematics from here. As Ian said what about receiving from the wireless station? There's either an SPI or serial interface with the micro controller. The other solution will be to wire up an xbee on the headset in transparent mode and read the data. I don't have a mindflex so I canno try it. It will probably need a level shifter from the toy because it's 3.3 V, but still smaller than wiring an arduino,
Eric Mika:
Ian & Epokh: Unfortunately the data is parsed and (to my knowledge) much of it is discarded by a micro controller in the headset before it is sent over the air to the base station. If you want all the data, you need to to grab it before it reaches the micro controller or somehow circumvent this part of the circuit. (And just FYI I believe the headset uses SPI as you suggested.)
And yes, You could desolder the daughterboard from the rest of the Mind Flex circuitry and cobble together your own wireless system. (XBee would be easy enough.) I used this approach for another project I worked on where I needed several headsets to talk to each other and to a base station wirelessly. It worked fine.
The NeuroSky daughterboard receives just 3.3 volts from the main board, so that makes life even easier if you wanted to use an XBee.
I wanted the tutorial to show the simplest possible approach, but there are certainly many other possible configurations. I specifically designed the Arduino Brain library to work just fine with no connection to a laptop: Since the Arduino handles the parsing process, you have access to all of the same brain data and can do whatever you like with it, laptop or not.
PlastBox:
Awesome! If I wasn't completely strapped for cash I'd instantly order me up a MindFlex and a few cheapo servos from dealextreme.com
One idea I've had is simply using the arduino to send a simple on/off IR-signal (NEC-protocol, modulated at 38KHz) whenever EEG values reach threshold levels. F.ex. high focus sends "On", high meditation sends "Off". Combined with an IR-led with a fairly narrow angle of spread and simple receivers (ATtiny+38KHz IR-demodulator) would allow me to just stare at something and turn it on or off.
Got loads of other ideas too, but it all comes down to this: Do you find any significant improvement in your control of your brainwaves with practice? I have the OCZ NIA and because of it's very unpolished and unintuitive software (no analog control in games, only thresholds->keypresses), I can't really use it for anything.
PlastBox:
With regards to training.. Would one potentially learn to control the brainwave patterns better if one created a constant feedback loop? That is, after all, the way we learn to move our bodies and utilize our senses.
Something like mapping each of the 6 FFT'd values to a piezo or button vibrator placed on my skin?
(Sorry for posting twice)
epokh:
to erikmika: that's a wonderful regulated power!
Yes you are right the micro-controller filter the data for the game task.
I don't see any trouble in using an xbee series 1 or 2 at a 9600 bps, it would be harder it it was a multi channel eeg which is the things I'm working on.
I bet you cannot use the arduino 3.3 output power because the opamp on the headset drain more 50mA (believe me when you need to have a 1000x gain on a double stage amp you need far more than 50mA!)
I live in Uk but i will try to order one and see if I can patch it together with a zigbee.
For PlastBox:
without going into academic debates, yes it is being done using fMRI for patients with chronic pain. What they are trying to do is to show your brain activity on a screen and you can shape it using meditation (closed loop control).
Ehmm I have some doubt you can obtain decent an accurate closed loop control with this system because the EEG is by itself noisy, single channel, no impedance matching with your skin (you should shave and use medical grade gel) and I bet you will get a lot EM interference from your environment.
The trick is to have at least a reliability > 50% in trials otherwise is like playing roulette!
This is what I have experienced using medical grade/hobbyist EEG devices and I hope I can be proved wrong!
epokh:
Argh retail price in UK is more than £150, is too much for my pockets. I'll try to find a remailer in USA. I hate business!
Milarepa:
Guys, I love your project!
I'm a cog neuroscience grad student and have a good bit experience with the OpenEEG and can compare to the real stuff like research grade EEG, MEG & fMRI.
While I would rather like people to build up on the OpenEEG hardware, simply because it's the only thing around that's open and proven to work. I have compared it myself against commercial devices and looked especially at things that are critical if you want to get some meaningful results.
On the other hand I'm a fan of the arduino and also like to see all those mind toys popping up and it's cool that those are getting hacked. Thanks also for the library, this breaks down a very important barrier for people who want to educate themselves about this but don't have the know-how!
For PlastBox/Epokh
I have written my thesis on EEG BCI control and, while there are some working systems, the ones that work best rely on signals that are not learned but more or less automatic, like mu-rythms over motor areas that occur automatically during movement imagery or evoked/induced EEG patterns that occur automatically and differ depending on whether you present a target or a non-target letter. Learning control over the amplitude of frequency bands is not easy, not everybody seems to be able to do it and most of the stuff we know about the meaning of the relationship between frequency band power and cognitive function are rather inconclusive. Most evidence here is purely empiric.
I doubt that you can get a lot of an effect with this device. Too noisy due to insufficient shilding and bad contacts.... but I haven't tried it so, there's no knowing...
epokh:
Hi Milarepa, I will be interested in reading your thesis.
The learning task you are referring is used also in other projects for human-robot interaction. I know a Asimov research group in Germany playing with a YES/No task to provide the robot manipulator with human feedback. To be fair I find more accurate and practical emotional interfaces (i.e. tracking facial expressions) and in 20 years of EEG literature I didn't see anything really exciting. Here I'm referring purely on the application side not on the academic research. I remember a game company that claimed to control the player with only a brain interface, needless to say they never released that product, it was too much of a science gap!
Steven:
You might want to also state that you need controlP5 (http://www.sojamo.de/libraries/controlP5/) for the visualization to work. Great project. My mind flex unit is on the way. I'll let you know how it turns out. Thank you for the idea!
Eric Mika:
Steven: Thanks for reminding me, I just updated the text. I use controlP5 so often, I practically take its presence for granted.
Good luck with the project and let me know what you end up building.
Milarepa:
@epokh
Interesting, are you referring to the Tuebingen group?
I have to agree, for a researcher EEG BCI research keeps being interesting, not only because grant money is still flowing. I worked with one of the research groups that share the DARPA grant which aims towards the development of silent BCI communication & control reliable enough to be used in the field. We had an awesome time 'discovering' that this will not be feasible in the near future. (Think: 'playing customized Quake 3D & 128 channel EEG') To be fair, there is some potential in the reconstruction of imagined speech.
Applicationwise of course EEG BCIs are worlds apart from what we can do with real-time fMRI. (That's what our research group has been busy with in the last years.) Expensive and unpractical, yet awesome! We'll see soon what potential lies in fNIRS.
As for the better interfaces for games, I too see most potential in facial expression analysis in a combination with normal motor output (controller)...
While I never tested game control devices I don't expect much performance from them, since the effects they show can only stem from muscle artifacts from facial muscles and high amplitude alpha activity. This might be enough to sell a product, but is not enough to impress.
I'd be happy to send you my thesis, you can find me at http://gsr-monkey.blogspot.com/ It leads to an early little project of mine which is terribly outdated, but has my email address...
Tom:
I'm sorry, but can someone explain me this article? http://www.spiegel.de/spiegel/print/d-69174739.html
kresp0:
Thank you for sharing your work!
I'm planning to modify one of these to use during sleep and record brainwaves patterns. Why? To make a system that helps me to have lucid dreams using lights and/or sounds (reminds me that i'm dreaming) when I'm in the sleep stage #3 or when in the REM stage.
Toughts?
Carpa:
@Tom: The articel is about MindFlex and how MindFlex work. John-Dylan Haynes, one of the best brain researcher, worldwide, try get the secret behind the MindFlex. He came to the answer that MindFlex is just a toy. He say it works simular to what the psychologist http://de.wikipedia.org/wiki/Burrhus_Frederic_Skinner discovert in 1948. So what ever MindFlex do, its not real, maybe a random generator.
However nice work! Greets from Germany.
Milarepa:
@Eric
You could do a simple test for us to clarify this:
Get someone with a some robust baseline alpha activity (you will probably have that if I may guess). Let the person close her eyes and leave them closed for a few seconds until you see a difference and let her open her eyes again. You will expect systematic changes in the alpha band: Whenever eyes are opened, alpha power will decrease and stay lower then when the eyes are closed. Even though the greatest changes will be observable on the backside of the head, you will see this effect also on the site where the device is worn if the 'EEG machine' is working. If you want to go further, try visual imagination with closed eyes. I'd love to see some annotated screen-shots of eyes open/closed, some head movements, eye-blinks would be interesting, too!
@Tom/Capra
Props to JD Haynes: Talking to random 'SPIEGEL' journalists takes courage when you are in cognitive neuroscience and do consciousness related stuff. I just don't understand why the journalist bothers him with this, when they've got an excellent BCI group at the Charitè. He's a heavily cited imaging guy and works mainly multivariate analysis and fMRI. He has published some awesome stuff but I don't think he's that much into EEG...
His experiment (in the article he bridged the gap with a wet towel and with a paperclip, yet the ball moves regularly up and down) shows that there is probably still more marketing to the whole thing then real science but it's result does not unequivocally lead to the conclusion that the author of the article wants us to draw. (That the device is based on _nothing_but_ the users superstitious belief that he is in control of the ball.)
I also disagree that a BCI game had to be more expensive then the device at hand. Hey: it's an amplifier, ADC, microcontroller, RF link hooked up to a computer, what more do you need except some proper engineering and electrode gel. Qua software, I know of no EEG-BCI which would cook with anything but water. Now that the device is hacked, I'm thrilled to see what creative people will make of it.
Nick H:
The question of how much snake-oil this thing contains was brought up in another forum.
Someone posted this link with some papers done by the Neurosky devs:
http://developer.neurosky.com/forum/viewtopic.php?f=2&t=45
I am no neuroscientist, but after reading those papers, I don't see much cause for concern. Cheap? Perhaps. Fraudulent? Doubtful.
em:
@kresp0
That sounds like a very cool idea. I'm interested in lucid dreams too, and I've been trying to use binaural beats to induce them - without much luck. An EEG like this could be very helpful, by letting you track sleep stages. If you try something like that, let me know how it goes!
benj:
This is completely awesome! I've been planning to try something like this with my Mindflex and am happy to see others beat me to it!
Any thoughts on how one might go about taking the serial values and transforming them back into a single waveform? It probably wouldn't be very accurate compared to the raw waveform, so maybe it's a moot point.
Matt:
Great video Eric, what kind of camera and software did you use for the editing and screen capture? I've been working on a series of arduino videos for my students and really like your method.
Chip:
Re: REM sleep, lucid dream induction, etc.
I was a psych major at Stanford in the early days of sleep research, some forty years ago. I remember a lecture where someone (might have been Dr. Wm. Dement, but I'm not sure) spoke about how the eyeball has an electrical potential, and how they could detect side-to-side eye movements with electrodes at the outer corner of each eye and up-down movements with a pair of electrodes on the forehead and cheek above and below the pupil of one eye. As the eye moves, the sensors detect the changing EM field. (Google "electro oculography" for more info.)
I've got minimal hobbyist electronics skills (so I could be missing something obvious) but I've always wondered why hobbyists are putting so much time and effort into messing around with DIY EEGs to detect REM sleep when EOG seems cheaper, simpler, and more direct. I haven't been able to find any information about DIYers exploring this avenue, though. So I thought I throw this out and see if anyone catches it.
Hunter:
One of the reasons you said you didn't choose the Force Trainer was because it didn't give power band outputs. I recently finished a project using the Force Trainer and you can get 2 different values that are being read. Each of those has a range from roughly 0-100. There's more detail here (check out the first comment for a sample of the output)
http://hackaday.com/2009/10/21/mind-control-via-serial-port/#more-17587
What did you mean by EEG power output? Does the MindFlex give you a more accurate reading?
Eric Mika:
Hunter: I've confirmed that this hack (and the accompanying code) works just fine with the Force Trainer, which is based on the same chip from NeuroSky -- in fact, we used the Force Trainer for our Mental Block project.
I think I addressed the different data coming from each unit in the chart at the top of the article: Both the Mind Flex and the Force Trainer give the two Attention and Meditation values that you described. However, the Mind Flex gives you even more data, which is why I recommend it.
The additional data -- the EEG power band values -- are basically an FFT of the raw brain wave data, which shows you the relative activity at different wavelengths (I explained this at length in the article). So, the Mind Flex doesn't necessarily give you a more accurate reading, but it does give you more data to work with. And I'm not inclined to say "no" to more data.
Also, the Mind Flex is a better candidate for major changes to the hardware layout, since the leads from the electrode and baseline sensors are soldered directly to the NeuroSky daughterboard. You could conceivably desolder the NeuroSky board from the Mind Flex main board, and integrate it into your own hardware design. In comparison, the electrode leads in the force trainer are soldered to the main board, which means you would have more desoldering work to do if you wanted to remove the NeuroSky board.
For these reasons, I recommend the Mind Flex over the Force Trainer if you're buying one specifically to hack. But if you already have a Force Trainer lying around, it will certainly work too.
Ben Floyd:
I'm definitely not a neuroscientist - just a regular day to day web programmer hoping to find something cool to play with. My question is this - can these kind of hack devices be used (or programmed) to replace keyboards? I was following a link to the OCZ NIA and I think I'm going to order one of those to play with (as there are many users who have hacked stuff into it with an API), but they mainly relate it to a joystick rather than a keyboard. Any thoughts on this?
Steven:
So, I got my supplies in and wired this thing up.. ( my soldering skills are lacking ).. The program / library worked like a charm and the processing app did its thing wonderfully.
Few questions: Where should the headband be located to make sure I have a green light all the time? Can I buy your l33t soldering skills at the store? Is there a way to change the rate in which the Nerosky chip sends data?
Alvin:
Steven, I'm wondering the same thing about the headband placement. I haven't seen it read a 0 for the signal strength (indicating good reading)...
I don't think there's a way to change the rate of data being sent from the Neurosky, if there is I'd be interested in knowing. If you're getting too much data to work with, you can always read it less often (as opposed to having it send less often) or do some post-processing with the raw values to calculate averages and such.
I'm going to interface mine with some RF xmitter, thanks for the article & lib!!
Eric Mika:
Steven: Great to hear that it worked for you!
NeuroSky says the headband electrode should be located above your left eye. If you're having trouble getting a good signal, there are a few things you can try: Replace the AAA batteries. Try turning the headset on and off while it's on your head... and try to hold as still as possible during this process. Also, you can try cleaning the electrodes (I use isopropyl alcohol).
As for soldering, the trick I use is to bend the end if wire to be soldered into a loop. Then I tin it with a generous dab of solder so that the loop is filled. This means I don't need to apply any additional solder when attaching the wire to the pins on the NeuroSky board, which leaves both hands free to maneuver the wire and the iron.
And finally, there's no way to speed up the data output... you should expect about a packet per second. (Likely because the chip is doing a bunch of averaging and FFT work on the wave data it collects in that period.)
If you're interested in a faster data rate, you could try the official NeuroSky MindSet, which gives you access to the raw wave values, or look into Open EEG.
Michael:
I've got everything to work but the visulize part. I'm not familar with "Processing" so that could be the problem. I downloaded the app, and put "brain_grapher" folder in a variety of places and opened the brain_grapher.pde. The program loads, but now graph appears. Am I missing something simple?
Michael:
I figured it out. I just needed to change the serial.list from 0 to 1.
Sorry for the previous long post
Eric Mika:
Michael: Great, I'll make a note of this in the tutorial.
The warnings you were getting from ControlP5 are normal.
Jippie:
Hello Eric,
Thank you for this great contribution! I've been testing the SoftSerial library with an Arduino with a hard-wire connection to a BlueSMiRF Gold bluetooth dongle, remotely connected to a Mindset. When using the example code 'BrainSerialOut' the Arduino serial terminal, spits out, first a parsing error, but then a line of, what looks like, readable data, every second. Because of the error I don't know if this reliable data...I use the 57600 baud rate for the softserial, and serial connection.
all the best
Jippie
AbstraktBob:
There is a discount store in MPLS, Discount 70, that has the Force Trainer for $40. But now I want a Mind Flex.
Eric Mika:
Jippie:
If the data is parsing into a CSV without errors after the initial hiccup, then it should be reliable -- it's unlikely that the packets could parse at all if there were any dropped bytes (there's a checksum) so if you're getting the data it's probably good.
I haven't encountered this issue myself, so it's likely related to your wireless configuration. If you're particularly concerned you can send a screenshot from the Processing grapher and I can let you know if any of the numbers look ridiculous.
The baud rate shouldn't matter. (The Brain libray is hard-coded to read from the NeuroSky chip at 9600.)
AbstraktBob:
That's an amazing price for the Force Trainer. It's very interesting to me that despite using the same data in nearly the same way via the same technology, the Mindflex receives much more praise from consumers and the press than the Force Trainer does. (e.g. the Mindflex has an extra half star on Amazon, and received an award from Popular Science, etc.) Better marketing? Better timing? Better gameplay? Who knows.
Daniel Bas:
Hi All,
I just want to say this project is amazing first and I read it a few days after I got my arduino! I was wondering if instead of sending it to a computer over serial, I could just have it control other stuff connected to the arduino. I know it is possible because it is just reading values from the headset, and it's also being parsed on the headset. So how would I have it just send the values to a variable? In the beginning, the program has :
Brain brain(Serial);
(and later on...)
Serial.println(brain.readCSV())
---------------------------------
what would I put in place of serial for it to just send it to a variable? would I just have a string var, and then do "Brain brain (variable_name);" ? Do I need that line in the first place if it isn't interfacing with serial?
what I want to do is have, every time it updates, it makes an integer variable equal to the "attention" value being read from the headset. So I guess:
int concentration_value = byte readAttention();
Sorry if that was a long explanation for a probably simple and obvious task. Thanks,
Daniel
Eric Mika:
Daniel:
Yes -- the library is designed to let you skip the CSV and instead access the latest readings directly from your Arduino code. The CSV is just a convenience if you want to send the values to another program.
Check out the "BrainTest" example that's packaged with the brain library, it illustrates exactly this use case by blinking an LED on pin 13 faster or slower depending on your attention level.
(Not the most creative application... just wanted to keep it simple. It's safe to delete the Serial.println(brain.readCSV()); line from the example, it's only there for debugging.)
Take a look at the "Function Overview" section of the brain library's readme file as well, it describes all the functions in the library -- there's one to read each of the values coming out of the NeuroSky chip individually.
You still need to call Brain brain(Serial); at the start of the program to set up communication with the NeuroSky chip, even if you don't end up sending serial data out of the Arduino.
Your intended application is the main reason we bother parsing the packets on the Arduino itself instead of on a PC, so I'm happy to see this feature go to use.
Good luck and I'd love to hear what you end up building.
Jippie:
Hey Eric,
Thanx for the explanation. I switched from the softserial Library to the hardware serial library, and used a Arduino Mega instead. I still use the BlueSMiRF for the wireless connection. Spits out data very stable now. I already made an experimental installation with it and tested it on some visitors. Still needs some tuning but it works already:). http://besneeuwd.blogspot.com/
best Jippie
epokh:
DONE GUYS!!!!!!!!!!
Successfully connected to my Zigbee in AT mode transmitting to my host pc.
Without any intermediate arduino or additional batteries.
I will post the info on my blog.
Don't have a camera in my lab right now!
I discovered some nice things with the oscilloscopes.
Drilling some holes tomorrow to keep everything in da box!
Gghgh VICTORYYYY!
Eric Mika:
epokh: Sounds great -- are you grabbing bytes before or after the headset's microcontroller? Parsing on the computer? I look forward to the post!
epokh:
I just wrote it on my blog in a rush and a very poor phone camera.
I will fix it properly on the next days. I want to 1 try to disconnect the radio module to save power but this depends on the firmware of the microcontroller that maybe will stop sending data if the radio is not present and 2 glue the zigbee inside. For some reason i want to use the API mode and do my own interface but a quicky is just to put it in AT mode and use your library over serial.
http://www.epokh.org/blog/?p=298
silver84:
Hello All,
First many thanks for all these precious informations.
Before, I was ready to buy quickly some Neurosky tool like Mindset or hacking a toy like Mindflex.
But I read John-Dylan Haynes about mind flex and also I am very surprised that here nobody reports something about the test suggested by Milarepa.
Sure its difficult to see Alpha wave with your eyes closed ;) but camera exits or other people can control.
Are you afraid to discover, like Hayne, that its only a toy with a random engine ?.
(Sorry, my English is very bad)
epokh:
You are totally right, that's why I'm using the xbee module so that I can read the power bands. That's the first test I want to do, when I manage to put all inside the helmet without wires going out.
And yes I expect to see a lot of noise. In that case you can use it as a random noise generator.
:-)
Anonymous:
Thanks for writing up your findings -
I recently bought a cheap Force Trainer.
Has anyone performed this hack on a Force Trainer -
i.e: wiring the arduino directly to the headset?
On the force trainer Neurosky board I can see a
cluster of 6 pins, two are "+", "-" power, to the right are 4 pins
with the letter "R" above them - any clues as to which are receive & transmit?
Anonymous:
oops - re above post... I found the tx pin on the Force Trainer.
the pin labels are on the reverse of the board...
epokh:
Some more high res pictures:
http://www.epokh.org/blog/?p=310
as you can read I need to put it on the other side.
I was such a chicken to try to close it in that way!
Steven:
I found my mindflex on eBay for ~25.00 AS IS ( it was missing the foam balls ).. Look at discount/outlet/scratch&dent stores online. The headset was was still in the original packaging.
Hope this information helps.
Side note: the game itself has a few nice parts in it and you can always take away some LEDs
Arturo:
Eric? Eric? Boy you've been busy.
silver84:
Humm,... have you a dream ? never anyone who does some tests :(
No one tests by shutting /opening the eyes to control Alpha waves, no one using, like John-Dylan Haynes, a plastic head... what a shame !
Take a few minutes to look at this video (its not necessary to understand German language... Hayne is not a stupid man :( ) :
http://www.spiegel.de/video/video-1044310.html
LaurieF:
I'm an artist planning to use the eeg-toy hack in an art installation to make configurable art for the viewer based on brain scans. www.lauriefrick.com
I got as far as getting the Deumilanove Arduino board, and soldering the connector wires to the T and Ground on the mindflex headset. I was encouraged when I saw how different the mindflex operated for various people, meaning it's at least getting different output. But started to burn hours trying to configure things that are just a couple steps beyond my ability...but I was totally game to try to get it working...and now really want to use this.
I'll share all my data gathering and experience with you. I'm in New York next week (mostly live in Austin) -- could I get help to get the hack configured and chat a bit about connecting neuroscience and art??
Thanks a ton,
Laurie
epokh:
silver84,
yes I know that professor and I've been in the Max Plank BCCN institute sometimes. As I said I want to test the quality of the FFT and not of the concentration bar which is the one the toy is using. The neurosky chip is low noise bio amplifier, that is how it should be taken. Then of course the final application is not brilliant, consider also the environmental condition. A fair test should be to put the neurosky sdk or the hacked mindflex chip in a radio anechoic chamber and measure the SNR.
silver84:
Epok,
Yes, but the test can be very much simple, like with plastic head with wet towel from Haynes, here there is no electric isolation problem... (no need for linear optocoupler, wireless and so on) :-)
You are alone to answer, so I think people here, seam to prefer the dream to the reality and finally that its what Haynes says ;-)
So, I always dont know if the Mindset is also a dream machine as the Mindflex could be :-(
Eric Mika:
silver84:
I don't think Epokh is "alone to answer" -- I constructed the original post in a way that would offer answers, or at least starting-points for skeptics. I encourage you to read the white papers NeuroSky has published ( http://developer.neurosky.com/forum/viewtopic.php?f=2&t=45 ) which, if they are to be believed, demonstrate that the data is more than random noise.
ricky:
Hi, i tried to use this hack to control a robot for a university subject, but i couldn't get it work. I'm watching my brain waves but never receive any signal about Attention or Meditation. Later i look the serial data and those signals are always equals to zero. Anyone can help me?
I tried to replace the batteries, cleaning the sensors, adjusting the headset well as a i read in mindflex web page (with the logo above the left eye), and i don't know what more can i do.
Thanks
Eric Mika:
Ricky:
It sounds like you're not getting a good connection, what is the first value coming in over serial? If it's greater than 0, then you don't have a decent connection.
Did you check continuity of your ground lead?
silver84:
Hi Eric Mika:
As I said before, you have done a very good job here.
There is no aggression against anyone in my posts (perhaps my bad English might be not very well understood...)
I know and I have already read your 4 links, 2 of them are copyright ed by the seller of the system...
But its not about I (try to ;) )speak : I am disappointed to dont read here any test trying to prove Hayne is right or wrong.
Also I find nothing about the Haynes test in the Neurosky forums, like I dont find any reactions from Neurosky on the net about the Hayne test ?!?
You know, some days ago, few minutes before finding this link (here) I was going to buying the Mindset and now I am not sure its a good idea, its the right product.
Here in Europa, many months later, the Mindflex from Mattel is always not sell (why ?) its only possible to buy the Mindset on the Europa shop from Neurosky.
ricky:
I get it!! :-) I thought that my headset was broken because the signal level never was green and i can't receive Attention and Meditattion signal but I tried to put on my mothers head and after 2 minutes begin work. I thought about our diferences .. my head is quite bigger than my mum's so the headset don't fit well .. maybe my mother' skin has a better conductivity .. i tried using aloe vera gel on the three sensor (2 on ears and the third on the forehead) an .. began work!!
Thanks Eric Mica, you were in truth, was a connection problem (but i read your help late :-p )
Im going to use delta signal in combination with Arduino's IRremote library and two IR leds to make an ON/OFF switch to move forward or backward my robot using the Sony IR Protocol. Im going to have an excellent at this subject thanks to you ;-)
Leigh Honeywell:
I got this up and running this evening, but I keep seeing the following error in my serial logs:
[0] "ERROR: Packet too long
Have you (or any other readers) run into this, and what does it mean?
I still seem to get data out of the device, though no-one who tried it got much of a read out of sensors other than the Attention/Meditation readings.
I also ran into some obnoxious errors with 64-bit Ubuntu and processing; I ended up copying the system copies of the rxtx library into processingdir/libraries/serial/library.
LaurieF:
Getting a clear connection = move to a different 'clean' spot.
Have been having trouble getting a clean '0' connection, and no matter how much alcohol swabbing I did, couldn't maintain a green light on the brain-grapher. Read on one of the neurosky developer posts http://exceptionalpsychology.blogspot.com/2009/08/neurosky-eeg-for-masse... -- suggested to try moving to a cleaner signal spot in the room. And I instantly got a good, clear, clean signal. Good tip.
LaurieF:
Hey Eric, I have it working on Windows 7.
changed the 1 to 0 in this line of code.
serial = new Serial(this, Serial.list()[0], 9600);
laurie
Eric Mika:
Hi Laurie. Thanks -- different computers will have different serial port assignments. "0" is usually a reasonably safe bet on the Mac, but I'm not sure that's the case on Windows.
If you're not sure which one to use, you can add the line println(Serial.list()) to the Processing sketch to see a list of each port so you can select the right one.
Rustichan:
Ok, I have my Mindflex and have just ordered an Arduino board. I'm relatively inexperienced with electronics, but I have some friends and family who can teach me the soldering skills and such. OUt of curiosity, can this hack toy be used with the official Neurosky product's software and games...I noticed there were a number of free downloads on Neurosky's website.
Mic:
I've got the same thing as Michael described except that changing the serial.ist index (I tried 0 all the way to 10) makes no difference. I still get,
"The package "controlP5" does not exist. You might be missing a library
Note that release 1.0, libraries must be installed in a folder named 'libraries' inside the 'sketchbook' folder."
The brain_grapher folder is in the Processing/libraries folder. There is no 'sketchbook' folder that I can find. After creating one and running brain_grapher.pde from it I still get the same error.
Same problem on Mac and PC... I tried with Arduino running and closed, same still.
Is there a troubleshoot I have ignored along the way? Thanks
Mic:
d'oh! Don't you hate it when people jsut want to obey the instructions without thinking! Sorry about that. I looked back over the earlier paragraph telling me to install controlP5 and it now works when on my head! Worse noobs than me might need to know this. There were no traces showing until I put it on my head
Cheers, awesome work man!
Steve:
Excellent project Eric
I've dabbled with eeg over the years but when I saw this I had to try it because it looked so straight forward - and MindFlex became available in the UK a few weeks ago.
Got the hardware sorted without any problems but having trouble with the graphing. Get the csv data from the MindFlex when using the serial monitor but when I run the grapher I get the following error:
error: variable or field 'serialEvent' declared void In function 'void setup()':
In function 'void draw()':
At global scope:
Bad error line: -3
I've tried to change line
serial = new Serial(this, Serial.list()[0], 9600);
as suggested but having no luck
Any ideas
Hopefully
Steve
Steve:
As usual - posted too soon. I had been running via the Arduino control panel. I downloaded the Processing package from the software list above, added the graphing and IP5 folders to the library of Processing and ran the graphing from within Processing. No changes needed, it just works. Brilliant. Now to write an app to dump the csv data to file and collect data during dream sleep.
Rustichan:
I got it running!!! (with the help of my brother and sister's husband.) Awesome! Now, does anyone know Arduino programming to save the data to an output file? I imagine it's pretty simple, but simple is currently beyond my reach...
epokh:
Tadaa final clean up on hardware and software.
Enjoyyyyyyyyyy.
Thanx a lot to EricMika and Spiffomatic for the software.
Now I can go to sleep.
Ehhhhhp!
epokh:
Ops the link didn't show up again:
http://www.epokh.org/blog/?p=317
Skater:
Guys you've done some amazing work!! I was really looking at using two of these headsets and seeing if they produce similar results. With two mind flex units / headsets do you think the rf transmitter operates on the same frequency and would cause problems? If so is it possible to change the rf freqency of one unit? Also is there enough space to perhaps mount an xbee inside the headset with only minor modifications?
Sorry for so many questions! Thanks
Add Your Comment