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 142Next »
rbayareh mancilla made it!8 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

I wanna get a 50Hz notch filter one!

Thank You. It helped me a lot.

theadi15259 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 am running into the same error

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

can someone please tell me what the code is supposed to be on line 166 of Read_EEG. it says "timeSignal(" and then it just ends like that. whats in that parentheses? THANK YOU

nik_sharky3 months 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?

If you want to present your SMD capacitors on a DIP package it's easy enough to make a small PCB that would sit on a DIP socket. Working with SMD components isn't as difficult as you might think, just have to be a little innovative with your soldering technique. I wouldn't worry about solder mask until you have a working prototype.

Thank for a reply :)
I was nebie when write previous comment, now I already use smd PCB adapters for smt components;

Would it make a difference if a Potentiometer was used versus a Trimmer Potentiometer? I do not understand the difference between the two.

lm358 is a dual op amp so can I just use three of them?
JanB51 month ago

Hi,

It took me some time to build this complex amplifier so nicely described in this initial post.

My electronic is powerd with 2x9 V bateries.

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.

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

with the amplitude of ~50 mV. When I blink (or touch the electrods) the pulses goes over the scale (exceed few V).

So far so good - my problem is I can't find the alpha waves ( 5-10 Hz) lasting for at least a second.

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.

Attached is PDF with more details:

- location of electrodes,

- FFT amplitudes for a 40 seconds long measurement (2D plot)

- examples of raw wave forms with closed & opened eyes (two 1D plots)

Perhaps someon sees what I do not see? A mistake in electrod location, a pattern ?

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.

Any advice is welcome

Thanks

Jan

atah JanB51 month ago

Hello Jan,

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.

Any advice from anyone would be great as I really want to make this project.

Thanks

JanB5 atah1 month ago

Hi Atah,

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.

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.

Thanks

atah JanB51 month ago

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.

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.

Thanks for the response and I appreciate your help

atah

JanB5 atah1 month ago

Hi Atah,

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.

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.

hope it helps

Jan

atah1 month ago

Hello,

I am really excited to have a chance at this project but the code to read the EEG through the soundcard (not ardruino input) seems to be missing component. If anyone who is a stronger coder could please look though it and debug it that would be great. I have tried for the last month but I feel as though I am mabye to new to coding to fix it.

Thanks

atah

ForamK1 month ago

What electrode types have worked for you ?? There are many available in the link you have provided

JanB5 ForamK1 month ago
ForamK1 month ago

Once you've started taking readings, adjust the potentiometer such that when you're not moving at all, voltages don't fluctuate offscreen (over 1V)

alpha waves may be present if we do not move. Can you please explain the above statement as i m confused and cannot understand the statement ?

ForamK1 month ago

This will obscure the brain data we want, and as this interference is primarily low frequency, it can be fairly easily filtered out with a high pass filter (HPF).

The above statement is mentioned.

But our data is also low frequency. How can we filter that also? Please explain

nnjp1 month ago
does it need programming
nnjp1 month ago
Pleaseeee help
nnjp1 month ago
How to. Download the code.


nnjp1 month ago
How to download the code
nnjp1 month ago
How to download code
nnjp1 month ago
Sorry for stupid questions
nnjp1 month ago
Sorry for stupid questions
nnjp1 month ago
Please please please please please
nnjp1 month ago
Do we need to buy notch filter pleaseeee help
nnjp1 month ago
How to connect all these electrodes to the computers please
polkijain2 months 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
zawy2 months 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.

tomasroda2 months 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

DuinoTeacher2 months ago

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

rizvi4ualways2 months ago

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

1-40 of 142Next »