Arduino Based Heartbeat Monitor

Published  October 7, 2015   111
S Saddam
Author
Heartbeat Monitor Project using Arduino

Heart rate, body temperature and blood pressure monitoring are very important parameters of human body. Doctors use various kind of medical apparatus like thermometer for checking fever or body temperature, BP monitor for blood pressure measurement and heart rate monitor for heart rate measurement. In this project, we have built an Arduino based heartbeat monitor which counts the number of heartbeats in a minute. Here we have used a heartbeat sensor module which senses the heartbeat upon putting a finger on the sensor.

 

Components

  1. Arduino
  2. Heart Beat sensor module
  3. 16x2 LCD
  4. Push button
  5. Bread board
  6. Power
  7. Connecting wires

 

Working of Heartbeat Monitor Project

Working of this project is quite easy but a little calculation for calculating heart rate is required. There are several methods for calculating heart rate, but here we have read only five pulses. Then we have calculated total heart beat in a minute by applying the below formula:

     Five_pusle_time=time2-time1;

      Single_pulse_time= Five_pusle_time /5;

      rate=60000/ Single_pulse_time;

where time1 is first pulse counter value

time2 is list pulse counter value

rate is final heart rate.

 

When first pulse comes, we start counter by using timer counter function in arduino that is millis();. And take first pulse counter value form millis();. Then we wait for five pulses. After getting five pulses we again take counter value in time2 and then we substarct time1 from time2 to take original time taken by five pulses. And then divide this time by 5 times for getting single pulse time. Now we have time for single pulse and we can easily find the pulse in one minute, deviding 600000 ms by single pulse time.

Rate= 600000/single pulse time.

Arduino Based Heartbeat Monitor Block Diagram

In this project we have used Heart beat sensor module to detect Heart Beat. This sensor module contains an IR pair which actually detect heart beat from blood. Heart pumps the blood in body which is called heart beat, when it happens the blood concentration in body changes. And we use this change to make a voltage or pulse electrically.

 

Circuit Diagram and Explanation

Circuit of heartbeat monitor is shown below, which contains arduino uno, heart beat sensor module, reset button and LCD. Arduino controls whole the process of system like reading pulses form Heart beat sensor module, calculating heart rate and sending this data to LCD. We can set the sensitivity of this sensor module by inbuilt potentiometer placed on this module. 

Arduino Based Heartbeat Counter Circuit Diagram

Heart beat sensor module’s output pin is directly connected to pin 8 of arduino. Vcc and GND are connected to Vcc and GND. A 16x2 LCD is connected with arduino in 4-bit mode. Control pin RS, RW and En are directly connected to arduino pin 12, GND and 11. And data pin D4-D7 is connected to pins 5, 4, 3 and 2 of arduino. And one push button is added for resetting reading and another is used to start the system for reading pulses. When we need to count heart rate, we press start button then arduino start counting pulses and also start counter for five seconds. This start push button is connected to pin 7 and reset push button is connected to pin 6 of arduino with respect to ground.

 

Program Description

In code we have used digital read function to read output of Heart Beat sensor module and millis() fuction for calculating time and then calculate Heart Rate.

heartbeat counter code

Before this we have initiazed all the components that we used in this project.

setup

and here we have pullup the push button line by using software pullup.

pullup

Code

#include<LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int in = 8;
int Reset=6;
int start=7;
int count=0,i=0,k=0,rate=0;

unsigned long time2,time1;
unsigned long time;

byte heart[8] = 
{
  0b00000,
  0b01010,
  0b11111,
  0b11111,
  0b11111,
  0b01110,
  0b00100,
  0b00000
};

void setup()
{
  lcd.createChar(1, heart);
  lcd.begin(16,2);
  
  lcd.print("Heart Beat ");
  lcd.write(1);
  lcd.setCursor(0,1);
  lcd.print("Monitering");
  pinMode(in, INPUT);
  pinMode(Reset, INPUT);
  pinMode(start, INPUT);
  digitalWrite(Reset, HIGH);
  digitalWrite(start, HIGH);
  delay(1000);
}

void loop()
{
  if(!(digitalRead(start)))
  {
    k=0;
    lcd.clear();
    lcd.print("Please wait.......");
    while(k<5)
    {
     if(digitalRead(in))
     {
      if(k==0)
      time1=millis();
      k++;
      while(digitalRead(in));
     }
    }
      time2=millis();
      rate=time2-time1;
      rate=rate/5;
      rate=60000/rate;
      lcd.clear();
      lcd.print("Heart Beat Rate:");
      lcd.setCursor(0,1);
      lcd.print(rate);
      lcd.print(" ");
      lcd.write(1);      
      k=0;
      rate=0;
    }
  if(!digitalRead(Reset))
  {
    rate=0;
     lcd.clear();
      lcd.print("Heart Beat Rate:");
      lcd.setCursor(0,1);
      lcd.write(1);
      lcd.print(rate);
      k=0;
  }
}

Video

Have any question realated to this Article?

Ask Our Community Members

Comments

Submitted by Fiza on Tue, 05/30/2017 - 17:53

Permalink

Hi sir, i am getting some random values as output. Sometimes -1, 2500, 98. And can you explain the coding regarding the formula to calculate heartbeat. You can email me. Thank you sir.

Submitted by Anil Kumar Reddy A on Wed, 07/05/2017 - 18:10

Permalink

Can give me the exact connections for arduino with lcd and pulse sensor?

Submitted by brhanu on Sat, 08/12/2017 - 02:33

Permalink

Nice idea!! but, I couldn't get the heart beat sensor module library for Proteus. please help me how can I get this library?

Submitted by Pooja Sain on Sun, 10/22/2017 - 22:32

Permalink

I m a b.tech final year student, I want to know the explanation of code with comments (//). Could you provide it ? Please i need it urgently.

hello sir

sir could you please post me all the components and the full codes required to

to design heart beat sensor using arduino at: []. i also want to incorporate SPO2 measurements in the heart rate sensor project. how possible is it?

Submitted by Navaneetha on Tue, 01/23/2018 - 12:03

Permalink

Hi,
Could anyone let me know the advantages of this project [Heartbeat Sensor using Arduino/Heart Rate Monitor] over the Heartbeat using Mobile Apps??

Also how can we determine the Accuracy of this project?

Submitted by AISHA on Tue, 01/23/2018 - 16:00

In reply to by Navaneetha

Permalink

It not possible for a Mobile app to measure the heartbeat without any hardware. This hardware is made using the Arduino, which is a cost effective open-source platform. The accuracy of the project depends in the sensor used. The one used here is only for development purpose and not medically approved 

Submitted by PRATHYUSHA on Wed, 02/28/2018 - 21:27

Permalink

How do we get rate =60000/1pulse time

1pulse time will be in sec then the rate calculated
would be beats per sec how is it possible

Submitted by arooj azhar on Fri, 03/09/2018 - 23:34

Permalink

hello sir,
i want to send the heartbeat rate(printed on my lcd) on my phone.please help me in doing so.
thank you