Portable ECG Heart Monitor Robot Project for Kids

Portable ECG Heart Monitor Robot Project for Kids | Step-by-Step Guide

🫀 What Is an ECG?

ECG stands for Electrocardiogram (say: ee-lek-tro-KAR-dee-oh-gram). Doctors use ECGs every day to look at how your heart is beating. Every time your heart pumps blood, it sends a tiny electrical signal through your body. Our robot project catches those signals and draws them on a screen — just like a real hospital machine!

We're going to build a portable version using an Arduino microcontroller and a special sensor called the AD8232. When you're done, you'll be able to see your own heartbeat waveform — the spiky zigzag line you've seen in movies! 📺

Heart Sends a Signal

Your heart muscle creates tiny electrical pulses every beat

📡 Electrodes Pick It Up

Sticky pads on your skin capture those tiny signals

🔬 Sensor Amplifies

The AD8232 chip makes the tiny signal much louder

💻 Arduino Reads It

The Arduino measures the signal thousands of times per second

📈 Screen Shows It

The Serial Plotter draws the iconic ECG waveform live!

🛒 Parts You'll Need

Ask a grown-up to help you buy these parts. You can find them at electronics stores or online. Total cost is usually around $20–$35.

🟦
Arduino Uno The brain of our project — $10–$15
❤️
AD8232 ECG Sensor Module The heart signal catcher — $5–$8
🩹
3 × ECG Electrode Pads Sticky pads for your skin — $3–$5
🔌
Jumper Wires (×10) Male-to-female connector wires — $2–$3
🧱
Breadboard For connecting components — $2–$4
💡
LED + 220Ω Resistor Optional heartbeat blink indicator — $1
🖥️
Computer with Arduino IDE Free download at arduino.cc
🔋
USB Cable (Type A–B) To connect Arduino to your computer

🔌 Wiring the Circuit

The AD8232 sensor module connects to the Arduino with just 6 wires. Follow the diagram below carefully. Always double-check before powering on!

ARDUINO UNO 3.3V GND GND A0 D2 D3 D13 Arduino Uno R3 AD8232 ECG MODULE 3.3V GND OUT LO– LO+ RA LA RL ELECTRODES LED+R 3.3V power Ground Signal Lead-off detect

🛠️ Step-by-Step Build Instructions

Follow these steps in order. Take your time — there's no rush! Ask a grown-up if you get stuck.

01

⬇️ Install Arduino IDE

Go to arduino.cc/en/software and download the free Arduino IDE for your computer (Windows, Mac, or Linux all work).

Install it like any normal program. When it opens, you'll see a white code editor — that's where we'll write our program!

02

🔌 Connect Arduino to Your Computer

Plug the USB cable into your Arduino Uno and the other end into your computer. A green power LED on the Arduino should light up.

In Arduino IDE: go to Tools → Board → Arduino Uno, then Tools → Port and select the COM port that appeared (on Mac it starts with /dev/cu.usbmodem...).

03

🧱 Set Up the Breadboard

Place your breadboard on a flat surface. Push the AD8232 module into the breadboard so its pins sit firmly in the holes.

Breadboards have rows of connected holes. The long rows on the sides (+/–) are for power, and the middle rows connect side-to-side.

04

🔗 Wire Up the Circuit

Using the connection table above, connect jumper wires from the AD8232 module to the Arduino:

🟡 3.3V → 3.3V  |  ⚫ GND → GND  |  🟢 OUTPUT → A0  |  🔵 LO– → D2  |  🟣 LO+ → D3

If adding the optional LED: connect LED long leg (+) to D13 through a 220Ω resistor, and short leg (–) to GND.

05

📝 Upload the Code

Copy the Arduino code from the section below into the Arduino IDE editor. Replace any existing code (the setup() and loop() functions).

Click the → Upload button (right-pointing arrow at the top). Wait for "Done uploading" to appear at the bottom of the screen.

06

🩹 Attach the Electrode Pads

Stick the three electrode pads to your body. Ask a grown-up to help! Standard placement:

🔴 RA (Right Arm) — right wrist or upper right chest  |  🟡 LA (Left Arm) — left wrist or upper left chest  |  ⚫ RL (Right Leg) — right lower chest or hip area

Connect the coloured lead wires from the AD8232 to the electrode pads using the snap connectors.

07

📊 Open Serial Plotter

In Arduino IDE: go to Tools → Serial Plotter. Make sure the baud rate in the bottom-right is set to 9600.

Sit still, breathe normally, and watch your heartbeat draw itself on the screen! You'll see the classic spiky ECG waveform — those are called P, QRS, and T waves. 🎉

💻 The Full Arduino Code

Copy this code and paste it into Arduino IDE. Every line has a comment (after //) explaining what it does — great for learning!

portable_ecg_monitor.ino
/*
 ================================================
   PORTABLE ECG HEART MONITOR
   Kids Robotics Project 🤖❤️
   Components: Arduino Uno + AD8232 ECG Sensor
 ================================================
*/

// ── PIN DEFINITIONS ───────────────────────────
const int LO_MINUS_PIN = 2;   // Lead-off detect negative
const int LO_PLUS_PIN  = 3;   // Lead-off detect positive
const int ECG_PIN      = A0;  // Analog ECG signal input
const int LED_PIN      = 13;  // Optional heartbeat LED

// ── HEARTBEAT DETECTION VARIABLES ─────────────
int  sensorValue  = 0;         // Raw ECG reading (0–1023)
int  threshold    = 600;       // Value above = peak detected
bool peakFound    = false;     // Are we currently in a peak?
unsigned long lastBeat   = 0; // Time of last heartbeat (ms)
unsigned long beatInterval = 0;// Time between beats (ms)
int  bpm          = 0;         // Beats Per Minute

// ── SETUP: RUNS ONCE AT START ─────────────────
void setup() {
  Serial.begin(9600);          // Start talking to computer
  
  // Set lead-off pins as inputs
  pinMode(LO_MINUS_PIN, INPUT); 
  pinMode(LO_PLUS_PIN,  INPUT);
  
  // LED pin as output
  pinMode(LED_PIN, OUTPUT);
  
  Serial.println("ECG Monitor Ready! Attach electrodes.");
}

// ── LOOP: RUNS OVER AND OVER ──────────────────
void loop() {
  
  // CHECK: Are the electrode leads attached properly?
  if (digitalRead(LO_MINUS_PIN) == HIGH ||
      digitalRead(LO_PLUS_PIN)  == HIGH) {
    
    // Electrodes not connected — print warning
    Serial.println(0);
    digitalWrite(LED_PIN, LOW);
    delay(10);
    return;                   // Skip rest of loop
  }
  
  // READ the ECG signal from analog pin A0
  sensorValue = analogRead(ECG_PIN);
  
  // SEND the value to Serial Plotter (draws the wave!)
  Serial.println(sensorValue);
  
  // ── HEARTBEAT DETECTION ─────────────────────
  if (sensorValue > threshold && !peakFound) {
    
    // NEW PEAK DETECTED! 🎉
    peakFound = true;
    digitalWrite(LED_PIN, HIGH);  // Flash LED
    
    // Calculate time between this beat and last beat
    beatInterval = millis() - lastBeat;
    lastBeat = millis();
    
    // Prevent divide-by-zero and crazy readings
    if (beatInterval > 300 && beatInterval < 2000) {
      // BPM = 60 seconds ÷ beat interval in seconds
      bpm = (int)(60000.0 / beatInterval);
      
      // Print BPM to Serial Monitor
      Serial.print("Heart Rate: ");
      Serial.print(bpm);
      Serial.println(" BPM");
    }
    
  } else if (sensorValue < threshold - 50) {
    // Signal came back down — reset for next peak
    peakFound = false;
    digitalWrite(LED_PIN, LOW);   // Turn off LED
  }
  
  // Wait 5ms between readings (200 samples per second)
  delay(5);
}

🤩 Cool Heart Science Facts!

100,000

Times your heart beats every single day — without stopping! ❤️

~70

Average resting heart beats per minute for kids aged 10–12

1786

Year that scientists first discovered the heart produces electricity

3.2m

Kilometres of blood vessels in the human body — enough to wrap Earth 80 times!

🔧 Troubleshooting Problems

Something not working? Don't worry — troubleshooting is a real engineering skill! Check these common problems:

❓ No wave appears in Serial Plotter

Make sure you selected the right COM port in Tools → Port. Unplug and replug the USB, then try again. Check all wires are firmly connected.

❓ The wave is just a flat line (zeros)

The electrodes might not be attached properly. Press them firmly on your skin. Make sure the lead wires are snapped onto the electrode pads securely.

❓ The wave is very noisy / messy

Try to sit very still — muscle movement creates electrical noise! Make sure your skin is clean and dry where the electrodes attach. Try moving the electrode positions slightly.

❓ Serial Plotter shows "0" repeatedly

This means the lead-off detection fired. Your electrodes lost contact — re-press them onto your skin and check the wire connections to D2 and D3.

❓ LED doesn't blink with heartbeats

Check that LED is in the right way — the longer leg (+) should go to D13 side. Verify your 220Ω resistor is connected. Also check the threshold value in code (try changing 600 to 550 or 650).

⚠️ Important Safety Rules

This project is safe when built correctly, but always follow these rules:

🛡️ Safety First — Always!

  • Always have an adult supervise this project, especially when attaching electrodes.
  • Use ONLY the 3.3V output from Arduino — NEVER connect body electrodes to any higher voltage or mains electricity.
  • Do NOT use this device if you have a pacemaker or any heart condition. Consult a doctor first.
  • This is a learning/hobby project, NOT a medical device. Never use it to diagnose health problems.
  • Disconnect electrodes before modifying any wiring or code.
  • If you feel any discomfort or tingling, remove the electrodes immediately.
  • Keep all electronics away from water and liquids.

🚀 What Can You Do Next?

📱 Add a Display

Connect an OLED screen to show BPM without a computer!

📊 Log Your Data

Save heart rate readings to an SD card over time

📶 Go Wireless

Upgrade to ESP32 to send data to your phone via Bluetooth

Add AI

Use Python and machine learning to detect irregular beats!

Made with ❤️ for curious young scientists & engineers

Always build with adult supervision · This is a hobby/education project, not a medical device.

Tags: Arduino ECG Project · Kids Robotics · STEM Electronics · Heart Monitor DIY · AD8232 Tutorial

Comments

Product Cards
Buddy Bot eBook
⭐ New 2026 Release
Build Your
Own Robot!
3D design, wiring &
Arduino coding.
Young inventors love it!
🖨️
3D Print
All parts
Wire it
Circuit guide
💻
Code it
Arduino IDE
🤖
Watch it
Walk & react
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Website Offer
₹499 300
🌍 International: $5 USD
One-time · Instant digital delivery
🔒 Secured by Razorpay · Your data is safe
📄 Download Free Sample Copy
🔒 Secured by Razorpay · Your data is safe
🍓
Raspberry Pi Pico Mastery
21 Projects
⚡ Launch Price — 80% OFF
Learn Pico
Build 21 Projects!
MicroPython · Wokwi
IoT · Certificate
Perfect for beginners!
🖥️
Wokwi
No hardware
🐍
MicroPy
From zero
🔨
21 Projects
IoT + sensors
📄
Certificate
Verified cert
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Launch Offer
₹999 200 80% OFF
🌍 International: $5 USD
One-time · Lifetime access · No subscription
🔒 Secured by Razorpay · UPI · Cards · NetBanking
🎉

You're in!

Payment successful! Your Buddy Bot eBook is ready. Time to build!

📖 Access Your eBook Now
🎉

Enrolled!

Payment successful! Lifetime access to all 21 Pico Projects is yours!

🍓 Go to My Course