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