AD8232 Heart Rate Monitor

I have a AD8232 Heart Rate Monitor and I’d like to send its output to a Samsung tablet running Blynk to display the famous Bleep Bleep Bleep graph. What widget would be best for this, SuperChart?

1 Like

Have you seen this thread…



Thanks @PeteKnight
I searched for AD8232, should have searched for ECG.


Yeah, that’s what they all say!


I once searched for ADHD but never stuck around for the results…

Based on a simple example for that sensor (below)…

1ms delay to keep the Serial output from saturation :smiley: hah, not nearly enough for Blynk… but any longer and you just don’t see the data.

It really needs to be buffered somehow and have the data rate expanded before sending the data to the App… Superchart would probably give a good reading, but the hard part (for me) is the buffering in the first place.

As mentioned in that other topic… EEPROM, arrays, or SD card. As long as the sample is not too long a duration for storage, then it could be fed back at an increased pulse time rate, say 100:1 for a 1/10 second display pulse to the Widget. Should be good enough to get a visual representation of a few heartbeats :thinking:

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

Doesn’t this sketch from Adadfruit buffer the data initially or am I “barking up the wrong tree” as usual?

Demo Program for AD8232 Heart Rate sensor.
Casey Kuhns @ SparkFun Electronics
The AD8232 Heart Rate sensor is a low cost EKG/ECG sensor.  This example shows
how to create an ECG with real time display.  The display is using Processing.
This sketch is based heavily on the Graphing Tutorial provided in the Arduino
This program requires a Processing sketch to view the data in real time.
Development environment specifics:
	IDE: Arduino 1.0.5
	Hardware Platform: Arduino Pro 3.3V/8MHz
	AD8232 Heart Monitor Version: 1.0
This code is beerware. If you see me (or any other SparkFun employee) at the
local pub, and you've found our code helpful, please buy us a round!
Distributed as-is; no warranty is given.

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()[2], 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:
1 Like

Sota, not really… how is that for an answer :wink:

It is buffering a serial flow until a newline… but it is built for the Processing program to display the data… that program has other functions, but often works in conjunction with the IDE (actually, I believe the IDE is based off of Processing??) in order to display graphics on the computer via the USB port… thus the use and buffering of serial data for the serial link.

No good for Blynk use though.


I eventually got it working, good enough for the kids to play with anyway. They love it, been playing Doctors and nurses for hours. :sweat_smile:
Old Galaxy 4 tablet as a screen, Wemos D1 hidden in a draw, 2 meter long earphone extension to the 3 re-usable gel pads, bandages, box of plaster and my wife’s old Stethoscope. Hours of fun …


please send code plesase

1 Like

STAT !! :stuck_out_tongue_winking_eye:


You’ll find everything you need here


1 Like

You can halp me? With the code? :(:disappointed_relieved:

1 Like

@Luciano_Lima_Fer You have your own topic already about your issue… please do not beg for code in other’s topics.