↑↓ 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
ProjectOne eveningNothing new, reusing Project B parts; $85 from an empty benchTier 1

Project D: Eyes as a joystick

Electrooculography. Two electrodes beside the eyes, a near-DC amplifier, and a cursor that follows your gaze. Weirdly simple, and the first step of an assistive speller.

AssumesThe safety charterSpineAnalog / mixed-signal hardwareClinical / regulatory / human factors
On this pageOne evening
  1. The circuit
  2. Electrodes
  3. Software
  4. Why this project matters

The eyeball is a battery. The front of the eye is a few millivolts positive relative to the back, so when you look left, the skin beside your left eye becomes slightly more positive and the skin beside your right eye slightly more negative. Two at the outer corners of the eyes pick up about 15 microvolts per degree of gaze. Amplify it, read it on an Arduino, and a dot on the screen follows your eyes. This is . It is also why blinks wreck , and it is the first stage of the speller you might build for someone with in Phase 5.

Predict before you look

You look 30 degrees to the left and hold your gaze there. What does the EOG trace do?

A step up that stays while you hold. is a position signal, not a velocity signal, which is what makes it usable as a joystick. It is also why the amplifier must pass very low frequencies: a high-pass at 0.5 Hz would turn the step back into a blip within a couple of seconds.

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
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
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
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
Total (prices drift; treat as a ceiling)$83

The circuit

The Project B amplifier with the high-pass lowered as far as it will go. Replace the 1 µF and 330 kΩ high-pass with 10 µF and 1 MΩ, for a corner at about 0.016 Hz, which holds a step for a minute before it decays. Keep the at 2000: a 30° look is about 500 µV, which becomes 1 V at the output, a comfortable swing for the Arduino. Keep the 35 Hz low-pass. For a second, vertical channel, build a second copy of the amplifier or use the AD8232 breakout (its high-pass is too high for clean but it will show you the deflections).

Electrodes

EOG electrode sites
This interactive needs JavaScript. If you are reading a printout, the caption describes what it shows.
Figure 1. Roughly where the cups go. The horizontal pair sits beside the outer corners of the eyes, near F7 and F8 on the 10-20 map; the reference and driven electrodes on the forehead near Fpz. The vertical pair is above and below one eye, off the map.

Horizontal channel: one gold cup at the outer corner of each eye, about a centimetre from the eye on the temple bone. Vertical channel, if you have it: one above the eyebrow and one below the eye on the cheekbone, same eye. Reference and on the forehead between the eyebrows, or on an earlobe.

Software

Read the channel, subtract a baseline captured while looking at the centre of the screen, scale to pixels, move a dot. Drift is the whole problem: the offset wanders by hundreds of microvolts over minutes, which looks exactly like a slow gaze shift. Add a key that recentres the baseline, and later a rule that slowly pulls the baseline toward the current value whenever the eyes have been still for a while.

A minimal Python listener, with pyserial and pygame:

import serial, pygame
ser = serial.Serial('/dev/ttyUSB0', 115200)
pygame.init(); screen = pygame.display.set_mode((800, 600))
base = None; gain = 0.8
while True:
    line = ser.readline().decode(errors='ignore').strip()
    if not line: continue
    h = float(line.split(',')[0])
    if base is None: base = h
    for e in pygame.event.get():
        if e.type == pygame.KEYDOWN and e.key == pygame.K_SPACE: base = h  # recentre
    x = int(400 + gain * (h - base))
    screen.fill((16, 21, 18)); pygame.draw.circle(screen, (124, 255, 178), (x, 300), 12); pygame.display.flip()
  1. Modify the high-pass and confirm on the plotter that the trace holds a step: touch an input briefly to a 9 V battery through a 1 MΩ and 100 Ω divider (about 900 µV) and watch the output step and hold for tens of seconds.
  2. Apply the horizontal and the reference. Look centre, left, centre, right. Watch the plotter. You should see clean steps of opposite sign.
  3. Blink. Notice the blink is a sharp on the horizontal channel and a large deflection on the vertical channel. File that away for the bestiary.
  4. Run the listener. Recentre with the spacebar while looking at the centre. Look around.
  5. Save a plot of left-centre-right-centre with the step sizes in microvolts noted, and measure your microvolts-per-degree by looking at two marks a known angle apart.

Why this project matters

Eye-tracking is the most reliable channel a person with advanced has, until the eyes fail too. Commercial eye-gaze systems are cameras and cost thousands of dollars. is a different sensing principle that works with the eyes closed, in the dark, and for a few dollars, and it is the foundation of the hybrid speller in Phase 5. The drift problem you just met is the entire reason that project is hard.

Recall
Why must an EOG amplifier pass much lower frequencies than an EEG amplifier?
EOG is a position signal: looking to one side produces a step that holds. A 0.5 Hz high-pass would decay that step to nothing within seconds, turning position into a brief blip.
Recall
What is the main practical problem in EOG and why?
Baseline drift. Electrode offsets wander by hundreds of microvolts over minutes, which is indistinguishable from a slow gaze shift, so the system needs recentring or baseline tracking.