AD8232 ECG Heart Monitor Library for Proteus: an Arduino UNO V4.0 and the AD8232 ECG module

AD8232 ECG Heart Monitor Library for Proteus

8 Views
40
700
60
25
60
PCBWay

Hello friends, I hope you all are doing great. Today, I am going to share the new AD8232 ECG Heart Monitor Library for Proteus, the first of the biomedical set in our University Lab series. The AD8232 is the little red module students use for their first heart monitor: three electrodes, a 3.5 mm jack, and an output that draws an ECG on any Arduino's analog pin. It is in countless biomedical engineering labs and final-year projects, yet there has been no way to try it in a simulator: Proteus has no heart.

Updates

AD8232 ECG Heart Monitor Library for Proteus

Latest version: V1.0 (November 2026, this tutorial)

Helping Tools

Our library gives it one. The module is drawn at its true size, and its model makes a realistic lead-I ECG, with P waves, QRS complexes and T waves, a heart rate that breathes, and normal, PVC or atrial fibrillation rhythms. It adds the noise and mains pickup of real electrodes, then runs it all through the AD8232's cardiac monitor chain as the datasheet describes it. The leads-off outputs work, the shutdown pin works, and the pop-up draws the ECG on red-grid paper at 25 mm/s. The demo is an Arduino beat detector that prints the heart rate and copes with an electrode coming off.

NOTICE: Our team has put a lot of effort into these small parts: the bodies, the animation and the pop-ups are all our own design, and you get them free. Your feedback is the fuel that keeps us going, so please tell us what you think in the comments below or in the AD8232 ECG board of our forum. And if our free libraries help you, you can buy us a coffee. So, let's get started with the AD8232 ECG Heart Monitor Library for Proteus:

AD8232 ECG Heart Monitor Library for Proteus: an Arduino UNO V4.0 and the AD8232 ECG module
Figure: The AD8232 ECG Heart Monitor Library for Proteus.

What is an ECG?

Every heartbeat starts with an electrical wave that spreads through the heart muscle. The wave reaches the skin as a tiny voltage, about a millivolt, and an electrocardiogram, ECG, records it. Each beat draws the same shape. A small bump, the P wave, is the upper chambers contracting. A sharp spike, the QRS complex, with a little dip before and after, is the main chambers firing. A rounded T wave is them recovering. The time from one R spike to the next, the RR interval, gives the heart rate: 60 divided by the RR interval in seconds.

The AD8232 records one view of that wave, one lead. With the right-arm electrode (RA) on the minus input and the left-arm electrode (LA) on the plus input, it sees lead I, the classic view across the chest. A third electrode, right leg (RL), ties the body to the circuit so the much larger mains hum picked up by the body is mostly cancelled.

The AD8232 Module

Our module is drawn at the true size of the common red board, 36 x 30 mm. It has the AD8232 in its 4 mm package, a 6-pin header on the 2.54 mm pitch, a 3.5 mm jack for the electrode cable, three electrode pads and two LEDs: PWR, and HR, which flashes with every heartbeat.

The module at a glance
The AD8232 module
Size36 x 30 mm
Supply3.3 V (the AD8232: 2.0 V to 3.5 V)
Gain, filters1100; a two-pole 0.5 Hz high-pass, a two-pole 40 Hz low-pass
Outputthe ECG around REFOUT, half the supply: 1.65 V
Leads offdc detection: LO+ high when LA is off, LO- high when RA is off
PinsGND, 3.3V, OUTPUT, LO-, LO+, SDN

The Signal Chain

We modelled the AD8232 the way its datasheet sets it up for monitoring the shape of the ECG. Its instrumentation amplifier has a gain of 100 and blocks the electrodes' own dc offset, which can be hundreds of millivolts, much larger than the heart's signal. Its op amp adds a gain of 11, making 1100 in all. A two-pole 0.5 Hz high-pass takes out the slow wander of breathing, and a two-pole 40 Hz low-pass takes out most of the noise. Everything sits around REFOUT, half of the supply, because the chip runs from a single supply: 1.65 V on 3.3 V. A 1.2 mV R wave comes out about 1.2 V above that.

Leads Off and Shutdown

In its dc leads-off mode, the AD8232 watches each input. LO+ goes high when the electrode on the plus input, LA here, comes off, and LO- when the one on the minus input, RA, comes off. Without an electrode the input drifts to a rail, and so does the output: what the Arduino reads then is not an ECG, and a sketch must ignore it. When the electrode is back, a fast restore brings the output back to the reference at once instead of waiting for the 0.5 Hz filter. SDN low puts the chip to sleep; our module pulls SDN up, so it runs when the pin is left open.

Our Heart Model

The ECG at the electrodes is built beat by beat from smooth waves for P, Q, R, S and T, with an R wave of 1.2 mV. The T wave moves with the heart rate, as it does in a real heart. The rate is not fixed: it rises and falls with breathing, four percent at 15 breaths a minute, and jitters a little from beat to beat. The RHYTHM property adds two classic arrhythmias. PVC makes every 6th beat a premature ventricular contraction: early, wide, with no P wave and an inverted T, followed by a pause. AFIB makes atrial fibrillation: no P waves, a wavy baseline, and an irregular rate. On top come breathing wander, mains pickup at 50 or 60 Hz, and noise from muscles and electrodes.

This is not a medical device, and neither is any hobby ECG module. The library is for learning how ECG front ends and beat detectors work; never use such a module to diagnose anyone.

Features of the AD8232 ECG Heart Monitor Library for Proteus

  • The real look, at true scale: the 36 x 30 mm module with its header, jack, pads and LEDs; at Run the HR LED flashes with every beat.
  • A realistic ECG: P, QRS and T waves, breathing heart-rate variation, normal, PVC and atrial fibrillation rhythms.
  • The AD8232 as its datasheet sets it up: gain 1100, 0.5 Hz high-pass, 40 Hz low-pass, around REFOUT, within the rails.
  • Real-world interference: breathing wander, mains pickup, electrode noise.
  • Leads-off detection and shutdown: LO+ and LO-, a fast restore, the SDN pin.
  • A pop-up: the ECG on paper at 25 mm/s, the electrodes on the chest, the heart rate and the RR intervals, graphs, an event log and a check page.
  • A complete package: about 1.2 MB with the library, our Arduino UNO V4.0 and the demo, without the source code of the model.

The AD8232 in Proteus

The device is ECGAD8232TEP in TEPAD8232.LIB, under Biomedical, with the prefix U and the analog model TEPAD8232.DLL. Search AD8232 in Pick Devices. Its six pins are the header on the left edge: GND, 3.3V, OUTPUT, LO-, LO+ and SDN.

AD8232 ECG module at true scale in the AD8232 ECG Heart Monitor Library for Proteus: header, jack, electrode pads and LEDs
Figure: The AD8232 module.

The Properties

Double-click the module to see these
PropertyWhat it does
Heart rate (BPM)beats per minute, 72 by default
Rhythm (RHYTHM)NORMAL, PVC (a premature beat every 6th) or AFIB
Noise (NOISE)muscle and electrode noise at the skin, microvolts RMS, 10 by default
Mains (MAINS)the mains pickup's frequency: 50, 60 or 0 for none
Leads off (LEADOFF)the LA electrode comes off at this time for 2 s; 0 = never

Download AD8232 ECG Heart Monitor Library for Proteus

Click the button below to download AD8232-ECG-Heart-Monitor-Library-for-Proteus-v1.0.zip (about 1.2 MB, without the source code of the models):

AD8232 ECG Library for Proteus V1.0
  • README.txt: installation, the demo, the wiring, troubleshooting and the limits.
  • Proteus Library Files: TEPAD8232.LIB and our ArduinoV4TEP.LIB.
  • Proteus Model Files: TEPAD8232.DLL and TEPARDUINO.DLL.
  • Arduino Code: the demo sketch.
  • Proteus Simulation: the demo project, its HEX file and copies of the DLLs.

No Proteus yet? Read How to Download and Install Proteus 7 and 8. New to libraries? Follow How to Install a New Library in Proteus.

How to Install AD8232 ECG Heart Monitor Library for Proteus

  1. Close Proteus and extract the whole zip file, for example to your Desktop.
  2. Copy the files from Proteus Library Files into the LIBRARY folder of Proteus.
  3. Copy the files from Proteus Model Files into the MODELS folder.
  4. Delete TEPAD8232.IDX from the LIBRARY folder if it is there.
  5. Start Proteus, press P and search for AD8232.

Demo: An Arduino Heart Rate Monitor

The demo is just the module and our Arduino UNO Library for Proteus V4.0, with its built-in monitor, the same window as our TEP Serial Monitor Advance for Proteus. OUTPUT goes to A0, LO+ to D10 and LO- to D11, GND to GND and 3.3V to a +3.3V terminal. SDN stays open. A 5 V Arduino pin must not drive it, because it would be above the AD8232's 3.3 V supply. The module's LEADOFF property is set to 8 s. Open AD8232-ECG-ArduinoUnoV4.pdsprj.

AD8232 ECG demo in Proteus: Arduino UNO V4.0 and the AD8232 module on an A4 sheet
Figure: The whole demo on an A4 sheet.

The Sketch

The sketch samples OUTPUT 250 times a second. Before it reads anything it checks the leads: while LO+ or LO- is high it ignores the output, and when they come back it starts its detector again:

  bool leadsOff = digitalRead(LO_PLUS) || digitalRead(LO_MINUS);

The beat detector is a light version of the classic Pan-Tompkins method. The slope over 8 ms picks out the steep QRS and ignores the gentle P and T waves; squaring makes it positive and stresses the big slopes; a 32 ms average turns each QRS into one hump. The threshold follows 40 % of the recent peaks, so it adapts to whatever amplitude the electrodes give:

  int x = analogRead(ECG_PIN);
  float d = x - x2; x2 = x1; x1 = x;
  float e = d * d;
  sum += e - win[wi]; win[wi] = e; wi = (wi + 1) % WIN;
  float m = sum / WIN;
  peak = max(peak * 0.998, m);
  float thr = max(0.4 * peak, 500.0);

A beat counts when the average crosses the threshold, no sooner than 250 ms after the last one. Every beat the sketch prints the RR interval and the heart rate, the mean of the last four intervals, and flags a beat that comes more than 20 % early.

Run the Demo

Open the project and press Run. The demo runs 14.6 simulated seconds, which Proteus ran in about two minutes on our PC. Click the module to open its pop-up; everything below is from that one run, the demo exactly as it ships.

The ECG

The first R wave comes at 0.35 s and the HR LED flashes with every beat after it. On the pop-up's paper strip each beat shows its P wave, the sharp QRS with its little Q and S dips, and the rounded T wave, all around the dashed REFOUT line at 1.65 V. The R waves stand 1.17 V to 1.23 V above it; the high-pass and the 40 Hz low-pass round the narrow R spike off a little. You can see a slight rise and fall of the baseline with the breathing, and a faint 50 Hz ripple.

The AD8232 module running in Proteus, the PWR LED on and the HR LED flashing with the heartbeat
Figure: The module running.
AD8232 pop-up in Proteus: the ECG on paper at 25 mm/s, the electrodes and the heart rate
Figure: The ECG in the pop-up.

The Heart Rate

The heart rate is set to 72 BPM, but like a real heart it breathes: the RR intervals ran from 789 to 879 ms. The module made 16 beats by 14.6 s, and outside the two seconds with an electrode off the sketch found every one, printing the rate from the mean of four intervals: 69 to 75 BPM. The monitor shows each one: 71 BPM at 1.12 s from an RR of 840 ms, 73 BPM at 2.80 s, and so on.

Arduino UNO V4.0 serial monitor in Proteus: every beat with its RR interval and the heart rate
Figure: The monitor.

An Electrode Comes Off

At 8 s the LA electrode comes off. LO+ goes high at 8.000 s and the output runs to the rail at 3.26 V; the strip shows the ECG ending in a flat line at the top. The sketch prints "leads off" and stops counting. Its own clock starts about 60 ms after the simulation's, so it stamps the event 7.94 s. At 10.001 s the electrode is back: LO+ goes low, the fast restore brings the output straight back to 1.65 V, and the sketch prints "leads on". It counts again from the next beats, and the next heart rate it prints is 73 BPM at 11.14 s.

AD8232 pop-up in Proteus with the LA electrode off: LO+ high and the output at the rail
Figure: The LA electrode off.
The AD8232 ECG demo running in the Proteus workspace after the leads came back
Figure: The demo running.
AD8232 pop-up in Proteus after the leads came back: the ECG restored
Figure: After the leads came back.

The Graphs, the Log and the Check Page

The Graphs page plots the output, the ECG at the electrodes in millivolts, the heart rate and LO+ over the last 2, 6 or 15 simulated seconds: you can compare the tiny signal at the skin with what the AD8232 makes of it. The Event log notes the leads coming off and back.

AD8232 pop-up Graphs in Proteus: the output, the ECG at the electrodes, the heart rate and LO+
Figure: The Graphs page.
AD8232 pop-up Event log in Proteus: the leads coming off and back
Figure: The Event log.

The Check page sums up the module: the 3.3 V supply and REFOUT, SDN, the electrodes and the leads-off outputs, the output with its R wave, the heart rate and the RR range, the rhythm and the interference.

AD8232 Check page in Proteus: supply, SDN, electrodes, output, heart rate and interference
Figure: The Check page.

Try It Yourself

  • Set RHYTHM to PVC and watch the sketch flag every 6th beat as early.
  • Set RHYTHM to AFIB and see how irregular the heart rate becomes, and how the P waves vanish from the strip.
  • Raise NOISE to 100 and find where the beat detector starts to miss or invent beats.
  • Set MAINS to 60 and raise NOISE, then add a 50/60 Hz notch filter to the sketch.
  • Drive SDN from a pin through a divider and put the AD8232 to sleep between measurements.

Ideas to Extend the Demo

  • Send the samples to a PC and plot the ECG live.
  • Add an OLED display and show the ECG and the heart rate on it.
  • Measure the heart-rate variability: the spread of the RR intervals over a minute.
  • Add an alarm when the rate goes under 50 or over 120 BPM.

Your Own Sketches

The demo sketch is in the zip file, and you can change it in the Arduino IDE. New to Arduino? Start with our Arduino Tutorial for Beginners. Export the compiled binary, and set the UNO's PROGRAM property to the new file. Our guide on How to get the HEX file from Arduino shows you where the file ends up.

Things to Know Before Using a Real Module

  • Not a medical device: never use it for diagnosis, and never on a person connected to mains-powered equipment; run the circuit from a battery and keep any laptop on its battery while connected.
  • Good contact matters: clean skin and fresh gel pads; RA on the right, LA on the left, RL low on the right.
  • Keep still: movement and tense muscles add noise that can look like beats.
  • Mind the logic levels: the module runs on 3.3 V; a 5 V pin must not drive SDN.

Troubleshooting

  • NO SUPPLY: 3.3V is missing or under 2.0 V.
  • SHUTDOWN: SDN is low; leave it open or drive it high from 3.3 V logic.
  • LEADS OFF: an electrode is off; LO+ or LO- is high and the output is at a rail.
  • The heart rate reads double: the detector also triggers on the T wave; raise its threshold or lengthen the refractory time.
  • The part is not simulated: TEPAD8232.DLL is missing from MODELS and from the project folder.

Limitations of the Simulation

  • The right-leg drive loop and the electrodes' changing half-cell potentials are not modelled.
  • Motion artifacts and the AD8232's own noise are not modelled.
  • The ECG is one lead, lead I, made of smooth waves: real ECGs vary more from beat to beat.
  • Arduino is a name of Arduino; this library is not made or endorsed by Arduino or Labcenter, or by Analog Devices.
  • Tested in Proteus 8.5 in November 2026 (the demo as shipped). Proteus 7 is not supported.

So, that was all about the AD8232 ECG Heart Monitor Library for Proteus. I hope it helps you build and test your first ECG project on your own PC: a heart that beats in Proteus, the AD8232 chain that makes it readable, leads-off handling, and a beat detector that turns it into a heart rate. If you have any questions, ask in the comments and I will help you out. Till the next tutorial, take care and have fun!


Comments

0

Join the conversation