Portable ECG monitor with heart rate and rhythm check

Heart disease is India's leading cause of death, and rural clinics rarely have an ECG machine. A low-cost single-lead monitor that shows the trace and flags irregular rhythm teaches the full signal chain from electrode to diagnosis aid.

ESP32Major projectECE, EIE, BME
ESP32AD823276 bpmOLEDFeatured
Parts
₹2,140
Build
14 weeks
Board
ESP32
Objectives
5
Run only from the battery, never while connected to a mains-powered laptop. It is not a medical device and must not be used for diagnosis.

Block diagram

Inputs
  • ELECTR
    ElectrodesPick up the heart's signal
  • AD8232
    AD8232 front endAmplifies and filters the ECG
Controller
  • ESP32
    ESP32Samples, filters and finds R-peaks
Power
  • +
    BatteryIsolated from mains for safety
Outputs
  • 23.4°COLED
    OLED displayShows the trace and BPM
  • CLOUD
    Cloud dashboardStores readings, plots trends and sends alerts+

Objectives

  1. To acquire a clean single-lead ECG at 250 samples/s with mains (50 Hz) interference removed.
  2. To detect R-peaks and compute heart rate.
  3. To flag irregular RR intervals as a possible arrhythmia for review.
  4. To compare heart rate with a commercial monitor over 20 recordings.
  5. To publish readings over MQTT and show them on a live dashboard with threshold alerts.

Parts and specifications

Total about ₹2,140 at typical online prices. Tap a part for its pinout and datasheet notes.

Design calculations

Sampling rate

ECG detail is below about 40 Hz on this front end; 250 samples/s gives margin for QRS timing (4 ms resolution).

50 Hz notch

A digital notch at 50 Hz with Q about 30: biquad with ω0 = 2π × 50 / 250. It removes mains hum without blurring the QRS.

Heart rate

HR = 60 / RR (s). R-peaks 0.8 s apart = 75 bpm. Average over 8 beats.

Irregular rhythm flag

Compute RMSSD of RR intervals over 30 beats; values well above the person's resting baseline, with irregular RR, are flagged for review, not diagnosed.

Pin map

SignalPin or connection
AD8232 OUTPUTGPIO 36 (ADC1)
LO+ / LO−GPIO 25 / 26 (lead-off)
SDNGPIO 27 (shutdown to save power)
OLED SDA / SCLGPIO 21 / 22
ElectrodesRA (right arm), LA (left arm), RL (right leg) for Lead I

Firmware outline

  1. Sample the AD8232 output at 250 Hz with a hardware timer.
  2. Skip samples while LO+ or LO− shows a lead off; show 'Check electrodes'.
  3. Filter: 0.5 Hz high-pass (baseline wander), 50 Hz notch, 40 Hz low-pass.
  4. Pan-Tompkins: derivative, square, 150 ms moving window, adaptive threshold for R-peaks.
  5. Show a scrolling trace and BPM on the OLED; stream samples over BLE or Wi-Fi for a PC plot.

Test plan

TestExpected result
Resting volunteerClear P, QRS and T waves on the plot
Same time as a pulse oximeterBPM within ±3
Electrode removedLead-off shown within 1 s
Laptop on mains vs batteryObserve 50 Hz hum and why battery is safer

These rows start your results table when you plan the project.

Viva practice

Say your answer out loud first, then check. The first 2 answers are free; Maker opens all 5.

1. What is Lead I?
2. Why the right-leg electrode?
3. What causes baseline wander?
4. What is the Pan-Tompkins algorithm?
5. Why battery-only?

Make it yours

One or two upgrades for a mini project, two to four for a major one.

Build these first

Datasheets and sources to cite

  • Analog Devices AD8232 datasheet
  • Pan and Tompkins, A real-time QRS detection algorithm (1985)
  • IEC 60601-1 (medical electrical equipment safety)

About this project

How much does the portable ecg monitor with heart rate and rhythm check project cost?

About ₹2,140 for the parts in the base list: ESP32 DevKit V1, AD8232 ECG sensor with electrodes, Disposable ECG electrodes (pack of 50), 0.96 inch OLED (SSD1306, I²C), 18650 cell 2600 mAh (branded), TP4056 charger with protection, MT3608 boost converter, Box and cable.

How long does it take?

About 12 weeks for the base project, built on an ESP32. Each upgrade adds time.

Which branches is it suitable for?

Electronics and Communication, Instrumentation, Biomedical, as a major project.

Which pins and design calculations does it use?

AD8232 OUTPUT on GPIO 36 (ADC1); LO+ / LO− on GPIO 25 / 26 (lead-off); SDN on GPIO 27 (shutdown to save power). Worked calculations on this page: sampling rate, 50 hz notch, heart rate, irregular rhythm flag.

How do I test it?

Resting volunteer: Clear P, QRS and T waves on the plot. Same time as a pulse oximeter: BPM within ±3. Electrode removed: Lead-off shown within 1 s. Laptop on mains vs battery: Observe 50 Hz hum and why battery is safer.

What are the objectives?

To acquire a clean single-lead ECG at 250 samples/s with mains (50 Hz) interference removed. To detect R-peaks and compute heart rate. To flag irregular RR intervals as a possible arrhythmia for review. To compare heart rate with a commercial monitor over 20 recordings.