Heart Rate Monitor AD8232 Interface Arduino

heart rate ecg arduino


The AD8232 from Analog Devices is a dedicated single lead heart rate monitor front end integrated circuit.  The AD8232 is an integrated signal conditioning block for ECG and other biopotential measurement applications. It is designed to extract, amplify, and filter small biopotential signals in the presence of noisy conditions, such as those created by motion or remote electrode placement.

This design allows for an ultralow power analog-to-digital converter (ADC) or an embedded microcontroller to acquire the output signal easily.


Heart diagram

Heart Diagram Credit : Wikipedia.org

Heart Beat with corresponding ECG signal


Heart Beat diagram Credit: Wikipedia.org

What is ECG?

Electrocardiography (ECG or EKG) is the method of recording the electrical activity of heart over a period of time using the electrodes placed on the skin.


Image Credit: Wikipedia.org

This ECG wave has two sections as PR interval and QT interval, by using the AD8232 IC we can get noise less information.

Heart Monitor AD8232 Board


The simple and easy to use breakout board for heart rate monitoring from Sparkfun. This board measures electrical activity of heart through the Electrode pads placed on the skin. By Interfacing this board with Arduino we can get ECG graph through Processing IDE window.

Pin Configuration


Board Label Pin Function Arduino Connection
GND Ground GND
3.3v 3.3v Power Supply 3.3v
OUTPUT Output Signal A0
LO- Leads-off Detect – 11
LO+ Leads-off Detect + 10
SDN Shutdown Not used

Electrode Pads


Cable Color Signal
Black RA (Right Arm)
Blue LA (Left Arm)
Red RL (Right Leg)


AD8232 Hookup with Arduino

heart rate sensor arduino

We can use the electrode jack or else pin holes for electrodes. Connect corresponding electrode pads in skin and then provide 3.3V and GND power supply from the Arduino board, the SDN (shutdown) pin is not connected to any part. Output from the breakout board is taken to Arduino’s A0 (Analog input 0) pin. To detect the Leads off situation LO – , LO +  are connected to Arduino digital pin D11 and D10 respectively.

Arduino Code


Heart_Rate_Display.inoDemo Program for AD8232 Heart Rate sensor.
Casey Kuhns @ SparkFun Electronics 6/27/2014

void setup() {
  // initialize the serial communication:
  pinMode(10, INPUT); // Setup for leads off detection LO +
  pinMode(11, INPUT); // Setup for leads off detection LO -


void loop() {
  if((digitalRead(10) == 1)||(digitalRead(11) == 1)){
    // send the value of analog input 0:
  //Wait for a bit to keep serial data from saturating

Processing Code


Heart_Rate_Display.inoDemo Program for AD8232 Heart Rate sensor.
Casey Kuhns @ SparkFun Electronics 6/27/2014
import processing.serial.*;

Serial myPort;        // The serial port
int xPos = 1;         // horizontal position of the graph
float height_old = 0;
float height_new = 0;
float inByte = 0;

void setup () {
  // set the window size:
  size(1000, 400);

  // List all the available serial ports
  // Open whatever port is the one you're using.
  myPort = new Serial(this, Serial.list()[0], 9600);
  // don't generate a serialEvent() unless you get a newline character:
  // set inital background:

void draw () {
  // everything happens in the serialEvent()

void serialEvent (Serial myPort) {
  // get the ASCII string:
  String inString = myPort.readStringUntil('\n');

  if (inString != null) {
    // trim off any whitespace:
    inString = trim(inString);

    // If leads off detection is true notify with blue line
    if (inString.equals("!")) {
      stroke(0, 0, 0xff); //Set stroke to blue ( R, G, B)
      inByte = 512;  // middle of the ADC range (Flat Line)
    // If the data is good let it through
    else {
      stroke(0xff, 0, 0); //Set stroke to red ( R, G, B)
      inByte = float(inString);

     //Map and draw the line for new data point
     inByte = map(inByte, 0, 1023, 0, height);
     height_new = height - inByte;
     line(xPos - 1, height_old, xPos, height_new);
     height_old = height_new;

      // at the edge of the screen, go back to the beginning:
      if (xPos >= width) {
        xPos = 0;
      else {
        // increment the horizontal position:


How to use Processing IDE to Plot Graph?


  1. Soniya October 4, 2016 Reply
    • admin October 6, 2016 Reply
  2. Shreyan February 24, 2017 Reply
  3. Ron May 21, 2017 Reply
  4. Martha June 7, 2017 Reply
  5. Denisse GA June 13, 2017 Reply
    • SAIDIyas August 15, 2017 Reply
      • Diyanko January 5, 2018 Reply
  6. Sandro Alves July 6, 2017 Reply
    • SAIDIyas August 15, 2017 Reply
  7. SAIDIyas August 15, 2017 Reply
  8. Ajit November 10, 2017 Reply
  9. Mil January 29, 2018 Reply
  10. Avinash February 1, 2018 Reply
  11. Jorge February 17, 2018 Reply
  12. Rich March 18, 2018 Reply
    • Ignacio Serrano March 24, 2018 Reply
  13. Rich March 20, 2018 Reply
  14. Franz Wurzinger March 21, 2018 Reply
    • Rich March 25, 2018 Reply
  15. Ahmad March 30, 2018 Reply
  16. Rich April 8, 2018 Reply
  17. Rich April 8, 2018 Reply

Add a Comment

Your email address will not be published. Required fields are marked *