Real Time Brainwave Clustering & Recognition

Alexander Chen, Jason Huang, Raymond Lo

Date: Aug. 1, 2011

Note:This project was done prior taking any course in machine learning.

One of my many dreams as a kid was to have super power like those heroic cartoon characters on TV. In particular, I have always wanted to move things simply by ‘thinking about it’. For example, I want to turn off the lights just by think about it, get food from the fridge to my table just by thinking about it.

When Prof. Mann introduced to me the Neurosky EEG chip, my dream have come true. After hacking around around with the chip, we were able to perform mind control on RC cars, lights and interactive games. The experience is wonderful. With most of these projects, we basically use the value of concentration and meditation as our main control variable.

In order to do more, we need to extract more information from our own brainwave. We need reliable signal that are unique and easy to control with. If you can find such signal, then we can do more complicated mind control on more objects. With this thought in mind, I walked in the world of machine learning and never stop learning it ever since.


This project uses Neurosky EEG chip to process my own brainwave in real time. We built the essential electronics and software to communicate with EEG chip ourselves and then I implemented machine learning algorithm hoping to find new stable signal to enable us more control in future EEG applications. To make this application real time, the whole project is written in C along with OpenCV and CUDA library.

Parsing Real Time EEG Data

By putting one electrode on the forehead and one electrode on each ear, we can successfully read stable brainwave signal via EEG chip. We use Arduino to take in these sensors values and interpret it according NeuroSky API on a standard computer. We applied all sorts of signal processing and transformation method, and I used them as feature hopping to do machine learning algorithm to extract more information out of it.

Unsupervised Learning: K-mean Clustering

K-mean algorithm is an unsupervised learning algorithm that can look at all the features in the data set and hard assign all data in k different groups base on how close they are to each other in n-dimensional space. This algorithm is not probabilistic therefore can run sufficiently fast in real time application.

Training: Naive Bayes Algorithm

After we sorted out k different groups with K-mean clustering algorithm, we used the separated data sets to train our classifier. Naive Bayes learning algorithm become our number one choice because of its simplicity and efficiency. With the algorithm trained, we can efficiently classify brainwave in real time.

Result & Analysis

The project is very successful in terms of the engineering and integration between hardware and software. The training speed and classification speed is very fast since both algorithm was implemented in c. However, it is not easy for us to find relationship between our classified brainwave and human thoughts. Since this project was implemented without any machine learning training and knowledge at the time. The algorithm was fast, simple and naive. If I have a chance to revisit the problem in the future. I will probably use more sophisticated algorithm such as deep belief net for clustering and svm for training. And will probably use existing machine learning brainwave data sets as our bench mark instead of collecting my own.

Show your support

Clapping shows how much you appreciated Alex Chen’s story.