DIY EEG (and ECG) Circuit

 by cah6
Featured
eeg_traces_01.gif
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!

 
Remove these adsRemove these ads by Signing Up

Step 1: Parts

random_breadboard_pic.jpg
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
1-40 of 45Next »
jpeepers18 says: May 15, 2013. 4:02 PM
What is the case size for the capacitors? Or what are the model numbers for the capacitors used in this design?
stanna says: May 14, 2013. 12:56 AM
i have a question, why are you using -9 V on the ground pin
nie.doma says: May 4, 2013. 6:52 AM
better filter for power supply broom you can find here.
http://www.radio-electronics.com/info/circuits/opamp_notch_filter/opamp_notch_filter.php
shineonyoucrazydiamond says: May 3, 2013. 4:27 PM
Great instructable, I'm just a little confused about the electrodes. Does the "ground" electrode (the one that connects to your mastoid or reference area on your body) serve as the ground line for the whole circuit? Is the circuit then connected to physical ground at all? Thanks!
cah6 (author) in reply to shineonyoucrazydiamondMay 3, 2013. 5:07 PM
Yes, that's ground for the whole circuit, since these signals you're measuring are really only useful in relation to your head's overall ground state. So, the batteries are +-9V relative to that spot on your body.
thuiberts says: Mar 21, 2013. 2:57 AM
Could it be that following this schematic does not make a notch filter because I used a regular 220nF capacitor instead of a tantalum one? What I get now seems to be more like a high pass filter with a not so very steep slope at around 60 Hz.
cah6 (author) in reply to thuibertsApr 21, 2013. 1:07 PM
The type of capacitor in that respect shouldn't really matter. The notch filter I used and listed here isn't a very conventional one, but it works for me in both testing and actual use. I grabbed the design from some random website as it seemed to be the simplest circuit for the function, but can't find it again. In a couple weeks when I have the time I'm going to revisit this section of the circuit, document it more, and fix any issues regarding it.
jchen23 says: Mar 7, 2013. 6:25 PM
just noticed you also use only 1 10nf capacitor. on the guide u list to have 3. just letting you know!
jonencar in reply to jchen23Mar 20, 2013. 11:13 PM
Noticed that one, too :)
jonencar says: Mar 20, 2013. 11:12 PM
Thanks for this sweet DIY! :)

For the electrodes, did some searching around for a more cost-effective option and found these:

Ambu Neuroline Cup

$7.50 for a pack of 10!  They are "Single patient use", and intended to be disposed of after each use in medical environments.  This is mainly for purposes of sterilization; for our purposes, however, we should be able to get extended use. :)

Can pick them up directly from Ambu in the US; King Medical is a good option for Canadian DIY.

Picked these up for my first attempt at the EEG circuit and should be giving them a try in the next few days.  Will post how it goes.
dbhaumik says: Feb 20, 2013. 7:51 AM
Will this work with active electrodes?
cah6 (author) in reply to dbhaumikMar 4, 2013. 8:21 PM
I haven't used active electrodes at all, but yes they should. As far as I can tell, they just help make a secure connection, which is what the gel does on the passive electrodes.
jchen23 says: Mar 1, 2013. 11:08 AM
if i'm doing ECG, would everything on this tutorial be the same? I'm also using arduino but i just figured I switch the soundcard with the arduino, correct?
sidharrth says: Feb 9, 2013. 1:38 AM
i did the whole thing and connected it to my laptop.But im not getting the waveforms in processing.org......
1. i replaced those tantalum capacitors with electrolytic ones of the same value ...will it affect the circuit operation??
2. The power line frequency over here is 50 hz....so,whats the new value of resistors and capacitors?
Plz help.....
apinto5 says: Jan 25, 2013. 7:02 AM
i'm unable to download the code Please help !!! ERROR: Download permission denied by uploader. (0b67c2f5) !!! Its urgent
Benny Boy says: Jan 20, 2013. 2:37 AM
50 Hz / 60 Hz interference, or hum, is introduced from sources around you that use the mains power supply and will not be due to the battery. The interference can be picked up at various stages throughout the circuit. The frequency relates to the number of times a second that that the AC current changes direction.
sidharrth says: Jan 13, 2013. 9:57 PM
what do mean by this power line interference??How can u have a power line interferance from a battery source(DC)??would u pls explain about it??
sidharrth says: Jan 13, 2013. 9:55 PM
what i want to know all is about how u derive the values of capacitor and resistors??For eg : in notch filter we used a resistor of 12 ohm and 270k ohm...How u get those values??What was the design??
Benny Boy says: Jan 11, 2013. 10:34 AM
Nice one. I should have it all sorted over this weekend. Thanks for your help. Have you considered doing any more with the device, for example controlling things?
Benny Boy says: Jan 10, 2013. 11:32 AM
That's fair enough. I'm using the Biomedical Toolkit of LabVIEW to write my program.

I think what I'll do is ignore the amplifier and use the components to make another set of ~ 30 Hz Low Pass filters.

Did you have to do much processing of data in your program? I'm applying more filtering in LabVIEW, including the 50 Hz Notch filters. I see some changes when messing around with the electrodes but am waiting on the electrode gel to take proper readings.

What sort of environment did you take your readings in? Do you have any screen shots of the sort of readings you got from your system?

Thanks for your quick response to my other queries. Much appreciated. I'll let you know the outcome of the alternative implementation!
cah6 (author) in reply to Benny BoyJan 10, 2013. 3:01 PM
I didn't do a whole lot more processing in the program. I applied another 60 Hz notch filter and LPF just to get rid of any residual noise that may have passed through, mostly just because Processing had a built in function for that through the minim library.

Besides that, once I got the time signal in I just took the FFT of it and displayed that to see the various frequency bands. On step 10 there's a picture of the time data (after the quick digital filtering) that I got in, with the FFT beneath it.
sidharrth says: Jan 5, 2013. 8:51 AM
Thanx cah6 for this wonderful project.......But now i need ur help very much!!!! Actually i was trying to design the capacitors and resistors for the past few day....bt am getting wrong somewhere....Pls do help me...i need the whole design of the capacitors and resistors used in your circuit....pls do reply....awaiting ur response soon...
cah6 (author) in reply to sidharrthJan 9, 2013. 6:15 PM
What exactly do you mean? Are you having problems finding capacitors / resistors with the appropriate value, knowing where they are in the diagram, etc?
Benny Boy says: Jan 6, 2013. 10:20 AM
Hey cah6. This really is an amazing project. I'm designing a similar EEG system based on your circuit. So far I've made good progress but I am stuck on a few problems and was hoping you could help me out with a few questions that I have.

Firstly, it looks like you had a myDAQ available to you but instead you used the sound card of your PC to acquire the signals. Was there a particular reason for this? I am trying to use the myDAQ analogue input channels of the myDAQ to acquire a differential signal from the circuit.

Secondly, I'm not having much luck with the 60 Hz notch filters. I've put the design into multisim and the response is very different from what you've shown in LabVIEW. Instead of the 60 Hz frequency cut off, I am seeing attenuation of all frequencies below 84 Hz and above 2 kHz. It's a long shot but I was wondering whether you came across any similar issues with your circuit that may help me resolve this problem?

cah6 (author) in reply to Benny BoyJan 9, 2013. 6:14 PM
I used myDAQ for initial testing, but since I wasn't very familiar with labview and making programs in there, the more natural way to visualize the results for me was using java. Also I figured I could just do more advanced stuff visualizing the results in java as opposed to in the labview environment.

The notch filter just has the amplifier for some fine tuning, it's not really necessary. I can't help much with the frequency response being distorted for the notch filters, though. That was one part I didn't do a multisim simulation beforehand: I built it and tested it with the myDAQ, and the results were what I wanted. Try a T-Notch: if it works, then that's great. Let me know if it does!
kithso says: Dec 18, 2012. 6:07 PM
Impressive, but does it make french fries?
Seriously, well done.
VirtualBoxer in reply to kithsoJan 7, 2013. 4:45 PM
French fries? WHAT?!
Benny Boy says: Jan 6, 2013. 10:25 AM
One more thing I forgot to mention. I'm considering using a T-Notch filter instead of that shown in your circuit. (This is to get around the problems I am currently having.) Was there a particular reason why you are using a notch filter that uses an amplifier? Is this an important gain stage for the project?
lean04 says: Dec 20, 2012. 8:23 AM
awesome instructable!
would it work with AD620NB instead of AD620AN?

also is would be awesome to make it standalone, with a lcd (arduino - raspberry pi?)
cah6 (author) in reply to lean04Dec 22, 2012. 2:26 PM
I can't find any links to the AD620NB, but chances are it's very similar to the AD620AN, so yes it should work. It's configuration might be slightly different though...I would look at its datasheet and find the equation for its overall gain, and make sure the resistors you use are such that the gain is the same as mine using the AD620AN.
lean04 in reply to cah6Dec 27, 2012. 1:19 AM
here is the datasheet http://www.analog.com/static/imported-files/data_sheets/AD620.pdf . The main difference i see is in the voltage offset section. I would really appreciate if you can adjust the resistors so i can use it because it was the only model i could find.
Thanks
lean04 in reply to lean04Jan 1, 2013. 11:42 PM
hi, i´ve been looking over the datasheet and what you´ve explained. I´m not really good at maths (nor an engineer) but i think that the overall gain and it´s ecuation is the same for both ic´s. The difference i see is in the gain error section, the NB model seems to be twice as accurate than the AN one. I think that then the resistors might be the same for both ic´s...
please correct me if i am wrong.
thank you
cah6 (author) in reply to lean04Jan 2, 2013. 5:12 PM
Yes, that should be the case. Since the gain equation is the same, using the same resistor as the one I listed will be good.
lean04 in reply to cah6Jan 5, 2013. 6:19 PM
thanks for answering, i´ll try to mount the circuit this weekend and post my experience.
hguvg says: Dec 29, 2012. 12:36 PM
This is a great Instructable. I am designing a circuit board based on your schematic, and was wondering, which capacitors are the tantalum capacitors in the schematic? Tantalum capacitors are polarized, and the only polarized caps I see in the schematic are the values of the electrolytic caps.
cah6 (author) in reply to hguvgJan 2, 2013. 11:44 PM
Eek, yeah that's my mistake for not using polarized symbols for those on the schematic. They're the only 100nF/220nF in the schematic...I think I'm going to redo the schematic with another program soon. Until then, though, put the tantalum ones with the right values in the appropriate places, in general with the positive lead on the left/bottom.
Johenix says: Dec 18, 2012. 9:52 PM
For the European version you will want to replace the 60Hz notch filters with 50Hz notch filters. What would the resistor values be?
cah6 (author) in reply to JohenixDec 22, 2012. 3:40 PM
Oh, thank you for asking, really good point. I don't have my circuit/papers with me at the moment, but I believe for that part, the 12 ohm resistor controls the frequency the notch is centered at. So to move that center to 50Hz, try a 15 ohm one. For a rough test, measure the output before and after the filter using the processing sketch, and you should see a large drop in that 50 Hz section (since it should be riddled with it before). I'll get back to you when I can regarding what particular resistor value actually does this.
beamrobot says: Dec 22, 2012. 4:03 AM
really nice and detailed.can this circuit be used as EMG sensor?
cah6 (author) in reply to beamrobotDec 22, 2012. 2:23 PM
Yes, I would think so, although I haven't specifically tested it as such. The main source of noise in this circuit is from muscles in the first place, so if you were to be specifically looking for them, checking out the response in lower frequencies could work. Try it out, and tell me how it goes!
1-40 of 45Next »
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!