loading
EEGs are a noninvasive way to look into your brain. While the brain is extremely complex, areas of it can lock into circular firing patterns, resulting in telltale brain waves that one can observe with the right equipment. Intensity of these waves change depending on your internal state. The waves we will be most easily able to distinguish are alpha and beta waves -- alpha waves occur at around 8-12 Hz and when measured from the frontal lobe provide an estimate of how relaxed a person is, while beta waves are around 12-30 Hz and correspond to how much a person is concentrating or how alert they are.

The concentration of each wave can also tell more specific things about your thought patterns depending on where you measure them from. For example, alpha concentrations on the left motor cortex increase when you think about moving your right hand. Regardless of where you're taking measurements, looking at the concentrations of waves in real time - a process called biofeedback - can give you much greater control over them.

This tutorial is an in-depth guide on how to make your own simple EEG circuit. Along with monitoring brain wave concentration, the final circuit can also be used as an ECG, as a way to see your heartbeat trace. The circuit will use 3 electrodes - 2 to measure a voltage difference across your scalp, and one as a reference to ground. Depending on how many parts you already have, the circuit could only set you back around $10.

The aim for this project is to be easily available and understood by people of every technology background. For those electronically savvy, I will include up front a finalized schematic so you can jump right into making it yourself. For those that want more guidance, I will include a detailed description / explanation of every section of the circuit, showing you what it does and why you need it. 

Then, I'll move onto the software (Processing based), which is a very important piece in actually interpreting the raw data you receive.

So - let's start!

Step 1: Parts

I purchased most of my parts from Digikey (and Amazon). Their layout might seem slightly intimidating at first glance, but they seem like the cheapest place to get parts. And they have the USPS first class shipping option ( < $3 for small orders, choose this! It will save you a lot.), meaning you don't have to spend the same amount on parts as shipping, as it is on some websites. 

Chips:

- 1x Instrumentation Amplifier - AD620AN - This is the most expensive, and most important part. While technically you can make your own instrumentation amplifier from 3 op-amps, I could never get my own to give me good results. Precision cut resistors in this ensure that it'll do its job.
- 2x Quad Op-Amp - TL084CN - Any Op-Amp will do. You need 5 single amps, this one just includes 4 in each chip.

Capacitors: 

I would strongly suggest buying a capacitor bundle from ebay or the like, espcecially if you plan on ever doing some other sort of electronic project. One bundle and you're basically set for life. Regardless, whether you buy them in a pack or individually, make sure to include these capacitors :

- 1x 10 nF, ceramic
- 1x 20 nF, ceramic
- 1x 100nF, tantalum
- 5x 220nF, tantalum
- 1x 1uF, electrolytic
- 2x 10uF, electrolytic

Resistors:

Same as capacitors, I suggest a bundle. This is a very good one, has all the values you need (minus the potentiometer). The individual values you'll need, though, are:

- 1x 1kΩ Potentiometer - via Digikey - very useful to adjust your gain on the fly.
- 2x 12Ω
- 1x 220Ω
- 1x 560Ω
- 2x 22kΩ
- 1x 47kΩ
- 2x 100kΩ
- 2x 180kΩ
- 1x 220kΩ
- 2x 270kΩ
- 1x 1MΩ

Connectors:

- A breadboard to wire everything on. This one is large enough, and comes with useful jumper wires. I suggest saving the jumper wires specifically for connecting the various stages of the design. This will make it very modular, and easy to reorganize/reorder if you end up needing to.
- Wires for everything else. I like that pack, since it's pre-cut and keeps your board tidy. You can also get plain wire and cut it yourself.
- 3.5mm audio cable.
- 2x 9V batteries for power.

Electrode Supplies:

- Ambu Neuroline Cups seem to be the most cost-effective method, found here. Thanks to user jonencar for the link in the comments.
- electrode gel
<p>Hey guys, so I, unlike most of the people who completed this seem to have done, did this project on a breadboard. After everything is said and done, it seems to work. When I run the code, i can make the graph spike and jump mainly by shaking my head or occasionally when blinking eyes. It seems that the gain on my model is not high enough, as beta waves (i.e. when shaking head, moving eyebrows, etc.) show up strongly and alpha waves are hit or miss at best. I'll go back and check my circuit to make sure it was all done correctly and such which may address the problem. That being said, assuming I made no egregious errors, the graphs you will see will not look like the image provided in all probability (at least not on your first few go-arounds). The waves were not nearly that defined for me and they looked to be generally like a series of arches that specific data points, and, for me, the bars on the bottom did not really move. Whether it was an issue with the code or my setup, I'm not sure. That said, I did some extensive testing on this system and it does indeed do what it is advertised to do and I made sure that it was indeed brainwaves that were being measured and not random interference, albeit not at the same advertised resolution, at least for now. </p><p>Something very useful I found out: if you have access to a 3d printer at your university/school or anywhere else, I suggest using it. I used 3d models from a company called OpenBCI, which is an open-source BCI company that allowed me to use their models for free to create this headset. It improved comfortability and increased accuracy of electrode placement a hundred times over, and I would advise attempting it if you have such a thing at your disposal. Overall a great journey. I'm planning on improving this one and hopefully moving on to a better version later on by applying some upgrades of my own that I've been formulating. Good luck to anybody attempting this, the instructable was missing a few things (i.e. working code and had some ambiguous statements at times), but it was solid overall, especially for one of such length. If anybody is curious, this guy, Marquis de Geek made some great improvements to the code if you're not one of those people who can code well, and his version seems to work well. here's the link: <a href="https://github.com/MarquisdeGeek/EEG" rel="nofollow">https://github.com/MarquisdeGeek/EEG</a></p>
Hello sir. .. i really appreciate your kindness and for distributing knowledge among people . ..<br>Please. . I just want to do another experiment. . So I just want to detect the signal. .. so can the signal after amplification be detected by the regular oscilloscope? <br>Thank you very much sir
<p>It depends on several factors, but, in short, not really. Of course it is entirely feasible for you to switch out that 560 ohm resistor for another to increase the gain (all the way up to 10,000 if you felt like it, following the specifications of the instrumentation amplifier and the formula provided to determine the gain) and it would be then entirely possible to read it on an oscilloscope, provided your scope had the proper specifications (bandwith, min/max input voltage, etc.). The problem I foresee here though is that these filters that are included are entirely necessary for a few reasons. Even if you have built-in low and high pass filters on you oscilloscope to satisfy the Nyquist Criterion in order to even read the frequency spectrum, you still willl invariably need that 60 Hz noise filter. Let me provide an example to show you what I mean. If you read a signal of say, 12 microvolts, then amplify it 10,000 times, but you don't remove any of the noise, you've amplified the ambient voltage from your lights and your computer, and whatever nearby electronics there are, also by 10,000 times. So, if you went to read the signal then, you would only see random fluctuations of ambient noise and you would have much less signal than you do noise, so chances are you wouldn't see any noticeable movement based on what you were thinking or doing with your body from the eeg signal, because your noise was amplified so much it was covering up any signal you may be trying to measure. But, if we do it as above, providing a small pre-amplification, then filtering out noise (like 60Hz electrical hum), then amplified the signal the rest of the way to whatever your desired amplification is, you will only have amplied your signal (at least in an ideal circuit) and you could easily measure that on your scope.</p>
<p>It depends on several factors, but, in short, not really. Of course it is entirely feasible for you to switch out that 560 ohm resistor for another to increase the gain (all the way up to 10,000 if you felt like it, following the specifications of the instrumentation amplifier and the formula provided to determine the gain) and it would be then entirely possible to read it on an oscilloscope, provided your scope had the proper specifications (bandwith, min/max input voltage, etc.). The problem I foresee here though is that these filters that are included are entirely necessary for a few reasons. Even if you have built-in low and high pass filters on you oscilloscope to satisfy the Nyquist Criterion in order to even read the frequency spectrum, you still willl invariably need that 60 Hz noise filter. Let me provide an example to show you what I mean. If you read a signal of say, 12 microvolts, then amplify it 10,000 times, but you don't remove any of the noise, you've amplified the ambient voltage from your lights and your computer, and whatever nearby electronics there are, also by 10,000 times. So, if you went to read the signal then, you would only see random fluctuations of ambient noise and you would have much less signal than you do noise, so chances are you wouldn't see any noticeable movement based on what you were thinking or doing with your body from the eeg signal, because your noise was amplified so much it was covering up any signal you may be trying to measure. But, if we do it as above, providing a small pre-amplification, then filtering out noise (like 60Hz electrical hum), then amplified the signal the rest of the way to whatever your desired amplification is, you will only have amplied your signal (at least in an ideal circuit) and you could easily measure that on your scope.</p>
<p>hello sir :)</p><p>please i have a question --</p><p>why a lot of these kind of circuits they use a/d converter and then present it on pc ?</p><p>can they use an oscillator like ( usb oscillator ) like this ---</p><p></p><p>im waiting for your answer :) thank u for ur kindness ..</p>
<p>Hopefully, I'm understanding your question correctly. As far as why many of these types of circuits use an ADC, the reasoning behind this has to do with optimization for more complex circuits. While, in a simple EEG setup like this one, an analog cable such as the 3.5mm one used here is fine for relaying the data to the computer, but in larger systems it's not as efficient. In systems with, say, 16 channels, you would use an analog multiplexer to to read and pass all of these various signals to your high-speed ADC which would then allow you to pass it all at once through a bus (like a USB) to your computer which can then read it all without the need for the added complexity of keeping your analog signals isolated. Though there's not much reason to build this section yourself, both for the added complexity and cost as well as decreased reliability, and you could easily accomplish this by passing your signal into a pre-built micro-controller like an Arduino or something and hooking that straight up with a USB to your computer. I hope that answers your question.</p>
<p>If we do the helmet, do we need to use the gel anymore?</p>
<p>no you don't need the gel anymore if you go the helmet route, the electrodes are dry electrodes. They run slightly more expensive, but are definitely worth it.</p>
<p>Dude! The helmet is way wicked cool! A true brain bucket! I'm probably going to use the ole &quot;silver spoon&quot; technique for style -- but that sci-fi lookin headgear is making you the envy!</p>
<p>hello sir -- please if we put a voltmeter directly after the first the ad 620 an .. how much the voltage would be ?</p>
<p>Can we know more thing thing then just the relaxation state of a person with this.</p>
<p>I would like to be someone's subject and have my brain readouts send to me via email explaining what they mean. I know that I don't have the know how to even understand how to build one of these devices myself or the time to do so I would like to have someone do it for me and be their test subject so I can learn more about how my brain functions. Anyone interested please let me know.</p>
<p>Hi,</p><p>It took me some time to build this complex amplifier so nicely described in this initial post.</p><p>My electronic is powerd with 2x9 V bateries. </p><p>One non-significant change : the readout is using ADC to digitize the wave forms, sampled at 200 Hz (MAX144), FFT is done on the computer.</p><p>On the qualitative level my setup looks like it is working - at least I see on the scope a stream of pulses in the range between few to ~30 Hz </p><p> with the amplitude of ~50 mV. When I blink (or touch the electrods) the pulses goes over the scale (exceed few V).</p><p>So far so good - my problem is I can't find the alpha waves ( 5-10 Hz) lasting for at least a second.</p><p>I have tried many electrodes locations, ask the human subject to close the eyes, concentrate, then open the eyes - there is no discernable change in the wave form patterns.</p><p>Attached is PDF with more details:</p><p>- location of electrodes,</p><p>- FFT amplitudes for a 40 seconds long measurement (2D plot)</p><p>- examples of raw wave forms with closed &amp; opened eyes (two 1D plots)</p><p>Perhaps someon sees what I do not see? A mistake in electrod location, a pattern ?</p><p>I'd like to turn on a LED with my thoughts - but I do not see how to controll with my though the brain waves which I measure.</p><p>Any advice is welcome</p><p>Thanks</p><p>Jan</p>
<p>hey jan,did you figure out how to control led using brain waves?if so please share.Thanks</p>
<p>Hi, what did you use to read this code? Please let me know, I am having trouble using processing to read the data...</p>
<p>It was half year ago I stopped playing with my EEG setup. What exactly are you asking for? What code are you trying to read? What kind of trouble? What is the error message you see? On what computer, OS?</p>
<p>Hello Jan,</p><p>Just wondering how you got the code to work. I have built the amplifier but the code seems to have errors for me, I have fixed the line in issue and such but in the section which shift the input and makes the final collected data 0 has a error which i do not know how to fix. I am new to coding and have spent many weeks trying to learn but I cannot seem to solve this issue. </p><p>Any advice from anyone would be great as I really want to make this project.</p><p>Thanks</p>
<p>Hi Atah,</p><p>well, I have not even tried to run the Matlab based code. Instead, I connected the output of the last stage of the EEG amplifier to an ADC (MAX144), who's I read in using Rasppebry Pi. I wrote a C/C++-code for Rpi reading ADC via SPI interface and used Kiss-FFT code for the real time FFT.</p><p>This is rather different path than suggested in this tutorial. Not sure what would be the best path for you w/o knowing what is your background.</p><p>Thanks</p>
<p>sorry do you mean the processing based code. I just cannot seem to get anything to work and I would really like to it to be honest. I am not new to circuits but coding is really new to me. I just want to see some response from the circuit that I have built to be honest. I was thinking you may have debugged the code given to read the EEG through the soundcard. I am new but I have really tried my best to figure it out but there is a section which seems like its missing a lot of stuff. </p><p>It would seem that you have a much higher background in coding than me as I have really only started this past year. So the best way to describe it is that i am quite a newby to this. </p><p>Thanks for the response and I appreciate your help</p><p>atah </p>
<p>Hi Atah,</p><p>looks like the last common element in your and my step is the output of EEG amplifiers. What I see looks like at the bottom of my PDF - the wave forms vs. time. Perhaps you could connect your output to an oscilloscope and verify you see similar shapes? Alternatively, you could connect EEG output to an amplifier (e.g. external speakers w/ some amplifier). 10 Hz is on the verge of the audible spectrum, but you should be able to hear 30 Hz. You do not want to hear the 60 Hz buzz - then you know your analog part is not working properly. In my case it took me ... many many evenings to iron out all the filters, in particular to tune both 60Hz notch filters, correct wiring errors. This circuit described above have not worked 'out of the box' for me. </p><p>So a short answer: check with the scope that you see pulses from your (or your subject) brain and not the 60 Hz buzz. Take a snap shot and post it :). Then, worry about computer input, sound card, and the code.</p><p>hope it helps</p><p>Jan </p>
I'd like to measure delta waves as well. What modifications should I make?
<p>Can anyone tell me the formulas for the filters used here to find the frequencies and other stuff the compare it with the processing and labview output waves.</p>
<p>Hello CAH 6 and congratulations for the excellent guide!!</p><p>I'd like to do a research about sleep stages on myself. I wanted to know if I can keep this device turned on in my head all night. It could be dangerous? </p><p>Thank you</p>
<p>I know this comment is a bit old, but that isn't in any way dangerous. The device simply measures your brainwaves, and does not interfere with them in any way. You should be fine with keeping it on for as long as you need. Just be aware that dreams can (more or less) lead to false readings based on the theme or emotion you are experiencing in your dreams. Although this can be irritating, it can be used as a medical tool to decode dreams and at least diagnose some sleep conditions.</p>
Can i use other instrumental amplifier
<p>Working on it</p>
<p>Hi, is this just a clean visual representation of the schematic from the circuit, or did you make changes to it?</p>
<p>I just cleaned up the circuit shown <a href="http://www.instructables.com/file/FTYHDPFH6MF2WPG/">here</a> you're correct. Since the supply sheet shows &quot;tantalum&quot; capacitors for the 220nf and 100nf caps, I showed them. I have a couple 220nf and 100nf Ceramic caps that I'll use on a punch down to find the polarity, then I'll mark them and repost.</p><p> The benefit of tantalum is higher heat threshold with lower variance. I'd say that a couple good polystyrene films would work as well. I think styrene films may be what he's using <a href="http://www.instructables.com/file/FLZT2TPH3Z3C82W/">here</a>.</p>
<p>I meant &quot;mylar film capacitors.&quot;</p>
<p>Alright, thanks for the reply. If you get it working, could you post about it here? I've been having a lot of difficulty getting mine to work, and I'm lost on what else to do.</p>
<p>Hi jimgarbe, does it work for you? I'd like to do a research about sleep stages on myself. I wanted to know if I can keep this device turned on in my head all night. It could be dangerous?</p>
<p>Haven't made it yet. About to give it a go. As far as danger goes, I'm not sure. I have my doubts regarding any danger with smaller voltages and amperes. People wear heart monitors and pulse monitors for days at a time. Someone mentioned a voltage divider rather than dual batteries, and then piping signals into an Arduino rather than a sound card. The wattage (volts x amps) potential with all of those caps and an Arduino scares me a little. I'm experimenting just like most. It sounds very promising. Maybe some TENS unit facts would provide the answer with all of that transdermal electricity stuff. </p>
<p>Great guide actually, code was a little wonky, but I managed to comb through it and make it work. This may sound kind of stupid considering I've built the entire circuit now and have all the parts installed, but I have yet to figure out how to attach the stupid electrodes to the breadboard. The photo shows some sort of adapter, but I'm not sure what it is or where to get one. Help is appreciated, I'm nearly finished building it, it's stupid tat I can't figure this out. Thanks</p>
<p>I basically followed the guide here, except I soldered the ends of the adapters to male jumper cables so I could insert them in my breadboard: http://eeghacker.blogspot.com/2013/11/making-eeg-electrode-adapter.html . You can buy the touch proof DIN adapters in a ten pack for cheap from this site, part #36671: http://www.plastics1.com/Gallery-CCS.php?FILTER_CLEAR&amp;FILTER_FNAME=36671. If you get your circuit working, do you mind posting a picture? I'm having trouble getting mine to work. </p>
<p>Hello I live in Italy. We use the 50hz frequency . Which changes should I make to the circuit to obtain a 50 hz filter? Thanks</p>
<p>Great Tutorial and Very Informative! </p>
<p>Great Tutorial and Very Informative! </p>
<p>I've doing everything but why not show the signal eeg or ecg do not know where the defect .</p><p>can you help me</p><p>please</p>
<p>I found that the 220nF tatulum capacitor is actually polarized. Should I match the positive side of it to where it connects to the 22kOhm resistor? or should I be matching the positive side of the 220nF capacitor with the positive side of the polarized capacitor on the right side of it? Cheers m8</p>
<p>does ECG electrodes work to capture the signals??? i didnt found EEG electrodes ,,so instead i bought ECG electrodes,, but i im confused that its working or not,, the changes of value is too small,, other thing does your electrodes work over your hair?? </p>
<p>does the ECG electrode works with you or not </p>
<p>Hi,</p><p>Can you provide a citation for this statement? </p><p>&quot;For example, alpha concentrations on the left motor cortex increase when you think about moving your right hand.&quot;</p><p>Claude</p><p>http://www.z-eeg.com </p>
<p>the left side of your brain controls motor functions for right side of body the right side of brain controls motor (I.E. muscles in arms legs etc. ) functions of left side of body. so the electrode connected to the left side of your head will pick up more when thinking about moving your right hand because left side of brain operates right side of your body.</p>
<p>Hi <br>can the owner of this circuit show me this circuit completely on bread board please </p><p>because i don&quot;t know what type of capacitor are there in circuit mention above </p>
<p>can i use OPA2134 instead of AD620 ?</p>
<p>hello !</p><p>i wanna build an eeg but my infromation isn't Complete i need your help !</p><p>plz give me infromation about it .</p>
<p>Hello there! Im trying to put it together on breadboard, but am finding it difficult to read the schematic pics, have u used 2 IC chips TL084CN, or 5 single Op.AMPS? I can barely notice the components of the first scheme? anyone can help? </p>
<p>I do not know how can you can run the code for reading eeg signal without any error. When I run the READ_EEG in arduino, it's contain 2 errors. When i try to fix the first error, the second error appear. I do not know why. Please help me to fix it.</p>
<p>See my comment above and try <a href="https://github.com/MarquisdeGeek/EEG" rel="nofollow">https://github.com/MarquisdeGeek/EEG</a></p>
<p>Hi, could you please show me what is the code for the two-player-version?</p>

About This Instructable

553,840views

714favorites

License:

More by cah6:DIY EEG (and ECG) Circuit 
Add instructable to: