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.
On this pageOne evening
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 electrodesElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry 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 electrooculographyElectrooculography (EOG) Recording eye position from the standing voltage across the eyeball, which moves with the eyes; also the main source of blink artifacts in EEG. Related: Blink artifactBlink artifact The large, slow deflection an eye blink produces in frontal channels, often ten times the size of the brain signal., Electroencephalography (EEG)Electroencephalography (EEG) Recording the brain's electrical activity from electrodes on the scalp, a few tens of microvolts of blurred, summed cortical activity.. Glossary entry. It is also why blinks wreck EEGElectroencephalography (EEG) Recording the brain's electrical activity from electrodes on the scalp, a few tens of microvolts of blurred, summed cortical activity. Related: Electrocorticography (ECoG)Electrocorticography (ECoG) Recording from electrodes placed on the surface of the brain under the skull, usually during epilepsy surgery evaluation; cleaner and sharper than EEG. , Magnetoencephalography (MEG)Magnetoencephalography (MEG) Recording the tiny magnetic fields produced by cortical currents with superconducting sensors in a shielded room; less blurred by the skull than EEG, and far more expensive. , Volume conductionVolume conduction The spreading of currents from a source through the conductive tissues of the head, which is why one source shows up on many electrodes and why scalp EEG is blurry. , Microvolt (µV)Microvolt (µV) One millionth of a volt. Scalp EEG is tens of microvolts; a AA battery is 1.5 million of them. . Glossary entry, and it is the first stage of the speller you might build for someone with ALSAmyotrophic lateral sclerosis (ALS) A progressive disease of motor neurons that removes movement and eventually speech while leaving thought intact; the population many BCIs are built for. Related: Locked-in syndromeLocked-in syndrome Full awareness with almost no voluntary movement, sometimes only the eyes; communication depends entirely on assistive technology. , Augmentative and alternative communication (AAC)Augmentative and alternative communication (AAC) Any tool that helps someone who cannot speak communicate, from picture boards to eye-gaze spellers to BCIs. . Glossary entry in Phase 5.
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. EOGElectrooculography (EOG) Recording eye position from the standing voltage across the eyeball, which moves with the eyes; also the main source of blink artifacts in EEG. Related: Blink artifactBlink artifact The large, slow deflection an eye blink produces in frontal channels, often ten times the size of the brain signal. , Electroencephalography (EEG)Electroencephalography (EEG) Recording the brain's electrical activity from electrodes on the scalp, a few tens of microvolts of blurred, summed cortical activity. . Glossary entry 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
| Part | Where | Qty | Approx. |
|---|---|---|---|
| 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 store | 1 | $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. | Amazon | 1 | $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. | Amazon | 1 | $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. | AliExpress | 1 | $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. | Amazon | 2 | $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. | Amazon | 1 | $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 gainGain How many times an amplifier multiplies its input; 1000× turns 50 microvolts into 50 millivolts, enough for an ADC to see. Related: Instrumentation amplifierInstrumentation amplifier A precision differential amplifier with very high input impedance and high CMRR, built from three op-amps and sold as a single chip such as the INA128 or AD8232. . Glossary entry 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 EOGElectrooculography (EOG) Recording eye position from the standing voltage across the eyeball, which moves with the eyes; also the main source of blink artifacts in EEG. Related: Blink artifactBlink artifact The large, slow deflection an eye blink produces in frontal channels, often ten times the size of the brain signal. , Electroencephalography (EEG)Electroencephalography (EEG) Recording the brain's electrical activity from electrodes on the scalp, a few tens of microvolts of blurred, summed cortical activity. . Glossary entry but it will show you the deflections).
Electrodes
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 DRLDriven-right-leg circuit A third electrode fed with an inverted copy of the common-mode signal, so the body's hum is actively cancelled instead of merely rejected. Related: Common-mode signalCommon-mode signal A voltage that appears equally on both inputs of a differential amplifier, such as 60 Hz hum picked up by the whole body. , Ground electrodeGround electrode The electrode that ties the body to the amplifier's zero and, in a good design, is driven to cancel common-mode hum. . Glossary entry 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 electrodeElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry 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()
- 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.
- Apply the horizontal electrodesElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry and the reference. Look centre, left, centre, right. Watch the plotter. You should see clean steps of opposite sign.
- Blink. Notice the blink is a sharp spikeSpike Shorthand for an action potential as seen by an electrode, a brief blip about a millisecond wide. Related: Action potentialAction potential The brief, all-or-nothing voltage spike a neuron fires, about a millisecond long and about 100 millivolts tall across its membrane. , Spike sortingSpike sorting Deciding which spikes on an electrode came from which neuron, by clustering their waveform shapes. , Extracellular recordingExtracellular recording Recording with an electrode near neurons rather than inside one; you see small, fast blips from nearby cells rather than the full membrane swing. . Glossary entry on the horizontal channel and a large deflection on the vertical channel. File that away for the artifactArtifact Anything in the recording that did not come from the brain: blinks, muscle, heartbeat, movement, sweat, mains hum, electrode pops. Related: Blink artifactBlink artifact The large, slow deflection an eye blink produces in frontal channels, often ten times the size of the brain signal. , Independent component analysis (ICA)Independent component analysis (ICA) A method that unmixes multichannel data into statistically independent sources, so blinks and heartbeat can be identified and removed. , Artifact subspace reconstruction (ASR)Artifact subspace reconstruction (ASR) An automatic method that detects short high-variance bursts and reconstructs them from clean data; common in real-time pipelines. . Glossary entry bestiary.
- Run the listener. Recentre with the spacebar while looking at the centre. Look around.
- 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 ALSAmyotrophic lateral sclerosis (ALS) A progressive disease of motor neurons that removes movement and eventually speech while leaving thought intact; the population many BCIs are built for. Related: Locked-in syndromeLocked-in syndrome Full awareness with almost no voluntary movement, sometimes only the eyes; communication depends entirely on assistive technology. , Augmentative and alternative communication (AAC)Augmentative and alternative communication (AAC) Any tool that helps someone who cannot speak communicate, from picture boards to eye-gaze spellers to BCIs. . Glossary entry has, until the eyes fail too. Commercial eye-gaze systems are cameras and cost thousands of dollars. EOGElectrooculography (EOG) Recording eye position from the standing voltage across the eyeball, which moves with the eyes; also the main source of blink artifacts in EEG. Related: Blink artifactBlink artifact The large, slow deflection an eye blink produces in frontal channels, often ten times the size of the brain signal. , Electroencephalography (EEG)Electroencephalography (EEG) Recording the brain's electrical activity from electrodes on the scalp, a few tens of microvolts of blurred, summed cortical activity. . Glossary entry 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.