Build Project

Healthcare

ESP32 AD8232 Bench Signal Viewer — No Electrodes

Read AD8232 output and leads-off flags on ESP32 with every electrode port disconnected. A USB bench acquisition demo, not a body-connected ECG.

AdvancedAges 14+Assembly time variesParts cost variesBench only — no electrodes
Logical non-body-connected bench data flow; no electrodes or measured ECG shown
Project Mission

View AD8232 Bench Samples — No Electrodes

Explain Like I'm 12

An analog front end amplifies and filters a small input. The ESP32 can digitize its output, but an unplugged input can float, clip or pick up interference. Drawing that output does not turn it into a heartbeat.

Learning Support

  • Recommended ageAges 14+
  • Adult supervisionSupervise low-voltage wiring; no person or animal connects to this circuit.
  • Classroom useStudy ADC counts and open-input status with every electrode port empty.
  • Parent promptWhy does a plotted shape not establish a biological signal or a safe patient interface?
  • Screen-free activityDraw the boundary between a USB-connected bench and a body-connected instrument.
  • Next challengeUse the separate analog-input guide and a potentiometer for a controlled waveform exercise; do not add electrodes to this USB bench.
  • Skills practiced
    • ADC1 acquisition
    • Digital status inputs
    • Serial display
    • Signal provenance
  • Learning outcomes
    • Read actual AD8232 OUTPUT counts on GPIO34.
    • Record LO+ and LO− pin states separately.
    • Explain clipping and open-input noise without interpreting it medically.
    • Keep all electrode pads, jack and lead cables disconnected.
  • Mini experiments
    • Observe the open-input output and leads-off states without attaching anything to the electrode connectors.
    • For an ADC wiring check, power off, disconnect AD8232 OUTPUT from GPIO34, then connect GPIO34 to GND. Restore power and compare the actual low-end counts. Power off again before restoring the original wiring.

Safety Standards

  • Bench-only, no electrodes, no skin contact and no health measurements.
  • Disconnect USB before wiring or changing the ADC test connection.
  • Use only ESP32 3V3 for the selected AD8232 board; no 5 V module supply or external signal generator is part of this exercise.

What You Will Build

A non-body-connected acquisition demo using a SparkFun SEN-12650 AD8232 board (v10 schematic) and classic ESP32-WROOM DevKit. It prints actual raw ADC samples and leads-off flags to USB Serial. The historical ECG URL remains, but this exercise does not acquire an ECG from a person.

Components List

  • Classic ESP32-WROOM DevKitUSB-powered; exposed GPIO34 (ADC1), GPIO32 and GPIO33; Arduino-ESP32 3.3.2.
  • SparkFun AD8232 Single Lead Heart Rate Monitor SEN-12650Use the documented v10 board configuration. OUTPUT, LO−, LO+, 3.3V and GND labels are the reference; do not assume another carrier has the same order.
  • Breadboard, short jumper wires and USB data cableNo electrode cable, pads, battery/isolation adapter or external generator is required.

Bill of Materials

PartQtyEstimated CostNotes
Classic ESP32-WROOM DevKit1VariesUSB-powered; exposed GPIO34 (ADC1), GPIO32 and GPIO33; Arduino-ESP32 3.3.2.
SparkFun AD8232 Single Lead Heart Rate Monitor SEN-126501VariesUse the documented v10 board configuration. OUTPUT, LO−, LO+, 3.3V and GND labels are the reference; do not assume another carrier has the same order.
Breadboard, short jumper wires and USB data cable1VariesNo electrode cable, pads, battery/isolation adapter or external generator is required.

Wiring

Only the electronics header connects to the ESP32. SparkFun SEN-12650 OUTPUT → GPIO34, LO+ → GPIO32, LO− → GPIO33, 3.3V → 3V3 and GND → GND. Leave the electrode jack and RA/LA/RL pads completely empty.

Logical non-body-connected AD8232 bench: OUTPUT to GPIO34 input, LO+ to GPIO32, LO− to GPIO33, 3.3V and GND; all electrode ports empty.

Open wiring diagram full size

  1. 1

    Unplug USB. Remove every electrode lead and pad; inspect that no person, animal or other instrument connects to the electrode side.

  2. 2

    Connect board 3.3V to ESP32 3V3 and board GND to GND. Do not substitute 5 V power.

  3. 3

    Connect OUTPUT to GPIO34 (input only), LO+ to GPIO32 and LO− to GPIO33. Leave SDN unconnected: the selected SparkFun v10 board includes its pull-up. Verify any different carrier before use.

  4. 4

    Keep the 3.5 mm jack and RA/LA/RL pads empty. Do not short them or attach a signal generator as an undocumented substitute.

  5. 5

    Upload with Arduino-ESP32 3.3.2 and open Serial Monitor or Serial Plotter at 115200 baud. USB is used only with this non-body-connected arrangement.

  6. 6

    Observe actual raw and lo_plus/lo_minus fields. Leads-off is expected with open inputs; no waveform or health value is being validated.

GPIO Mapping

SignalESP32 PinDirectionNotes
AD8232 OUTPUTGPIO34Analog inputADC1 input-only pin; 12-bit raw counts, not GPIO output.
AD8232 LO+GPIO32Digital inputActual leads-off comparator status.
AD8232 LO−GPIO33Digital inputActual leads-off comparator status.
Board 3.3V / GND3V3 / GNDPower / referenceOne USB-powered low-voltage bench; no patient isolation claimed.
SDNNot connectedBoard pull-upSparkFun v10 pull-up holds it enabled.
Electrode jack and RA/LA/RLNot connectedNo body connectionNo leads, pads or external source attached.

Circuit Explanation

AD8232 is an analog signal-conditioning front end, not an ADC or an isolation barrier. The selected carrier sets its gain, filters and leads-off mode using external components. USB ground joins the ESP32 and board. No patient-safe power/data barrier is present; keeping the electrode ports empty is the actual supported boundary.

Engineering Explanation

The code requests 12-bit raw ADC counts (0–4095), not millivolts or physiological units. Classic ESP32 at 11 dB has an approximately 0.15–3.1 V documented measurement range; this differs from the board's 3.3 V supply and GPIO limits. A 3.3 V-powered AD8232 output can approach its rails and clip the measurement; a flat or noisy trace with open inputs is not a measured ECG. LO flags are status bits, not signal-quality or safety certification. Target polling is 100 readings/s, with software/Serial jitter; this is not a clinical acquisition bandwidth claim.

Libraries

  • Arduino-ESP32 3.3.2Classic ESP32-WROOM review baseline; analogReadResolution(12), ADC_11db and digitalRead. No external sensor library is required.

Code

Copy into Arduino IDE. Install any libraries noted in the component guides first.

esp32-ecg-monitor.ino
// Classic ESP32-WROOM DevKit; Arduino-ESP32 3.3.2; no external library.
// SparkFun AD8232 SEN-12650 v10: BENCH ONLY, no leads or electrodes attached.
// USB Serial is permitted only in this non-body-connected arrangement.
const int SIGNAL_PIN = 34; // AD8232 OUTPUT -> ADC1 input, never a GPIO output.
const int LO_PLUS = 32;
const int LO_MINUS = 33;
const uint32_t PERIOD_US = 10000; // Target 100 readings/s, not precision timing.
uint32_t lastSampleUs = 0;

void setup() {
  Serial.begin(115200);
  pinMode(SIGNAL_PIN, INPUT);
  pinMode(LO_PLUS, INPUT);
  pinMode(LO_MINUS, INPUT);
  analogReadResolution(12);
  analogSetPinAttenuation(SIGNAL_PIN, ADC_11db);
  lastSampleUs = micros();
}

void loop() {
  uint32_t now = micros();
  if ((uint32_t)(now - lastSampleUs) < PERIOD_US) return;
  lastSampleUs = now; // Do not manufacture catch-up samples after a delay.
  uint16_t raw = analogRead(SIGNAL_PIN);
  int loPlus = digitalRead(LO_PLUS);
  int loMinus = digitalRead(LO_MINUS);
  // Always show actual ADC conversion and actual flags, even with open inputs.
  Serial.printf("raw:%u\tlo_plus:%d\tlo_minus:%d\n",
                (unsigned int)raw, loPlus, loMinus);
}

Code Explanation

About every 10 ms the sketch prints the actual ADC conversion and both actual digital states. It does not replace an open-lead sample with 2048 or invent a waveform. Serial Monitor shows labelled fields; Serial Plotter can show raw, lo_plus and lo_minus as three series, with the 0/1 flags close to the bottom of the ADC scale. The scheduler skips catch-up work rather than fabricating missed samples. It does not validate leads, guarantee cadence or determine heart rate.

Expected Output

At 115200 baud, records contain raw:<actual count>, lo_plus:<0 or 1> and lo_minus:<0 or 1>, separated by tabs. In the selected dc leads-off configuration, open electrode inputs are expected to assert their corresponding flags; settling, noise or clipping may be visible. No numeric trace or measurement from hardware is supplied here. No ECG shape, BPM, diagnosis or medical accuracy is promised.

Troubleshooting

  • Flat, rail-limited or noisy trace With electrode ports deliberately empty, this is not proof of a failed or working ECG system. Check the 3.3 V rail and OUTPUT-to-GPIO34 connection; do not attach electrodes to make the graph look better.
  • LO flags differ from expectations Check LO+/LO− labels, carrier revision, SDN pull-up and dc/ac leads-off configuration. Do not bypass the flags or treat LOW as permission for body contact.
  • ADC path needs an independent check Power off and disconnect module OUTPUT first. Ground GPIO34 and inspect its actual low-end counts after power-up. This checks the ADC path only, not the AD8232, isolation or biological operation.
  • Plotter is blank Select the correct port and 115200 baud; close other serial clients. Read the same labelled records in Serial Monitor. Confirm a USB data cable and matching board selection.

Common Mistakes

  • Connecting electrodes while a USB cable provides a computer ground path.
  • Assuming a battery or a generic USB isolator establishes a complete patient-safe arrangement.
  • Reading GPIO34 as a GPIO output or powering the AD8232 carrier from 5 V.
  • Interpreting an open-input trace or synthetic midscale as a valid biological signal.

Testing Checklist

  • Verify that electrode cable, jack and RA/LA/RL pads remain unconnected.
  • Check module power, common ground and GPIO34 input direction.
  • Confirm all output fields come from analogRead/digitalRead, with no forced 2048 value.
  • Distinguish the optional grounded-ADC check from sensor/hardware validation.
  • These are planned checks, not a record of hardware testing.

Engineering Tips

  • Keep acquisition provenance with every saved trace.
  • Do not call a leads-off flag an isolation or physiological validity test.
  • Use the existing analog-input guide for an independently controlled signal.

Upgrade Ideas

  • Save raw bench records with configuration notes.
  • Study filtering offline without calling the result a verified ECG.

Real-World Applications

  • Non-body-connected ADC interface lesson
  • Leads-off status and signal-provenance discussion

FAQs

Can I attach electrodes if I use a battery?

No. This page specifies only an electrode-disconnected bench demo. It provides no complete isolated body-connected arrangement; a battery alone does not establish one.

Why keep samples when leads are off?

To inspect the actual electrical output alongside its status flags. These are open-input bench records, not valid ECG data; replacing them with 2048 would conceal that distinction.

Review, Testing, and References

Author: Abdul Mubeen and the ESP32 Engine editorial team. Last updated: 2026-11-11. Reviewed: wiring logic, Arduino code structure, beginner safety, and learning sequence.

Educational level: Advanced. Estimated completion time: Assembly time varies. This project is for learning and prototyping; production or unattended hardware needs additional engineering review.

Check your result

Check the actual fields and wiring against this bench-only arrangement. A graph is not proof of a biological signal, successful compilation, patient isolation or hardware validation.

  • Read ADC1 input counts
  • Observe status bits
  • Keep electrode ports empty