Instructables

DIY EEG (and ECG) Circuit

Featured
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 94Next »
RohanHundia16 hours 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?

twizilla2 days 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

That link for the electrodes doesn't work anymore

RohanHundia10 days 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

RohanHundia10 days 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

Zalo2 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

hikinful2 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)  hikinful2 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!2 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
theadi15254 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 ?

TheAlex4 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.

judd127a5 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.

gkai25 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)  gkai25 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.

Kreshu6 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)  Kreshu6 months ago
I decided to upload it to github, so you can get it here:

https://github.com/cah6/EEG
cshi16 months ago
hello, i just built this circuit but i think that i have a big problem, i measured the voltage at the end i've got 7.8 Volts(i think it goes above one of the amplifiers) and it doesn't change with the potentiometer. i'm checking the circuit over and over again. i tried to short the electrodes end and from the instrumentation amplifier i get 0.00 volts.
from the first operational amplifier i get 1,4 volts. i think that this is the problem, because if i get 0 from the instrumentation how can i get 1.4(that has to be amplified 80 times after...)

i'm using a tl084C(without the N) and only ceramic capacitors(plus the three electrolitic) all the measurements are in respect to the batteries ground(i've not connected the electrodes)
dhirajp157 months ago
if we use different opams for filter will there be any change in resistor and capacitor values??? if i use lm741 or op07 ic will i hav to change the values of resistance or capacitance???
rlabina7 months ago
Do I have to apply some changes in the circuit and/or code if I will use this as an ECG?
cah6 (author)  rlabina7 months ago
No changes are absolutely necessary, but:

Since ECG data isn't as sensitive, you can probably get good data right after stage 1. The other stages are mostly just cleaning up the data, but that's not as necessary with ECG data.

Regardless, you'll need to reduce the gain through the circuit, as ECG data is inherently higher amplitude than EEG data, either in stage 1 or 5. Your best bet is to keep the stage 1 gain the same, read off data while changing it in 5, and just seeing what works for you.
rlabina cah67 months ago
Is the gain reduced by adjusting the potentiometer? Or do I need to add a resistor or replace the pot with a higher resistance? Also, I tried to run the code on Processing but it only shows the "default display" because "Display 0 does not exist" according to the console. Do you have any idea on this?

I'm fairly new to this and I need to complete this project as a part of my thesis. So I would appreciate the help. Thank you very much..
I am trying to run this circuit through matlab (simulink). Can u tell what program i have to make ( like of haw many bandwidth bandpass filter i have to apply, when and where to apply them etc.). also pl tell of how many bandwidth the different brain waves should be.
rlabina9 months ago
I want to make an ECG using your instructable. My 100nF and 220nF tantalum capacitors looked nothing like in your breadboard. They're really, really small (see image) and I have no idea how to place them. Can I replace the tantalum capacitors with electrolytic/ceramic? Would this have any effect?

I would really appreciate it if you can answer my questions. Thank you very much.

2013-08-14 21.23.59.jpg
zachs858 rlabina8 months ago
Those look like surface mount capacitors, they are much harder to work with, and wont work in a breadboard without special equipment (if at all). You need through hole components.
rlabina zachs8587 months ago
Yes, I just found what they were. Thanks anyway. I think if you can solder some wires to the terminals, you can then place them in a breadboard. But that's too much work. I didn't know back then that you if you want to buy nF capacitors, you have to convert it into uF first. >_<
achuth rahul7 months ago
can you help me out how the same(EEG)circuit can be used as ECG circuit
skrastanov7 months ago
While this instructable was a lot of help to me, this here is most definitely NOT a notch filter. It is a high pass filter, which can be easily proven when deriving the transfer function (I can send you a mathematica notebook with the derivation). For more intuitive reasoning, the mere presence of C5 is sufficient to tell you that nothing passes through at low frequency.

You can find a fairly simple and quite versatile notch filter here: http://members.shaw.ca/roma/nine.html
abraham448 months ago
Thank you, this is such a nice project and very elaborated. Im just having a trouble with tantalum capacitors, idk where to connect the positive and negative terminal because in the circuit they are shown as no polarity but mines have a and -. Should I use ceramic capacitors instead of tantalum or which way do I connect them?. Thank you in advance!
abidik8 months ago
(removed by author or community request)
cah6 (author)  abidik8 months ago
For the instrumentation amplifier, you're intended to connect the two input signals to pin 2 and 3, with the output coming off pin 6. Connect the ground electrode to pin 5, and the others are just power supply pins / the two with the resistor across them. Does this answer your question?
abidik cah68 months ago
No.....No.. As I understand , I couldn't explain my problem.. I did not understand how can I make connections between the parts in the 3rd photo making with TL084CN. Because the legs of the parts and capacitor values in the stage 2 can not be seen clearly on the breadboard ... So sory for my simple questions.. because I am not an engineer ... I am only a MD and hobbyiest.. I am sending the photo about circut and confused parts marked in the attached file.... thanks for your patience


cah6 (author)  abidik8 months ago
I still don't think I completely understand the question. Are you talking about how stage 2 connects to stage 1? The only way they're connected is through the 22kHz resistor, which connects to pin 6 of the TL084CN. Or are you having trouble seeing what value capacitors you have?
chipstein11 months ago
This is an excellent description of EEG frequencies and all the components of the circuit. I hope you won't mind suggestions from somebody who does EEG for a living.
1.  Even with professional EEG systems, the most important component of a good recording is good contact between the electrodes and the skin, which requires some sort of skin prep and conductive electrolyte. These are available at the same places you can buy the electrodes, and will give much better results than a second notch filter. 
2.  The electrodes, and especially homemade ones, can produce large unbalanced half-cell potentials--i.e., act like batteries--and generate DC offsets of hundreds of millivolts. With the AD620, a gain of 89, and 9-volt batteries, a DC offset of only 84 mV will pin the output against the positive or negative rail, obliterating it. To prevent this, the first stage gain is usually set much lower.
3. 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.
- Chip
mjb123 chipstein9 months ago
Like, or +1, or Kudos.... don't see how to upvote but this comment deserves!
Mvtnns9 months ago
What is 220n cap for? Is it a part of the notch filter or is it used to remove DC offset?
navidstuv10 months ago
please help me..i realy need your help.
Thanks for your project..I downloaded your code.but it has error ('framebuffer objects are not supported by this harware(or driver)') i dont know what my problem is?
is it because of my hardware???
polkijain11 months ago
Please help me out to build a robot with it!
ClaireSophie11 months ago
Hey, I would like to use this EEG for a project where I need to distinguish two different signals. Is it possible this with this circuit? I need a sign for going left and one for right.:) Thank you in advance!
1-40 of 94Next »
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!