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.
- Parts
- ₹2,140
- Build
- 14 weeks
- Board
- ESP32
- Objectives
- 5
Block diagram
- ElectrodesPick up the heart's signal
- AD8232 front endAmplifies and filters the ECG
- ESP32Samples, filters and finds R-peaks
- BatteryIsolated from mains for safety
- OLED displayShows the trace and BPM
- Cloud dashboardStores readings, plots trends and sends alerts+
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.
- To publish readings over MQTT and show them on a live dashboard with threshold alerts.
Parts and specifications
- ESP32 DevKit V1Dual-core 240 MHz, 520 KB SRAM, Wi-Fi + Bluetooth, 3.3 V logic, 12-bit ADC (use ADC1 pins when Wi-Fi is on)₹450Buy
- AD8232 ECG sensor with electrodesSingle-lead ECG front end, gain about 1100, 0.5 to 40 Hz band, analog output, lead-off detect₹650Buy
- Disposable ECG electrodes (pack of 50)₹250
- TP4056 charger with protection1 A CC/CV Li-ion charging to 4.2 V, DW01 protection cuts at about 2.5 V₹40Buy
- Box and cable₹200
Total about ₹2,140 at typical online prices. Tap a part for its pinout and datasheet notes.
Design calculations
ECG detail is below about 40 Hz on this front end; 250 samples/s gives margin for QRS timing (4 ms resolution).
A digital notch at 50 Hz with Q about 30: biquad with ω0 = 2π × 50 / 250. It removes mains hum without blurring the QRS.
HR = 60 / RR (s). R-peaks 0.8 s apart = 75 bpm. Average over 8 beats.
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
| Signal | Pin or connection |
|---|---|
| AD8232 OUTPUT | GPIO 36 (ADC1) |
| LO+ / LO− | GPIO 25 / 26 (lead-off) |
| SDN | GPIO 27 (shutdown to save power) |
| OLED SDA / SCL | GPIO 21 / 22 |
| Electrodes | RA (right arm), LA (left arm), RL (right leg) for Lead I |
Firmware outline
- Sample the AD8232 output at 250 Hz with a hardware timer.
- Skip samples while LO+ or LO− shows a lead off; show 'Check electrodes'.
- Filter: 0.5 Hz high-pass (baseline wander), 50 Hz notch, 40 Hz low-pass.
- Pan-Tompkins: derivative, square, 150 ms moving window, adaptive threshold for R-peaks.
- Show a scrolling trace and BPM on the OLED; stream samples over BLE or Wi-Fi for a PC plot.
Test plan
| Test | Expected result |
|---|---|
| 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 |
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.
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.
