Buckle up, folks…
EEG, or electroencephalography, is the measurement of the brain’s electrical activity through sensors placed on the head. This activity manifests as electrical waves oscillating at different frequencies (as sound waves do, or even regular ocean waves). You’re producing many different frequencies of brainwaves at a time, and each frequency range is associated with certain types of mental activity, and tends to originate from certain areas of the brain.
EEG’s getting big! Since it’s been in my project stable for a while, many people have been asking for advice, so here’s a primer with pretty much everything I’ve written on the subject and some previously-unpublished FAQs. (I also just did a talk covering much of this at EMF Camp, and as soon as the recording goes up, I’ll embed it here—the dryness is abated somewhat when accompanied by arm-waving.)
EEG & Me
My brain explorations began at the University of Michigan, where a voluntary sleep study required me to spend a couple of nights in a lab, having electrodes glued to my head while F. Murray Abraham and David Attenborough revealed mysteries of the oceans. After graduating, I became (very) briefly involved with the Ann Arbor-based MiND Ensemble, who were using EEG devices to create stirring live performances. Unfortunately, I moved to San Francisco about a month later. (Suby says they’ve been getting a lot of press all of a sudden, probably because of the recent surge of interest in brainwave tech.)
My first legit, hands-on experience started with a pair of Necomimi (robotic cat ears that respond to brainwaves) from Neurowear in late 2012. Soon afterward, I posted a Necomimi teardown on this blog.
After that, I turned two sets of Necomimi into new, brainwave-controlled animatronic accessories for the sizzling Hot Couture fashion show at the Crucible. These included a set of horns…
…and a pair of wings.
(You can see video of them in the show via the “Hot Couture” link above, and also here.)
Here are my notes from building the wings. If you’re doing something that only requires a couple of small moving parts, I highly recommend using Necomimi!
OCZ NIA & NeuroSky MindWave
I didn’t write about brainwave sensing for a while. I did buy an OCZ NIA (while I had a reasonably lucrative full-time job in support), to track my brainwaves while sleeping. However, it only works with Windows, and I’m not setting up dual-boot just for that… but I’ll soon be collaborating with a neighbor on this! I also picked up a NeuroSky MindWave—their Bluetooth-enabled, mobile-friendly headset—and started building a world in Unity that I could travel through with my brain. That’s still a work in progress.
Next came my artist residency at Instructables. I’ve been working on another animatronic project—but this time, I wanted to build it almost entirely from scratch. I’m still working on the animatronics themselves, but the EEG part is all done. I’m using a Pinoccio Scout microcontroller to slurp up the signal from a hacked NeuroSky MindFlex headset.
Here’s my “Mesh Your Brain” tutorial on getting the signal out of the MindFlex with Pinoccio. (If you haven’t been following along, Pinoccio is an open-source microcontroller, compatible with the Arduino, that has a built-in radio network and a rechargeable battery. This makes it great for wearables and remote-controlled robot swarms!)
And here’s my guide to making the MindFlex more comfortable and attractive (which, by its nature, includes a pretty exhaustive MindFlex teardown).
And… I think I might be driving up the price for these things, haha. At least ten people have gone out to buy NeuroSky headsets since seeing the EMF talk, reading the tutorials, or having a chat about best methods. So, if you want one too, you’d best jump on it!
EEG & You (FAEEGQ!)
So, here are the questions I’m most often asked about EEG hacking. (Largely compiled from my EMF talk and conversations with Behnaz Farahi. Thanks for the prompting, Behnaz!)
Q. What is the best EEG system for what I’m trying to build?
Here’s a quick rundown on the available consumer systems:
- NEUROSKY. I’m most familiar with these. Compared to the Emotiv and open-source systems, they are inexpensive and easy to use, but limited in scope. I consider them ajarware. These sets have a single forehead sensor, to pick up the brain activity, and a clip that sandwiches your earlobe between two metal contacts: a reference point for the current (to filter out sensor data caused by blood flowing, etc.), and a ground wire. The NeuroSky headsets detect “attention” (roughly corresponding to beta frequencies), “meditation” (~alpha), and—in some systems—eye blinks. “Attention” and “meditation” are normalized to a 0-100 scale. (I go into this more in my tutorials.)
- MindWave: A wireless headset with Bluetooth built in, which can talk to computers and mobile devices innately. You can build your own software for it without hacking into the set. It can detect eye blinks, which I think would be useful for switching “modes” if you’re controlling something. Uses a single AAA battery.
- MindFlex: A game system from Mattel, very popular among EEG enthusiasts. Several published hacks exist, most notably the frontiernerds tutorial (and accompanying Arduino library), upon which I based my Pinoccio hack. The hack doesn’t interfere with normal function of the game. The usual hack doesn’t get you eye-blink data, though that might be accessible if you do Darren Mothersele’s hard-mode one for the raw data. (You might want to do that anyway, since the normal reporting rate of the MindFlex is 1Hz, or one set of data per second. The raw data stream is much faster.) You can usually get these for cheaper than retail, via Amazon—although, as mentioned before, they’re becoming more scarce as people catch on. Often it makes more sense to buy the MindFlex Duel set, which nets you two headsets and might cost you less. It has a bigger battery pack: 3 AAAs.
- Necomimi: I put these under NeuroSky because they use the same chip and algorithm, although they are manufactured by a company called Neurowear and have additional programming added to make them move organically. Also has a “calibration” indicator mode. Has a biggish battery pack. Doesn’t do Bluetooth. But it’s great for wearables if you just need to modify a couple of sensors.
- MindSet: Haven’t used this. It’s like a MindWave had a baby with a pair of headphones and a mic. You don’t see it around much, these days.
- EMOTIV. I haven’t personally hacked on these; this information comes from research and personal conversations with Emotiv users and developers. Requires moist sensor contacts and more open head-space, and costs more, but gives you more information than the NeuroSky sets do.
- Epoc: The Emotiv set that most brain-hackers I know use, it reads 14 channels of data from different areas of the brain. Reports from others indicate that it’s about as reliable as the NeuroSky sets; it requires saline solution to provide good conductivity between your skin and the electrodes, which apparently makes for some connectivity issues. However, you get more information: reading from the premotor cortex, it can also detect mental signals for forward / back / left / right / disappear. I’d love to play with that last one! (Plus, it does eye blinks.) You have to hack it, or else spring for the SDK (software development kit).
- Insight: The pretty, new set, not yet commercially available, it comes packed with extra sensors that detect the physical orientation of your head, as well as eye blinks, etc. I got a look at the SDK for this one back in February, and even then, it was impressively responsive, powerful, and intuitive. However, you might have to drop a few hundo if you want the raw data. This guy isn’t shipping yet.
- OPEN-SOURCE. I haven’t used these, because I tend to focus on the higher-level function and don’t care so much about building my own custom system. Information comes chiefly from online research.
- OpenEEG: Oh, so you’re gonna build your own system, eh? I guess this is the place for you. They have parts lists and everything from the ground up. I’m not sure how the cost compares to pre-built sets like the MindFlex, since you’d be buying all the components on a small scale, unless you wanted to just go bananas and make like fifty of these.
- OpenBCI: You fancy! This baby has 16 channels and will set you back a few hundred. Also, it’s not shipping yet (you can preorder). But it’s ☆☆!!!open!!!☆☆
Beyond these, you have the Muse, the Melon, and other sculptured “lifestyle” EEG sets that I haven’t looked into much. Plus the NIA. And, of course, the heavy-grade stuff that universities use… but that’s beyond the scope of this FAQ.
Besides all this, I have a couple of friends who have developed their own systems. Be sure to check out the work of Jonathan Toomim (who’s doing some weird experiments with holding your breath) and Masahiro Kahata.
Aaaarrrrggghhhhhhhhhhh, there’s so much of this stuff! Next question!!!
Brain by Samuel Dion-Girardeau from The Noun Project
Q. You can read my mind?!
Noooooo. Commercial EEG rigs can pretty much pick up channels relating to premotor (directional) impulses, some mental-state indicators, muscle movements like eye-blinks, and little else. Even detecting “emotions” (happiness, sadness) is tricky. Granted, there have been studies with some other REALLY INTERESTING stuff: the P300 “recognition” spike, identifying objects out of a set, etc. But you don’t generally get that on a normal person’s salary.
Q. So, what can I do?
Figure out what the capacities of your headset are. Then, learn to tweak your brain’s activity to control those metrics.
For example, with the MindFlex, you have “attention” and “meditation” metrics. For me, these things elevate “attention”:
- Pick large numbers and add/multiply them in my head
- Write emails
- Listen to an unfamiliar song and try to transcribe the lyrics
- Visualize: if you have a readout or feedback of the current activity, will it to go higher.
And for “meditation”, it’s pretty much your standard meditation exercises:
- Close my eyes (A couple of my friends, Amanda and Pokey of AHA, made a recording of the frequencies present while Pokes opened and closed his eyes. Then, they converted it into sound. The difference is actually audible!)
- Breathe slowly and deeply
Note that the alpha and beta frequencies aren’t necessarily in opposition. When you’re both highly focused and highly relaxed, they may both be peaking. Then someone calls your name, and focus spikes upward, while relaxation shows a radical dropoff. Fascinatin’!
Brain by Anisha Varghese from The Noun Project
Q. Are you really controlling that thing with your brain? Or is it basically random signals and coincidence?
Of course, it’s a bit of both. Yes, I’m able to reliably toggle something on/off by setting a threshold (say, maintaining ≥80% attention) that corresponds to “on”. For beginners, it will be tougher. And there’s often a fair amount of up/down mobility in the numbers; the data are noisy, especially with the MindFlex, where you only have one channel.
Q. How can I increase connectivity?
This is a big problem with EEG devices. It can be difficult to maintain a good signal with the electrodes.
First, clean your contact surfaces. Wipe your skin and the electrode with an alcohol or saline wipe.
Then, apply something conductive. For the Epoc, make sure that the saline pads don’t dry out. They have to be wet. For other headsets, it still helps. here’s single-purpose conductive EEG paste available; or, you can add salt to some lotion or water and apply that.
Finally, make sure your electrode(s) are positioned correctly. Move ‘em around until you get something good. You may need to press fairly hard; even the commercial headsets usually leave a bit of a mark on my forehead, and the ear clips may hurt a bit after a while.
Q. Is it comfortable?
They’re designed for wearability, so they’re usually pretty comfortable… but both Necomimi and MindWave headsets have rigid plastic headbands that, in my experience, start to dig in after a while. (It’s pretty inevitable, since they’re supporting the weight of batteries and other hardware.) And as mentioned above, you’ll probably want to take off the ear clip after a while. I do recommend my comfort upgrade, which moves the weight down around your neck—where it’s about the same as a pair of noise-canceling headphones, and also looks a little more intentionally cyberpunk. :)
Brain by Blake Ferguson from The Noun Project
Q. Stumbling blocks?
I had the most trouble with the Necomimi wings. First, that headset got stuck in calibration mode for a long time, pretty much the entire time I was constructing the wings. So, I oriented the wings’ servos such that they would look good when that behavior was active. Of course, on the day of the show, suddenly the headset started working again… and the right wing decided to flop over to the left and stay there for minutes at a time, which looked pretty weird (although still passable).
Also, remember that you’re working with servos that are designed to support a load of light foam, close to the pivot point. I knew the wings were a bit of a stretch, so I used the lightest materials possible. Still, the left servo has given out since the show. If you need something more heavy-duty, build it yourself.
Besides that, conductivity. Always the conductivity!
Q. With the Arduino/Pinoccio hack: what should I use?
If you want your headpiece to remote-control hardware or wearables, or communicate with a computer, I highly recommend going with Pinoccio. It’s got this communication built-in, and has its own rechargeable battery attached, so you’re truly wireless.
If you’re only ever planning to be within USB-cable range of a computer, or you’re building a self-contained apparatus that won’t communicate with anything else, a plain Arduino Uno will work just fine.
Brain by SuperAtic LABS from The Noun Project
Q. What’s the data stream look like? Can it be smoothed?
Normally, it’s at 1Hz, and it jumps around a fair bit. Behnaz asked about this and ended up using the VarSpeedSevo library. It sounds like that’s going really well. I also suggested a couple of rough hacks that took the difference between the old value and the new value and moved between them in increments (basically the same as adjusting the servo speed), but this would of course introduce lag as well.
You can get faster data reporting with Darren’s raw-data hardware hack.
Q. Can you use this to control your mind?
Not directly. It’s super useful for getting feedback, which is of course instrumental in voluntary mental exercises. You might have heard of transcranial direct-current stimulation (TDCS), which takes about 15 minutes to set in and can help people focus… or its alternating-current equivalent (TACS), which was recently in the news as a means to induce lucid dreaming… or even transcranial magnetic stimulation (TMS), in relation to mood control. But all of these involve passing electromagnetic stimulation into the brain. Anything you do to yourself with these EEG headsets is a self-induced change; it’s simply a method of measuring what’s going on in there, from the outside signals that make it through the skull.
Brain by Eric Bird from The Noun Project
http://frontiernerds.com/brain-hack – Has become the standard Arduino + MindFlex hack.
https://github.com/kitschpatrol/BrainGrapher – A Processing sketch to accompany the frontiernerds tutorial: it graphs the EEG data in real-time.
http://darrenmothersele.com/blog/2013/10/07/mindflex-raw-eeg-data/ – A more in-depth physical MindFlex hack that gets at the raw data stream.
http://hackaday.com/tag/eeg/ – Hackaday is smitten with EEG mods.
And two awesome projects—weirdly, two of my friend-groups independently decided, this year, to build giant brains with LED patterns controlled by EEG data. Great minds blink alike?
https://www.indiegogo.com/projects/dr-brainlove – This one went to the playa.
http://thinktank.uchicago.edu/ – This one operates out of UChicago, traveling the world for education!
I’m going to go ahead and publish this now, since there’s another talk tomorrow and I’d like to have this available as a reference. I may update it later, though, with more info for y’all. Happy hacking!