Board Overview
NOTE : The switch is to set the working mode, it will change the signal type to be Digital or Analog. If it was NOT set as consistent as the code or wiring, ie the switch was set as "A", but you write your Code as digitalRead and(or) you wire the module onto Arduino digital pin, in this case, you will fail to get any readings, vice versa.
Tutorial
In this tutorial, you will learn how to use this Heart Rate sensor in digital mode as well as analog mode, more than this, at the end of this tutorial, we will show you how to use this sensor to draw the ECG to a LCD Module.
Once you opened the box, you can find a black belt inside of the package. Thread it through the holes of the sensor as indicated in the photo. And then you could attach it on your finger (suggested), wrist or any other places where Expos blood vessels. Do not attach the belt too tight or too loose to your finger or the reading might be not stable. During the test, you should steady your finger and do not move too much, or the readings might be unstable.
1.Thread the belt through the holes
4.Wrap on the back of wrist
#define heartratePin A1
#include "DFRobot_Heartrate.h"
DFRobot_Heartrate heartrate(DIGITAL_MODE); ///< ANALOG_MODE or DIGITAL_MODE
void setup() {
Serial.begin(115200);
}
void loop() {
uint8_t rateValue;
heartrate.getValue(heartratePin); ///< A1 foot sampled values
rateValue = heartrate.getRate(); ///< Get heart rate value
if(rateValue) {
Serial.println(rateValue);
}
delay(20);
}
Draw the ECG (Electrocardiography)
Digital Mode
Attach this sensor to Arduino D2
Set the sensor mode switch as D (digital)
Upload the code below
Open the Arduino Serial Plotter (Baud: 9600)
/*
DigitalReadSerial
Reads a digital input on pin 2, prints the result to the serial monitor
This example code is in the public domain.
*/
// digital pin 2 has a pushbutton attached to it. Give it a name:
int pushButton = 2;
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
// make the pushbutton's pin an input:
pinMode(pushButton, INPUT);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input pin:
int buttonState = digitalRead(pushButton);
// print out the state of the button:
Serial.println(buttonState);
delay(10); // delay in between reads for stability
}
Analog Mode
Attach this sensor to Arduino A1
Set the sensor mode switch as A (analog)
Upload the code below
Open the Arduino Serial Plotter (Baud: 9600)
/*
AnalogReadSerial
Reads an analog input on pin 0, prints the result to the serial monitor.
Graphical representation is available using serial plotter (Tools > Serial Plotter menu)
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
This example code is in the public domain.
*/
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A1);
// print out the value you read:
Serial.println(sensorValue);
delay(10); // delay in between reads for stability
}
![desc9](https://i.ibb.co/9Zz0czN/desc9.png)
Finger clip Generic Heart Rate Monitor Sensor for Arduino
Finger-clip Heart Rate Sensor is based on PAH8001EI-2G, a high performance and low power CMOS-process optical sensor with Green LED and DSP integrated serving as a Heart Rate Detection(HRD) sensor. This module is based on optical technology which measures the variation human blood movement in the vessel. Low power consumption and flexible power saving mode make it suitable for wearable device. Cause the heart rate sensor chip need high processing speed for the algorithm of heart rate data(), this module integrate a STM32, reserved SWD interface allow users to reprogram the STM32.
Specification
~ Ultra-low power consumption, power saving mode during time of no touch movement
~ Flexible sleep rate control
~ Integrated the STM32F103
~ I2C interface
~ Heart rate sensor area just 3.0 x 4.7mm
~ Reserved SWD interface
~ Working temperature: -20 ~ +60℃
Copy the following code into a new sketch of Arduino and upload the sketch, then you can get heart rate from the Serial Monitor. It may take about a minute to get valid heart rate after you touch your finger with sensor.
#include <Wire.h>
void setup() {
Serial.begin(9600);
Serial.println("heart rate sensor:");
Wire.begin();
}
void loop() {
Wire.requestFrom(0xA0 >> 1, 1); // request 1 bytes from slave device
while(Wire.available()) { // slave may send less than requested
unsigned char c = Wire.read(); // receive heart rate value (a byte)
Serial.println(c, DEC); // print heart rate value
}
delay(500);
}
ECG Heart Rate Monitor Sensor for Arduino
Introduction
This Heart Rate Monitor Sensor is used to measure the electrical activity of the heart. This electrical activity can be charted as an ECG and output as an analog reading. An ECG signal can be extremely noisy so we have included an AD8232 chip on the PCB Which will provide a clear signal from the PR and QT Intervals. Using the Arduino IDE "Serial Plotter" feature you are also able to view the plot ECG output on your PC!
Please Note: This product is NOT a medical device and is not intended to be used as such or as an accessory to such nor diagnose or treat any conditions.
Specification
Input Voltage: 3.3 - 6V (5V recommended)
Output Voltage: 0 - 3.3V
Operating current: <10mA
Dimension: 35 x 22(mm), 1.378" x 0.866"(in)
Interface Type: PH2.0-3P
Board Overview
Tutorial
![desc2](https://i.ibb.co/3SJvTWn/desc2.png)
NOTE:
An the ECG Signal CAN BE quite Noisy Due to Surrounding muscle Activity at The Further at The the Sensor PADS are from at The Heart, at The More muscle Noise you by Will See the To Improve at The Signal at Quality, the Follow THESE the Simple Tips:..
The Keep the Sensor PADS AS use Close to The heart as you can make
sure the RA and LA sensor pads are on the contact of the heart
Try not to move too much while taking a measurement
Try to use fresh pads for each measurement. The pads loose the ability to pass signals with multiple applications
Prepare and clean the area you plan to stick pads. This will help make a good connection (hair is not a good conductor)
You may have to adjust sensor placement for different individuals
Sample Code
const int heartPin = A1;
void setup() {
Serial.begin(115200);
}
void loop() {
int heartValue = analogRead(heartPin);
Serial.println(heartValue);
delay(5);
}
Expected Result
Open the Arduino IDE 1.6.6 (or above) "Serial Plotter";
Then you could see the output signal from the microcontroller - A1 port, the ECG.
NOTE : If you found there was a lot of jamming waveforms, they may come from the body's static electricity. Touch something metal to discharge any static electricity. More read on WikiHow.
#include "HeartSpeed.h"
HeartSpeed heartspeed(A1); ///<The serial port for at observe pulse.
//HeartSpeed heartspeed(A1,RAW_DATA); ///<The serial port mapper, observation of ECG diagram.
/* Print the position result */
void mycb(uint8_t rawData, int value)
{
if(rawData){
Serial.println(value);
}else{
Serial.print("HeartRate Value = "); Serial.println(value);
}
}
void setup() {
Serial.begin(115200);
heartspeed.setCB(mycb); ///Callback function.
heartspeed.begin();///The pulse test.
}
void loop() {
}
Open the Arduino IDE 1.6.6 (or above) "Serial Port";
Then you could see the output signal in BPM.
![desc5](https://i.ibb.co/GJLmyqV/desc5.png)