Instructables
Picture of DIY EEG (and ECG) Circuit
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
1-40 of 114Next »
polkijain6 days ago

the processing code shows an error in line 143- "cannot find anything named 'in' "

i suppose there's some issue with the minim library.

kindly help!!!!

Capture.JPG
zawy10 days ago

LT1167 and INA114 are two other instrumentation amplifier chips used. See fig 8 of LT1167 datasheet and this link

http://www.electro-tech-online.com/attachments/ecg-3-png.69399/

for how to apply a driving voltage to the body to reduce DC offset which can ruin the CMRR. But I do not see why these 9V battery designs can't use a mid-point between two electrodes as the ground and thereby tie it to the ref ground of these instr amps instead of applying a driving-ground "voltage" to the body. The high CMRR (DC-volt rejection) provided by these instr amp chips by the precisely matching amplifying resistors is needed because you can't control the two skin contact resistances and any DC voltage (up to 300 mV, 30,000 times higher than the needed EEG signals) will appear as a DIFFERENCE in the voltage in the two wires at the instr amp inputs, not too mention wire length and circuit layout differences and 60 Hz, and hence overwhelm the EEG slow-AC signals you're looking for. The DC voltages can change with time even at the 10 Hz level in which we're interested for both EKG and EEG, so you can't filter them out before the instr amp input terminals with a simple RC filter. However Fig 5 of LT1167 shows how to filter HIGHER frequencies (> 30 Hz for EEG) before the input terminals, although a post-instr amp filter might be just as good, and you want as little between the body and instr amp inputs as possible. Use twisted pair on the input wires and shield them if 60 Hz is still a problem since the post-amp 60 Hz filter may be too late in the circuit to be useful to prevent the 10 uV EEG signals from being overwhelmed. To reduce skin resistance and thereby improve CMRR you are suppose to use a standard gel with silver-chloride electrodes. I am told the electrodes can be made by placing recently scraped (very clean, non-oxidized) silver that is to be used as the contact in normal bleach and connecting it to the positive terminal of a 9 V battery and apply 2.5 mA/cm^2 for 15 minutes, using a 10k potentiometer and ammeter in series with the battery and contact. I've also seen gold-plated audio terminals used, but I do not know how good that is. Silver-chloride terminals are the norm, and it's emphasized so much, I would not skimp on it. You can make a gel by heating sodium alginate with water and low sodium salt. Light abrasion of the skin surface before applying the gel can greatly reduce resistance from 100k ohms to 5 k ohms, but I do not know if it is enough to prevent use of the gel or the silver-chloride electrodes. If you apply the output of the instr amp to a PC-based oscilloscope or other o-scope, then the software might have on-board digital filtering that far surpasses any analog filtering your circuit would implement. So it seems possible that just 1 resistor and the one instr amp IC are the only components needed for an EEG signal. Also, the 1167 instr amp needs about only 1 mA, so you can use two 500 ohm resistors to create a ground and +4.5V and -4.5V and a single battery if you don't mind using it lasting only a 10 or so hours.

tomasroda23 days ago

Hello,

What value shoul'd i use for 50 hz notch filter ?

Hi. As I investigate, first and last cascades themselves are not really notch filters, its Butterworth high-pass filters which pass all frequencies which is higher than 60Hz to inverting input of second cascade amp, so it's freqs will be drowned after second cascade. To calculate Butterworth HP filter on OP amp You can use this link:

http://www.calculatoredge.com/electronics/sk%20hig...

or:

http://www.daycounter.com/Filters/Sallen-Key-HP-Calculator.phtml

Or install filterWiz tool:

http://www.schematica.com/active_filters/fwlite.html

thank you :D

Ok, so I made the circuit; but how do I interface the electrodes with it?

theadi15257 months ago

I downloaded the program (READ_EEG) and Processing show my "unexpected token: }" in 166 line and next (Cannot find anything named "in") 143 line, Is the program correct ?

I got the same error result. Did you ever get it resolved?

i want ecg waveform demo for run in pc i want to use in shooting plz anybudy tell me from wher can i download a demo version plz help me if any one knows

http://www.bioshare.info/en/freebrowser

nik_sharky1 month ago

Hi, thanks a lot for Your awesome work. I'm newbie in electronics and have some questions.

1. R5 and R16 on common scheme is 220 Ohm but on detailed schemes its 270KOhm, I try calc RC filter freq and think that it should be 270K. Am I right?

2. Can I use ceramic capacitors instead of tantalum? Can't find it in DIP :( only SMD

3. I make circuit but for some reasons its not work correctly. Try to test it using 13Hz triangle wave from smartphone on input1 and input2 connected to GND. And see the signal until R9, so diff-amp and notch filter work normal, after R9 signal is too weak, what it can be, is it mut be 180KOhm?

IN3PDO1 month ago

Firstable, thanks for sharing your work. This project, among the all I read on the web, is the more clear for me. Actually I need an EEG device only to measure the SMR waves. Since I'm not an electrical engineer (actually I'm an actor and need the EEG to develop some experimental training), I'd like to ask you how can I modify the filters:

the HPF from 7 to 12,5 and th LPF from 31 to 15,5.

Or at least, can you give me some parameters to be able to do it myself?

Another question, this device could be usefull also to measure EMG?

Thanks

RahulG21 month ago

Will the electrodes work without electrode gel? If not can anybody please suggest something if one wants to use dry electrodes?

Thanks.

cah6 (author)  RahulG21 month ago

All I can really say is to try it. Readings weren't nearly as good with dry electrodes for me. It could be possible though?

hello cah6 am kindly asking is it possible to use this circuit to collect EEG signal data and input it to Pic 16F877a microcontroller.Want to use the data for sleep detector

cah6 (author)  Slyvester Tello1 month ago

Yeah! It would definitely be possible to skip the computer and sample the output with a microcontroller.

sams12 months ago

a bit curious as to why the output is being read from between the 22k and capacitor in stage 6 rather than the output at the op-amp? It seems as though that last notch filter is not required.

Also i am making a smd version of this pcb. If it is alright with you i would like to post them up for people who wants to give this a try.

cah6 (author)  sams11 month ago

You can definitely post an SMD version of the PCB. For me, the output was just much cleaner with the second notch. I can't remember all the details, though.

stanna1 year ago
i have a question, why are you using -9 V on the ground pin
tnguyen133 stanna2 months ago

Dual supply configuration for Op-amp

cah6 (author)  stanna1 year ago
I'm not: GND is connected to your body, +-9V are the supply pins.
nilan2 months ago

why not use a bandpass filter ? rather than using two filters HPF and LPF

RohanHundia3 months ago

Can you please explain me what is the exact role of an instrumentation amplifier does it amplify voltage or frequency and by how much?

The instrumentation amplifier is a very accurate form of the operational amplifier. These amplifiers compare two signals (such as in and feedback, or double in with some feedback [prevents extra noise from getting introduced]) and amplifies the voltage. The signals picked up are very tiny voltages, so these up that to something that can be read easily.

twizilla3 months ago

Try google. This is the link to the item in their store

http://store.ambu.com/am_esa/esa/ItemDetails.jsp?@where.ItemID@EQ=72615-M%2F10

bounding star3 months ago

That link for the electrodes doesn't work anymore

RohanHundia3 months ago

Hi cah6, I (READ_EEG) and Processing show my "unexpected token: }" in 166 line and next (Cannot find anything named "in") 143 line, CAN YOU HELP ME RECTIFY THE ERRORS.

THANK YOU

RohanHundia3 months ago

Hi cah6, I am a student keenly interested in this project of designing an EEG System. I have designed the circuit but I am facing issues in reading the data and the software part of it. I want to design a system which allows the users to play a ping pong game can u explain how should i go with the software.

Thank you.

is it possible to use a oscilloscope instead of a computer to show/process data? And thx for the great project good job

Zalo5 months ago

I hope you don't mind cah6, but to get some practice with 123D's Circuit building tools I transcribed this schematic and posted it online here: http://123d.circuits.io/circuits/212387-cah6-s-eeg...

Hopefully I didn't make any mistakes, it would be nifty to have a working buyable EEG PCB for hobbyist builders online.

Very cool project; do you mind if I mention it/possibly use a photo at an upcoming talk I'm giving?

What would you estimate as the overall cost of the project?

Here's the talk: http://solidcon.com/solid2014/public/schedule/detail/33422

hikinful6 months ago

As other have said, this is a great instructable, thanks! It occurred to me that much of the work done by your analog input circuit could be done by signal processing algorithms; is there a theoretical reason why it's better to apply filters and so on in the analog domain rather than simply amplifying it and digitizing it straightaway? I am naive when it come to this subject so thanks for understanding if this is a silly question.

cah6 (author)  hikinful5 months ago

Not a silly question at all!

Essentially, you only have a certain number of values you can put analog values into when you convert them to be digital. By doing some of the processing and amplifying the result to the max value, you're basically maximizing the resolution of the values you read in.

Say you have 1:9 signal to noise ratio, of which you can completely remove the noise. If you were to immediately do the analog -> digital conversion, say with 1024 bins to sort the data into, your actual data/signal is reduced to 102 bins, where the rest is just noise. If you filtered the signal before reading it in, magically removed all noise, and amplified the signal to its max height, you could get much better digital resolution when you read it into your computer. This is a really rigged example and I wasn't very precise with it, but it should give you the general idea of why it's good to filter early (especially if the actual signal is pretty small).

rbayareh mancilla made it!6 months ago

Hi! I made this proyect. I only used a High pass filter from 8Hz to 50Hz (alpha to beta waves) just for watch the changes between the waves. I used Labview and MyDAQ to observe the changes, programming a 60Hz notch filter, a graph and FFT to observe better the frequency of alpha and beta. Here are the results:

filtro pasa banda 8-13Hz.pngfiltro pasa banda 14-30Hz.pngCapture.PNGCapture2.PNGCapture3.PNGCapture4.PNGCapture5.PNGCapture7.PNG
TheAlex8 months ago

Hello Cah6,

So glad that you made the project open. I have a quick question, as you use a 31Hz LPF in stage 4, is a notch filter absolutely needed in stage 2 ? Theoretically stage 4 will eliminate the line noise as well, right ?

-Alex.

judd127a8 months ago

Hey there cah6. I'm undergoing building this for my major project at university. I am intending on using the data acquired to be turned into music. Thank you so much for uploading a detailed description, and please don't feel obliged to answer since you have already taken so much of your time out to upload this.

previously in the comments someone said "Unfortunately, computer mike inputs all seem to have their own high pass filters, ranging from around 5 Hz for Macs (when they have one) up to 20-40Hz for PCs. With a Mac, you don't need the 7 Hz HPF. With most PCs, alpha and low gamma are toast. A good USB audio input adapter will go down to 5 Hz and get around this problem."

If this is the case, how did you connect your EEG to the soundcard? Did you use a USB input adapter as suggested?

Also at stage 2 it talks about the notch filter, i am a little confused as the image that goes with it doesn't show the notch filter as far as i'm aware. I can only see 1 notch filter at the end of the circuit. Excuse me if i have asked some pretty obvious questions, I am new to this.

thanks,

Callum.

gkai29 months ago

Hai... first of all thanks for putting up such a detailed description.

I need to make an EEG collection system which is a part of my major project "brain controlled switches"

I have some doubts regarding your model. You explained about alpha and beta waves. I want to know whether I will get 3 different signals for 3 different thought processes (right hand movement, left hand movement, left leg movement, etc.) using your EEG circuit. Also will a particular signal be the same when the process is done after some time for the same person.

Also when I read the comments below many are having trouble with the notch filter. Can u please update the final circuit diagram with the better notch filter and its details.

Hoping you will reply soon.

Thank you

cah6 (author)  gkai29 months ago

You'd have to basically use 3 copies of the circuit (one for each signal) and feed them to the analog pins of an Arduino or something similar to read them at once.

For the notch filter, I'd try http://members.shaw.ca/roma/nine.html. I'm not exactly sure what's up with the one I initially put up, since it worked for me, but I suppose people are having issues with it.

Kreshu9 months ago
This is a great project! I have started developing it. But a sketch READ_EEG_cleaner is not available anymore, could you put it somewhere again?
Thanks for sharing knowledge :)
cah6 (author)  Kreshu9 months ago
I decided to upload it to github, so you can get it here:

https://github.com/cah6/EEG
1-40 of 114Next »