DIY medical science can be surprisingly fun. With just a few easy-to-find components, you can start exploring the tiny electrical signals that keep your body running. While doctors and hospitals use this data to monitor health, hobbyists and tinkerers are free to experiment, explore, and learn in creative ways.
One of the best places to start is with the heart. The AD8232 Heart Rate Monitor Module makes it easy to detect and visualize the electrical signals your heart produces with every beat.
In this tutorial, you’ll learn how to hook up the AD8232 module to an Arduino, build a basic ECG (electrocardiogram) monitor, and watch your own heart in action.
Let’s get started, and prove you’re not heartless after all!
Understanding the ECG Signal
Before we start, it’s important to understand what exactly we’re trying to measure. The electrical signals produced by your heart have a very specific pattern, and learning the basics of that pattern will help you make sense of what the AD8232 is capturing.
Let’s take a quick look at how your heart works.
Your heart has four main chambers: the right atrium and left atrium at the top, and the right ventricle and left ventricle at the bottom.

The right side of the heart (the right atrium and right ventricle) collects blood that has already delivered oxygen to the body and is now low in oxygen. This oxygen-poor blood is sent to the lungs to pick up more oxygen. The left side of the heart (the left atrium and left ventricle) receives this freshly oxygenated blood from the lungs and pumps it out to the rest of the body. After the oxygen is used up by your cells, the blood returns to the right side of the heart, and the cycle begins again.
The heartbeat starts with a special group of cells in the right atrium called the sinoatrial (SA) node. This is known as the heart’s natural pacemaker. It sends out an electrical signal that triggers the heart to beat and sets the heart rate.
Here’s how each part of the electrical signal corresponds to a wave or segment on the ECG:
P wave
When the atria are filled with blood, the SA node fires. This electrical signal spreads through the atria, causing them to contract and push blood down into the ventricles. On an ECG, this electrical event is shown as the P wave.

PR Segment
Right after the P wave comes the PR segment. This short delay gives the ventricles enough time to fill with blood before they contract. During this pause, the electrical signal travels from the atria to the special pathway called the atrioventricular (AV) node.

QRS Complex
Once the signal reaches the AV node, it continues through a bundle of fibers called the bundle of His, which splits into the right and left bundle branches. These branches carry the signal toward the bottom (apex) of the heart. This causes the ventricles to contract, forcing blood out of the heart—to the lungs (from the right ventricle) and to the rest of the body (from the left ventricle). This strong electrical event creates a sharp spike on the ECG called the QRS complex.

ST Segment
During the ST segment, blood is being actively pushed out of the heart.

T Wave
After the ventricles have pumped out the blood, they begin to relax. This part of the electrical signal is represented by the T wave on the ECG. At the end of the T wave, the ventricles have fully relaxed, and the heart is ready to start the entire cycle again.

Hardware Overview
Now that you have a basic understanding of the ECG signal and what it represents, let’s take a closer look at the hardware that makes this project possible.
The AD8232 module is specifically designed to detect and process your heart’s electrical activity.
The AD8232 module detects these signals, removes surrounding electrical “noise,” and amplifies them so they can be more easily analyzed. It then outputs the cleaned and amplified signal as an analog voltage, which a microcontroller’s ADC can read. After being converted into digital form, this data can be used to generate an ECG, or electrocardiogram.
The AD8232 Chip
At the center of the module is the AD8232 IC—a low power, single-lead ECG front-end, by Analog Devices.

It has many features necessary for providing accurate ECG measurements:
- Instrumentation Amplification: It amplifies the tiny biopotential signals. These signals, measured in microvolts or millivolts, need to be significantly boosted to be readable by a microcontroller’s analog-to-digital converter (ADC). The AD8232 provides a high signal gain for this purpose.
- Filtering: ECG signals are susceptible to various forms of noise, including motion artifacts and line frequency interference (e.g., 50/60 Hz noise from power lines). The AD8232 incorporates both a two-pole adjustable high-pass filter to eliminate motion artifacts and half-cell potential from the electrodes, and a three-pole adjustable low-pass filter to remove additional noise.
- Right Leg Drive (RLD): To improve the common-mode rejection of noise, the chip includes a right leg drive amplifier. This circuit actively drives the body’s common-mode voltage to a reference potential, which is typically a virtual ground generated by the chip itself, thereby reducing interference.
- Fast Restore: The AD8232 features a “fast restore” function that allows it to quickly recover after an abrupt signal change that might “rail” the amplifier, such as when an electrode becomes disconnected.
All these features allow the AD8232 module to be used in a range of health-related ECG and Heart-Rate (HR) applications, including fitness and activity heart rate monitors, portable ECG, wearable and remote health monitors, and similar.
Lead-Off Detection
One especially important feature is its ability to detect when one of the electrode pads, called leads, is not attached properly. The chip has two special pins, LO+ and LO−, which tell us when one or both of the leads are not connected. This is important because a missing or loose lead could result in wrong data or no data at all.

Low Power Mode
The AD8232 chip has a low power consumption mode that you can activate by pulling the SDN (Shutdown) pin to a LOW logic level, greatly reducing the power consumption. This is ideal for battery-powered devices like portable monitors or fitness bands.

If you use the lead-off detection feature, you can even program the microcontroller to go into standby mode at the same time, saving even more energy.
For more technical details, users can refer to the official AD8232 datasheet.
Sensor Cable and ECG Electrodes
The module comes with a cable that has a standard 3.5mm audio jack on one end and three small snap-on connectors on the other. These connectors are used to attach ECG electrodes, which are small, sticky pads. You peel off the backing, stick the pads to your body, and then snap the connectors onto them.

Keep in mind that the electrodes are usually only good for one or two uses because they lose their stickiness and ability to conduct electricity well after they’ve been peeled off once.
The electrical signals from your heart are extremely weak, so placing the electrodes correctly is crucial for getting a good reading. More details on proper electrode placement will be covered later in the tutorial.
3.5mm Jack Connector
The module has a 3.5mm jack connector, which is what the sensor cable plugs into.

LED Indicator and Jumper
The module also has a small LED light that flashes with your heartbeat. This is a simple but very useful way to quickly see if the device is working and picking up a signal.

There is a solder jumper on the module that lets you turn this LED on or off. This is useful for projects that run on batteries, where every bit of power matters, and you may not want the LED blinking and using up energy.
AD8232 Module Pinout
The AD8232 module breaks out nine connections from the IC.

GND is the ground pin.
3.3V is the power supply pin; connect it to a 3.3V power source.
OUTPUT is the analog output pin where the amplified and filtered heart signal comes out. You connect this to an analog input pin on a microcontroller like an Arduino (for example, pin A0).
LO- and LO+ are the lead-off pins. These pins send a HIGH signal if an electrode comes loose, helping you know if your connections are good.
SDN (Shutdown) is a special pin that puts the chip into a low-power mode to save energy. To do this, you pull the pin to a LOW voltage.
RA, LA, and RL are alternative pins for connecting custom sensors or electrodes. They stand for Right Arm, Left Arm, and Right Leg, respectively, and are typically used in more advanced setups.
Wiring the AD8232 Module to an Arduino
Alright, let’s connect the AD8232 module to the Arduino.
Begin by connecting the 3.3V pin of the module to the 3.3V pin on the Arduino, and connect the GND pin to one of the Arduino’s ground pins. Next, connect the OUTPUT pin of the module to the A0 analog input pin on the Arduino.
It is also useful to connect the LO+ and LO− pins from the module to Arduino pins 10 and 11. This way, when the electrodes are not attached, the Arduino can detect the missing leads and avoid sending meaningless data to the Serial Monitor.
Here’s a quick reference table for the pin connections:
| AD8232 Module | Arduino | |
| 3.3V | 3.3V | |
| GND | GND | |
| OUTPUT | A0 | |
| LO+ | 10 | |
| LO- | 11 |
Follow the diagram below, to make necessary connections.

Placing the Electrodes
Now that the wiring is complete, the next step is to place the electrode pads on your body.
The electrodes have a simple naming system: RA, LA, and RL, which stand for Right Arm, Left Arm, and Right Leg. RA and LA help the module measure the electrical potential difference between the right arm and the left arm. The RL provides a reference point for noise cancellation.
The cables are generally color-coded to match a standard setup based on what’s called Einthoven’s triangle.
One common method is to place the electrodes on the forearms and the right leg, as shown in the first diagram. Another option is to place them on the chest, with the RA and LA electrodes near the shoulders or upper chest area, and the RL electrode just above the right hip, as shown in the second diagram.

We found that the second option provides the strongest and most reliable readings, since the signals are captured closer to the heart itself.
Arduino Example Code
Below is a simple sketch that reads heart signal data from the AD8232 module and prints it to the Serial Monitor so you can see what’s happening in real time.
Warning:
This module is intended solely for educational and experimental use with ECG technology. It is not certified for clinical or medical use and must not be used to diagnose or treat any medical conditions.
const int SENSOR_PIN = A0;
const int LO_POS_PIN = 8;
const int LO_NEG_PIN = 9;
void setup() {
// initialize the serial communication:
Serial.begin(9600);
// Setup for leads off detection
pinMode(LO_POS_PIN, INPUT);
pinMode(LO_NEG_PIN, INPUT);
}
void loop() {
if ((digitalRead(LO_POS_PIN) == 1) || (digitalRead(LO_NEG_PIN) == 1)) {
Serial.println('!');
} else {
Serial.println(analogRead(SENSOR_PIN));
}
//Wait for a bit to keep serial data from saturating
delay(1);
}After uploading this sketch to your Arduino, open the Serial Monitor and make sure the baud rate is set to 9600. You should start seeing numbers printed to the screen. Below is an example output with the electrodes connected near the shoulders and the right hip.

While you can watch these numbers change in the Serial Monitor, it’s much easier to understand what’s happening if you look at the signal as a graph. To do that, open the Serial Plotter in the Arduino IDE by going to Tools > Serial Plotter. Once that’s open, you should see a waveform that moves with your heartbeat. If your electrodes are well-placed and you’re sitting still, the signal will look like a smooth repeating pattern—this is your ECG, or electrocardiogram.

Code Explantion
We start by declaring which pins we’re using. The analog signal from the AD8232 is connected to pin A0, and the two lead-off detection pins (LO+ and LO−) are connected to pins 10 and 11.
const int SENSOR_PIN = A0;
const int LO_POS_PIN = 10;
const int LO_NEG_PIN = 11;In the setup() function, we first initialize the Serial Monitor. Then, we configure the two lead-off pins, LO+ and LO-, to act as digital inputs so they can be read by the Arduino.
void setup() {
// initialize the serial communication:
Serial.begin(9600);
// Setup for leads off detection
pinMode(LO_POS_PIN, INPUT);
pinMode(LO_NEG_PIN, INPUT);
}In the loop() section, we first read the LO+ and LO− pins. If either one of these pins is HIGH, that means an electrode has come loose or is not properly connected to the body. In that case, we print a simple ! to the Serial Monitor to warn us that the connection is bad. If everything is connected properly and both LO+ and LO− are LOW, we read the analog signal from the sensor’s output pin and print the value to the Serial Monitor. These are the actual heart signal readings.
At the end of the loop, we add a very short delay of 1 millisecond to prevent the serial output from flooding with too much data too fast.
void loop() {
if ((digitalRead(LO_POS_PIN) == 1) || (digitalRead(LO_NEG_PIN) == 1)) {
Serial.println('!');
} else {
Serial.println(analogRead(SENSOR_PIN));
}
//Wait for a bit to keep serial data from saturating
delay(1);
}Getting a Good ECG Reading
If your ECG graph doesn’t look clear or sharp, don’t worry—it’s very common. ECGs are known to be a bit noisy, especially because you’re measuring a very small electrical impulse from a large and complex muscle. These signals are very weak, and it doesn’t take much to interfere with them. But there are some easy ways to improve the quality of your signal.
- Place the pads close to your heart. The closer the pads are to your heart, the stronger the signal they will pick up.
- Check the placement of your pads. Make sure you’ve put the RA (Right Arm) and LA (Left Arm) pads on the correct sides of your body. Incorrect placement can lead to a weak or inverted signal.
- Stay still. Try not to move too much while taking a measurement. Movement from your skeletal muscles can create electrical noise that interferes with the heart’s signal.
- Use fresh pads. The electrodes lose their ability to pass signals well after they’ve been used a few times. Using a new set of pads for each measurement can make a big difference.
- Clean the area. Before you stick the pads on, make sure the skin is clean and dry. A clean surface helps create a good connection. Remember, hair is not a good conductor of electricity, so try to place the pads on smooth skin.
- Adjust for each person. Everyone’s body is a little different, so you may need to adjust the placement of the pads to get the best signal for each individual.
