Bench modeSteps, parts, and safety only. Big type for a phone at the bench.
Phase 1: First contactProjectOne eveningAbout $40 in partsTier 1

Project C: Muscle to motion

Forearm EMG drives a servo, a game, or a cursor. The fastest reliable "control something with your nervous system" you can build.

AssumesThe safety charterSpineAnalog / mixed-signal hardwareDecoding / signal processing / ML

You are skimming: the title, the first figure, and the short version. Switch to Read in the header for the full page, or Deep to open every deep dive.

Muscles are electrically loud. When you clench your fist, the muscles in your forearm produce a burst of activity a thousand times larger than EEG, and two snap electrodes over them will pick it up with almost no fuss. Amplify it, smooth it into an envelope, and map the envelope to a servo angle, and you have built a one-channel controller, which is the control principle of most prosthetic hands sold today.

Predict before you look

A single motor unit fires at maybe 10 to 30 times a second. When you clench hard, what does the raw EMG look like?

Dense noise whose loudness tracks effort. Hundreds of motor units fire asynchronously, and their spikes overlap into something that looks like noise between about 20 and 500 Hz. The information is in the envelope, not the waveform, which is why step one of every EMG controller is to rectify and smooth.

Parts

PartWhereQtyApprox.
9 V batteries and snap connectors, ×4
Two batteries give you a ±9 V split supply. Never power anything touching skin from the wall or from a laptop USB port.
Any store1$10
AD8232 heart-rate monitor breakout
A complete biopotential front end on a board. Use it to compare against your own amplifier, and to see what a good DRL looks like.
SparkFun, Adafruit1$20
Arduino Nano Every or Uno (10-bit ADC, USB serial)
A clone works. You need a real analog input; the Nano Every and Uno are the simplest path to the Web Serial plotter.
Arduino store, Amazon, Micro Center1$15
Disposable snap ECG electrodes, pack of 50, and snap leads
For EMG and as a quick ground/reference. Snap leads with alligator or 3.5 mm ends.
Amazon1$12
Full-size breadboard, ×2, and jumper wiresAdafruit, Amazon1$12
Hobby servo (SG90)
For muscle-to-motion.
Adafruit, Amazon1$4
INA128 instrumentation amplifier (DIP-8), ×2
The AD620 or INA118 are interchangeable for our purposes. Get the through-hole DIP version for breadboards.
Digi-Key, Mouser2$18
Resistor and capacitor assortment
1% metal-film resistors matter for the instrumentation amplifier's balance. Include 0.1 µF ceramics and a few 1 to 10 µF film or ceramic caps.
Amazon, Adafruit1$15
Total (prices drift; treat as a ceiling)$106

Two routes

Route 1: the amplifier you already built. Take the single-channel EEG amplifier from Project B and change two capacitors. The high-pass moves from 0.5 Hz to about 20 Hz (0.1 µF into 82 kΩ) so that motion artifact and the electrode offset are gone. The low-pass moves from 35 Hz to about 500 Hz (3.3 kΩ into 0.1 µF). Reduce the total gain to about 500, because EMG is bigger. Sample at 1000 Hz.

Route 2: the AD8232 breakout. SparkFun’s board has an , a circuit, and filters on one board. Its filters are set up for heart signals (0.5 to 40 Hz), so it attenuates most of the EMG band, but the envelope still comes through well enough to drive a servo, and it takes fifteen minutes. Use this route if you want the demo tonight, and route 1 if you want to understand it.

Electrodes

Two snap electrodes about three centimetres apart along the flexor muscles on the inside of the forearm, a hand’s width below the elbow, going to the two amplifier inputs. A third on the bony point of the elbow as the DRL or reference. Clean the skin with alcohol first. Clench: the trace should explode. Relax: it should be nearly flat.

Software

On the Arduino, three lines of real work per sample. Subtract the midpoint (512), take the absolute value, and run an exponential moving average with a time constant of about 100 ms. That number is the envelope. Map it from its resting value to its clenched value onto 0 to 180 degrees, write it to the servo. Send the raw sample and the envelope out over serial as two channels so the plotter shows both.

// inside the 1 kHz sampling loop
int raw = analogRead(A0) - 512;
float rect = abs(raw);
env = env + 0.01f * (rect - env);           // ~100 ms smoothing at 1 kHz
int angle = constrain(map((int)env, restLevel, clenchLevel, 0, 180), 0, 180);
servo.write(angle);
Serial.print(raw); Serial.print(','); Serial.println((int)env);

Calibrate restLevel and clenchLevel by watching the envelope on the plotter for a few seconds relaxed and a few seconds clenched, and hard-coding the numbers. Later you will make this automatic; for now it teaches you that every biosignal system has a calibration step.

  1. Choose a route and build or connect the amplifier. Confirm a flat trace with the electrodes shorted together.
  2. Apply three electrodes as described. Watch the raw trace: relax, clench, relax. Note the resting and clenched amplitudes in your notebook.
  3. Add the rectify-and-smooth code. Watch the envelope channel follow your clench with a small lag. Change the smoothing constant and see the lag change.
  4. Connect the servo (signal to pin 9, power from the Arduino 5 V). Map the envelope to angle. Clench slowly and watch the horn follow.
  5. Save a plot of the raw and envelope for one clench. Record the two calibration numbers.

Going further

Two channels, flexors and extensors, and a servo that goes both ways. Drive a game instead of a servo: Python reads the serial port and presses a key when the envelope crosses a threshold. Add a second threshold for a “hard” clench and you have two commands, which is the control scheme of a two-site prosthetic hand. Then read the armband project, where eight channels and a classifier turn this into gesture recognition.

What to read now

Why so small? has the table of how big each biosignal is; EMG’s place on it explains why this project was easy. The Phase 5 control project is what this becomes when it is for someone else.

Recall
Why is the first processing step in every EMG controller rectify-and-smooth?
EMG is the overlapping activity of hundreds of asynchronous motor units and looks like band-limited noise. Its information is in the envelope (loudness), not the waveform, so you take the absolute value and average.
Recall
Why can't you notch out 60 Hz from EMG the way you might from EEG?
EMG's useful band (about 20 to 500 Hz) contains 60 Hz, so a notch removes signal along with hum. Hum has to be fixed at the source.