AAR Final Wrap-Up

Several months ago, I decided to take a class that would change my perception on technology and the human brain. If you did not already see my research proposal, then click here to read it first. After months of hard work and dedication, I finally finished my project. The ability to display brainwave data on a smartphone.

My Initial Plan.

aar8I first created a plan with my mentor Matt Yun. In the AAR program, every student is paired up with their own mentor in that specific field. Lucky for me, my mentor already had previous experience with brainwaves and EEG headsets.

My plan was to find a way to extract the data from the Emotiv headset. After doing so, I would devise a way to send the brainwave data to a server and receive that data on a smartphone. But for any high schooler, this was not an easy task to do with the amount of work given to students in school.


I had an idea to go with my friend to a Treehacks, Stanford University’s official 36-hour hackathon. A hackathon, or an event in which a large number of people meet to make all sorts of creative projects out of code, would be the perfect place to work on this project. Unfortunately due to age restriction, we were not even allowed to attend.

After being kicked out of the hackathon, we got some Jamba Juice, ordered a pizza and started hacking in a Starbucks on the Stanford campus. What only felt like a few minutes, was a few hours. It was 10pm. Starbucks was closing and I still was finding a way to hack the Emotiv headset. I needed to come up with another plan.

Plan B.

After asking my mentor for some advice, I tried playing with the Emotiv headset a few weeks later. My main challenge was to find a way to decrypt the data being sent from the Emotiv. After a few days of playing with Python and bash scripts I finally was successful enough to see the raw stream of data being sent to the computer. I had just conquered my biggest challenge of all.

2016-06-27 at 9.58.25 PM

Completing half of the project gave me the inspiration I needed to finish this project. I texted my friend to meet me at the library and we moved on to the next phase of the project. All I needed to do was find a simple way to send the data from the computer to an iOS device. I used ngrok, or a service that creates secure tunnels to localhost. Then an iOS app was created so that the user could open it and receive the information sent from the computer. After receiving the data on the iOS device, I parsed it into JSON using Alamofire. Lastly, I formatted the data into the app.


The Final Steps.

After finishing the app, I did some more research to give the raw data some purpose. The few months of hard work was worth it. I had done it. I finished it. If you want to read my complete project, click here.


Research Proposal – Measuring Brainwaves and Monitoring Behavior

Hey everyone! I will be starting a new project for a my Advanced Authentic Research class in school. I am going to be sharing updates as I continue working on this project.

Research Question

How can an application that measures emitted brain waves give feedback based on a person’s behavior?

Background and Significance

Hans Berger
Hans Berger

Brain waves, or neural oscillations, were first observed by German psychiatrist Hans Berger in 1924. Brainwaves are vibrations emitted from the brain when neurons communicate with each other.

There are several types of brain waves, and each type of wave is used in different circumstances. When we are tired, slow, sleeping, or dreaming, we are emitting oscillations with low frequencies. When we are awake or alert, we emit oscillations with higher frequencies. According to Brainworks Neurotherapy, the different types of brain waves can be categorized according to their frequencies into four groups: delta (.5 to 3 Hz), theta (3 to 8 Hz), alpha (8 to 12 Hz), beta (12 to 38 Hz), and gamma waves (38 to 42 Hz).

Brain Wave Patterns
According to Brainwave College, these waves are very important because they represent the activity that is occurring in the brain. But the waves don’t only represent brain activity, they can also determine the brain’s behavior. Brain stimulation can alter the patterns of brain waves thus changing the state of mind. An alarm clock is an example of brain stimulation because it is changing delta waves into beta waves (an asleep to awake state). Medications or recreational drugs are the most common methods to alter brain function.

Developed by Hans Berger, Electroencephalography (EEG) is a human-made method to track brain activity without affecting the subject. By placing several electrodes nodes on the scalp of a person, the EEG is able to detect voltage fluctuations of the person’s brain. According to WebMD, this is commonly used by medical professionals to monitor the depth of anesthesia and diagnose epilepsy, catatonia, and seizures. This method of detecting brain waves is extremely uninvasive unlike Electrocorticography, which requires electrodes to be placed on the surface of the brain instead of the scalp.

The device that I will be using to measure brain waves is the Emotiv EPOC. According to Emotive EPOC Product Specifications, the device is a scientific contextual wireless EEG system that has 14 EEG channels and 2 references. Using this device, I will be able to receive brain wave data from the Emotiv which can then be parsed through the server.

Emotiv EPOC headset

Research Methodology

The first step of the research will be to establish a way to attain access to the raw stream data from the Emotiv EPOC headset. For this task, I will be using “EmoKit”, which is an open source driver created by the OpenYou Organization.

Emotiv Wave Graph
Emotiv’s data visualization software.

Next, I will need to create a mechanism that can parse the data received from the Emotiv to the server. For this I will use Node.js, which is a Javascript Runtime for developing server-side web applications. With Node.js I will be able to receive data on any device, whether it is a browser on a computer, or an app on an iPhone.

After the Emotiv data is synchronized on another device, the data can then be used to construct a graph for the front-end user to visualize. To construct graphs, I will use a third-party library (not decided yet). Another feature that this project will incorporate is to be able to analyze the data and trends, so that the application give feedback based on the data. The app will also have an appealing user interface and experience for the website and iOS app. Finally, this project will be published on a website, uploaded to the App Store, and open-sourced.

Human Subjects

Humans subjects will be used in this project. With human trails, I can get the data of different individuals to test the application. I will be filling out the HASRC application form to ask for permission to use human subjects in my project.


“What Are Brainwaves?” Brainworks Neurotherapy, n.d. Web. 08 Dec. 2015.

“Why Are Brainwaves Important?” Brainwave College, n.d. Web. 08 Dec. 2015.

“Electroencephalogram (EEG) Test to Measure Brain Electrical Activity.” WebMD, n.d. Web. 08 Dec. 2015.

Brain Computer Interface & Scientific Contextual Eeg. Emotiv EPOC (n.d.): n. pag. Web.