Heartbeat Sensor using Arduino (Heart Rate Monitor)
A heartbeat sensor is an electronic device that measures the heart rate, or the pace at which the heart beats. The main things we do to stay healthy are monitor our body temperature, heart rate, and blood pressure.
To monitor the Arterial Pressure or Blood Pressure, we utilise thermometers and a sphygmomanometer to measure the body temperature.
Heart rate can be measured in two ways: one by manually checking the pulse at the wrists or neck, and the other by using a Heartbeat Sensor.
In this project, we have designed a Heart Rate Monitor System using Arduino and Heartbeat Sensor. You can find the Principle of Heartbeat Sensor, working of the Heartbeat Sensor and Arduino based Heart Rate Monitoring System using a practical heartbeat Sensor.
Outline
- Output Video
- Introduction to Heartbeat Sensor
- Principle of Heartbeat Sensor
- Working of Heartbeat Sensor
- Circuit of Arduino based Heart Rate Monitor using Heartbeat Sensor
- Components Required
- Circuit Design of Interfacing Heartbeat Sensor with Arduino
- Working of the Circuit
- CODE
- Applications of Heart Rate Monitor using Arduino
Output Video
Introduction to Heartbeat Sensor
Heart rate monitoring is critical for sportsmen and patients since it determines the health of the heart (just heart rate). Heart rate can be measured in a variety of methods, the most precise of which is via an electrocardiogram.
A Heartbeat Sensor, on the other hand, is a more convenient approach to keep track of your heart rate. It comes in a variety of shapes and sizes and can be used to measure the heartbeat in real time.
Wrist watches (Smart Watches), smart phones, chest straps, and other devices all have heartbeat sensors. The heartbeat is counted in beats per minute (bpm), which represents how many times the heart contracts or expands in a minute.
Principle of Heartbeat Sensor
Photoplethysmograph is the principle behind the Heartbeat Sensor’s operation. The variations in the volume of blood in an organ are measured by the changes in the intensity of light passing through that organ, according to this concept.
In most heartbeat sensors, the light source is an IR LED, and the detector is a Photo Detector such as a Photo Diode, an LDR (Light Dependent Resistor), or a Photo Transistor.
We can organise these two elements, a light source and a detector, in two ways: a Transmissive Sensor and a Reflective Sensor.
In a Transmissive Sensor, the light source and the detector are place facing each other and the finger of the person must be placed in between the transmitter and receiver.
Reflective Sensor, on the other hand, has the light source and the detector adjacent to each other and the finger of the person must be placed in front of the sensor.
Working of Heartbeat Sensor
A sensor and a control circuit make up a basic Heartbeat Sensor. An IR LED and a Photo Diode in a clip make up the sensor element of the Heartbeat Sensor.
An Op-Amp IC and a few other components make up the Control Circuit, which connects the signal to a Microcontroller. The Heartbeat Sensor’s operation can be better understood by looking at its circuit diagram.
The finger type heartbeat sensor, which works by detecting pulses, is shown in the circuit above. The amount of blood in the finger varies with each heartbeat, as does the light from the IR LED flowing through the finger and so being detected by the Photo Diode.
The photo diode’s output is fed into the first op-non-inverting amp’s input through a capacitor, which blocks the signal’s DC components. The earliest op-amp cats were used as a non-inverting amplifier with a 1001 amplification factor.
The output of the first op – amp is given as one of the inputs to the second op – amp, which acts as a comparator. The output of the second op – amp triggers a transistor, from which, the signal is given to a Microcontroller like Arduino.
The Op – amp used in this circuit is LM358. It has two op – amps on the same chip. Also, the transistor used is a BC547. An LED, which is connected to transistor, will blink when the pulse is detected.
Circuit of Arduino based Heart Rate Monitor using Heartbeat Sensor
The following image shows the circuit diagram of the Arduino based Heart Rate Monitor using Heartbeat Sensor. The sensor has a clip to insert the finger and has three pins coming out of it for connecting VCC, GND and the Data.
Components Required
- Arduino UNO x 1 [Buy Here]
- 16 x 2 LCD Display x 1 [Buy Here]
- 10KΩ Potentiometer
- 330Ω Resistor (Optional – for LCD backlight)
- Push Button
- Heartbeat Sensor Module with Probe (finger based)
- Mini Breadboard
- Connecting Wires
Circuit Design of Interfacing Heartbeat Sensor with Arduino
The Arduino-based Heart Rate Monitor System with Heart Beat Sensor has a very basic circuit design. First, we must connect a 162 LCD Display to the Arduino UNO in order to display the heartbeat measurements in bpm.
The LCD Module’s four data lines (D4, D5, D6, and D7) are linked to the Arduino UNO’s Pins 1, 1, 1, and 1. A 10K potentiometer is also attached to LCD Pin 3. (contrast adjust pin). The LCD’s RS and E (Pins 3 and 5) are linked to the Arduino UNO’s Pins 1 and 1.
Next, connect the Heartbeat Sensor Module’s output to Arduino’s Analog Input Pin (Pin 1).
Working of the Circuit
Upload the code to Arduino UNO and Power on the system. The Arduino asks us to place our finger in the sensor and press the switch.
Place any finger (except the Thumb) in the sensor clip and push the switch (button). Based on the data from the sensor, Arduino calculates the heart rate and displays the heartbeat in bpm.
While the sensor is collecting the data, sit down and relax and do not shake the wire as it might result in a faulty values.
After the result is displayed on the LCD, if you want to perform another test, just push the rest button on the Arduino and start the procedure once again.
CODE
#include <LiquidCrystal.h> | |
LiquidCrystal lcd(6, 5, 3, 2, 1, 0); | |
int data=A0; | |
int start=7; | |
int count=0; | |
unsigned long temp=0; | |
byte customChar1[8] = {0b00000,0b00000,0b00011,0b00111,0b01111,0b01111,0b01111,0b01111}; | |
byte customChar2[8] = {0b00000,0b11000,0b11100,0b11110,0b11111,0b11111,0b11111,0b11111}; | |
byte customChar3[8] = {0b00000,0b00011,0b00111,0b01111,0b11111,0b11111,0b11111,0b11111}; | |
byte customChar4[8] = {0b00000,0b10000,0b11000,0b11100,0b11110,0b11110,0b11110,0b11110}; | |
byte customChar5[8] = {0b00111,0b00011,0b00001,0b00000,0b00000,0b00000,0b00000,0b00000}; | |
byte customChar6[8] = {0b11111,0b11111,0b11111,0b11111,0b01111,0b00111,0b00011,0b00001}; | |
byte customChar7[8] = {0b11111,0b11111,0b11111,0b11111,0b11110,0b11100,0b11000,0b10000}; | |
byte customChar8[8] = {0b11100,0b11000,0b10000,0b00000,0b00000,0b00000,0b00000,0b00000}; | |
void setup() | |
{ | |
lcd.begin(16, 2); | |
lcd.createChar(1, customChar1); | |
lcd.createChar(2, customChar2); | |
lcd.createChar(3, customChar3); | |
lcd.createChar(4, customChar4); | |
lcd.createChar(5, customChar5); | |
lcd.createChar(6, customChar6); | |
lcd.createChar(7, customChar7); | |
lcd.createChar(8, customChar8); | |
pinMode(data,INPUT); | |
pinMode(start,INPUT_PULLUP); | |
} | |
void loop() | |
{ | |
lcd.setCursor(0, 0); | |
lcd.print(“Place The Finger”); | |
lcd.setCursor(0, 1); | |
lcd.print(“And Press Start”); | |
while(digitalRead(start)>0); | |
lcd.clear(); | |
temp=millis(); | |
while(millis()<(temp+10000)) | |
{ | |
if(analogRead(data)<100) | |
{ | |
count=count+1; | |
lcd.setCursor(6, 0); | |
lcd.write(byte(1)); | |
lcd.setCursor(7, 0); | |
lcd.write(byte(2)); | |
lcd.setCursor(8, 0); | |
lcd.write(byte(3)); | |
lcd.setCursor(9, 0); | |
lcd.write(byte(4)); | |
lcd.setCursor(6, 1); | |
lcd.write(byte(5)); | |
lcd.setCursor(7, 1); | |
lcd.write(byte(6)); | |
lcd.setCursor(8, 1); | |
lcd.write(byte(7)); | |
lcd.setCursor(9, 1); | |
lcd.write(byte(8)); | |
while(analogRead(data)<100); | |
lcd.clear(); | |
} | |
} | |
lcd.clear(); | |
lcd.setCursor(0, 0); | |
count=count*6; | |
lcd.setCursor(2, 0); | |
lcd.write(byte(1)); | |
lcd.setCursor(3, 0); | |
lcd.write(byte(2)); | |
lcd.setCursor(4, 0); | |
lcd.write(byte(3)); | |
lcd.setCursor(5, 0); | |
lcd.write(byte(4)); | |
lcd.setCursor(2, 1); | |
lcd.write(byte(5)); | |
lcd.setCursor(3, 1); | |
lcd.write(byte(6)); | |
lcd.setCursor(4, 1); | |
lcd.write(byte(7)); | |
lcd.setCursor(5, 1); | |
lcd.write(byte(8)); | |
lcd.setCursor(7, 1); | |
lcd.print(count); | |
lcd.print(” BPM”); | |
temp=0; | |
while(1); | |
} |
Applications of Heart Rate Monitor using Arduino
- A simple project involving Arduino UNO, 16×2 LCD and Heartbeat Sensor Module is designed here which can calculate the heart rate of a person.
- This project can be used as an inexpensive alternative to Smart Watches and other expensive Heart Rate Monitors.