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 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.

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 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:

(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.

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.

March 2013 Update:

Almost three years on, I think I need to close the comments since I don’t have the time (or hardware on hand) to keep up with support. Please post future issues on the GitHub page of the relevant project:

Most issues I’m seeing in the comments seem like the result of either soldering errors or compatibility-breaking changes to the Processing and Arduino APIs. I’ll try to stay ahead of these on GitHub and will be happy to accept pull requests to keep the code up to date and working.

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.

April 9 2010 at 12 AM

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.

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.

April 9 2010 at 2 AM

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,

April 9 2010 at 4 AM

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.

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.

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)

April 9 2010 at 5 AM

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!

April 9 2010 at 8 AM

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!

April 9 2010 at 9 AM

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...

April 9 2010 at 9 AM

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!

April 9 2010 at 3 PM

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!

April 10 2010 at 2 AM

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.

April 10 2010 at 4 AM

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...

April 10 2010 at 9 AM

Tom:

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?

April 10 2010 at 4 PM

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.

April 11 2010 at 6 AM

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.

April 11 2010 at 1 PM

Nick H:

The question of how much snake-oil this thing contains was brought up in another forum.

I am no neuroscientist, but after reading those papers, I don't see much cause for concern. Cheap? Perhaps. Fraudulent? Doubtful.

April 13 2010 at 4 PM

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!

April 13 2010 at 7 PM

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.

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.

April 13 2010 at 9 PM

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.

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?

April 14 2010 at 1 PM

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.

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?

April 14 2010 at 5 PM

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?

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!!

April 19 2010 at 10 PM

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.

April 19 2010 at 10 PM

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?

April 20 2010 at 2 PM

Michael:

I figured it out. I just needed to change the serial.list from 0 to 1.
Sorry for the previous long post

April 20 2010 at 4 PM

Eric Mika:

Michael: Great, I'll make a note of this in the tutorial.

The warnings you were getting from ControlP5 are normal.

April 21 2010 at 6 PM

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

April 26 2010 at 9 AM

AbstraktBob:

There is a discount store in MPLS, Discount 70, that has the Force Trainer for $40. But now I want a Mind Flex.

April 29 2010 at 9 PM

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.

May 5 2010 at 11 AM

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

May 5 2010 at 2 PM

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.

May 5 2010 at 2 PM

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

May 6 2010 at 5 AM

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!

May 7 2010 at 1 PM

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!

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.

silver84:

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)

May 9 2010 at 9 AM

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.
:-)

May 10 2010 at 2 AM

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?

May 10 2010 at 11 PM

Anonymous:

oops - re above post... I found the tx pin on the Force Trainer.
the pin labels are on the reverse of the board...

May 11 2010 at 1 AM

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!

May 11 2010 at 4 AM

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

May 11 2010 at 10 AM

Arturo:

Eric? Eric? Boy you've been busy.

May 12 2010 at 5 PM

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 :( ) :

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

May 13 2010 at 8 AM

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.

May 13 2010 at 11 AM

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 :-(

May 13 2010 at 5 PM

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.

May 13 2010 at 7 PM

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

May 14 2010 at 1 PM

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?

May 14 2010 at 5 PM

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.

May 14 2010 at 5 PM

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 ;-)

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.

changed the 1 to 0 in this line of code.
serial = new Serial(this, Serial.list()[0], 9600);

laurie

June 8 2010 at 10 AM

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.

June 13 2010 at 1 PM

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.

July 16 2010 at 2 AM

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

July 21 2010 at 2 PM

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

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:

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.

July 24 2010 at 5 PM

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...

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

August 17 2010 at 8 AM

bcook65:

Help...
made the hack to the mind flex headgear. loaded the brain_serial out to my arduino and it is sending data to the serial monitor. When I run processing and open and run the brain_grapher.pde I get the following error:

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.

Ive downloaded the controlp5 .. there is no controlp5 folder unless you go into specific folders and most of the folders have that folder or file named that.. I have copies of that everywhere i can find a library to put them.. Maybe I missed something but have watched the video and read the instructions numerous times and cannot seem to find what I am doing wrong. Any suggestions??

Bcook65

September 5 2010 at 2 AM

shaiel:

Huh! I've been diagnosed with Narcolepsy, which, for those only familiar with the Hollywood version, doesn't mean randomly falling asleep mid-conversation. Narcolepsy is characterized by episodes of what are called "micro-naps," where the sufferer will lose consciousness for a few milliseconds and then wake up several times over the course of the episode. During the episode, the sufferer cannot think straight. I find it's sorta like the confusion on the verge of going to sleep or just after waking up.

EEG analysis is generally not used to diagnose or investigate narcolepsy. Instead, other symptoms are checked (usually, the time delay from NREM to REM sleep, which in normal people is 90-110 minutes, and is 0-10 in a narcoleptic). During this time, the patient's EEG levels are monitored, but only the NREM -> REM data is used.

From what I can tell, in a hospital setting like that, I'd never have a narcoleptic episode. Certain things keep me alert, including human interaction, especially when around non-friends (and also other stuff like, say, standing up). I'm not sure if this is true for others with narcolepsy, but I'm really, really curious now what my EEG levels look like during an episode. This hack would give me the opportunity to examine my EEG levels while alone.

My hope is that I can rig a device to monitor my EEG levels constantly, and inform me when I'm about to have an episode, or heck, when I'm currently having an episode. Because my brain is in an altered state during it, I can't parse the thought "Oh, I'm having an episode; I should go lie down." I don't realize until it ends what just happened. I've learned to watch for signs that one is coming, but doing that is really exhausting.

If this is possible with the brain hack, if the values are good enough and if the changes are distinctive enough (I know that's a lot of ifs...) maybe I can rig something that'll vastly improve my quality of life. I still drive, but I take significant precautions when doing so and only go short distances (30 mins or less) to minimize the risk. Between those and my meds, I'm as safe behind the wheel as any other MA driver, but I still fear having an episode. This could eliminate that fear, and possibly save my life if I do have an episode that I failed to notice was coming.

I'm not getting my hopes up, but thank you for providing the opportunity to try :)

September 10 2010 at 2 PM

Troy:

Thanks for a great project. I put it together tonight and it works great.

Peter:

For those who want to save data to file, follow the link below to some instructions. Bit of a hack but it works with no programming mods or skills needed.http://www.49days.co.uk/FileSave.html

September 19 2010 at 2 PM

Peter:

can you send me an example of the data you graph using putty steve

September 22 2010 at 9 PM

Josh:

Awesome project, I was wondering your thoughts on the difficulty for someone with no experience with circuitry/soldering to re-create the project as this would be a first for me. From the video guide it looks like a pretty straight forward procedure, but are there any tips or precautions that I should be aware of before I attempt it?
Any response asap would be greatly appreciated!

September 29 2010 at 11 AM

Josh:

Awesome project, I was wondering your thoughts on the difficulty for someone with no experience with circuitry/soldering to re-create the project as this would be a first for me. From the video guide it looks like a pretty straight forward procedure, but are there any tips or precautions that I should be aware of before I attempt it?
Any response asap would be greatly appreciated!

September 29 2010 at 11 AM

daniel:

For people interesting on lucid dreams :
Here you can see a diy for creating a lucid dream mask which detects when you are on REM :http://brindefalk.solarbotics.net/kvasar/kvasar.html

Now about mindflex,are you tried use your modded mindflex with Mindset's demos/games on pc?
it would be great could use this device as a mindset and/or PLX XWave (the new device which would conect to iphone/ipod touch streaming the data throught audio jack.

After reading this blog and the devices website it seem they work same way and the most important :they use the same kind of data.
thanks for your hack
dani

October 1 2010 at 6 PM

Johannes:

hi,
first of all: super cool project! thumbs up!

aaand finally, I got it running. had some minor problems on the way ...

BUT I don't get any 'attention' or 'meditation' visualization, nothing happens in the first two channles.
an example of what's going on in the console:

the rest seems ok. looks like the example above.
I'm new with processing, so could somebody tell me what that means?

shouts from germany! and thanks in advance if there's someone who can help

JO

October 2 2010 at 8 AM

Johannes:

ok ... must have missed the question by ricky above. read all the comments again and finally got my first two channels working. saltwater on my ears an forehead ... as easy as this. damn.

the error still occurs, though.
and no matter how hard i try ... attention is almost all the time below meditation ... hope that's no bad news concerning my brain status lol

October 2 2010 at 11 AM

Josh:

I've done the hardware hack and I'm at the point were I've connected the ardunio and mind flex but when I open the serial monitor it remains blank. I believe I loaded the brain library correctly but i did notice this extra bit of code in my script "Serial.println(brain.readErrors());" other than that its exactly the same as in the procedure. any suggestions on what im doing wrong?

October 5 2010 at 11 PM

Jay u:

Josh, check your baud rate. I was having the same issue but I got it worked when I change the rate to 9600 or 14400.

October 27 2010 at 11 AM

Jay u:

My problem is have Processing running but I have nothing happen on graph and got following WARNING:

Eric Mika:

Jay: Those warnings are normal, it just has to do with the way the code instantiates the GUI elements. If you're not seeing anything in the grapher, check the Arduino serial monitor and make sure you're getting data from the MindFlex.

October 27 2010 at 12 PM

Jay u:

Same as above few people. Post too quick!! I was misunderstanding the order of serial port. My arduino is in COM9, I keep trying:
serial = new Serial(this, Serial.list()[8], 9600); and
serial = new Serial(this, Serial.list()[9], 9600);
Neither of them works.
I figured if I have serial: COM1, COM2, COM3, COM9, COM11. I have Arduino connected @COM9, I should use:
serial = new Serial(this, Serial.list()[4], 9600);

if you have COM1, COM2, COM4...so on and you have arduino @ COM4. You should use
serial = new Serial(this, Serial.list()[3], 9600);
not
serial = new Serial(this, Serial.list()[4], 9600);

Anyway~ Great works Eric Mika and thanks for all who post any helpful info here!

October 27 2010 at 5 PM

Jay u:

LOL~ Didn't see you already replied. I have this window opened since this noon. Thanks for reply anyway! It all works great!

However, I was test on my desktop not laptop with battery. Does that really matter or serious issue? The only thing hurts me is the zip tie and headband was too tight because I got a big head. haha...

(They are not going to cause brain dead, are they?)

October 27 2010 at 5 PM

vsurducan:

Hi Eric,

As I saw the neurosky chip can be interfaced directly to the RS232 PC without using any microcontroller, however an optoisolated level converter is must.
What software do I need to compile the open source visualiser, without using Arduino?
Thank you,
Vasile

This is a fantastic hack, Argos are selling these Mindflex things in the UK for 59 quid at the moment (Dec 26th 2010), so I purchased this and got it working in half an hour or so , this is really useful for a project I am doing on memory - my aim is to use the data generated via your excellant Processing App to train neural nets so they can categorise my responses while hooked up....thanks very much - a clear and perfectly working hack!

December 26 2010 at 4 PM

Skater:

I've been playing around with this Mindflex hack and unfortunately I've only sometimes been able to maintain a consistent good connection. I've tried putting bigger wiring on the ground, using salt water on my electrodes and my ears and forehead and turning off other RF devices to remove radio interference (heres hoping). I can get the green light and the attention meditation values only after a couple of minutes and only for short bursts. Is there something else I can do?

January 3 2011 at 2 AM

Alex:

It seems many people are having issues with connectivity. Without a good connection you cannot get correct meditation/attention readings. Rarely, can i get my connection value below 25. What advice can you offer to ensure a good '0' reading for connection? Did you have any issues with this?

January 3 2011 at 8 PM

Mark:

This project has opened my eyes to a whole new world of interfacing.I am a bit confused about one thing though and would welcome any insight...

Whenever my skin/sweat/dead-skin/whatever results in a bad connection, all I have to do is touch the Arduino board ground (any ground [i.e. a wire to ground], but over an area [like wire coiled in a spiral/wrapped around a finger/etc, or the housing for the USB jack]).

So why no band on the MindFlex product? does being wireless (and a floating potential, i.e. no ground connected to earth ground) really fix the issue?

Has anyone on this form (I'm looking to you epokh, *wink*), with a wireless (i.e. xbee or whatever) implementation, had the issue of poor signal quality value?

I was thinking to implement an opto-isolator, but don't know a good module. I was also thinking of how much of a load led + resistor would put on the tx line (on the nerosky card), maybe a dirty quick solution would work. I don't have a scope (the other arduino I bought a few days ago [to turn into a scope] is back-ordered / still-in-transit, LOL) so I can't analyze the floating ground relative to earth (but I suspect the hum is to blame).

Insight?
Thanks!

January 6 2011 at 10 PM

Sk8ersquare:

I'm going to try and get an opto isolator tomorrow and see if I can get better results as this does seem to be some kind of issue introduced by the hack - as ive noticed once the wires are connected into the board suddenly the headset is unable to calibrate with the main base station. Signs it is unable to establish that '0' quality connection. I'm wondering if the led load of the isolator will continue to show this issue though - I will let you all know the results.

January 9 2011 at 7 AM

George:

i saw someone complain about the price...

Neurosky gives a big university discount in usa and eu, just email sales if you're a student or teacher

January 12 2011 at 7 PM

Mark:

Sk8ersquare: Earlier ppl said that the daughter card was really sensitive to drops in it's source.. the led will likely draw current from a fet-based (i.e. CMOS) tx (because it's a tx likely->high output impedance), and could pull down the VDD a bit causing the card to act wrong (PURE GUESS)... But if i'm right, then maybe a fet hooked up strait to the batteries (i.e. right to the batteries, not after any regulator) could be used to power the optoisolator... i.e. the tx just powers the gate, with likely a common source config? maybe drain, it's been ages since i last worked on transistor models.. hahah first yr circuits..

Best of luck! my parts are in the mail, so i'm still stuck waiting... hahah.. but I made BrainPong in processing and it's hilarious.. if anyone wants it, just let me know.. It's nothing special, just uses the serial data to control the speed of the up-down scroll of your bar.. that's it, NO score/ai/2player/etc.. but the name made me laugh.. BrainPong ahahah..

January 13 2011 at 7 PM

Jade's Mom:

We bought my daughter MindFlex for Christmas, and would love to somehow turn this into a science experiment for the science fair. I read through this forum and while I think what you are doing is brilliant, it is far beyond this simple Mom. Can anyone give ideas how how to use MindFlex to measure "thoughts" and neatly wrap it up into a 10 years old 5th grade science fair experiment? Thanks so much!!!

January 15 2011 at 5 PM

qsue47:

every time i try to upload it to the board i get an error message saying brain does not name a type .. what am i doing wrong?

January 18 2011 at 5 PM

Eric Mika:

Hi everyone, thank you for your comments. I apologize for the delayed response.

@Rustichan: Saving to a log on the Arduino itself is kind of a pain, but perfectly doable with some extra hardware to interface with flash memory. This microSD Shield looks like a good start. Unless everything has to be on the Arduino, it’s going to be much easier to just use Processing to save the values to a text file. Processing makes this trivial thanks to the saveStrings function (if you want to write a log in one shot) or createWriter (if you want to keep appending data to the same log file).

@Skater: I don’t think there are interference issues, and if there are we don’t care because we’re not using the Mind Flex’s radios anyway. Wireless is definitely possible. I’ve used a pair of Mind Flex headsets transmitting wirelessly over XBee radios without any problems. Unfortunately, though, there’s not enough room in the headset to squeeze an XBee, so you’ll need to mount it on the outside. I’m sitting on some code that lets you go straight from an XBee on the headset to an XBee connected to a PC, effectively cutting the Arduino out of the picture for applications where it’s not needed… still need to clean it up and write a post. If anyone needs it now, just send me an email.

@bcook65: I don’t completely understand what you mean about there being no controlP5 folder. There’s good documentation about installing libraries on the Processing Wiki.

@Josh: The project is relatively simple, although the soldering is a bit tricky simply because there’s not much space next to the pins and you don’t want to short them. But I’d say go for it. If you don’t have an Arduino already, you could get up to speed on soldering technique and basic electronics by building one from a kit.

@daniel: Thanks, I haven’t tried any of the Mindset’s demo games. I kind of doubt they would work since I’m using my own packet format (the CSV) and Neurosky’s software is probably expecting a Bluetooth connection. (Could be ways around this…) Frankly I’m not interested enough in any of their games to bother, but let me know if you have any luck.

@Johannes: I’ve seen the “packet too long” come up now and then. I think it’s harmless since any bad packets are just discarded. The message is actually coming from the parser running on the Arduino, not from within Processing.

@Josh: Can you get any serial data at all from the Arduino? Do you have the right port selected? If basic serial troubleshooting fails, then I would check the hardware for shorts or other problems.

@vsurducan: I ported the Arduino code to Java so the brain data can be parsed straight through Processing via USB (through an RS232 converter, of course). I’ll post the code eventually, or email me if you want it now.

@Mark: Interesting, I hadn’t noticed the grounding thing before. You should already be grounded relative to the Arduino circuit thanks to the two ear clips, but maybe extra grounding will help. Regarding opto-isolator, SparkFun sells a nice module, although I haven’t tried it myself. I think it might be easier to just go wireless.

@Sk8ersquare: You might check the hardware / batteries. I’ve had no trouble simultaneously connecting to the Mind Flex base station and reading the packets through the Arduino. (That’s how I found out that the LEDs on the base station are simply mapped to the attention value.)

@Jade’s Mom: Great! If you’re not up for the soldering + arduino + code approach of the full hack, I imagine you could shape a basic science fare project around observing and writing down the number of green lights illuminated on the Mind Flex base station during different activities.

@qsue47: That means the Arduino development environment can’t find the library. Make sure you installed the library correctly and that you have the #include <Brain.h> line at the top of your Arduino sketch.

January 22 2011 at 12 AM

Shay:

I picked up the MindFlex yesterday at Walmart on clearance for $49. Don't spend $80 if you don't have to.

So cool! Thank you for the best how-to hack vid ever. I built the eeg using the Mindflex and it is reading great, but I am having trouble with your visualizer software. When I run the program it says that "ControlP5 does not exist, you might be missing a library". Do you know what needs to be done? I'm really excited to see this info with a visual. I am pretty new to "Processing", so forgive me if it something basic. Any help would be Awesome. Thanks

Eric Mika:

Noega33:

Hi,
Gret job. I got my Mindflex last Weekend and I'm expecting my BTM-182 bluetooth module anytime soon
A) As anyone already connected the Mindflex to a PC (using the Processing Grapher) using the BTM-182 ?
B) As a small contribution to the community, please find this link that provides the TGAM1 module specificationhttp://wearcam.org/ece516/neurosky_eeg_brainwave_chip_and_board_tgam1.pdf

it explains how to select output data and also how to adjust notch filter to adapt to 50Hz or 60Hz environment (usefull if you bought the mindflex in the US and use it in Europe (as I'm))

February 3 2011 at 3 PM

Dan:

Great hack, been faffing about for hours now, not getting any data through. I haven't seen the Bluetooth Arduino boards mentioned so maybe this is my problem? I can upload to arduino fine, but serial monitor shows nothing. I am using BT w/ ATmega 328 so testing with usb is not an option.

If anyone has any ideas they would be much appreciated.

Thanks

February 6 2011 at 9 AM

Noega33:

Hi,
I Connected a BTM-182 (using the board described here:http://atomsoft.wordpress.com)
I was able to check the BT connection using Visual Basic 6, but I cannot make it work with Brain_Grapher (processing).
Get somthing similar to what Jay u reported:

Is there any reason why you couldn't install (glue exteriorly or whatever) an RJ11 phone jack on the mindflex and clip that in to the arduino from about six feet with a similar jack? I mean we're transmitting numeric data - not analog values, so technically, it doesn't even need to be shielded, does it? It seems awkward to have a whole unprotected arduino strapped to one side of your head.

Also:
Does the Processing graphing .pde include real-time information?
Which leads of course to the next idea:
Also - is there an easy method to convert the saved data to .edf format?http://www.teuniz.net/edfbrowser/
This might be useful for non-professionals who have the ResMed S9 Autoset CPAP machine so they can compare there existing .edf sleep data with relevant concurrent brain state data.

Eric,
I've executed your mindflex hack, and i'm getting set up for the first time with the arduino uno, and i've got a compilation error on your Brain library.

Arduino is recognized by the system and can run example apps such as Blink.

I load up your BrainSerialOut, and if i compile it i get:
"BrainSerialOut.cpp:5:19: error: Brain.h: No such file or directory"
followed by BrainSerialOut:7: error: 'Brain' does not name a type which is just because of the error above...

I have the arduino core source built and copied to: ~/Documents/Arduino/
(contains /app, /build, /core etc...), and here is where i have copied /Brain and am running the app from.

just out of curiosity, i ran
$ gcc Brain.h

which returns:
Brain.h:7:22: error: WProgram.h: No such file or directory

I do have that header file though, in the arduino source, It just seems like the compilers arent knowing to look in the right folder.

I feel like there is just a small dependency or directory structure issue that I am overlooking being brand new to this platform. I really really appreciate this article and work you've done.

Can you give me any hints at getting past this?

PS I am making a musical synthesizer in flash, for use in my various music projects. you will click with a mouse to choose various parameters... pitch, resonance, cutoff, etc.., and the mindflex will supply the modulation values for whatever your current param is, modifying some base sine/triangle/square tone.

YESSS thank you! we have data! data looks pretty good, too. I knew it was just a dumb directory issue. I'll keep you updated upon completion of my synthesizer! you are getting credit in the application.

February 26 2011 at 6 PM

Eric Mika:

@Dan and Noega33: Those errors are not important. You can ignore them. I’ve tested the system wirelessly with XBees and it works fine, never tried Bluetooth. I don’t see any reason why it shouldn’t work. What are you seeing in a serial monitor through the Bluetooth connection? If you’re getting data there, I would suspect it’s a matter of selecting the correct serial port in Processing (see Serial.list()). If you’re not getting data in a serial monitor, then I’d suspect the hardware configuration.

@Chris: Sure, it’s a digital signal, the Arduino could be anywhere. Probably even better from the MindFlex’s perspective if it’s not mounted on the headset.

I’m not sure about your definition of real time data. The Mind Flex sends a bundle of data every second reflecting measurements taken over the last second. It does not send any real-time wave data. But if you consider data up to one second old as “real time”, then you are getting real-time data of one kind of another front it.

I’m not familiar with edf format, but it looks like multi-channel raw wave data, which isn’t something you can get from the Mind Flex. (But I could just be misreading the format.)

noega33:

Erik,
Thank's for the answer.
But after many hours of different tests, I droped the Processing program and I rolled my own Visual Basic 6 program.
It works perfectly
I can visualise all basic data (Signal, Meditation, attention, EEG band power, etc, etc) using an .OCX called Graphlite that I modified.
I also modified the TGAM1 board in the Mindflex to get the raw data (512 values).
The issue I have is that, when I apply a FFT to the signal, I don't get any close to the EEG power bands as computed by the module.
As anyone already tried to match the computed module values with you own FFT computation?
My configuration is:
Mindflex Headset (I modified the TGAM1 BR1 strap to get raw data, using http://wearcam.org/ece516/neurosky_eeg_brainwave_chip_and_board_tgam1.pdf

Marleen:

I've got my mindflex and I am testing it with my arduino, it works great!
I only have a small problem, I still receive values when I am not wearing the mindflex, do you know what can cause this?

Thank you very much in advance!

Marleen.

March 14 2011 at 4 PM

Marleen:

Dear Eric,

I've got my mindflex and I am testing it with my arduino, it works great!
I only have a small problem, I still receive values when I am not wearing the mindflex, do you know what can cause this?

Thank you very much in advance!

Marleen.

March 14 2011 at 4 PM

kaps:

hi eric

thanks for the brilliant hack.

I soldered the t pin and the gnd pin as given in your post. Then i tried it using it with console. It worked fine for one or 2 times then it stopped working and now the arduino code is also not working with arduino.

And now the console is saying "switch on the headset" even if the headset is on. Can you suggest any way to check that if the headsets are fine or not.

I read the Neurosky overview document. Inspecting the waveform comparisons, it clearly involves a high-pass filter that heavily cuts off the low frequencies. This prevents the signal from drifting beyond the limits of the ADC. This is OK. The authors of the overview document attribute the extra cointents in low frequency in the comparison system to long leads, praising their own system avoiding this hurdle. They are clearly wrong. Their device clearly heavily filters out the low frequencies, which returns the signal quickly toward zero whenever it tends to drift. With eye blinks, the Neurosky system thus does not reach as high peaks and when the eye lid leaves the cornea and the signal returns toward zero, the Neurosky follows the downward change which, along with the accumulated compensating shift toward zero, results in a negative overshoot. All this is quite acceptable for EEG neurofeedback. A least one professional system does this.
The reason I wanted to describe this, is to document that the system is not pure imagination or dream, as Silver84 is inclined to believed. Eye blinks behave just as expected. The John-Dylan Haynes "demonstration" is not faulty. It conclusion is. Yes, these systems can collect noise, so the game can reflect noise. But with good contact, not just at the forehead but also at each ear, its signal will essentially be real biological signals, including artefacts from eye blinks or eye movements and from muscles (e.g., frowning). Avoiding these should leave the signal as mostlt from brain origin, i.e. bona fide EEG.

March 25 2011 at 1 PM

plumberpenguin:

noega33 mentioned the BR1 strap for raw waves which I would assume would be what the MindSet does, anyone been able to get this working, and would it provide a faster response time? One second is kind of impractical for musical purposes among other things

March 25 2011 at 5 PM

Dan Paspisil:

I have been learning a lot about EEG in school lately. I did the hack and got the values and it doesn't seem to be reading anything of significance. Alpha should consistently go up dramatically when the eyes are closed, it doesn't. I have used other single electrode systems that have easily picked this up. To boost signal I used alcohol wipes, EEG abrasive cream, and then EEG conductive paste, these all made no difference. I am not sure if I am doing something wrong. The only thing of significance I could get is that the meditation value stayed much higher when I changed the electrodes position to the back of my skull (where alpha waves would be much stronger) but Alpha values themselves did not seem to consistently change with open and closed eyes. Does anyone know of any tips or tricks to get real values out it?

March 27 2011 at 3 PM

McEEG:

I've Identified the RF modules that the MindFlex uses. They're both RF24DT-10DSUJ modules made by ELAN Microelectronics. It uses their EM198810 transceiver chip.

Google for datasheets; there appears to be one for the module, and one for the transceiver chip, but you'll also likely need the 3 application notes for the transceiver.

At this point I've no idea if the MindFlex transmits all the data seen on the EEG module of not.

Cheers.

March 28 2011 at 10 PM

puiutz777:

Hey, i'm very interested about EEG, and this toy,too. Can you tell me where i find the document Neurosky overview?Do you know what are the exactly values of the signals for the 5th levels on the console?Do you know the algoritm they use to filter the signals or the algoritm which they calculates the value of the power for the motor?

April 1 2011 at 3 AM

puiutz777:

How about controling the console with your PC?Have you tried to connect some how the PC with the console?It will be very interesting to controle the ball with your PC.How can you connect the wireless receiver on the console with PC wireless transmitter?
PS: sorry for posting twice...

the hardware part is configured, but when the first number in the character set is suppose to drop to " 0 ", it continues on to 200 without any change. it seems wearing it or not doesnt show any difference in number variations.

i tried to run the processing sketch, and when i turn off then on the mindflex itself, the data is visualized for 5 seconds, then drops right out.

im not sure how to fix this signal issue. thanks ahead

April 2 2011 at 3 PM

hirotami:

thank you very much for these detailed instructions! i'm very new to arduino and am trying to scale this up for a project. our goal is to use the mindflex (actually 2 mindflexes) to make a multiplayer game in which we proportionally drive computer fans with speed controllers with a ping pong ball in the middle for an inverse-tug-of-war-esque game. i was wondering if anyone could give me suggestions on running two headbands into the same arduino and converting the string of data into an output for the speed controller, and whether or not this would require a shield.

thank you so much for your time!

April 2 2011 at 5 PM

Noega33:

In response to plumberpenguin post:

When you read raw wave values, you get 512 readings that represents 1 second of recording;
If you add processing time and tranfer time (about one more second), you get one complete set of data every 2 seconds
Bottom line, getting raw waves slows down the cycle from one set of data every second to one set of data every two seconds seconds. So it is not faster

hardboiledeeg:

Hey all,

I'm a PhD student working with EEG with a casual interest in hardware hacking/EEE etc. I've had one eye on the commercial EEG hacking scene for a while, and so far it seems that it would be really useful to have a source for (reasonably) expert information on the biophysical basis of the signals these types of devices are tapping. I'm planning to start a blog which aims to give a decent description of the origin of EEG signals and the problems inherent in recording them, aimed at everyone with an interest in the area, but lacking enough knowledge to break through the jargon barrier which is such a problem in the cognitive neuroscience literature.

I've only had enough time to read through a small proportion of the replies here (will go through the rest as time allows), but I'd be really interested to hear from anyone who has questions about any technical issues (if nothing else, just to gauge interest/find out what people want to know). I'd also love to hear from Milareepa and epokh if you guys are interested in contributing, as you guys seem to span the academic/hacker divide.

Such a gratThe EEG’s aren’t really a fun process at all, but they do help in diagnostics! Feel free to email me anytime you want if you ever want to chat.. kind of cool.. I just clicked on a random link and find someone in Maine! , I’ve never had the pleasure of having my head bandaged like a brain surgery patient, while recording my every muscle twitch before. EEG, first developed for testing epilepsy, is most certainly not a quick method and most likely not an effective way to understand emotion in users. Firstly, the practitioner needs to understand the science behind the tool. It can be a very in-depth discipline, so it is crucial that any study is implemented by a professional researcher who is an expert in cognitive neuroscience as well as psychology. EEG is not a technique that will give the clear black and white results that the industry wants. In the analysis of data, the research must make a lot of deductions when interpreting the results. It is not a test that gives conclusive results on its own, but it can offer useful indicators of emotion, the key being the mapping of the results to particular emotions. this is very helpful information. I appreciate your work. Thanks for sharing..

Biiig thanks, this is really funny. At least it saved my Mindflex from the dust-death :)

April 29 2011 at 12 PM

puiutz777:

Dear BCI2000 Users,

please excuse me for posting off topic.

Prof. Kübler at Würzburg University (Germany) is offering a PhD or postdoc postion. Please find the full offer below.

Regards,
Ruben Real

__________________________________________________________________________
We are seeking a PhD-student or post-doctoral researcher interested in the development and evaluation of EEG based paradigms for the detection of consciousness in non-responsive patients.

This is an excellent opportunity to work within an international environment and to foster one?s interest in research on EEG, brain computer interfaces (BCI), and cognitive functions. The group is tightly integrated with several international research programs (e.g. Tools for Brain Computer Interfaces, www.tobi-project.org, DECODER, www.decoderproject.eu).

The appointee will have a master?s equivalent or a postgraduate degree (PhD) in Psychology, Neuroscience, Biology or a related scientific subject. Applicants from other backgrounds are also welcome and should provide documented expertise in one of these areas. Above all, a strong interest in multidisciplinary research and a willingness to travel to other labs is required. The position leaves room for developing and pursuing own ideas and paradigms.

The post can be either part- or full-time and is available as of now for a minimum duration of 2 years (extension highly probable). Salary corresponds to TVL-13.

The University of Würzburg aims to increase the number of women in science and thus, strongly encourages qualified female scientists to apply. Applicants with disabilities will be favoured in case of equal qualification.

Details
Successful applicants will develop and evaluate EEG-based paradigms for the detection of consciousness in non-responsive patients. Paradigms have to be sensitive for different cognitive tasks and depth of information processing, ranging from simple signal detection to higher cognitive processes from which the degree of consciousness can be delineated. Paradigms must be independent of motor control and be highly sensitive. The applicant will collect data with healthy subjects and patients in rehabilitation centres around Würzburg. Research results will be disseminated in the form of conference presentations and scientific publications.

Selection Criteria
The appointee will have a master?s equivalent or a postgraduate degree (PhD) in Psychology, Neuroscience, Biology or a related scientific subject. Applicants from other backgrounds are also welcome and should provide documented expertise in one of these areas. Above all, a strong interest in multidisciplinary research is required.

The successful applicant will fulfil the following criteria

Essential skills include the ability
* to collect EEG data. Postdoctoral applicants must be able to analyze and interpret EEG data (including event-related potentials).
* to manage, manipulate and analyze datasets including behavioural data
* to conduct multivariate statistical analyses
* to search and review scientific information on EEG, consciousness and cognitive functions
* to work in a multidisciplinary team
* to work independently

The applicant should be willing to work with patients with severe disorders of consciousness, their families and caregivers.

Attributes
The applicant
* is interested in EEG, cognitive functions and disorders of consciousness
* shows an enthusiasm and conscientiousness for the work
* is willing to travel to project partners across Europe
* is able to organize own work
* is able to work in a team
_______________________________________________________________________________

garrett:

Just wanted to say thanks for the excellent Tutorial and accompanying code. Just got the hack working here and it only took like 30 minutes! Couldn't have done it without your breakdown as I am not an electrical engineer, just a tinkerer. Thanks again and will definitely credit your work in anything I end up using the headset for.

May 16 2011 at 3 PM

Skater:

Thanks for all this great work guys! I had a question about the notch filter. I've read through the TGAM-1 spec sheet but it was not very clear.
h__p://wearcam.org/ece516/neurosky_eeg_brainwave_chip_and_board_tgam1.pdf

Can I change it easily by just a solder join or do I need to move that resistor?

Thankyou

May 26 2011 at 9 PM

noega33:

Hi Skater,
Your straps configuration is the same as the one in the TGAM1 spec document.
You are configure to operate in a 60Hz environment, if you need to reconfigure to 50Hz environment you will have to move the M strap to the other side (as I did it). In other words, after you are done, all 5 straps will be configuerd similarly (all on the same side)
You cannot just put a solder joint, the strap, is in fact a 1000 ohms resistor What I did is to use a bigger size SMC resistor to ease soldering
Good luck
noega33

May 28 2011 at 9 AM

Karan :

Guys, I am having a minor problem with this amazing project.
My serial output reads fine, except that every alternate line,
it reads
ERROR: Checksum

Can someone please tell me how to get rid of this ERROR ?
Also, I had a question. Is there a way to increase the rate at which these values are coming in ? Or are they limited by the mindflex device ?

Thanks in advance

Karan

June 8 2011 at 12 PM

Karan :

In relation to the above problem, I'm also having truoble with the
processing code. The connection goes to RED as soon as I start the mind flex,
and I cannot see the graphs.

Karan :

I got rid of the ERROR in the arduino sketch by commenting the line
Serial.println(brain.readErrors());

But I still cannot get the Processing Sketch to work.
The data shown by the Arduino Serial Window looks fine.
I do close it before running the processing code. But still no luck.

If this might be problematic, can someone suggest any other way I can plot these data as a graph in real time using some other software ? or some other code ?

Sorry but I'm really not good at Programming, I just wanted to see
how the graphs change when I'm multitasking, or playing games, or meditating.

Thanks

Karan

June 8 2011 at 4 PM

Karan:

Guys,

Sorry for posting yet again,
But just letting you know that I am using the correct COM port in the processing sketch. Mine is COM4 which is 3rd in the list, so I use list[2] in the code.
I really don't know what is going on.
Another Question, Can we use these serial values while they are coming in?
For example, if the meditation value is too low, blink an LED, or change colors of
RGB LED based on Concentration Values ? Something like that ?

Thanks

June 9 2011 at 2 PM

Eric Mika:

@Karan, are you on Mac or WIndows or Linux? I ask because I have seen some issues on the Windows version of Processing where white space is not completely stripped from the incoming serial data, preventing the visualizer from parsing the data properly. This might be the issue.

What does the simple Processing program below print to the console? It should look basically the same as what you’re getting in the Arduino serial monitor.

import processing.serial.*;

Serial serial;

void setup(){

println(Serial.list());

// change the [0] number below to match the serial

// port you’ve connected the Mind Flex to, per the

// serial list printed above

serial = new Serial(this, Serial.list()[0],9600);

serial.bufferUntil(10);

}

void serialEvent(Serial p){

// spit out whatever’s coming in over serial

println(p.readString());

}

If this looks correct, then I don’t see why the visualizer shouldn’t work. Just make sure to set the [0] number in Serial.list()[0] to whatever works in the above sketch in the actual visualizer code.

Not sure what you mean about using the serial values while they are coming in. Once they’ve come in over the wire, they’re yours to do whatever you’d like. And sure, you could use it to blink an LED or change the color of an RGBLED. That’s the whole idea. (Although for this use case you would probably just use the Arduino code, not the Processing visualizer.)

June 11 2011 at 7 PM

Karan:

@Eric,

Thanks a lot. After much efforts, the Processing Graph is working.
Although, there is one problem still pertaining.
I cannot seem to get the connection status to be green all the time.
Most of the time it's "Yellow". The Numeric Value for the connection quality reaches at best 26 and then rises again. Because of this, the Attention and Meditation Values are most of the time sitting at 0.

Is there something I could do to ensure better connection ?
The other data graphs correctly. But Attention and Meditation are crucial.

Just finished building it! Its funny, I thought I had a great idea to build this for lucid dreaming research, but after reading the comments I see just how unique of an idea that is...

Anyways, thats for the awesome work you did!

July 3 2011 at 11 AM

SpecTrum:

Cool project!
The Mindflex of the Sega Toys has the ThinkGear chip? I can do the project with him?
Thanks.

July 19 2011 at 4 PM

johnf:

Michael A. Persinger -- God helmetwww.rexresearch.com/persinger/persinger.htm
This practitioner uses "rotating magnetic field" stimulation at very low intensity, applied at the Temporal areas. Given a susceptible type of subject in a sensorily deprived blindfolded state,sensations such as ecstacy and hallucinations are produced.
The system requires EEG input to a computer which applies appropriate timed and graded pulses to DAC and solenoids. Reference is made to a subject who had been able to detect the pulses from a bedside clock--producing weird dreams.

July 21 2011 at 5 PM

Kim:

Hey guys

I'm kind of stuck at the very beginning stage of this project.
I've dragged 'BRAIN' folder into finder-document-arduino, but can't see 'BRAIN' example on arduino examples. it just comes as sketchbook, not as an example.
Does anyone could help me out with this?

arduino says, 'brain' does not name a type

BrainSerialOut.cpp:5:19: error: Brain.h: No such file or directory
BrainSerialOut:7: error: 'Brain' does not name a type
BrainSerialOut.cpp: In function 'void loop()':
BrainSerialOut:18: error: 'brain' was not declared in this scope

Eric Mika:

Kim:

@Eric

all sorted out! thanks so much, btw it is just amazing!!!!!!!!!!!!

July 28 2011 at 1 PM

Paul Klemstine:

I just mounted a Teensy Microcontroller inside my MindFlex handband. The Teensy fits perfectly inside the case, I only had to Dremel out a little hole to plug in the USB cable. The 5 volts from the Teensy powers the headband.

Dave:

I followed the instructions in the hack and am able to log the EEG data from over the serial monitor using some relatively simple processing code. However, I'm concerned that the data I'm getting isn't accurate: while going about daily activities at work wearing the headband, all the test subjects are giving off enormous amounts of delta waves and much smaller amounts of the other wavelengths. Has anyone else been experiencing this issue? I feel like I shouldn't be generating deep sleep waves while wide awake and working on stuff...hopefully I'm not sleepwalking through my day or something!

Thanks!

August 19 2011 at 4 PM

fjord:

i got the same problem as josh. when i open the serial monitor there is no data. i checked the headset with the mindflex game and it works, so i did not destroy it.

any ideas what i can try? maybe my soldering is bad, but how would i check that? i don't have much soldering experience, but usually it works.

August 28 2011 at 7 PM

infrax:

@Eric

I am getting following errors when I try to run the visualizer:

brain_grapher:-1: error: variable or field 'serialEvent' declared void
brain_grapher:-1: error: expected `)' before 'p'
brain_grapher:0: error: 'import' does not name a type
brain_grapher:1: error: 'import' does not name a type
[...]
brain_grapher.cpp: At global scope:
brain_grapher:105: error: variable or field 'serialEvent' declared void
brain_grapher:105: error: expected `)' before 'p'

I am using Ardunio Uno and new to arduino programming. I extracted ControlP5 in the "Arduino/libraries" folder, but I get the same errors. I tried changing the index in serial = new Serial(this, Serial.list()[0], 9600); but errors remain.

Please suggest me a solution to get the visualizer running...

September 4 2011 at 4 PM

Eric Mika:

@ infrax The visualizer runs in Processing (Java), not Arduino (C++). Try running it in Processing.

September 4 2011 at 5 PM

miguelvmonroy:

I have a big question.
I could now get on my arduino board this file using USB BrainSerialOut.pde

miguelvmonroy:

that when I connect the headset TX and RX I put the arduino and the land of the crown to the other land arduino not read any data in the serial monitor

September 6 2011 at 6 AM

adam:

Hi,

I am researching ways for me to visualize my brain waves as part of a DJ set. The method that you have put forward here seems to be cost effective and relatively un-impeding in terms of freedom of movement, and being able to wear headphones.

Can you recommend how I might be able to turn the raw "bar-chart" style signal data into a more entertaining visualization. For example, would MaxMSP be able to interpret the data?

Eric Mika:

miguel venegas monroy:

Hi Eric Mika.

you dont undertand me ?

i have that problem.

i dont connect my toys. they dont send any DATA.

:(

September 15 2011 at 8 PM

Eric Mika:

Miguel, I can’t tell anything about the quality of the solder joints from your photos. If you’re not getting any serial data, then you’ve either fried the board, didn’t solder properly, or didn’t configure and install the Arduino software correctly.

Check your work for shorts. Try the headset with the original game to see if the board is fried. Double check the instructions.

September 15 2011 at 8 PM

Paul:

Thanks,Mr. Eric Mika, Mr. Arturo Vidich, and Ms. Sofy Yuditskaya, and everyone from the Arduino community.
This looks like great fun. This is what I have done so far.
1. Downloaded the program that a. Talks to the Arduino and b. Displays the graphs of your brain waves
2. Install the program "arduino-0022.zip"
3. Unzip and Add some files to the "libraries" folder that you just previously installed, kitschpatrol-Arduino-Brain-Library-2beb7ce , processing-1.5.1-windows.zip , controlP5.zip and also kitschpatrol-Processing-Brain-Grapher-2b821ba
On the hardware side I just stuck the wires in the Arduino holes and that seems to be working. I have serial data flowing, now. Also of note, no need for a wall wart if your using USB.

I was wondering if I can use the Mindflex version of the NeuroSky chip to interface with the Mindset software and development tools. It would be great if we could work even a hobbled version as they have over 20 games and other fun applications. Just use Mindset's "Developer Tools 2.1" with the updated "thinkgear_testapp.c" ?, No? BTW: I secured my mindflex device,(sans base) at a thrift store for $1.00. $19.98 for the Arduino, Uno, ebay.

September 26 2011 at 12 PM

appie:

This is awesome.

I have a newbie question: why do you need an Arduino for this, you are tapping a serial port connection, then feed it into an Arduino program that simply relays the data to the output which then gets read on your computer. Can't you do the exact same thing with a simple serial-to-USB connector ?

This is not to critique your work, I am planning to get this working and don't mind going the Arduino route if needed but I just don't understand why it can't be done without one.

September 27 2011 at 12 AM

o11o:

Hello !!!!
First of all : what an amazing website !!!
Actually been workin on EEGand BCI fora whileandI have some question about the "hacked MindFlex " :
1. Since Mindflex uses Neurosky's EEG Ship : is there any possibilty to perform Neurosky's Apps with Mindflex+ arduino ?! ( Am not sure if TGAM is thesame one used in Mindflex !!).. Ifso; please show how ?§

2. Is there any chance to get the Microcontroller Exct reference also its program ?

Actually got an Idea about using Neurosky's apps.. like to copy the source cide and so in the arduino software... but still could'nt figur out how to make it work !! :(

Thanks in Advance !!
Best Regards !!
Adam

September 27 2011 at 9 AM

Eric Mika:

@Paul: I don’t have a Mindset but I think there might be some issues getting the serial data where it needs to go. (Since the Mindset connects via bluetooth.) Still, it might be possible. I’m just not that interested in any of the software.

@appie: Sure, for other projects I have written a parser in Java and just gone straight into a laptop over serial. For the project I developed this library for, space constraints made it easier to use an Arduino instead of a laptop.

@o11o: See my response to Paul regarding Neurosky apps. I don’t think I understand question #2. Good luck with everything.

o11o:

Hello again ..

the #2 Q was about the microcontrollers in the circuit ( the 1st before the radio Tr and the 2nd after the Rx radio unit - wot is extly btw ( the radio transmission -UART/Bluetooth/ nordic...) === their exct reference and their "C" programs if it is possible ?! I have one omme own but dont think it works!!!
if the transmission unit on the headset ( mindflex ) is bluetooth and IF ( wow ) the EEG ship on minflex is similar to the TGAM I think it wud work for DEFO...

Thanks in advance
Best Regards
Adam

September 28 2011 at 4 PM

Shanker Raja:

Hello,

Over the past few months I have been searching for an inexpensive EEG device to control actuators, for a high school robotic project, where I am voluntering

I came across mind flex in toys are us and subsequently your website. Thsi seems like a good place to start.

Your work is excellent and informative. My fear is the raw data may be noisy. I am thinking of using the out put from the chip to train neural networks and subsequently control the acuators. I would like your advise before starting, since you have some experience in processing EG signals in general and mind flex in particular. Also would hooking up more two or more units be helpful.

I will post photos on [my flickr][] later that show the TGAM board in the MindWave if you're curious. The upshot is, the MindWave is in mode 3, and you have to set your serial communication to 57600 Baud if you want to get anything from it.

The library returns "could not parse" errors. Possibly because the MindWave is returning a 10-bit raw EEG value with code 0x80 before the "EEG powers" data? That's a first guess.

That's all I've got so far: I spent a few hours last night getting the arduino to receive serial comms, got a signal, did a fist pump, and shut it down for the night before I screwed it up.

The MindWave works great with the Brain library, and I was able to use the readAttention and other calls to control servos with the MindWave.

The only thing you need to do differently is to set serial to 57600 baud rather than 9600.

October 9 2011 at 1 PM

Eric Mika:

@Josh DiMauro Awesome, thank for the information! The bit on the BR0 ad BR1 pads is golden.

October 9 2011 at 3 PM

Paul:

I have had some fun discovering what the hacked mindflex can do. To go even deeper I have been trying to connect the hacked mindflex to some free software on the web including open source EEG and Mindset Neurosky. I can only conclude the some sort of “bridge software” is needed to connect the serial data to these various free applications.
1. Think gear connector, I was able to install it and at one point it was running in the tray. However shortly after that I could not get it to start up again.
2 tried with one(above) running, no COM after a scan and errors out as -2
3. Tried with Arduino 0022 running the example program “brainserialout” When doing so I was able to get data to show on the “serial monitor” and it identified it as COM3. I even tried without the serial monitor running.
4. Tried open source “neuroserver” COM1 error, I was not given a choice to select COM3
Any ideas on what to try next? Thanks in advance for any input.

October 10 2011 at 8 PM

Arthur:

Hey,

After a good amount of tests I keep getting more Delta waves even when I'm playing FPS games, which are the opposite of sleeping. How can assure that the waves I'm receiving there are actually Delta? Also my meditation keeps on a high level on any kind of activity and the signal is green.

Any more information about the waves would be really helpful,
Thanks in advance,
Arthur.

November 6 2011 at 5 PM

Simone:

Hi,
just an information. I'd like to connect the mindflex console to an AC adapter instead of using batteries. But what kind of adapter? For sure 6V, but what about the amperage? Any idea?
Thanks in advance,
Simone.

November 16 2011 at 7 PM

MTBiker:

Why MindFlex work so unstable without console?
I get data in processing only on 10 try (and it is not always)
My sequance of action is:
-turn on the mindflex,
-push button in processing,
and nothing display therein about 30sec... maybe I wait too little ?

When I use mindflex console, connection set usually quickly... but for my project that redundantly

I've been working on a project using the MindWave headset. Now, the linked project uses the MindWave wireless card, which is kind of a pain. Hence why I began tinkering with a hard-wired headset, as noted above.

Anyway, I have a curious problem: it takes FOREVER for the headset to get a good signal when it's wired into the arduino. Or, you know, about 90-120 seconds, give or take a forever. The "signal strength" indicator sits at 200, and 200, and 200, and then down to about 50… and then, finally, I get a good signal.

This sounds a lot like there's capacitance somewhere, probably on the shared ground and baseline electrode. That's a total guess, though.

Has anyone else seen this? I'm trying to work out where to begin troubleshooting.

November 18 2011 at 4 PM

Mohannedino:

Dear all,

Thanks for all previous valuable information ,
I worked in C# using Serial port component ,... after uploading "Arduino Brain Library" to the board , and visualize the EEG data on "C# programmed oscilloscope" like in the main project , I could not know the unit of measurement of the values that come from Arduino !
I need to know it as the values have no commas and visualizing them on XOY coordination need this unit.

any ideas here!

Thanks and best regards,

Mohannedino

November 20 2011 at 1 PM

Joe Bob Briggs:

@Eric : If I read @Josh DiMauro's comment properly, it should be possible to set the Mind Flex into a "raw + normal" output mode? Is that true?

Also: any updates on the wireless efforts? XBee is a possibility, but I am wondering if anyone has tried a smaller RF module that can fit inside the case, to make the headset easier to wear?

Technically that's true, but you'll have to solder the jumpers, and they're utterly freaking miniscule. Like, there's just NO DAMN WAY I'm going to attempt it.

If you want wireless, may I suggest just using the MindWave headset itself? It _is_ wireless out of the box. And the cost difference between the headset and the Mind Flex is minimal, especially if you add a couple of xbee radios.

My efforts above were aimed at removing the wireless link for a particular project which already has wires running two and from the headset, making the wireless link redundant.

November 25 2011 at 3 PM

Alex Hatch:

Hi all!

So I have a quick question regarding reading the serial output from the neurosky chip.
First some info - I am using an arduino, but I am doing a project connecting the arduino to a cellphone via bluetooth. I have serial working over bluetooth properly, and I've set up the headset through serial. Ideally, I want to use the SoftSerial library to read the output of the headset instead of using the hardware serial, so that I can receive and transmit through the bluetooth sensor.
Question is, how would I modify the brain library to read input from a definable software serial pin rather than the default hardware serial line?

thanks for the wonderful write up, and code and support on this project, hopefully I'll be able to use it properly soon...

November 25 2011 at 11 PM

Eric Mika:

steve:

Hi guy's, after building this everything works except the Meditation and Attention ? These are zero (0) all the time....any ideas as to whatI'm doing wrong. I get all the power bands ok (ish) as I seem to have high delta and gamma waves at the same time?

November 28 2011 at 7 PM

Mohannedino:

Hello again,

I would like to know if anyone has any information regarding my previous question,

Chris Neuner:

Thanks everyone for the informative multi-year thread. I have the project functioning properly with the arduino, midflex headset and a mac running processing. Good times.

Now, I want the arduino to map the attention value data to output PWM duty-cycle. The attention value from neurosky seems to be a convenient 0-100 which correlates nicely. Seems like this should be easy.... is it?

Can anyone point me in the right direction on what would be involved in programming. I'm a programming noob so forgive me if this is painfully obvious.

nimrod:

processing results above do occur in current pre alpha as well as in current stable release 1.5.1. gee. who is gonna port it? :)

well, what u can do is, just comment out the setfont attribute for new textlabel. it only occured twice for me and raised an null pointer exception. after commenting out, the graph works fine, im still trying to interpret it though ^^.

excellent job, thanks for your support.

December 11 2011 at 12 PM

J. Koomen:

Hi, great hack! I want to use the software for my emotive brainwave reader. I have floats for all the emotions, and I want to connect these to the graph. How should I replace the values?

example:

Float excitement = 99;

So I want excitement to be assigned as a bar. Can you give me and example on how to change this?

Thanks in advance.

December 11 2011 at 5 PM

Eric Mika:

@All: Arduino 1.0 includes some changes that break existing libraries.
(Seems a bit aggressive of them!)

So, to anyone having trouble with “No such file or directory” and “____ does not name a type” errors from the Arduino IDE, check Github for the latest code which includes a fix.

December 17 2011 at 2 AM

Chris:

This is all very cool. I will order the uber head set form neurosky. I train CEO's and the last one simply failed due to attention. I am always wondering if something like this would create a feedback for training executives.

January 3 2012 at 5 PM

Blane Parker :

Whenever I load the code into my arduino (mega) my serial monitor is blank, and when I run the visualization software and run it, it says that that I am missing conttrolp5, where does this file go.

January 4 2012 at 5 PM

Hokurai:

Alright. Well, I have it working... Except for the visualizer. The serial monitor is reading the data fine. The processing is compiling fine with a few warnings (after downloading and placing controlp5). But when it shows up with the grapher, it's blank and stays blank. Any fix for this?

January 6 2012 at 4 PM

Eric Mika:

Check my previous comment for a simple Processing serial test case, play with the index on Serial.list()[0] until you’re seeing the same thing in Processing that you’re seeing through the Arduino serial monitor.

January 6 2012 at 5 PM

Hokurai:

I was thinking the same thing with the serial port but I could not figure out how to set the serial port and I didn't see the serial monitor. I'll play around with it later.

January 6 2012 at 9 PM

Hokurai:

Alright, I got my port changed and now I'm getting a packet too long error but it is otherwise working.

January 7 2012 at 12 AM

Hokurai:

So... Yeah. Anyone seen any other tools floating about for this? I might have a few ideas on projects I can do using this.

January 7 2012 at 1 AM

urbnmnky:

Maybe I am just tired, but I am having problems getting the visualization part to work. I finally got the controlP5 library to be recognized by Processing, however, when I try to run the brain_grapher.pde example, I keep getting the error,

Cannot find a class or type named "Channel"

This occurs on line 9;

Channel[] channels = new Channel[11];

Any thoughts?

January 18 2012 at 1 AM

Eric Mika:

@urbnmnky You have the Channel.pde file? It’s showing up in a tab in Processing when you open brain_grapher.pde?

This is a great hack. I found a Mindflex duel (comes with 2 headsets) for $30 at target :) One headset didn't get a connection below 26, so I tried the other headset and get 0 consistently, so people with connection problems it could be the headset unfortunately :?.

What worries me now is that the values seem pretty random, I can't consciously change concentration or meditation values at all. At this point now I'm considering grabbing a Mindset or Emotiv epoch, because after getting a taste with this hack the possibilities seem awesome.

January 21 2012 at 11 PM

Eric Mika:

@Loktar: Thanks! I’d be wary of the MindSet if you’re underwhelmed with the accuracy of the Mind Flex. It probably user a very similar chipset / DSP to the Mind Flex.

I’ve never worked with the Emotiv. Interested to hear if you have better luck with it.

January 22 2012 at 8 PM

Alexandre:

Hi Eric!

Thanks so much for this!! The arduino set up has been no problem but i'm new to processing and could use some guidance ( so far I have overcome the RXTX mismatch).

Your nice sample code below showed me that [2] corresponds to the COM5 that my arduino is reading in on, but after it prints the list of [0] to [2] nothing comes in at all, you state that I should see the csv lines? I can close processing and re open arduino and verify that packets are still being received. The second window that opens from processing is just a little grey box.

Marleen:

Hey!

I'm fiddling around with the Mind Flex hack and Arduino right now and I've detached the daughter board from the motherboard and connected it directly to my Arduino. Also I have completely taken apart the Mind Flex headband and I now have 3 loose sensors also connected to my Arduinoboard. Now, it's working and receiving data from the sensors but even when they're not attached I'm receiving rates going up to about 2500000 in the serial monitor of Arduino. I was wondering if it's normal rates are still coming in when the sensors are not attached to my head? My connection is fine, around 25 - 50. Also, I'm not getting any rates from meditaion and attention. I tried the salt water and aloe vera trick but they didn't work here :P

Amazing hack! I have coupled the Mind Flex with a JPEG camera. I record brain data and images onto the same SD card. Later processing edits the images to reflect the brain state of the user when the picture was taken! Thanks so much! Check it out http://benbergphoto.blogspot.com/2012/01/braincam.html

January 29 2012 at 6 PM

Noega33:

Hi everyone,
Since my last post (April 2011...), I did additional homework and I developped an Android application to display all power bands and continuously records Alpha data to try to improve my relaxation...
The system is made of the TGAM PCB coming from the Mindflex game. the TAGAM was removed from the game and directly connected to a BTM 182 (bluetooth module).
In order to verify if I did not have to much "electric" noise, I connected all three contacts together to simulate a "zero" signal and the result was:
all power bands were at Zero, but "attention" and "meditation" signal were not zeros.
As anyone been able to understand how the attention and meditation signals are generated?
Are they generated from power ba

January 30 2012 at 5 PM

Jacob:

I had the same problem with the poor connection quality, but I resoldered the connection to ground on the headset and it worked much better. Where is the documentation about what each error means. I keep getting a Checksum error that I don't know how to fix. I get the data, but I always get an error afterwards. I am using some delays in my code if that could affect it, but I do need the delays.

February 1 2012 at 2 AM

Noega33:

Hi,
I my case I did not have any problem with the connection.
Signal quality was good and Checksum also
My question is : How come that with all three contacts (EEG, Ref and Ground) tied together, I get no signal on the power band (this is normal) but I get "good" signals for "Attention" & "Meditation".
I was expecting Zeros for "Attention" & "Meditation".
Does anyone know the relationship between power bands and "Attention" & "Meditation".?
Regards

February 2 2012 at 8 AM

Christine:

Hello!
Thank you for such a detailed and wonderful tutorial. I've completed the hack and am now trying to send the data into MaxMSP. I'm quite new to arduino and Max and can't seem to figure out how to modify your arduino code to send the values to Max. I'd ideally like to read a CSV into max, similar to the printout to the serial monitor in Arduino. Does anyone have any tips for me in this department? Thank you very much.

February 4 2012 at 4 PM

Christine:

Hello again.
I figured out how to move the data into Max using the serial object. (I know, it seems obvious but again I am a beginner.)
Thanks again!

February 5 2012 at 2 PM

Andy:

Hi, great stuff, I am using it for my Degree Project in Electronic and Electrical engineering as a way to get EEG signals so thanks very much.
However If i can ask one thing, how would i gain access to the raw wave signal?
Thanks in advance.
Andy

February 7 2012 at 8 AM

Andy:

Hi again, also

i keep getting this error message when uploading
avrdude: stk500_getsync(): not in sync: resp=0x00
i have checked it is the correct port, that all drivers are correct, but when i place the Arduino on my head nothing happens on the serial monitor, i think because of this error during uploading. help would be greatly appreciated
Andy

February 7 2012 at 12 PM

Andy:

Ignore that comment i seem to have solvved that bit. but still no data incoming on the serial monitor, any ideas?
andy

February 7 2012 at 12 PM

Andy:

Sorry to be the most annoying person ever but now ive solved that problem and have yet another one.

Andy:

Your all going to be sick of the sight of me. I fixed it :D but now I return to my first question, how do i access the pure data wave? i.e pre-fft waveform

February 8 2012 at 12 PM

Eric Mika:

@Andy: The error gnu.io.PortInUseException suggests that another application is using the serial port. Are you sure you have the correct port selected, per this comment? Are you sure you closed the serial monitor in Arduino (along with any other apps which might use the serial port)?

February 8 2012 at 12 PM

Andy:

Yeah i firgured this out literally seconds before you replied i think! thanks very much for the response. I had forgotten to close the serial monitor in Arduino. Its all working fine at the minute. My only problem now is not knowing how to a/ record the data i am collecting, maybe in matlab, and b/ how to access the raw wave file as i cant seem to get the signals i want, for example theta seems the most active which i think is strange...

February 8 2012 at 3 PM

Andy:

I think a better question would be how do i export the incoming data from proccessing into a text file, as i could then use the text file in Matlab. The data is printed in the format
[0] = 0
[1] = 0
[2] = 10
etc, would it be possible for it to be printed in the format
0,0,10 etc...

The graphs are all very good but with no way to store them or record them they become less useful so any reccomendations on how to record either the Power band values or the actual graph would be appreciated.

Thanks
Andy

February 8 2012 at 4 PM

Eric Mika:

Andy, see the Processing documentation… for example, saveStrings(). Saving out text files is trivial.

You can roll your own format, but CSV similar to what’s coming from the Arduino would make sense.

February 8 2012 at 5 PM

Andy:

I had stumbled across this before, and tried to implement it but instead of it updating, i.e the text file ending up like this;
1,1,10
2,1,7
1,1,5

it would just display the last packet on the text file i.e
1,1,5.

Im sorry to be such a nuisance, It's all very new to me and i've only got C++ experience.
Thanks
Andy

February 8 2012 at 6 PM

Eric Mika:

If you’re putting saveStrings() in the loop, it will overwrite the file every time. A simple (but not particularly robust) approach would involve buffering each line of data to a string array and then saving the file before exiting the program. A better approach would use the Java file API to save as you go.

These very basic programming questions are probably more appropriate and better served elsewhere.

February 8 2012 at 7 PM

Andy:

Thanks very much, apologies for taking up your time, and thanks again for the great mod :)
Andy

February 8 2012 at 7 PM

Vu Hoang:

I want to hack the MINDFLEX system to increase the volume of an epic nobel prize inspiring kind of song the more I concentrate. Is this possible?? If so where do I start?

noega33:

Hi Andy,
To your question: "how to access raw data"
There are two methods, I only tried one
First (not tried)
Change TGAM1 board configuration by sending commands through UART
refer to TGAM1 spec Sheet document (I gave the link i one of my early posts)
Second (I tried and works)
Change strap BR1 from Gnd to Vcc (refer to TGAM1 doc spec); You will get Normal output (36 bytes) and raw data (512 values , 2 bytes per value)
Note 1t:hat in this configuration baud rate will be 57.6K
Note 2: If you are using the device in a 50hz power country you need to change the M strap from VCC to GNd
Rgds

February 11 2012 at 12 PM

Hich32:

Hi Eric

Nice Hack, I tried it and it works great !!!!

My question is I noticed that you skipped the raw EEG data from the Mindset protocole for the purpose of this hack. Do you know how to display raw data besides power bands ?

February 16 2012 at 5 AM

Eric Mika:

@Hich32: When I wrote the tutorial a few years ago, I wasn’t aware of a way to access the raw wave data.

Since then, other folks have figured it out. See noega33’s comment right above yours for an approach to raw data access. I assume once you have the data, you would start with an FFT and go from there.

February 16 2012 at 4 PM

Noega33:

In response to Hich32 question, please find below the 68 bytes values you read when you selected raw values
The first 36 bytes represent the band powers and all other data including Checksum
Starting at row 42, you get the first raw value high-order byte
Row 50 is the second raw vzlue high order byte
and so on until you read all 512 raw values

In Total, there are 512 raw values made of two bytes
In order to get all 512 values, we need to read 512x8=4096 bytes
exemple to compute first raw data value
raw=256*Byte(42)+Byte(43)
if (raw>=32768); raw=raw-65536

February 21 2012 at 8 AM

MeToo :):

Excellent hack. To contribute: Following this, attention and meditation values stay zero, and Connection never reached zero. Also the game stopped working. When removing Arduino connection the game started working again (indicating good values returning).

Instead I then got all good values using an Arduino Mini Pro powered by the headset batteries to run your program and send the resulting numbers via 433mhz RF radio and Virtualwire library to another Arduino hooked up to the Mac. So it seems some headsets are too sensitive in some way for direct connection.

February 21 2012 at 3 PM

Dome:

thank to mika and all the precious contributors! great work.

attempting to contribute here my two cents:

1. i bought the mindFlex Duel version (with two headsets) in US via ebay and i'm in Europe

2. did the hack and SW setup, it all worked in some way and i can read data in arduino and show them with mika's graph processing sketch.

3. the headset has only one clip for only ONE ear, i suppose it works for the reference AND for grounding (clip double sided)... someone can confirm that to me?

4. in order to get the green light and the Zero signal strenght i must ground myself touching the USB shield on arduino and standing with bare foots on the floor

5. i used a 1meter cable from the headset to arduino (for TX and ground) and it works. i implanted a female minijack on the headset body.

6. when i manage to get the green signal strenght on mika graph i get contraddictory values.. the most suspectfull one is the meditation value, always very high and in anycase much higher than attention... this doesn't seem to me very realistic especially considering i did the test while i was reading the posts here in a language that is not mine... anyone else figured this out? since i'm using the head set in a 50Hz country (italy) can this be the cause? or any other idea/suggestion?

7. in fact i read it would be essential to switch the circuit to operate in a 50Hz environment, but not being an electronic and not being english speaking, i can't understand some terms and the whole procedure, can someone be so nice to help me with some kind of step by step + images tutorial? i think it would be very helpfull for other EU peoples trying this hack...

8. i tried to connect simultaneously with arduino and the original console, it works even if as soon as i connect the soldered wires (TX and GND) through a minijack i implanted on the headset, the connection quality goes to yellow and the console says it needs to calibrate, after a while it gets a good signal and start working with the console and arduino simultaneously.
also here what is anomalous is that if i use the console alone i can manage to stop the fan by 'relaxing' but when i'm also connected to arduino i never manage to stop the fan and the value of attention is in general much higher, almost always near to max speed!! any explanation about this weird behavior? also here could this be addressed also to the fact i'm using the 60Hz version in a 50HZ country?

any help and suggestion would be much appreciated.

thanks domenico

February 25 2012 at 2 PM

John d:

Hi, great hack! any idea the best way to pass this list data info into max msp at all?

February 29 2012 at 9 PM

Dome:

@ john d

that's what i'm working on right now, once you've done with mika's hack/mod, you just have to access the serial data coming from arduino. the easyest starting point is to use the max tutorial patch 02cSerialCommunication.maxpat just turno on the toogle 3 (print formatted) and you'll see the same numbers you get on the arduino monitor (but close it before running the max patch) on the max window. then if you want to use the data a rough but fat way is to connect an unpack obbjet to the fromsymbol object. use 22 outputs since the commas are interpretes as data too. hope it helps...

this is pretti simple to achieve, the difficult is how to scale use those data... the power bands seems to go from 0 to 1500000!!! but it is not clear what the range is exactly... that would be essential... please mika or anyone else who used them could you let us know in your expereince what power band ranges are? thanks in advance.

March 2 2012 at 8 AM

Gabriella and Ella Ashford:

Hi, my name is Ella, I am in 5th grade and I am about to hit the mindflex hard with a series of experiments to prove that EEG's can be used better than a clock to determine a child's individualized education plan. For example, instead of a teacher droning on and on from 9:00 to 9:45, a teacher would move the child onto their next subject when their EEG scanner went into meditation or distraction mode. I cannot hack into an EEG scanner. Are you in the Washington State area? We could come to you to try and run our experiments on your hack project. Or, I could measure the height the ball floats at and convert it to a digital readout.
I am running this experiment for the Washington State Science Fair at the end of the month. Do you think that the "float pattern"of the ball can resemble the data of your "hacked" method? Thanks so much for your time!!!! Ella

March 6 2012 at 7 PM

chipchip:

Jonah:

Hi,guys,
Great hack and discussion here.This sunday I tried the similar hack but fail. Helps needed.
I used the thinkgear chip not the mindflex. But it is right the same chip. I connectted the Tx of TGAM to RX of arduino uno, Gnd to Gnd and 3.3v of arduino to TGAM V+. This part I think is the same with all you guys. I do not want crack my mindwave or mindset, instead, I got ECG electrodes to do the work. Three electodes connect to EEG, Gnd and Ref positions repectively.With the setup above, after upload the code, no output from the serial monitor.Why,though?! When uploading I had the Rx wire off. If not, I would met with the stk500 error prompt. Anyone ever try TGAM here? Anyone could help?Thanks. My poor weekend, with the button like electrode sticky on my head,but not work,sigh.

March 11 2012 at 7 AM

Dome:

@ chipchip
thanks a lot! did u write that article? can i email to you directly so i can ask you few more details? or can u put me in toch with its author?
best
d

March 12 2012 at 1 PM

VAmari:

hi everyone...
i just tryed the last hack\mod (dome's one - hi Dome :-D ) and it works good, but I have other trouble...
i usually use Arduino like an I\O interface with max\msp. i always load "firmata standard" sketch, and i never used TX\RX pin.
i try to use "brain" sketch from Mika and works to, but I would use both together at the same time and i really don't want to buy another arduino.
i'm realy bad in "processing" programming, so here the question.
how i can merge "firmata standard" and "brain" arduino sketchs due to continue to use input\output "firmata" and parsing function on RX pin of "brain"?
how i can imagine, someone of you said "it's quite simple!", so please, Mika (or some one else that can do it) can you merge these 2 sketchs!

tnx a lot

ps: sorry my english is quite poor...i hope you have understood ;-)

if someone want, we can keep in touch via email

March 26 2012 at 10 AM

Marie:

Hi,

Don't know if anyone might be able to help me out, when I run the sketch in Processing this comes out:

Anyone have any idea on how to fix? I am not familiar with processing. sorry about this.

Apr 12, 2012 12:35:36 PM controlP5.Textlabel printConstructorError
SEVERE: The Textlabel constructor you are using has been deprecated, please use constructor
new Textlabel(ControlP5,String,int,int) or
new Textlabel(ControlP5,String,int,int,int,int) or
new Textlabel(ControlP5,String,int,int,int,int,int,int)
instead. The Textlabel with value 'Attention' is disabled and will not be rendered.
Exception in thread "Animation Thread" java.lang.NullPointerException
at controlP5.Textlabel.setFont(Unknown Source)
at brain_grapher$Monitor.(brain_grapher.java:498)
at brain_grapher.setup(brain_grapher.java:85)
at processing.core.PApplet.handleDraw(PApplet.java:1608)
at processing.core.PApplet.run(PApplet.java:1530)
at java.lang.Thread.run(Thread.java:680)

FarrisLabs:

I wonder if anyone has tried to use the MindFlex Duel device which uses two headsets? I really want to control a game using this MindFlex hack.

And I would love to try to control my irregular heart beat using this device. Anyway getting that kind of biofeedback can't hurt.

Thanks for the fantastic hack. Can't wait to order the gear and work on this in between semesters of my Game Design course.

April 24 2012 at 2 PM

Pault:

I do have exactly the same problem as MARIE

Apr 12, 2012 12:35:36 PM controlP5.Textlabel printConstructorError
SEVERE: The Textlabel constructor you are using has been deprecated, please use constructor
new Textlabel(ControlP5,String,int,int) or
new Textlabel(ControlP5,String,int,int,int,int) or
new Textlabel(ControlP5,String,int,int,int,int,int,int)
instead. The Textlabel with value 'Attention' is disabled and will not be rendered.
Exception in thread "Animation Thread" java.lang.NullPointerException
at controlP5.Textlabel.setFont(Unknown Source)
at brain_grapher$Monitor.(brain_grapher.java:498)
at brain_grapher.setup(brain_grapher.java:85)
at processing.core.PApplet.handleDraw(PApplet.java:1608)
at processing.core.PApplet.run(PApplet.java:1530)
at java.lang.Thread.run(Thread.java:680)

Make sure you’re using Processing 1.5.1 or 2.0a5, and ControlP5 0.7.2.

Good luck!

April 29 2012 at 1 PM

Teeth:

I would like to ask the way to prove that beta waves will affect attention.
Or "signal strength, attention, meditation, and δ, theta, low alpha, alpha is high, low beta, high beta, low gamma, high gamma", which influence each other?

May 2 2012 at 8 AM

Pault:

Thanks a lot, Eric. The updated version works wonderful. There are no values for attention and meditation. That is probably because I'm not in a "attention" nor "meditation" state?
Regards, Paul

May 2 2012 at 9 AM

Eric Mika:

@Pault: Are you seeing any other values? I haven’t had a chance to test the new brain grapher code with a headset.

May 2 2012 at 1 PM

Pault:

Yes, I see 8 colored bars going up and down and curves doing something similar. At first sight they move rather randomly, but when I start doing some math in my head for a short while some of them stay higher. As soon as I start looking at the screen again they start moving randomly. It needs a second person to do more tests. I will let you know.

Eric Mika:

Steven Wang:

Can you give us a new version of arduino-BrainSerialOut program supporting parsing 57600 baud rate/50hz and a new version of Processing Brain Visualizer supporting raw EEG display ?

That would be perfect~ Thank you very much!

May 5 2012 at 4 PM

idee17:

In the Arduino sketch you have up above, i'm getting this error
'Brain' does not name a type
it's probably something I did wrong, but I installed the Arduino library kitschpatrolArduinoBrainLibrary1a73876 and it seem to be working just fine.
So, if anyone can help me it would be great

May 23 2012 at 11 PM

edan:

Has anyone managed to get the Brain library to log the data to an SD card? It would be awesome to log EEG data over a longer period of time and then graph the results. Sadly, my initial efforts have met with very strange results... the Brain library seems to interact weirdly with data logging code. (see my post in the Adafruit Arduino Shields forum, "Data Logger Shield Gone Haywire (Arduino Brain Library)")

May 25 2012 at 11 AM

edan:

I should note though that I wired a 6N138 optoisolator between the Mindflex and the Arduino and it works great! Not only is there no question of noise/ground loops from the Arduino messing with the EEG signal, but there's also no longer the chance of frying my brain if I plug the Arduino into a wall-powered laptop.
Wiring is as follows:
Mindflex V+ to 6N138 LED anode (pin 2)
Mindflex T pin to 470 ohm resistor to 6N138 LED cathode (pin 3)
Arduino 5V to 6N138 Vcc (pin 8)
1K resistor between 6N138 Vb (pin 7) and GND (pin 5)
Arduino RX pin to 6N138 Vo (pin 6)
Arduino GND to 6N138 GND (pin 5)

I suspect a 6N137 might be able to handle the 57600 baud signal of the Mindflex chip in full RAW data mode, but I haven't tried it... still have to get this much working first.

May 25 2012 at 2 PM

edan:

Incidentally, the optocoupler might be one way to put a stop to having to disconnect the MindFlex everytime you upload a new program (due to RX pin interference). I think the 6N138 might have a pin that could be used as a disable pin; alternately, the power consumption might be low enough to drive the 6N138 output transistors off an Arduino digital pin (that only gets turned on once the program is happily loaded).

May 26 2012 at 2 PM

chris:

I am having trouble with the top half of the graph. The monitor values appear, but the graph over time does not appear. The radio buttons are all there but no data fills. any suggestions?

May 27 2012 at 12 PM

edan:

Pault:

I'm getting only yellow as connection strength. (51 on the arduino monitor window). I tried cleaning the contacts and the skin with alcohol and tested with contact paste from a hospital but no improvement. When I disconnect the arduino and start the game I get good callibration. As soon as I plug in the arduino, I loose contact and the voice starts about "calibrating".

May 29 2012 at 11 AM

JackelPirata:

Hello guys! Thanks for this amazing material. I have a couple of questions if you dont mind.

How did you convert the values of each of the 8 EEG bands into a range between 0 and 100 to draw the brain monitor?

Which are the lowest and highest serial values for each band?

Thank you for the help and time

May 31 2012 at 12 PM

Elastickman:

Hello every body, and thanks for this hack. I'm a french student in a design school. (sorry for my english..) i would like to use this hack with "grasshopper" for rhino. it's a plug in for a 3D software for control things in in. I use FIREFLY in grasshopper that permitted me to control with my arduino. But i can't read RX value in this plug in. But there is a solution, i can read OSC or UDP from processing to grasshopper.

I want just a little help for simplify your code for juste send data in OSC or UDP in your sketch. I think someone have ever do this but i don't find it. If you have somes ideas... thanks you a lot.

the primary idea is to genere "mental mesh" with mind flex. :)

June 3 2012 at 5 AM

Eric Mika:

@JackelPirata The visualizer establishes the bounds dynamically, based on local or global maxima. (E.g. For each channel the highest value on record establishes the upper bound of the graph, or you want you can flip the checkbox and use the highest value for all channels as the max instead.

@Elastickman It should be trivial to write an OSC bridge. Take a look at this chunk of Processing code and the oscP5 library. If you have the choice, OSC should be simpler than UDP since you don’t have to invent a packet format.

June 7 2012 at 10 AM

edan:

Regarding using this as an EEG sleep monitor, I added a quick post on how to zoom in on a particular section of the sleep logger graph using gnuplot:

edan:

I should also add that getting usable data out of this setup requires fairly heavy filtering (a response time measured in tens of seconds or minutes) as the MindFlex is by default quite noisy. That said, after filtering it's quite usable.

June 7 2012 at 5 PM

Elastickman:

As mentioned in the initial statement, about having dangerous voltages near your brain.. sorry, that even laptop batteries can pose a considerable danger to you as well, ESPECIALLY Lithium-Ion calls which can deliver the voltage WITH a considerable current- which can KILL you.. the reason the headset is wireless, probably is to isolate any other voltage source from the electrodes in a toy form.. however, the author is correct in that a fault- even minor, in the laptop's power supply can result in a considerable danger.. for this, the laptop's 'brick' (power supply) **MUST** be properly grounded! AND it is not advisable that you attach wires to this headset unless they are properly isolated using opto-isolators and signal transformers (if you are really concerned about safety).

June 11 2012 at 3 PM

Alex:

This is indeed valuable, Thank you Eric. I'm wondering then it should be able to do this on the Neurosky Brainband here: http://myndplay.com/products.php?prod=7
as the chip is the same, am I correct? I have one of these and would really like to hack into it using Processing.

June 21 2012 at 7 PM

Sab:

Hello,
sorry if this has been solved already - couldn't find a good explanation.
Sketch uploads but as soon as I try and upload with the wires into the board, I get this message (Arduino One Mac Osx 10.6)

avrdude: stk500_recv(): programmer not responding

:/
any help would be really appreciated!

thanks.

July 2 2012 at 8 AM

Eric Mika:

@Sab if you’re connected to the NeuroSky over hardware serial, you will need to disconnect the TX / RX leads before uploading code. (This is true for any Arduino hardware serial situation, and technically in the case of this project you only need to disconnect anything on the RX pin — the upload process uses these pins and will cry foul if there’s anything in the way.)

July 2 2012 at 9 AM

Jay:

Hey, this is amazing! Thanks for the instructions - I'm not receiving/seeing any data on the Serial Monitor...any advice? I've tried different baud rates...

July 3 2012 at 10 PM

John K:

As others have said, this is a great project!

I have a few things to add to this as I am currently performing the mod on my Mindflex Duel headset...

1.) I have discovered an easier solder-less way to connect to the T and R pins on the NeuroSky. It involves some breadboard jumper wires. They come with most Arduino starter kits (or you can get them from sparkfun/amazon (http://tinyurl.com/bnccjtn)). I have added a photobucket gallery to showcase how it was done.

Basically you just pull the rubber sheeting off of the pin, leaving a gold connector. You take the wire and pin out of the gold connector, bend it 90 degrees, and crimp it just a little bit on the end that is going to be connected to the T/R pin (this is because the T/R bin have a slightly smaller diameter than the hole of the connector). It make take a few minutes to make sure that the connector fits snug over the T/R pin. (a hint is to hook up a bread board jumper to the other end of the connector before trying to place it over the T/R pin). Something that is not clear in the gallery is that you pull the pin and the wire out of the connector, so you just have the gold part. That means you can hook another M/M wire into one side and the T/R pin into the other.

And as for the Mindflex duel... you do not need to drill a hole. If you look at the gallery I have uploaded it shows that you can run the wires out of the ear clip wire hole.

2.) The common ground: is it needed? I wanted to try and do this without soldering so I can still use the device as intended. What does the common ground do? ala is it required? If possible, would you be able to be as technical as you can as to what happens with/without it.

3.) The Mindflex Duel headset has a TGAM1 V2.8 NeuroSky board. Do you think there are any differences between the the Duel and regular Mindflex headsets?

July 8 2012 at 1 PM

Eric Mika:

Solderless Connection: Looks good. I’d personally be nervous about the security of the connection since a wearable device has a rough life… but if it works it works.

Common ground: Without common ground the voltages on the serial wires will be “floating” and you won’t be able to parse any packets. If done correctly, the grounding lead won’t interfere with the operation of the headset.

Mindflex Duel: I don’t have this hardware on hand, so I couldn’t tell you. The chip used in the original mindset was also a TGAM1, and I doubt they’d break the chip’s protocol across minor version revisions. (But who knows!)

July 8 2012 at 1 PM

John K:

How is it that when I take the headset off and put my finger on the clip, and another finger on the headband pad that I get readings... this does not seem very kosher.

July 8 2012 at 6 PM

Eric Mika:

It’s a toy EEG, I don’t think you’re going to find a rabbi willing to sign off on it.

We’ve been round and round on whether it actually works in the comments. Can’t be sure without testing toy against a medical grade eeg — NeuroSky has published the (favorable) results of such a test, but I’d be interested to see a neutral third party reproduce the results.

July 8 2012 at 6 PM

John K:

@Eric Mika

HAHA!! That comment made my day.

I saw everyone posting about whether or not it works and just wanted to add my opinion.

I appreciate the tutorial none the less.

The connectors are snug surprisingly enough. I just wish I could have done a solderless connection on the ground (there isnt a pin).

I have an extra couple Duel headsets (I bought 4 games)... if you want one I'd be more than willing to send you one so you can play around with it.

Just wondering what the specifics were on the Arduino mod to take the USB voltage line out. I am running this on a Mac MINI and I'd rather not fry my brain, I'm using an Apple USB keyboard with USB hub within it as a buffer (if it even works that way who knows I could still be almost killing myself every single time). Was wondering if you had the schematic on the changes you made to the Uno to make it ONLY powered by battery pack/wall wart.
thanks!

July 17 2012 at 6 PM

Diwasma:

@Eric Mika

I've just attempted your hack using the Arduino Leonardo, which for the most part has gone well.

Up until this point, everything else is working as expected. Based on Arduino's documentation I had to make a minor change to the Brainserialout example, which fixed everything up:

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

The serial monitor reports as it is supposed to. However, when I try to run the visualization I get the following warning:

I am interested in taking an analog signal out of the headset to use as an audio modulating signal by way of a sonification of the "brain wave" . Do you think it is possible/easy to obtain this signal from the headset without digital mediation?
Thanks
Pete

July 26 2012 at 10 PM

Jimbo:

Given the 'rawness' of this approach do you think that wearing two headsets, one on each side, you would be able to control different signal levels to each side? it just seems quite limiting that at present we can only control one variable high or low.

July 28 2012 at 10 AM

Hule:

Hi guys, I'm having a little problem here...

After reading a while and solving many common problems (closing the serial of Arduino to make it work an other stuff XD) I've got it running fine... The situation I have is that the upper part of the grapher (the timeline) is not being displayed, besides the bars are working fine.

Any idea how to solve this? Any help would be great :)

August 12 2012 at 12 PM

Hule:

Sovled... You just need to click the buttons on the grapher...

Now, another issue just arrised.

I need to keep the EEG working for 5 hours, but my laptop's battery cant make it... I just noticed that when the laptop's plugged in, the connectivity of the signal can´t reach 0 as long as it is connected, it keeps between 26 and 80 which makes the "attention" and "meditation" graphs doesn't work; I guess it's because the voltage of the wall affect the usb connection to the Arduino.

So, I was thinking to make a bluetooth connection so I don´t need to use the usb and it won´t be affected when the battery is charging, do you thing this will work out the problem?

tstmrhrk:

Thanks for your great work.
BrainSerialOut works fine and then Brain grapher works in my condition. Although Brain grapher shows histogram , there is no line graph upper side in Brain grapher. Why there is only histogram? I doubt that folder alignment of processing. Please tell me your idea to solve my problem.

August 27 2012 at 9 PM

hans:

i have the same problem as above no line graph just bars

August 28 2012 at 12 AM

hans:

check boxes are not working to change displays

August 28 2012 at 12 AM

Aaron:

@Eric Mika: I am looking for just the raw data for brainwave activity dumped into a database (and later to be used as a triggers for various projects). Would you recommend one of the NeuroSky devices to get this data? I don't really care about anything the live streaming of the frequency numbers.

Thanks!

AG

September 5 2012 at 11 AM

Brad:

Hey guys, I have the Dual Mindfkex headset and I followed the instructions here and everything works EXCEPT for the visualizer. The issue is "Their is no connection" in the visualizer but it shows the data in the serial monitor.

I downloaded the Icontrol5, put that in the library which is in the core file and installed it within the Processing. Their is no connection.

Does anyone have any ideas on what the issue might be? (I am running windows 7)

September 27 2012 at 6 PM

Alex:

Hi Eric any idea why getting this Warning in Processing? is it because of different Java versions on the computer? I'm using Windows 7 and Processing 1.5 and Arduino Uno. Any tips appreciated... Alex

I saw some posts (Dave/Steve/Arthur) that are extremely similar to what I am experiencing. I am registering very high Delta and Theta waves during waking hours as well as random on/off of the Attention & Meditation values. I double checked my soldering work and all is well and I am using the right wire too. I didn't see any responses to the posts. Is anyone else out there having similar issues? Other than it being an issue with the chip and/or the code, any biological factor of these readings in a waking state would include having epilepsy, ADD/ADHD, or experiencing some new age enlightenment of some sort from what I gathered in my search on the net. Any info on how to resolve this would be greatly appreciated because I know I am not epileptic. Thanks!

HI there,
thanks for the amazing tutorial, I am trying to use these data from the neurosky chip into Max\MSP, any help?

October 9 2012 at 7 AM

Arnold Gies:

Hello Eric
This evening I stumbled across your presentation re your experiment as to the Arduino based brain wave monitor.
My wife is disabled and often suffers from severe migraines. When I am home, I can usually talk her down into relative comfort but I do have to go away for work. Your demonstration left no doubt in my mind, that this could be used as a training tool with positive visual feedback for her to learn to relax all the way into the Theta stage if need be, to dispel the pain of punishing migraines.
Would it be possible for you to prepare this system, and provide the software for a window 7 based laptop. I am very very concerned about the software as I am a illiterate computer user, not a tinkerer.
Do you think it may be possible for me to install such software, but I am jumping the gun; would you consider making and shipping such a thing. Naturally, I expect to pay you.
I would appreciate your reply.
Thank you for your time.
Arnold Gies Ontario Canada

October 15 2012 at 6 PM

ChrisWW:

This is amazing. I have the Mind Flex, Anduino Uno and Bluetooth Mate Silver and am warming up the soldering iron.

What I understand is that the data received is for the last second. Is there any way to get the data that is more real-time. Without having to wait the second, while the data packet is being filled.

I am trying to make a neurofeedback machine, and I am afraid that second old data will be too stale for the mind to associate with.

@skater - I would like to get your code to go from an XBee on the headset to an XBee connected to a PC. Can you send me an email chris dot wallwork at yahoo dot com.

November 1 2012 at 7 PM

Dave Aragon:

@Chip: (if you're even still around) did you ever get anything more re: your observation that EOG would be a good data source? I'd been thinking the same thing. I'm not sure the one-electrode EEG could easily be made to fit the essentially differential nature of an EOG, but if it could be done, it would save a boatload of work.

November 3 2012 at 4 AM

mitchamkyle:

Hi, i've done everything, but it says Serial does not run in 64 bit mode. How can I fix this??

November 9 2012 at 9 PM

mitchamkyle:

ok like the brain serial out just says "unexpected char: 'i'"
So it doesnt do anything, and none of the other things for the software seem to be working at all. As in my previous comment, it says the Serial does not run in 64 bit mode. Idk what to do and I totally spent 100 bucks on this stuff. I hope this is fixable. Any help? The software section of the tutorial seems really rushed as if we are supposed to know the software already.
Just want to figure this out. I have 64 bit version of windows and running processing in compatibility mode didnt help.

Eric Mika:

Since it’s unlikely this will be fixed in Processing any time soon, try the 32 bit version instead.

November 11 2012 at 11 AM

Wasif:

Hi,

I performed the hack and it was sending out the data perfectly. Now, I want to get the data using the TGAM1 chip separately from the motherboard. I have got a TGAM1 chip from neurosky and connected it with 3.3 V and with the EEG and ref electrodes. But when I am connecting the Tx pin with the arduino Rx pin, no data is being received on the serial monitor.

I have very limited knowledge about electronics.

I need some suggestions on this issue.
1. Where do I connect the Rx pin of the chip ?
2. How to change the strap of the baud rate pins ?
3. How can I change the strap for the 50/60 Hz notch frequency pins ?

Thanks.

November 12 2012 at 5 PM

Braeden:

Thanks for the great instructions, but I have a problem.

When I try to upload the BrainSerialOut program to my board, it give me the following errors:

BrainSerialOut:8: error: 'Brain' does not name a type
BrainSerialOut.pde: In function 'void loop()':
BrainSerialOut:19: error: 'brain' was not declared in this scope

I'm new to using Arduino and programming in general. Any idea what this means?

For those worrying about making electrical connections with their brain and line powered devices, you need not worry. First, you are only getting 5 volts from the computer to the Arduino. You can have 5 volts go across your body all day long, and you would be fine. The body has such a high resistance, that there really is no current to worry about. Secondly, and this is more important, the circuit only has ground and a single signal wire from the sensor, so at no point is the +5v from the computer ever in contact with you. You are only ever touching ground, which you also do every day if you have a computer with a metal case and you happen to touch it.

November 24 2012 at 5 PM

Eric Mika:

@krux: Yes, when everything is working properly there’s no exposure to dangerous voltage. The paranoia comes from worst-case scenarios involving electrical surges or spontaneous hardware failure which might make the circuit behave in an unexpected (and possibly dangerous) way. The risk is low, but caution and due diligence never hurts.

November 24 2012 at 6 PM

Gary:

First, thanks to you and your colleagues for sharing how you hacked the MindFlex device. The comments section has also been very helpful :-)

I've followed your instructions and the Connection Light and animated Monitor both work fine when I run brain_grapher.pde in Processing. However, the graph area remains a blank white space.

I'm on a Mac using the most recent versions of Processing (2.0b6) and ControlP5 (2.0.3) and suspect the absence of a graph may be a version issue. Unfortunately, Processing 2.0a5, which you've identified as the version to use, is no longer available for downloading so I can't test it. I've tried running Processing 2.0a9 with an older version of ControlP5 (0.7.2), but the graph still does not appear.

Wonder if you think it's a version issue or something else entirely and whether you could suggest a workaround?

Thanks in advance.

November 25 2012 at 6 PM

Eric Mika:

@Gary: Sorry you’re having trouble. Processing and ControlP5 have changed significantly since I implemented this hack, and I haven’t had time to avert some bit-rot as the host frameworks’ APIs change. (With the exception of an Arduino 1.0 update.)

These updates are on my to-do list, but unfortunately not towards the top.

November 25 2012 at 7 PM

Gary:

@Eric: Sorry for the false alarm. Just realized that flipping the checkbox to blank triggers the brain_grapher.pde graph display. Good news is that your code works with the latest versions of Processing and ControlP5 on a Mac.

By-the-way, I suspect that the "attention" and "meditation" values are derived from one's pulse rate that is captured by the earlobe sensor. The "illusion" of controlling the path of a suspended ball through brain waves is just that.

But even if it's nothing more than a digital Ouija board, it's a blast to hack, so thanks again to you and the Frontier Nerds for generously sharing your work.

November 25 2012 at 9 PM

Art:

Dear Eric,

Your work is pretty impressive. Unfortunately, when I tried to use Processing-Brain-Grapher-master with NeuroSky MindWave Mobile it didn't work properly. I've had a lot of weird Alfa, Beta.... etc. waves. Even when I took off the sensor it showed some random data.
But I was able to work with Lucid Scribe which gave me some believable data.
I believe, Levitating ball game from Mattel might be really good and cheap platform for research.
Please, let me know if I forgot to install anything.

November 26 2012 at 8 PM

RINSON:

Hellow eric
can i use mindflex dual for this project

November 27 2012 at 8 AM

Catur:

Dear Eric,
I implemented your tutorial. I am using Arduino UNO to read the EEG data from MindFlex.
The reading is good, but I still confuse about the data.
My quality data is never going below 26. So, my concentration and meditation data is always 0. Can you give me some advice to fix that, so the concentration and meditation data would appear?

Thanks..

November 28 2012 at 12 AM

Braeden:

@Catur, I am having the exact same problem.

Did you get it resolved?

December 1 2012 at 4 PM

Chris W:

@Art: Just wondering-I think the brain library has BigEndian and LittleEndian backwards. I corrected the data and it looks much better.

@Eric: I did your hack. Great, but the electrical interference from the Arduino and also the computer through the USB was fierce. How do I know? I can play the game just fine with power off, making the ball go up and down at will, but when I turn the Arduino on, I can't play anymore. Solution: I put an NTE3096 optoisolator at the Tx data output and the Arduino far away on the lab bench. Now it runs nice and clean.

December 5 2012 at 10 PM

Stepphan:

I am having troubles with the brain visualizer, I keep getting the error Cannot find class or type named "ControlFont". Any suggestions?

December 6 2012 at 2 PM

Max:

Amazing job, really interesting.

I have the whole system already connected and running with an arduino UNO rev 3 in windows 7.
The problem is that i have no meditation or concentration bars, neither the bars that should appear at the top. My problem is that i have yellow ligth conection, that means my transfer speed is low...

Can anyone please help me ??? I really would like to have this thing working and play with it and begin my own proyects.

@Diwasma I think I remember reading that leonardo does not work at normal RX input voltages, this might be where your problem is. Try using an UNO.

December 11 2012 at 10 AM

Thomas Meston:

Hi all,
Just wanted to update this forum in hopes of saving any new prospective hacker loads of headaches. NOTE: This hack no longer works as described above!!! Something has changed over the past couple years in either the device (headsets) or the in the latest Arduinos. (Or never worked at all...) I purchased two mindflex duels and tried this hack on all FOUR headsets with approximately a 3% connection rate. And believe me, my team and i read through every comment on this forum multiple times. What we found out was that there is a huge grounding issue when connecting the arduino straight to a wall powered laptop. Once the laptop was unplugged the connection went straight to zero and worked fine. As stated above in the comments, optoisolating or going wireless is the only viable way for this hack to work. Hope i saved someone some time. Good luck.

December 11 2012 at 5 PM

Anthony:

Hey I have made my Mindflex into an EEG but i dont know how to save the data on the analog output number into a file. I also dont get what you mean by opening the brain_grapher.pde file in processing. Id appreciate if you could hep me.

December 23 2012 at 7 PM

Anthony:

I fixed my previous problem and am ok now. Just wondering how would you convert the data you get into Hz?

December 23 2012 at 9 PM

원호:

Anyone get this to work on Windows? I am really confused about the processing parts. Like, all of it. I run the processing program (2.07 32bit) after I put the kitschpatrol contents in My Documents/Processing/Libraries folder, but then there is nothing to do from there. If I try to go to Examples it is totally different from the video (which is still confusingly fast) and I can't add the brain thing to it. I've assembled everything though, but I feel like maybe this tutorial was for someone who knows about processing, because this is so hard. :( Any help guys? Am I missing something small? If I try to run things like Brain Graph I get controlP5 not found, but I have no idea where this is..

December 28 2012 at 5 PM

double:

Hi Eric,
I have the same problem with Catur and Braeden, the best data quality is around 26, and both concentration and meditation value are alwarys 0.
Have you met the same problem before?
thanks

January 15 2013 at 2 AM

michelle :

Hi my partner and I are doing a similar project that allows the mindflex headset to become a computer cursor. We are using the arduino uno chip and we are having trouble on where we should solder on the mindflex chip and what code would be best fit for us. Our goal is to have the mindflex headset to move the computer cursor up, down, left, and right. We would really appreciate your help, thank you.

I ran into a quite strange bug using the library with the star wars force trainer: Basically, if I have my macbook pro plugged into the wall (I know you're not supposed to have it plugged into the wall...) but if I do anyway, I'll get readings of 200, 0, 0. Basically the force trainer can't get a connection to my brain. If I unplug the laptop, it works fine.

This wouldn't be a problem, except that I really want to wire it up to my desktop so I can pipe the data into Unity and drive an elaborate DirectX 11 particle simulation. Has anyone else run into this? Anyone know if there's a way to set things up so that the force trainer works when the computer is plugged in?

Oops - nevermind. I just finally saw some comments above describing the same thing.

January 21 2013 at 10 PM

Alpha_A:

Hello Eric, I'm from Brazil and I'm estudandos your work and would like to know how can I do to make the ever green signal for my yellow this constantly and my top pick and not submit anything lower and estremamente incostante,

Damien Kahmer:

Hey guys got everything up and running. I'm on a Mac running ControlP52.0.4 and Processing 2.0b7 with an ArduinoUNO and a generic mindflex headset.

The issue I'm having is with brain_grapher. In the serial monitor on Arduino I'm seeing my values, things like:0,40,66,40408,10779,11818,7957,3907,7380,4313,2901 are common, and they fluctuate quite a bit. Unfortunately in brain_grapher, nothing is showing up. I get a red connection light and that is it. Within processing, I read WARNING: BitFont is now of type PFont, use setFont(PFont) instead. as an "Error" but I'm not sure what is going on.

Any body have any tips for me?

February 17 2013 at 2 AM

Damien Kahmer:

So I'm fairly certain that I got it resolved, I'm now not getting any lined data of the graph. Only the bar graph... Loving this project but really having some trouble with it lol

February 17 2013 at 3 AM

Susana:

Hi all,

Really nice tutorial!! Thanks! I have use the bluetooth adapter that comes with the mindwave (usb dongle), connect to the tx, rt pins of the arduino and then use your library. I have added one more function to your library to be able to connect the usb dongle to the mindwave and works great.

Now, I want to connect the arduino to an android with a USB hostshield. Therefore, I need to connect the usb dongle to other pins. I am trying to use your library for SoftwareSerial but I can not achieve to read anything. I can connect the mindwave properly but the brain.update() is always false. Any idea?

@Alex Hatch: I think you were doing something similar...

February 19 2013 at 6 AM

Geva:

Rinson: You can use Mindflex Dual for this. It has two headbands identical to the one described here.

February 27 2013 at 12 PM

hexalot:

Is anyone still working on this? Havent found a solution for no signal yet. Serial monitor picks up the data just fine, brain graph refuses to show anything, just a dead graph and a red connection dot

March 2 2013 at 8 PM

ANIL:

Hi Eric,
my name is anil. We are doing a project on mind controlled robot. The EEG sensor used for our project is Neurosky Mindwave. We visualise the data signal on Device monitoring studio. The problem is the payload received is of length 4. In that packet only one value is varied according to eeg data. But we cant find whether it is meditation ,attention or other brain waves. so can i controll a robot using these value.Also what kind of modification should i made in your program?

March 24 2013 at 3 AM

Eric Mika:

Almost three years on, I think I need to close the comments since I don’t have the time (or hardware on hand) to keep up with support. Please post future issues on the GitHub page of the relevant project:

Most issues I’m seeing in the comments seem like the result of either soldering errors or compatibility-breaking changes to the Processing and Arduino APIs. I’ll try to stay ahead of these on GitHub and will be happy to accept pull requests to keep the code up to date and working.