Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

Heart Rate Monitor

By

Adithya Venkatraman 19BEC1030


Abishek.R 19BEC1365
K.B.Pranav 19BEC1173
Krithik Kannan 19BEC1269

A project report submitted to


Dr.G GUGAPRIYA

SCHOOL OF ELECTRONICS
ENGINEERING
in partial fulfilment of the requirements for the course of

ECE 3003 – MICROCONTROLLERS AND ITS


APPLICATIONS
In
B.Tech. ELECTRONICS AND COMMUNICATION
ENGINEERING

Vandalur – Kelambakkam Road


Chennai – 600127
BONAFIDE CERTIFICATE

Certified that this project report entitled “Heart rate monitor” is


a Bonafide work of ADITHYA VENKATRAMAN (19BEC1030), R
ABISHEK (19BEC1365), KB PRANAV (19BEC1173), KRITHIK
KANNAN (19BEC1269).

who carried out the project work under my supervision and


guidance for ECE3003- MICROCONTROLLERS AND ITS
APPLICATIONS.

Dr. G GUGAPRIYA
School of Electronics Engineering
(SENSE) VIT University, Chennai
Chennai - 600127
ABSTRACT
This project will discuss about the health services in the field of
diagnostic tools and life support systems in the form of
photoplethysmography. We designed a system capable of providing
heart pumping activity information through a phenomenon known as
photoplethysmography. We collect the data pulse using a heart rate
sensor (fingertip sensor). This system works to retrieve data from the
bloodstream on the index finger and for the simulation the data is
retrieved from the sensor through a test pin giving arbitrary values.
ACKNOWLEDGEMENT

We wish to express our sincere thanks and deep sense of gratitude to


our project guide, Dr.G Gugapriya , Associate Professor, School of
Electronics Engineering, for his consistent encouragement and
valuable guidance offered to us in a pleasant manner throughout the
course of the project work.
We are extremely grateful to Dr. Sivasubramanian. A, Dean of
School of Electronics Engineering, VIT Chennai, for extending the
facilities of the school towards our project and for her unstinting
support.
We express our thanks to our Head of the Department
Dr. Vetrivelan. P for his support throughout the course of this
project.
We also take this opportunity to thank all the faculty of the school for
their support and their wisdom imparted to us throughout the course.
We thank our parents, family, and friends for bearing with us
throughout the course of our project and for the opportunity they
provided us in undergoing this course in such a prestigious institution.
CHAPTER 1
INTRODUCTION
The diagnostic tool measuring heart rate is a medical device that will be used to
help nurses and very useful to know the state of the patient's condition. The
principle of this diagnostic tool is to count the number of heartbeats in minutes.
Then from the heart beat count will be determined whether the patient is in normal
condition or not. Usually, people who have arrhythmia abnormalities of heart
disease, specific values will deviate from the range of 60-100 BPM. Monitoring
heart rate is very important for athletes, patients as it determines the condition of
the heart (just heart rate). There are many ways to measure heart rate and the most
precise one is using an Electrocardiography but the easier way to monitor the
heart rate is to use a Heartbeat Sensor. It comes in different shapes and sizes and
allows an instant way to measure the heartbeat.
Heartbeat Sensors are available in Wrist Watches (Smart Watches), Smart Phones,
chest straps, etc. The heartbeat is measured in beats per minute or bpm, which
indicates the number of times the heart is contracting or expanding in a minute.

1.1 OBJECTIVE
Ever since humans have existed, ‘health’ has undoubtedly been the single most
important factor in one’s life. Knowing how our body parts or internal organs are
functioning is vital to keep track of ourselves and remain healthy.
It is much easier and more convenient to check ourselves. Parameters like heart
rate, pulse rate, temperature, BMI, etc. can be conveniently calculated. This
becomes more relevant in this current scenario amidst the pandemic which we are
facing now. Although getting tested is the best way to know if one is infected or
not, testing our pulse and heart rate can give us hints of possible symptoms of the
virus.

1.2 PRINCIPLE
The device senses the heart rate from the fingertip using IR reflection method and
displays it on a three digit seven segment display in beats per minute. The circuit has
an accuracy of 4 beats per minute and it is very easy to use. In medical terms, the
technique used here for sensing heart rate is called photoplethysmography.
CHAPTER 2

CIRCUIT DESIGN

Fig 1. Basic block diagram

2.1 SOFTWARE SPECIFICATIONS

COMPONENTS:

● 8051 Microcontroller ​
● LTH 1550-01 photo interrupter​
● Resistors​
● Capacitors ​
● LCD Display
2.2 CIRCUIT DIAGRAM
Working of the heart rate monitor

LTH1550-01 photo interrupter forms the photoplethysmographic sensor here.


LTH1550-01 is simply an IR diode – phototransistor pair in a single package. The
front side of the IR diode and phototransistor are exposed and the remaining parts are
well isolated. When the finger tip is placed over the sensor the volumetric pulsing of
the blood volume inside the finger tip due to heart beat varies the intensity of the
reflected beam and this variation in intensity is according to the heart beat.

When more light falls on the photo transistor it conducts more, its collector current
increases and so its collector voltage decreases. When less light falls on the photo
transistor it conducts less, its collector current decreases and so its collector voltage
decreases. This variation in the collector voltage will be proportional to the heart rate.
Anyway this voltage variation is so feeble and additional signal conditioning stages are
necessary to convert it into a microcontroller recognizable form.

The next part of the circuit consists of two active low pass filters using op amp
LM324. The LM324 is a quad op amp that can be operated from a single rail supply.
Resistor R23, R17 and capacitor C5 sets the gain and cut off frequency of the first
filter. With the given component values, gain will be 11 and cut off frequency will be
2.5Hz. The gain and cut off frequency are determined using the following equations.
Capacitor C15 is used to by-pass noise if any may cause false triggering of the
comparator.

Voltage gain Av =1 + (R17 / R23)

Cut off frequency Fc= 1/(2π *R17*C5)

The second low pass filter also has the same gain and cut off frequency. The two low
pass filters form a very critical part of the circuit as any noise or false signals passing
to the microcontroller stage will produce disastrous results. The output of the filter
stage will be a voltage level fluctuating between 0 and 0.35 volts and this fluctuation is
converted into a 0 to 5V swing using the comparator based on the third opamp (IC1c).
The reference voltage of the comparator is set to 0.3V. Whenever the output voltage of
the filter stage goes above 0.3V, the output of the comparator goes to zero and
whenever the output voltage of the filter stage goes below 0.3V, the output of the
comparator goes to positive saturation. The result will be a neat pulse fluctuating
between 0 and 5V at a rate equal to the heart rate. This pulse is fed to the
microcontroller for counting.
CHAPTER 3
SYSTEM IMPLEMENTATION AND ANALYSIS
This section describes system implementation and results with inferences.

CODE:
ORG 000H // origin
MOV DPTR,#LUT // moves starting address of LUT to
DPTR
MOV P1,#00000000B // sets P1 as output port
MOV P0,#00000000B // sets P0 as output port
MAIN: MOV R6,#230D // loads register R6 with 230D
SETB P3.5 // sets P3.5 as input port
MOV TMOD,#01100001B // Sets Timer1 as Mode2 counter &
Timer0 as Mode1 timer
MOV TL1,#00000000B // loads TL1 with initial value
MOV TH1,#00000000B // loads TH1 with initial value
SETB TR1 // starts timer(counter) 1
BACK: MOV TH0,#00000000B // loads initial value to TH0
MOV TL0,#00000000B // loads initial value to TL0
SETB TR0 // starts timer 0
HERE: JNB TF0,HERE // checks for Timer 0 roll over
CLR TR0 // stops Timer0
CLR TF0 // clears Timer Flag 0
DJNZ R6,BACK
CLR TR1 // stops Timer(counter)1
CLR TF0 // clears Timer Flag 0
CLR TF1 // clears Timer Flag 1
ACALL DLOOP // Calls subroutine DLOOP for
displaying the count
SJMP MAIN // jumps back to the main loop
DLOOP: MOV R5,#252D
BACK1: MOV A,TL1 // loads the current count to the
accumulator
MOV B,#4D // loads register B with 4D
MUL AB // Multiplies the TL1 count with 4
MOV B,#100D // loads register B with 100D
DIV AB // isolates first digit of the count
SETB P1.0 // display driver transistor Q1 ON
ACALL DISPLAY // converts 1st digit to 7seg
pattern
MOV P0,A // puts the pattern to port 0
ACALL DELAY
ACALL DELAY
MOV A,B
MOV B,#10D
DIV AB // isolates the second digit of the
count
CLR P1.0 // display driver transistor Q1 OFF
SETB P1.1 // display driver transistor Q2 ON
ACALL DISPLAY // converts the 2nd digit to 7seg
pattern
MOV P0,A
ACALL DELAY
ACALL DELAY
MOV A,B // moves the last digit of the count
to accumulator
CLR P1.1 // display driver transistor Q2 OFF
SETB P1.2 // display driver transistor Q3 ON
ACALL DISPLAY // converts 3rd digit to 7seg
pattern
MOV P0,A // puts the pattern to port 0
ACALL DELAY // calls 1ms delay
ACALL DELAY
CLR P1.2
DJNZ R5,BACK1 // repeats the subroutine DLOOP 100
times
MOV P0,#11111111B
RET

DELAY: MOV R7,#250D // 1ms delay


DEL1: DJNZ R7,DEL1
RET

DISPLAY: MOVC A,@A+DPTR // gets 7seg digit drive pattern for


current value in A
CPL A
RET
LUT: DB 3FH // LUT starts here
DB 06H
DB 5BH
DB 4FH
DB 66H
DB 6DH
DB 7DH
DB 07H
DB 7FH
DB 6FH
END
WORKING:

For the counting purpose both the timers of 8051 (Timer0 and Timer1) are used. Timer
1 is configured as an 8 bit auto reload counter for registering the number of incoming
zero going pulses and Timer0 is configured as a 16 bit timer which generate the
necessary 1 second time span for the Timer1 to count.For counting the number of beats
Timer0 and Timer1 are used. Timer1 is set as an 8 bit auto reload counter for counting
the the number of pulses (indicating the heart beat) and Timer0 is set as a 16 bit timer
which generates a 65536uS delay. When looped 230 times it will produce a 15 second
time span (230 x 65536uS =15S) for the Timer 1 to count. The number of counts
obtained in 15 seconds is multiplied by 4 to obtain the heart rate in beats per minute.

The Timer 0 which generates the 1 second time span is configured in Mode 1 (16 bit
timer). So the maximum it can count is 2^16 and it is 65536. In 8051 the crystal
frequency is divided by 12 using an internal frequency divider network before
applying it as a clock for the timer. That means the timer will increment by one for
every 1/12th of the crystal frequency. For an 8051 based system clocked by a 12MHz
crystal, the time taken for one timer increment will be 1µS (ie; 1/12MHz). So the
maximum time delay that can be obtained using one session of the timer will be
65536µS.
Setting up the circuit.

When power is switched ON, the indicator LED D4 will glow an continues
in that state. Now place your finger tip over the sensor and adjust preset
R14 so that the LED D4 starts blinking. After you got the LED blinking,
reset the power and wait for 15 seconds. The display will show your heart
rate in beats per minute.

NOTE:

Due to the pandemic situation and lockdown , the LTH 1550-01 photo
interrupter was not available.So we decided to make this project using an
arduino.

CIRCUIT DESIGN (using Arduino)

1. BLOCK DIAGRAM

Fig 1. Basic block diagram

SOFTWARE SPECIFICATIONS COMPONENTS:

● Heartbeat / Pulse sensor


● Arduino UNO
● Virtual terminal
● Oscilloscope
● Potentiometer
● DC voltmeter
● Software used: Proteus, Arduino IDE
CIRCUIT DIAGRAM (PROTEUS)

COMPONENTS SPECIFICATIONS:
● Heartbeat / Pulse sensor: A simple Heartbeat Sensor consists of a
sensor and a control circuit. The sensor part of the Heartbeat
Sensor consists of an IR LED and a Photo Diode placed in a clip.
Every heartbeat will alter the amount of blood in the finger and the
light from the IR LED passing through the finger and thus
detected by the Photodiode will also vary.
● Arduino UNO: The Arduino Uno is a microcontroller board based
on a removable, dual-inline-package (DIP) ATmega328 AVR
microcontroller. It has 20 digital input/output pins (of which 6 can
be used as PWM outputs and 6 can be used as analog inputs). The
Arduino Uno is programmed using the Arduino Software (IDE),
our Integrated Development Environment common to all our
boards and running both online and offline.
● Virtual terminal: Virtual Terminal is a tool in Proteus, which is
used to view data coming from Serial Port (DB9) and also used to
send the data to Serial Port.
● Oscilloscope: It is the waveform analyzer.Oscilloscope is basically
used to monitor signals or waveforms.

CODE:
#define USE_ARDUINO_INTERRUPTS true
// Set-up low-level interrupts for most acurate BPM math.
#include <PulseSensorPlayground.h>
// Includes the PulseSensorPlayground Library.

// Variables
const int PulseWire = 0;
// PulseSensor PURPLE WIRE connected to ANALOG PIN 0
const int LED13 = 13;

// The on-board Arduino LED, close to PIN 13. int Threshold =


550;
// Determine which Signal to "count as a beat" and which to ignore.
// Use the "Gettting Started Project" to fine-tune
Threshold Value beyond default setting.
// Otherwise leave the default "550" value.

PulseSensorPlayground pulseSensor; // Creates an instance of the


PulseSensorPlayground object called "pulseSensor"

void setup() {

Serial.begin(9600);
// For Serial Monitor

// Configure the PulseSensor object, by assigning our


variables to it. pulseSensor.analogInput(PulseWire);
pulseSensor.blinkOnPulse(LED13);
//auto-magically blink Arduino's LED with heartbeat.
pulseSensor.setThreshold(Threshold);

// Double-check the "pulseSensor" object was created and


"began" seeing a signal.

if (pulseSensor.begin()) {
Serial.println("We created a Heart/PulseSensor Object for our project !");
//This prints one time at Arduino power-up, or on Arduino reset.
}
}

void loop() {

int myBPM = pulseSensor.getBeatsPerMinute(); // Calls function


on our pulseSensor object that returns BPM as an "int".
// "myBPM" hold this BPM value now.

if (pulseSensor.sawStartOfBeat()) {
// Constantly test to see if "a beat happened".
Serial.println("A HeartBeat Happened ! "); // If test is "true", print a
message "a heartbeat happened".
Serial.print("BPM: ");
// Print phrase "BPM: "
Serial.println(myBPM);
// Print the value inside of myBPM.
}

delay(20);
// considered best practice in a simple sketch.

}
WORKING:

Heartbeat Sensor is an electronic device that is used to measure the


heart rate. Monitoring body temperature, heart rate and blood pressure
are the basic things that we do in order to keep us healthy. To measure
the body temperature, we use thermometers and a sphygmomanometer
to monitor the Arterial Pressure or Blood Pressure.
Heart Rate can be monitored in two ways: one way is to manually check
the pulse either at wrists or neck and the other way is to use 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.
For ease we have displayed the signals of the heat bit sensed on the
oscilloscope. Waveforms generated are plotted as analog signals, giving us
a brief about the health of that person. Arbitrary digital values are shown in
the minitor to track the health of the patient.

This is a brief of what we have plotted on the virtual terminal in


proteus simulation→
1. Displays user's live and changing BPM, Beats Per Minute, in
Arduino's native Serial Monitor.
2. Print: " A Heartbeat Happened!" when a beat is detected, live.
3. Learn about using a Pulse Sensor Library "Object".
4. Blinks LED on PIN 13 with user's Heartbeat.
OUTPUT:
CONCLUSION:
Hence, we have designed a simple physiological parameters monitor
which calculates the heart rate and pulse of a person. Thus, since our
Proteus simulation is running, it proves the fact that our circuit is thus
valid and suitable for any hardware prototype working model which
may help people and can give an alternate device as a solution to
monitoring their health on a daily basis.

APPLICATION:
​ A simple project involving Arduino UNO 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.
​ In this covid scenario outside, the physiological parameters
related to heart are important to ponder upon and they need to be
checked on an everyday basis. So, our project is easy to operate
by anyone and can give the readings of BPM and pulse of a
person.

REFERENCES:
https://www.electronicshub.org/heartbeat-sensor-using-
arduino-heart-rate-
monitor/#:~:text=First%2C%20in%20order%20to%20disp
lay,LCD%20(contrast%20adjust%20pin).

​ https://www.engineersgarage.com/electronic-
projects/arduino-based-heartbeat-and-body-temperature
- monitoring-iot-device/


You might also like