Ever wanted to visualize your brain activity in real-time? Move an object on a screen with your mind? This tutorial shows you how to make a recreational EEG beanie that turns brainwaves into light, using a microcontroller, LEDs and a special chip that processes brain activity. It also demonstrates how to use the hat to control audiovisual interfaces in Processing.

To make this toy EEG device, I connected the ThinkGear ASIC Module (a chip from Neurosky which processes real-time brain activity) to an Arduino. The custom Arduino firmware then converts these brain signals into light of different colors, intensities and brightness, which change according to the mental state of the wearer. Neopixel LEDs are integrated into the hat's pompom, however if you prefer you can place LEDs elsewhere on the hat, or on an accessory (for this you will need to include bluetooth). All the small electronic components are hidden in the fold of the hat, so it looks and feels as though you're just wearing a comfortable beanie.

The finished hat:

...and here's a video of the testing of the hat (before putting the LEDs into the pompom and securing the battery onto the hat yet, hence the hanging wires).Turn on the captions for explanations!

Connecting the beanie to Processing

The Arduino is easily accessible via a micro USB connector hidden inside the hat´s pompom. This allows you to create live interactive "brain art" with the hat, using a programming language such as Processing. Simply connect the micro USB on the pompom to your computer´s USB port, and import the real-time serial stream into Processing (or wirelessly if you make the hat with bluetooth). Then customize your Processing sketches so that the levels of "attention" and "meditation" control the sketch variables (such as color, opacity, movement, coordinates, rotation speed, etc). To get you started, I've included in step 13 the snipet of the Processing code you will need. There are endless possibilities: you can draw, write words, control moving blobs, play games. Here are two simple examples, full screen in HD for best effect!

Fly a bird using your brainwaves: In this example, the real-time amount of "attention" controls the vertical flight of the bird. The more I concentrated, the higher the bird flew. It takes some training to get used to it! You could also control, if you wanted, the speed of the wings flapping, or the trajectory of the flight, etc. Script was adapted from the original sketch by Liana.

Brainwaves controlling the color of a blob: In this example, the real-time levels of "attention" (green) and "relaxation" (turquoise) control the color of the blob.Script was adapted from the original sketch by Oggy.

Enjoy building your brainwave hat! If you know teachers or classrooms who would love to make an EEG hat, please share this project!

If you write about this project, thank you very much for sharing, and please link to this instructables tutorial.

Step 1: A Bit of Science

How can we measure brain activity using a wearable hat?

Electroencephalography (EEG) is the measurement of neural activity through sensors (electrodes) placed against the scalp. These electrodes can measure the tiny electrical changes that occur when neurons fire. By amplifying these signals through a computer, we can observe a person's brain activity in real-time. Here is a great video that explains the fundamentals of EEG (University of Waterloo):

Cleaning up the signal

When a brain signal is recorded from a person's head using EEG sensors, it picks up a bunch of information other than brain signals: muscle and eye movements from the person, and especially interference noise from that old refrigerator in the corner of the lab. Before the brain signal can be interpreted, we need to clean it up or "pre-process" it: filter out the noise, remove all the muscle, eye movement and blinking from the signal.

We then do a couple of other mathematical manipulations with the data to estimate the amount of different brainwaves by frequency of their oscillations (there's not only one type of brainwave). Neural oscillations can thus be classified into "frequency bands": Delta (0-4Hz), Theta (~4-8Hz), Alpha (~8-12Hz), Beta (~12-30Hz) and Gamma (>30Hz).

In research experiments, the signal cleaning is done manually after the experiments, using special software. Commercial EEG headsets contain chips that pre-process the signal in real-time. This tutorial uses Neurosky's ThinkGear™ ASIC Module, which filters out HF noise and muscle movements from the real-time brain signals, and applies custom algorithms designed by Neurosky to detect approximate levels of "relaxation" and "attention", as well as the levels of delta, theta, low alpha, high alpha, low beta, high beta and gamma waves.

Interpreting the brain signal

Now that we have cleaned up the brain signal, we can start to interpret it. Changes over time in the levels of the different frequency bands reveal important information about the mental states of a person, for instance: if they are asleep, concentrating on a difficult mental exercise, relaxing, have their eyes open or closed, etc. Certain brain signals can also be indicative of clinical conditions (epileptic seizures or sleep disorders).

In a typical research experiment, the EEG is recorded and then averaged for each participant (over many, many trials), for a large group of participants. Scientists study recurrent patterns of neural responses to visual/auditory/multisensory stimuli to understand how the brain processes and encodes information. For example: based on a person's EEG, can we predict whether they are looking at a photo of Times Square at rush hour or an eagle flying against a blue sky? It appears that we can, by the way.

Brain-computer interfaces

Recurrent patterns in brain activity can also be used for writing algorithms for brain-computer interfaces (BCI). A brain computer interface is a computer system that allows a person to control an object using only their brain. Several BCIs are currently being developed to assist persons with restricted mobility and/or communication, allowing them to write or control objects on a computer screen. Two methods commonly used in developing such BCIs are motor imagery (imagining that you are executing a specific body movement) and the P300 event related potential (a positive change in voltage that roughly starts around 250ms after stimulus onset). A few spelling systems use these methods to allow people to communicate with their brainwaves. However, they require substantial training and they don't allow us to simply think of words and subsequently see them appear on a computer screen. The easiest signals to use for controlling objects with a BCI would be facial muscle activity, which is detected by sensors placed in the frontal area of the head. These signals are easily recognizable (left/right eye movements, blinking, jaw movements, clenching teeth, etc). There's a lot of exciting progress being done in BCI research. However, keep in mind that BCIs do not (yet) allow us to do "mind-reading". The closest thing I have seen to "mind-reading" would have to be this very cool experiment conducted at Berkeley, using fMRI (not EEG).

University of Minnesota's mind-controlled quadcopter:

Portable EEG vs Clinical/Research EEG
EEG equipment used in research labs and hospitals provide robust, high quality recordings of brain activity. Unfortunately, the wires connecting the headset to amplifiers restrict the mobility of the wearer. Wireless EEG headsets are easy to put on and nowadays many of these use "dry" electrodes (electrodes that don't require gooey gel or saline solution). The main limitation in using portable EEG devices for research purposes is the spatial & temporal resolution (1-14 electrodes; average sampling rate 128 Hz), which is nowhere as good as that of research EEG headsets (32-256 electrodes; sampling rates up to 20 kHz). This means that it is much more difficult to extract and accurately map the source of a brain signal with a portable device than it is with advanced equipment. Also, in a portable device the signal is more noisy as there's a lot more muscle activity due to the person moving around (even though a lot of the noise is filtered out during signal pre-processing). However, even with lower resolution, portable EEG headsets provide accurate readings of frequency band power, and can be used for different applications such as developing simple non-invasive brain computer interfaces, and for certain clinical practices (neurofeedback). Wireless EEG headsets are fairly recent, and their efficacy will improve along with technology.

  • Research/Clinical EEG systems: EGI, Biosemi, BrainProducts, G.tec
  • Wireless & portable EEG devices: Emotiv, IMEC, Muse, Melon, Neurosky
  • Open Source EEG: OpenBCI
<p>impressive instructable ! very very well done !</p>
<p>Wow that is crazy awesome looking! I love more and more things are being done with brainwave, especially as better and better sensors are becoming cheaper. Thanks for sharing!</p>
<p>This is brillant ! I love the concept and the design. Thanks for sharing !</p>
<p>Thanks :)</p>
<p>Hi! your .zip folder seems to be missing a lot of headers. do you have</p><p>#include &lt;Board.h&gt;</p><p>#include &lt;BoardManager.h&gt;</p><p>#include &lt;NeoPixels.h&gt;</p><p>#include &lt;LowFreqOsc.h&gt;</p><p>#include &lt;Devices.h&gt;</p><p>#include &lt;LightController.h&gt;</p><p>#include &lt;ModeSwitch.h&gt;</p><p>or a link to where they are available online?</p>
<p>If you could reply as soon as possible that would be excellent, as I have a student who would like to complete this project by this coming Friday. (She has all hardware completed and most code, except for the missing libraries.)</p>
<p>Does anyone know what wires the author uses for the EEG and reference pins in this picture(on the left side)? </p><p>https://cdn.instructables.com/FIO/M8RI/I155Z0S7/FIOM8RII155Z0S7.LARGE.jpg</p>
<p>Hi, I don't have the answer to your question unfortunately, but I do have a question for you; do you happen to know where some of the missing libraries are in the .zip file? (see the original comment I posted)</p>
<p>Have you selected the proper board in the board menu?</p>
<p>I am using an Arduino Uno and I selected that, so yes. My issue is that some of the libraries needed weren't in the .zip download provided.</p>
<p>How amazing really thank you for sharing this great work with us , we would like to make this project and try it in our unversity ( we have few questions &amp; we have sent you an email at illumino.eeg@gmail.com‬ )</p><p>hope that you can help us .<br><br>This was really brillant ! Thanks for sharing !</p>
<p>What Reference electrode use for?</p>
<p>Thanks for sharing! i make it out by hacking Necomimi.</p>
<p>Awesome! Feel free to share photos of the hat you've made with us (email: illumino.eeg@gmail.com)</p>
<p>This is like one of the coolest things ever. I want to make it but I'm afraid that I would spend a bunch of money to buy the components and then screw it all up.</p>
<p>wow! really that was such a nice 'ible</p><p>but that EEG part is tricky to find in india</p>
<p>So awesome :) ! And looks really cool in action!</p>

About This Instructable




More by wavelet_spaghetti:CopperFill Steampunk Bluetooth Lamp Beanie Turns Brainwaves into Light 
Add instructable to: