↑↓ move↵ open[] previous / next lesson? all shortcuts
Appearance
Theme
Type size
Reading

Focus mode hides the sidebars. Press f to toggle it anywhere.

Keyboard shortcuts
/
Search
[ ]
Previous / next lesson
t
Jump to the table of contents
r
Review queue
f
Focus mode
?
This panel
ProjectTwo eveningsAbout $65 more after Project A, $170 from an empty benchTier 1

Project B: One channel of you

Alpha EEG from one instrumentation amplifier, a driven-right-leg circuit, and gold cup electrodes. Close your eyes and a bump appears at 10 Hz. Open them and it vanishes.

AssumesThe safety charterSpineAnalog / mixed-signal hardware
On this pageTwo evenings
  1. The circuit
  2. What the numbers should look like
  3. Going further
  4. What to read now

This is the project that makes the field feel real. Three , one on the back of your head, one on an earlobe, one on your forehead. An amplifier with a of about two thousand and a band-pass from half a hertz to forty. An Arduino to sample it and the Web Serial plotter to show it. Close your eyes and watch a peak grow at about 10 Hz in the . Open them and watch it disappear within a second. That peak is your , and once you have seen it you will not stop seeing it.

One channel of simulated EEGSimulated signal
This interactive needs JavaScript. If you are reading a printout, the caption describes what it shows.
Figure 1. What you are aiming for. A simulated single channel over the back of the head, with the usual troubles. Press Eyes closed and watch the spectrum. Then try the filters.
Try this
  1. Press Eyes closed. Watch the shaded alpha band in the fill in over two seconds. Press it again.
  2. Turn Mains hum up until the trace is a solid band, then set the low-pass to 40 Hz. Then turn the on. Notice which one helped more.
  3. Press Blink. Compare its size to alpha. Set the high-pass to 0.5 Hz and press Blink again.
Predict before you look

Where on the head will alpha be largest?

The back of the head, over visual cortex. Alpha is what visual cortex does when it has nothing to look at. Put the on the forehead first and you will see nothing, which is a useful mistake to make once.

Parts

PartWhereQtyApprox.
9 V batteries, ×4, and snap connectors
$9.69 for four Energizer cells plus $3.59 for three snap connectors (Amazon B0CR8RKQ5Q). Two batteries give you a ±9 V split supply. Never power anything touching skin from the wall or from a laptop USB port.
Amazon, any store1$13
AD8232 heart-rate monitor breakout
A complete biopotential front end on a board, and the clone comes with a cable and pads. SparkFun's version is $24.41 and has better documentation and a known-good layout. Use it to compare against your own amplifier, and to see what a good DRL looks like.
Amazon, SparkFun1$11
Alligator clip leads, ×10Amazon1$5
Arduino Nano clone (ATmega328P, CH340), ×3
A three-pack is cheaper than one genuine board and you will kill one. The official Nano Every is $14.90 for a single board if you want Arduino's support. Either has the 10-bit analog input the Web Serial plotter needs; CH340 boards work with Chrome's Web Serial.
Amazon1$13
Auto-ranging digital multimeter
You will use this more than any other tool, so buy an auto-ranging one; the $17 TM-510 is auto-ranging. Below that price you get manual ranging, which wastes time. A true-RMS meter is about $35 and you will not need it this year.
Amazon1$17
Disposable snap ECG electrodes, bag of 50
3M Red Dot, $11.40 for fifty. Clip the alligator leads onto the snap studs rather than buying leads; a set of four 3.5 mm snap leads is $9.99 if you want them tidy.
Amazon1$12
EEG conductive paste, 50 g tube
Holds the cups on and lowers impedance. A 50 g tube is enough for many sessions; the 8 oz jar of Ten20, which is the clinical standard and easier to remove from hair, is $27.99.
Amazon1$9
Flush cutters, wire strippers, tweezers
$7.99 for the stripper and flush cutter, plus $5.99 for a three-piece ESD tweezer set (Amazon B0BNNGC3Q2).
Amazon1$14
Full-size breadboard, ×2, and jumper wires
Two 830-point boards, two 400-point boards, and 120 jumpers for $7.99. Adafruit's single premium board is $5.95 and its contacts grip better.
Amazon1$8
Gold cup EEG electrodes, set of 10 with DIN 1.5 mm leads
$22.01 for ten, shipped free, in two to four weeks. The same thing on Amazon is about $60 for ten and arrives in days; the OpenBCI set is $44.99 and is usually sold out. Reusable, so clean them after each use.
AliExpress1$22
INA128 instrumentation amplifier (DIP-8), ×2
A two-pack is $9.99. TI's own INA128P is $18.99 each and the part is on a discontinuance notice, so the marketplace two-packs are grey stock; they work, but if one is noisier than the datasheet that is why. The AD620 or INA118 are interchangeable for our purposes. Get the through-hole DIP version for breadboards.
Amazon2$10
Resistor and capacitor assortment
$5.69 for 600 1% metal-film resistors, plus $9.99 for a 480-piece ceramic capacitor kit (10 pF to 10 µF, Amazon B0D2GVNDHY). 1% metal-film matters for the instrumentation amplifier's balance.
Amazon1$16
Temperature-adjustable soldering iron kit with solder, stand, and flux
$11.99 for the iron, five tips, solder, a stand, and flux, which is everything Phase 1 needs. Its temperature dial is open-loop and its tips wear fast; the Pinecil V2 at $25.99 from Pine64 holds temperature properly and will outlast your degree, and it needs a USB-C PD supply you may already own.
Amazon1$12
TL072 dual op-amps, ×10
For filters, the DRL circuit, and the audio stage of the SpikerBox. A ten-pack costs the same as two singles. The OPA2134 is quieter if you want to hear the difference.
Amazon1$6
Total (prices drift; treat as a ceiling)$168

The circuit

Compared to the , two things change: the moves down to frequencies, and a third with a feedback circuit is added to cancel hum.

Input protection. Each lead goes through a 100 kΩ resistor before the amplifier input. With the INA128’s 10 GΩ this costs nothing, and it limits any fault current to microamps.

. INA128, resistor 500 Ω, about 100. The resistor is split into two 250 Ω resistors in series, because the junction between them carries the average of the two inputs, which is the voltage. You need it for the next part.

. A TL072 stage takes the common-mode voltage from that junction, inverts and amplifies it (1 MΩ feedback, 25 kΩ input, so about −40), and drives the third through a 390 kΩ resistor. Now the body’s hum is actively cancelled instead of only rejected. The 390 kΩ limits the current the circuit can push into you to about 25 microamps even if everything fails, which is what requires.

High-pass at 0.5 Hz. A 1 µF capacitor into 330 kΩ. This removes the offset, which can be tens of millivolts and would saturate the next stage. It also removes sweat drift.

Second stage. TL072 non-inverting, 20 (1 kΩ to ground, 19 kΩ feedback; 18 kΩ plus 1 kΩ works). Total about 2000, so 50 µV of alpha becomes 100 mV.

Low-pass at about 35 Hz. 10 kΩ into 0.47 µF. This is the for a 250 Hz sample rate, and it knocks down a good part of the 60 Hz.

Level shift for the . The output swings around ground. The Arduino reads 0 to 5 V. A 10 µF capacitor into two 1 MΩ resistors, one to 5 V and one to ground, centres the signal at 2.5 V without adding a meaningful high-pass (0.03 Hz).

One channel of EEG, every stage
This interactive needs JavaScript. If you are reading a printout, the caption describes what it shows.
Figure 2. Every stage of the amplifier. Hover or tap a part for its value and its job. The driven-right-leg stage takes the common-mode voltage from the junction of the split gain resistor; the 390 kΩ in its output is the safety limit.
The three electrodes
This interactive needs JavaScript. If you are reading a printout, the caption describes what it shows.
Figure 3. Where the three electrodes go, top view, nose up. O1 over the back of the head on the left, the reference on the left earlobe, the driven electrode on the forehead. Tap any site for what is under it.
10-20 electrode application with gold cups and pasteNatus Neuro7:14Open on YouTubeA clinical technologist doing it properly: skin prep, a full cup of paste, a gauze square pressed over the cup. You only need three sites, but the hand movements are the same.
  1. Build the with the split resistor and the two bypass capacitors. Test with a 1 kHz tone through a 100:1 divider as in the .
  2. Add the 0.5 Hz high-pass and the ×20 stage. Test again; the tone should be about 2000 times bigger than the input. With the input shorted through 10 kΩ, look at the output on the plotter: this is your . Write it down in millivolts and divide by 2000.
  3. Add the low-pass, the level shift, and the Arduino. Load the serial streamer sketch from the plotter page. Confirm you see a flat line at about 512 counts with the input shorted.
  4. Add the stage. Do not connect it to anything yet. Check it does not oscillate (a steady output near 0 V with the inputs shorted).
  5. Prepare the skin. Part the hair at the back of the head, slightly left of centre (the position called O1), and rub the spot with a little Nuprep or alcohol on a cotton swab. Do the same on the left earlobe and the centre of the forehead.
  6. Fill three gold cups with Ten20 paste, more than seems reasonable, and press them on: O1 to the amplifier’s + input, earlobe to the − input, forehead to the output. Hold each cup down for ten seconds. A strip of medical tape helps.
  7. Unplug the laptop charger. Connect the Arduino. Start the plotter.
  8. Sit still, look at a fixed point, and watch. Blink on purpose and see the deflection. Clench your jaw and see the burst. Then close your eyes for ten seconds and watch the .
  9. Save a plot with eyes closed and one with eyes open, axes labelled, and the CSV next to them.

What the numbers should look like

Real alpha, eyes closed against eyes open
This interactive needs JavaScript. If you are reading a printout, the caption describes what it shows.
Figure 4. Real EEG, not simulated: subject S001 from the PhysioNet motor-imagery dataset, channel O1, eyes closed, with the eyes-open run overlaid in yellow on the spectrum. The bump at about 10 Hz is what you are looking for. Scrub through it; alpha comes and goes in bursts.
Alpha waves of the EEGBackyard Brains3:25Open on YouTubeEyes open, eyes closed, on the same kind of hardware you just built.

Input-referred noise with a shorted input: a few microvolts RMS if soldered, ten or twenty on a breadboard. Alpha, eyes closed, at O1: 20 to 60 µV peak in most people. A blink at O1: 50 to 150 µV. The same blink on the forehead: 300 µV or more. Sixty-hertz hum after the and low-pass, with the laptop unplugged: under 5 µV, ideally under 1.

Going further

Replace the breadboard with a soldered board and watch the drop by a factor of five. Compare your amplifier to the AD8232 breakout, which has a and built in, and see what a professional designer did differently. Move the to C3 (above the left ear, toward the top) and open and close your right hand: the mu rhythm is alpha’s cousin and it drops when you move. Add a second channel and a second Arduino pin.

What to read now

Why so small? is about the , the difference measurement, and the third you just used. Why the hum? is the debugging list above, with the reasons. Alpha and the back of the head is about what you saw. And the artifact bestiary will name every strange thing on your trace.

Recall
Why is the gain resistor of the instrumentation amplifier split into two?
The junction between the two halves carries the average of the two inputs, the common-mode voltage, which the driven-right-leg circuit inverts and feeds back to the third electrode.
Recall
What does the 390 kΩ resistor in the DRL output do, and which standard does it satisfy?
It limits the current the circuit can ever push into the body to about 25 µA even under a fault, satisfying IEC 60601 patient leakage limits.
Recall
Why must the 0.5 Hz high-pass come before the second gain stage rather than after?
Electrode offsets can be tens of millivolts. Multiplied by 20 they would saturate the stage; the high-pass removes them first.