Welcome to my page. My name is Karina, and I am a rising senior at Castilleja School. Over the past six weeks I have created an exploding star color organ and an EEG. You can read more about the exploding star color organ and the process I went through to create it at the bottom of my page.

Bill of Materials

Code for EEG

Final Project: EEG

An EEG is a test that detects electrical activity across the brain. The specific EEG that I built detects alpha waves – which are waves found when one is conscious and relaxed. They are generally between 8-13 Hz, which is why the circuit I built (and the code I used) is catered to picking up a signal within that frequency. The circuit has an amplifier and various filters that are used to get rid of unwanted noise created by outside causes.

The circuit begins with an instrumentation amplifier which takes as its input 2 voltages, and outputs the difference between the two – then multiplying the difference by some gain. The instrumentation amplifier chip helps change the gain by altering the value of the resistor between pins 1 and 8 (Aside: The active electrodes are connected to pins 2 and 3 of the instrumentation amplifier chip). Next, the data is pushed through a 60 Hertz Notch Filter. We push it through a 60 Hertz filter because the biggest source of noise in this system will be at 60 Hertz (because of interference from the power line). We use this filter, as well as a couple more to cut out as much interference as we can before applying more gain.

Next, the signal is pushed through a 7 Hertz high pass filter. As we are measuring data across the skin, our final data will also contain voltage from the skin on the head of whomever is being measured. This can obscure the brain data that we want – but we can filter this out using the 7 Hertz high pass filter because the interference is mostly low frequency. This filter is a 2-pole high pass filter that has a cutoff frequency. As it is a high pass filter, frequencies above this cutoff will approach a gain of 1, while frequencies below will be continually reduced.

Next, the signal is pushed through a 31 Hertz Low Pass Filter. This allows us to filter out data above the frequencies we are interested in analyzing. Next, the data and signal pass through a 1 Hertz High Pass Filter and Gain. The beginning of this circuit contains a high pass filter with a cutoff frequency of 1 Hertz. On the other end, the resistor and capacitor in parallel provide some extra filtering of high frequencies. The potentiometer is a variable resistor which means that when the input is connected to the first pin and the output to the second, turning the wiper changes its resistance linearly from 0 to 1000 ohms. The potentiometer allows you to adjust so that such that voltages don’t go offscreen. This is because a potentiometer works like a resistor would work. By twisting the potentiometer in one direction, we get a lower resistance, while twisting it the other direction would get a higher resistance. This allows us to add just a little bit more resistance to the circuit – which keeps the frequency that we are capturing in the window that we want on the computer. Next, the data and signal are pushed through a final 60Hertz Notch Filter. Even with all the previous filtering stages, the data will still at this point contain a good amount of 60 Hertz noise. To fix this, the data this one last filter.

The reason why we use both high and low pass filter’s, is because we want to eliminate unnecessary data – there is a certain frequency that the waves we are reading are within. By filtering out frequencies above and below that we can focus on and get a clearer look at the frequency we want (this allows us to get more interpretable data).

Finally, the data goes into the computer. Using a USB stereo adapter and an auxiliary cord,  I was able to transfer the signal from the circuit into the computer. Using a coding software called “Processing,” I was able to display the alpha waves that I was seeking. I could tell that it worked because when I closed my eyes, the signal would change to a different frequency – which was what was expected as the waves received should be different in a resting state. The code I used I found online – I spent a lot of time configuring the code using a debugging software called “Debug Mode – For Processing” to make sure that it ran correctly with my specific computer and circuit. The code also had some errors and so I used the debugging software to pinpoint them and alter the code.