Ks0261 keyestudio AD8232 ECG Measurement Heart Monitor Sensor Module

From Keyestudio Wiki
Jump to: navigation, search


Introduction

The AD8232 is an integrated front end for signal conditioning of cardiac bioelectrical signals to monitor heart rate.
This is a low-power, single-lead and heart rate monitor front end for all types of vital signs.

thumb


Specification

  • Power voltage:DC 3.3V
  • Output:analog output
  • Interface(connect RA, LA, RL): 3PIN, 2.54PIN or earphone jack
  • Working Temperature:-40℃ to +85℃


thumb


Connection Diagram


thumb


Sample Code

1> Burn the code to UNO board using arduino IDE

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);
}


thumb


2> Using processing softwarethumb to find the program as below:

myPort = new Serial(this, Serial.list()[2], 9600);
This program,Serial.list()[2],9600,is to check the serial port of the computer you used,for example,the below figure shows only one port, so it is Serial.list()[0],9600.

thumb

When the computer appears COM1 and COM5,COM5 is the UNO test of AD8232 board, so it shows Serial.list()[1],9600, you can refer to the below figure:

thumb


Heart_Rate_Display.ino
Demo Program for AD8232 Heart Rate sensor.

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've found our code helpful, please buy us a round!
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++;
      }    
  }
}


Test Result

Using the software thumb to open the program,click thumb key. Using three pads,R-end is stuck on the left chest, L-end is for the right chest, COM is stuck near the stomach.
It will appear the following pattern, and the LED light on the PCB board will flash with the heartbeat. In this way,you can make sure that the board is available.

thumb



Resources

  • PDF:

https://drive.google.com/open?id=16Fhn8dVlzO9zI_uU0KmpTKqDGU3Rdw1q

  • Get Codes of All Project:

https://drive.google.com/open?id=1G3aJAjXGb_luWEfEi9N2BaujjLZIfi8I

  • Get Processing Software:

https://drive.google.com/open?id=1Zfw-xgq9KrXM2IFT3dSB0p_d4dXX-OG5


Get One Now