Introduction: DIY EEG (and ECG) Circuit

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!

Step 1: Parts

Picture of 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

Step 2: Complete Design

Picture of Complete Design

The attached picture is the final schematic. After the instrumentation amplifier, each box is a single op-amp (couldn't find a non-dual op-amp using this schematic program). I've also included the frequency response of the finished circuit (taken with the NI myDAQ, a good all-purpose oscilloscope) -- excluding the ~90x amplification the data receives by going through the instrumentation amplifier. For those not too familiar with dB, a nice conversion calculator with dB to linear gain/attenuation can be found here.

Regarding power: the easiest way to power the circuit is with 2 9V batteries. To feed your op-amps -9V to 9V of power, connect one battery the correct way, and one backwards. That is, connect the positive lead of one battery to your positive power supply line and its negative lead to GND (ground). With the other battery, connect its positive lead to GND, and its negative lead to the negative power supply line. To "set" GND, you will eventually connect an electrode from your leg directly to the GND line. This will ensure that "0V" is your leg's voltage (unaffected by any head activity), and that all readings will vary from there. 

The biggest design goal for this circuit is to obtain the data, then reduce noise by enough to get a good signal into the computer, where we will process the data a bit more. As we will be using our computer's sound card to get the data in, we have to cut noise enough that the signal with noise does not spike above or below +1V and -1V, as this is the point where the sound card clips the data off. As we will be using +-9V through batteries to power the circuit, we also have to make sure that as our data is going through the circuit, it never peaks above or below this value. 

I've also included an example of how to lay out the components on a breadboard, one with notes on it and one without. It isn't exactly how I did it, but should give you a general idea if you haven't worked with breadboards before. Still, I do NOT suggest using that picture as a strict guide on how to wire everything. Follow the actual schematic -- the breadboard layout looks like a pretty jarbled mess (it gets really hard to avoid that when you try to fit everything on a 30-column board). The program also didn't always layer the components correctly, and since there's no way to test the "breadboard schematic", there's a possibility that it's not perfect. Use it as a general guideline, if you need it.

To clarify some specific colors used on the breadboard view -- all red wires are power lines, and all black are basic interconnections between circuit pieces (most are connections to ground). The green wire is the output of the first notch filter, the yellow is the output of the 8 Hz HPF, the blue is the output of the 30 Hz LPF, and the white wire is the output of the gain stage. The box at the bottom represents the audio cable going to the sound card.

In general, things to remember are that in breadboards the power lines (top and bottom rows) are connected horizontally, and the rest is connected vertically, with breaks in connections across the middle gap. When looking at the schematic, take care not to connect wires together unless a black circle is there with the connections - a cross without a dot doesn't indicate a connection.

Step 3: Stage 1 - Instrumentation Amplifier

Picture of Stage 1 - Instrumentation Amplifier

An instrumentation amplifier takes as its inputs 2 voltages, and outputs the difference between the two multiplied by some gain, G. Instrumentation amplifiers, however, are not perfect. On real amplifiers, the output is slightly skewed if both input voltages are offset the same by some amount. A perfect amplifier would take as inputs 2.1V and 2.2V, and output 0.1V*G. A real one is influenced by this common offset, and will change the output slightly accordingly. The Common Mode Rejection Ratio (CMRR) is a value given to the amplifier that corresponds to how well it ignores the common offset between inputs. A higher CMRR is better, and will output something closer to what a perfect amplifier would. It is possible to make your own instrumentation amplifier (usually with 3 op-amps), but unless you make it with precision resistors, it will suffer from a low CMRR. I personally couldn't get a good reading with a self-made instrumentation amp. 

Using an instrumentation amplifier chip, the gain is changed by altering the value of the resistor between pin 1 and 8. 

The datasheet for the AD620AN (our instrumentation amplifier) is here. From it, you can see that the formula for gain using this chip is G = 1 + 49,400 / Rg, which equates to a gain of 89.2 with a 560 ohm resistor. This is a good number to get the data into a not-miniscule range; we'll add a way to adjust gain on the fly a bit later. You should also see on this datasheet that on your actual circuit, your active electrodes (ones that are not the ground electrode) will be connected to pin 2 and 3 (-IN and +IN).


Step 4: Stage 2 - 60 Hz Notch Filter

Picture of Stage 2 - 60 Hz Notch Filter

The biggest source of noise in our system will be centered at 60 Hz, due to power line interference. Even if you use batteries to power your circuit, your circuit will still experience this noise. For this reason, we will have 2 "notch" filters - filters that have a severe reduction of gain around 1 particular frequency. We will use one now, to cut out as much interference as we can before we apply any more gain to our circuit, and one at the very end, to cut out any more interference we may have picked up.

The notch filter is most sensitive to changes in the 12 ohm resistor. To ensure the notch is centered at 60Hz, take a reading (detailed on the last stage) at the end of the instrumentation amplifier, then do so again once the signal has gone through the notch filter. You should see a significant reduction in the amplitude of the 60Hz (light grey) frequency band. If it is not centered at 60Hz, try a 10 ohm resistor, or even a different 12ohm one, as at that resistance it can easily vary by a considerable amount.

Step 5: Stage 3 - 7Hz High Pass Filter

Picture of Stage 3 - 7Hz High Pass Filter

As we are measuring data across the skin, our final data will also contain voltage from our galvanic skin response across our head. 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 trade-off doing this is that we also filter out a lot of gamma/delta wave data (the brain waves that are about 8 Hz and less), but if our main focus is alpha/beta wave monitoring, this isn't much of a problem. 

This filter is a 2-pole HPF with a cutoff frequency of 7.23Hz. A cutoff frequency of 7.23Hz means that at this frequency, the circuit outputs data that is reduced to about 71% of its original value. As it is a high pass filter, frequencies above this cutoff will approach a gain of 1, while frequencies below will be continually reduced. The filter having 2 poles means that in the region below the cutoff frequency, the gain falls off much faster than a simpler resistor/capacitor circuit. More specifically, in this circuit, our double pole design reduces data by a factor of about 56 by the time it gets to 1Hz, while a single pole would only reduce it by a factor of about 7.5.

Along with the circuit design, I've also included the frequency response of this particular section.

Step 6: Stage 4 - 31Hz Low Pass Filter

Picture of Stage 4 - 31Hz Low Pass Filter

Next up, we want to filter out data above the frequencies we are interested in. More specifically, as beta wave information stops out at 30Hz, we want to get rid of anything above that, as combined it can contribute a good amount of noise to our data. The circuit design is very similar to the high pass filter from stage 3 - it has a gain of .71 at 31.23Hz, and decreases from there at a rate such that by 300Hz it has attenuated the data by about a factor of 100.

Again, I've included the frequency response of this section here. 

Step 7: Stage 5 - 1 Hz HPF and Gain of 83-455

Picture of Stage 5 - 1 Hz HPF and Gain of 83-455

The beginning of this circuit contains a quick HPF of cutoff frequency 1Hz (Fc = 1/(2*pi*R11*C11), just for some extra attenuation of unwanted noise. On the other end, the resistor and capacitor in parallel provide some extra filtering of high frequencies (Fc = 1/(2*pi*10nF*100kΩ) = 160Hz on a low-pass filter).

The main purpose of this section, however, lies below this, with the 220Ω resistor and potentiometer (pot for short). This op-amp is a non-inverting amplifier, and so has a gain of  G = 1 + R12/(R13+R14), (ignoring the 10nF capacitor, as it's a small value and won't contribute much to the gain). The potentiometer is a variable resistor - when the input is connected to the first pin and the output to the second, turning the wiper changes its resistance linearly between 0 and 1000 ohms. This means that when the pot is turned all the way to the left, the gain of this circuit is G = 1 + R12/(R13 + 0) = 1 + 100k/(220 + 0) = 455. When it is turned all the way to the right, the gain is G = 1 + R12/(R13 + 1000) = 1 + 100k/(220 + 1k) = 83.

Remember, this 83-455 gain is on top of the 89.2x gain from the instrumentation amplifier. Alpha wave amplitude varies from person to person, from about 10 to 30 uV. Using a middle value of 20 uV, this means the ending voltage reading could range from 83*89.2*20e-6 = .148V to 455*89.2*20e-6 = .81172V. 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). It doesn't have to be maximized such that the amplitude is the highest possible without clipping - just know that if you make it too small, you'll increase the error incurred from digitally reading the data into the computer. 

Step 8: Stage 6 - Another 60Hz Notch Filter (and Into the Computer!)

Picture of Stage 6 - Another 60Hz Notch Filter (and Into the Computer!)

Even with all the previous filtering stages, the data will still at this point contain a good amount of 60 Hz noise. To fix this, we will process it through another notch filter centered at 60 Hz, identical to the previous one. The final data will still have a small amount of noise, but that can be ignored through software once the data is loaded into the computer. 

To get the data into the computer, we will be using a 3.5mm male-to-male cable (this is the same size ending as any headphone jack). On the cable, the first 2 notches are the right and left channels, and the one furthest down is GND. As shown in the picture, you should connect the end of the cable between the 22k resistor and 220nF capacitor (the yellow alligator clip), and the base of the cable to the GND line of your circuit -- the same line you connected your GND electrode to (the red alligator clip in the image). I suggest connecting the other end of these alligator clips to jumper wires, inserting these into their appropriate place in the circuit. Connect the other end of the cable into the microphone port of your computer, and you're good to go!

Now, onto the electrode setup and code.

Step 9: Getting Electrodes, and Proper Placement

Picture of Getting Electrodes, and Proper Placement

For the electrodes themselves, these are known to be very good ones. Check this page for updates, though, as I'm currently investigating cheaper ways to make your own electrodes.

There are many possible electrode placements - which one you choose will depend on a mix of convenience and what you wish to measure. For a trial demonstration, we will measure alpha waves originating from the occipital lobe. This is because these waves are the easiest to produce, are quite large in amplitude, and only require 1 electrode on a section of the scalp with hair.

Parts of your head you'll need to know for this are the mastoid, nasion, and inion. The mastoid is the bone behind your ear: you can easily feel it by rubbing that area. The nasion is the ridge between your nose and forehead, just between your eyebrows. The inion is the point where your skull ends at the back of your head. 

For this setup, you'll need a bandana and some tape (I used electrical tape, but scotch tape or even a band-aid would probably work). First, find your left mastoid. Clear away any hair, and tape the ground electrode to the skin there. Next, tie the bandana tight around your head, such that it is above both the nasion and inion. The bandana will be used to secure in place the remaining 2 electrodes. Put one electrode about 1 inch above and 1 inch to the right of your nasion, and the second the same distance from your inion. Using this top down view, your electrodes should be roughly in the area of Fp2 and O2. 

As mentioned, we will be primarily measuring alpha waves with this setup. Alpha waves are around 8-12 Hz waves, and in general increase in amplitude when you are relaxed or in a more meditative state. Because one electrode lays on your occipital lobe (the part of your brain used for visual processing), whenever you close your eyes there should be a distinct increase in alpha wave concentration. The increase should be even more apparent if you relax and try to clear your mind while your eyes are closed. 

Step 10: "Processing" the Data

Picture of "Processing" the Data

CAUTION: I highly suggest doing this on a laptop, because there is a danger involved if there's a spike in voltage from the wall outlet. Regardless, BE VERY CAREFUL WITH THE PROBES GOING TO THE SOUND CARD. If they accidentally touch a high voltage source (i.e. you stick them into a power outlet), you can fry your computer's sound card.

First thing to do is to download Processing, available at http://processing.org. It doesn't require any installation; just unzip the download, open the folder, and run it. Download the sketch (what programs are called in processing), and open it up. The program should be good to go as is, and while there should be enough documentation to understand what's going on in the sketch, I want to make a few notes and give a general outline of what it does here. 

I encourage you to tinker with the program - change things, make your own, etc. Don't be afraid to break it, since a working version can always be found here. If you're new to programming, the guys that made processing have some really great basic tutorials here. One thing to note is that Processing is case sensitive - if at some point you type in FFTHeight instead of FFTheight, the program will give you an error and take you to the line where you typed in the former. I didn't document every single function that I used - if you're unsure about what a part of code does, you should look up the function being used at processing.org, so that you can see what its meant to do, as well as exactly what it takes as inputs and produces as outputs. Audio classes won't be found as easily there (minim, FFT, AudioInput, etc). To find documentation for those pieces, look here, specifically at the manuals under the tools tab at the top. 

Also, a little background on the FFT. Data can be represented in many ways, two common ways being in time and frequency. Representing information into frequency domain usually amounts to showing data as the combination of a lot of sine waves with various frequencies and amplitudes. If you have a pure sine wave, say oscillating at 1 Hz, you would see the sine wave we all know and love in the time domain, but in the frequency domain would just see one line at f = 1. If in time you had a wave that was made by adding one sine wave at 1 Hz, and one that was half the amplitude the first but at 2 Hz, in frequency you would see two lines - one at 1 Hz with a height of 1, and one at 2 Hz with a height of 0.5.

From this, you can represent very complicated signals (any signal!) as a combination of a number (sometimes an infinite number) of sine waves. The most common way to convert signals from the time domain to frequency is with the FFT (Fast Fourier Transform). It does exactly what I just described -- it takes as input a section of time domain signal, and outputs bands corresponding to the concentration of certain ranges of frequencies in that signal. This data can easily be visualized by displaying each band as a bar with a certain height, as I did in the code.

This program is really just a data acquisition / visualization one. There are a LOT of things you can do with this circuit -- I encourage you to really play around with it and make something of your own! The next step is an optional one detailing something a little more fun that I made with the type of data acquired in this program. 

Code available here.

Step 11: Playing Pong With Your EEG

Picture of Playing Pong With Your EEG

I also decided to make a quick demo game of something more fun you can do with the EEG circuit. You can read most of this in the attached processing code, but the general concept is a simple pong game where you control the paddles with your concentration of alpha waves. The easiest way to manage the controls is to close your eyes and relax to make the paddle move up, and to open your eyes and focus to make it move down. The electrode setup is the same as the previous code slice - GND behind left ear, and active electrodes on the right frontal and occipital lobes.

The associated code is much neater than the data-reading one. Because the game code incorporates object oriented programming, experienced programmers will likely find it easier to follow along, while those that have not worked with object oriented code before may have a harder time. If you fall into the latter category, I highly suggest reading this tutorial to get familiar with the basics.

The circuit used for this one is exactly the same, except you need two, since you have two players. To get it in via the audio cable, connect one of the circuits the usual way (outlined in the previous steps), and the other circuit to the other audio channel (the middle section of the audio cable). You can use one set of batteries for both circuits, so they should share the same ground.

Code available here.

Quick video demo of me using it against a wall here.

Step 12: Going Further - Using Arduino to Get More Inputs

By using the microphone input to your computer, you can monitor two EEG nodes at once (right and left channels). To monitor more simultaneously, however, you need to use a microcontroller such as the Arduino Uno to get the data into your computer. The Uno has 6 analog inputs, so you can observe 6 channels at once without any extra circuitry. If you want to observe more, you need a multiplexer chip such as the MAX4051. This chip will take as input a number of EEG channels and a number from 0-7, and output only the channel corresponding to the number. Rapidly cycling through the channels samples all of them at a rate necessary for good data acquisition.

Comments

AbdelrhmanN (author)2017-12-12

I have two questions
first: would the code show me output when i connect the circuit to my laptop
second: the ICS TL084 and AD620 are what i need to build it up or I need to get another ICS please answer me fast some of my grades depend on this :)

vijmrs99 (author)2017-12-02

does this code is valid with processing 3 also?

RanaY6 (author)2017-11-25

I made this circuit but I have a problem
The circuit does not sense anything until people in the room or the person we put sensors on start talking
Any solutions ?

AlanA47 made it! (author)2016-03-08

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.

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: https://github.com/MarquisdeGeek/EEG

RanaY6 (author)AlanA472017-11-12

Can you explain the code ,please ?

MichaelA536 (author)AlanA472017-10-29

Do you think you could replace the breadboard with an arduino or raspberry pi? Thank you.

unglaublich (author)AlanA472017-07-20

you mentioned about this

bci helmet, have you tried it??? and since it uses rf(radio freq. with the dongle)

for data transfer from the electrodes/sensors how would that hook up with this ???

AhmedS513 (author)AlanA472017-06-21

What kind of electrodes did you use with this helmet?

Vũ MinhP (author)AlanA472016-03-14

If we do the helmet, do we need to use the gel anymore?

AlanA47 (author)Vũ MinhP2016-05-29

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.

romanrandom (author)AlanA472017-06-20

Or you can 3D print them: https://github.com/CASSON-lab/3d_printed_eeg_electrodes

quakig (author)AlanA472017-02-12

Hi Alan,

Since you already made this, can you please clarify as to how did you use the tantalum capacitors in the project.

The schematic given here does not say anything about the polarity of tantalum capacitors. But as far as I know, putting tantalum caps in the wrong direction can destroy it.

So do I need to keep any particular polarity for the tantalum caps?

Hope to hear from you.

AlanA47 (author)quakig2017-02-14

Hi,

So, I actually ran into the same issue building the circuit. Rather than deal with the uni-directional capacitors and track down the current to make sure everything was hooked up properly, I just got some ceramic caps for those instead of tantalum. The diagram called for bi-directional caps, so I decided to trust that instead of the material that was called for in write-up (which never references the fact that the tantalum caps have a direction anyway).

quakig (author)AlanA472017-02-14

Thanks a lot !!

haydar90 (author)AlanA472016-06-04

Hello sir. .. i really appreciate your kindness and for distributing knowledge among people . ..
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?
Thank you very much sir

AlanA47 (author)haydar902016-06-08

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.

AlanA47 (author)haydar902016-06-08

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.

haydar90 (author)AlanA472016-05-31

hello sir :)

please i have a question --

why a lot of these kind of circuits they use a/d converter and then present it on pc ?

can they use an oscillator like ( usb oscillator ) like this ---

im waiting for your answer :) thank u for ur kindness ..

AlanA47 (author)haydar902016-06-03

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.

jimgarbe (author)AlanA472016-03-10

Dude! The helmet is way wicked cool! A true brain bucket! I'm probably going to use the ole "silver spoon" technique for style -- but that sci-fi lookin headgear is making you the envy!

RanaY6 (author)2017-11-12

I can not understand the code and values in the code

DIYscientist made it! (author)2017-10-01

I made this on a breadboard and used the updated code from MarquisdeGeek here https://github.com/MarquisdeGeek/EEG/commit/bf8327... The EEG pads I used didn't have the sensitivity to actually pick up any Alpha or Beta waves, (got them on Amazon) so I purchased Ambu Neuroline EEG probes here https://www.healthproductsexpress.com/Ambu-AMB7261...

The code from Marquis fixes everything except for the "size error." All you have to do is change the two inputs (line 99 or 121) from "size(windowLength, windowHeight, P2D);" to "size(840, 500, P2D);". Since it doesn't recognize integers input as strings.

This is a really neat build, I hope to get the EEG pads soon so I can see the inputs (white wires on the bottom left). One thing I noticed is that on the Low Pass Filter, I didn't have a 25nF capacitor in either of my kits - seems like this is a rarer type. I ended up using a 22nF instead, which shouldn't (hopefully) throw off the readings.

RanaY6 (author)DIYscientist2017-11-12

Do you understand the code, Sir ?

tapanp8 (author)2017-11-09

can anyone pls help me with the coding part....

johnm1370 (author)2017-10-26

Hello, I have a question. Can this EEG circuit work on rodents ? I would build one right away if it can record rodents brain waves. Can someone answer ?

MichaelA536 (author)2017-10-20

Does anyone know if you could ditch using your own breadboard and instead use a raspberry pi or arduino instead? If so, could you attach the amplifier to either processor? Thank you.

eddy465465 (author)2017-08-02

does this circuit provides much information to fly a drone................

jelte1234 (author)eddy4654652017-09-27

That would not be safe at the least, also you only have 2 channels. So no..

jongrrr (author)2017-09-26

has anyone worked out a diagram or schematic for doing it with 8 electrodes instead of 2?

GraceG23 (author)2017-02-05

My circuit seems to work until the LPF(LM4250) which locks the signal at a DC voltage. Anyone who might know what's wrong?

rraviprasanth47 (author)GraceG232017-09-26

THERE IS NO LM4250. ONLY LM358 IS USED.

rraviprasanth47 (author)2017-09-26

is it possible to use a single device that performs the function of sound card and DAQ device given in the circuit?

nidhi.1 (author)2017-09-06

Hello Guys,

I was trying to run the code but Processing is showing me a box," No size mentioned in variable form."

nidhi.1 (author)nidhi.12017-09-06

Please let me know about any solution if possible.

aamirvhora143 (author)2017-08-18

Hello guys.

I'm getting lots of error in given code.

https://github.com/cah6/EEG/blob/master/READ_EEG/R...

Please help to solve this problem.

Thanks in advance

zacnaw2017 (author)2016-11-16

Hi I am trying to put the code from Read_EGG into the processing system that it tells you to download and when I hit run it comes up with a lot of different errors dealing with "FFT", "minim", "in" etc... I don't know what to do I don't really know coding all to well can anyone help me please! I need a response fast!

KarlChilds (author)zacnaw20172017-06-11

I'm having the same issue. Have you figured this out?

Joses JenishS (author)KarlChilds2017-06-26

Were you able to find out a fix for this problem?

Aethnir (author)Joses JenishS2017-06-29

Hey guys! I think you may just need to download the 'minim' sketch library in the processing software... (Sketch > Import a library > add a library > Type minim)...

XochitlV2 (author)2017-02-06

Does anybody know what to do about this?

romanrandom (author)XochitlV22017-06-20

Replace line 99 with:

surface.setSize(windowLength, windowHeight);

KarlChilds (author)XochitlV22017-06-11

I have the same issue.. Did you figure this out by any chance?

smoore5527 (author)2017-06-16

how would I edit this to bring 4 channels to the party? would I need 2 $10 amp chips and do this all twice?

Swantabun (author)2017-06-06

How do I use MyDAQ and labview for EEG data acquisition?

XochitlV2 (author)2017-02-06

how do I download the sketch? please somebody answer my questions

TobiasZ7 (author)XochitlV22017-05-22

At the bottom of step 10 there is a link.

ElectricTanmay (author)2017-01-15

What values of capacitors and resistors do I use in the notch filters for 50Hz? Because it's 50Hz where I live.

EhrenP (author)ElectricTanmay2017-02-13

Try using a different configuration (Twin T) for the 50hz notch filter. I'm doing so, as I couldn't figure out the configuration or transfer function of the particular design he gives, but can calculate it easier building one from the Twin T way. (there are specific tutorials online in how to construct a 50hz specifically with values if that's easier) then just connect to the following circuit block as normal.

mvencelj (author)EhrenP2017-05-08

Hmm, I don't recognize the topology given here as a notch filter. With the values as given, it is actually a high pass filter.
I would also propose a twin-T instead.

ElectricTanmay (author)EhrenP2017-02-13

Ah yes! I'll try that. Thanks!

About This Instructable

766,781views

1,107favorites

License:

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