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…

Pete.

2 Likes

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

2 Likes

Yeah, that’s what they all say!

3 Likes

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:
  Serial.begin(9600);
  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)){
    Serial.println('!');
  }
  else{
    // send the value of analog input 0:
      Serial.println(analogRead(A0));
  }
  //Wait for a bit to keep serial data from saturating
  delay(1);
}
2 Likes

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

/******************************************************************************
Heart_Rate_Display.ino
Demo Program for AD8232 Heart Rate sensor.
Casey Kuhns @ SparkFun Electronics
6/27/2014
https://github.com/sparkfun/AD8232_Heart_Rate_Monitor
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
IDE. http://www.arduino.cc/en/Tutorial/Graph
Resources:
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
  println(Serial.list());
  // 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:
  myPort.bufferUntil('\n');
  // set inital background:
  background(0xff);
}


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;
        background(0xff);
      } 
      else {
        // increment the horizontal position:
        xPos++;
      }
    
  }
}
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.

2 Likes

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 …

5 Likes

please send code plesase

1 Like

STAT !! :stuck_out_tongue_winking_eye:

3 Likes

You’ll find everything you need here

:joy:

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.

2 Likes