Heartbeat Sensor Using Arduino Pratik1
Heartbeat Sensor Using Arduino Pratik1
Acknowledgement
We are very happy to express our sincere thanks to the Head of Dept. of ECE Dr. Haradhan Chel for allowing
us in proceeding with the report for Seminar on TOUCH SCREEN TECHNOLOGY.
We express our profound gratitude and indebtedness to Mr. Dr. Agile Mathew, Department of Electronics and
Communication Engineering, CITK. Address for introducing this topic and for his intellectual support, valuable
suggestion, esteemed guidelines and constant insight overview throughout the Seminar.
We would like to acknowledge the educational resources that we actually have got from CIT Kokrajhar.
ABSTRACT
Heartbeat Sensor is an electronic device that is used to measure the heart rate, i.e. speed of the heartbeat.
Monitoring body temperature, heart rate and blood pressure are the basic things that we do in order to keep us
healthy. In order 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.
CONTENTS
CHAPTER-1
Introduction
1.1 Defining Arduino Uno
1.2 History
1.3 Hardware
1.4 Different Types of Arduino Boards
1.5 Feature of Arduino Boards
1.6 Arduino Uno
1.7 Lily Pad Arduino Board
1.8 Arduino Mega (R3) Board
1.9 Arduino Leonardo Board
1.10 LM358 IC
1.11 Pin Configuration of LM358 IC
1.12 Features of LM358 IC
CHAPTER-2
2.1 Principle of Heartbeat Sensor
2.2 Architecture of Project
CHAPTER-3
Components Required
Cost Table
3.1 Arduino UNO x 1
3.2 16 x 2 LCD Display x 1
3.3 10KΩ Potentiometer
3.4 Heartbeat Sensor Module with Probe (finger Based)
3.5 Mini Breadboard
3.6 Connecting Wires
CHAPTER-4
Working of Heartbeat Sensor
4.1 Circuit Design of Interfacing Heartbeat Sensor with Arduino
4.2 Finger Measuring Heartbeat Module
4.3 Working of the circuit
CHAPTER-5
Code
CHAPTER-6
Applications of Heart Rate Monitor using Arduino
CHAPTER-7
Conclusion
CHAPTER-8
References
CHAPTER-1
Introduction to Heartbeat Sensor
Digital pins: 14 (These pins have only 2 states i.e. high or low or in simple
words either 5 V or 0 V no in between values. These pins are mostly used to
sense the voltage presence when switch is open or close)
Analog pins: 6 (A0 to A5 and they come up with a resolution of 10 bits and they
provide flexibility of connecting any external device via these pins. These pins are
configured from 0 V to 5 V but they can be configured to high range by using AREF
pin or analog Reference () function. ADC (analog to digital convertor) is used to
sample these pins. These pins take analog signal and by using ADC convertor they
convert this analog signal to number between 0 – 1023)
Out of 14 digital pins, 6 can be used for PWM (pulse width modulation)
USB port
Arduino board designs use a variety of microprocessors and controllers. The boards
are equipped with sets of digital and analog input/output (I/O) pins that may be
interfaced to various expansion boards ('shields') or breadboards (For prototyping)
and other circuits. The boards feature serial communications interfaces, including
Universal Serial Bus (USB) on some models, which are also used for loading
programs from personal computers. The microcontrollers can be programmed using C
and C++ programming languages. In addition to using traditional compiler toolchains,
the Arduino project provides an integrated development environment (IDE) based on
the Processing language project.
The Arduino project started in 2005 as a program for students at the Interaction
Design Institute Ivrea in Ivrea, Italy, aiming to provide a low-cost and easy way for
novices and professionals to create devices that interact with their environment using
sensors and actuators. Common examples of such devices intended for beginner
hobbyists include simple robots, thermostats and motion detectors.
The name Arduino comes from a bar in Ivrea, Italy, where some of the founders
of the project used to meet. The bar was named after Arduino of Ivrea, who was
the margrave of the March of Ivrea and King of Italy from 1002 to 1014.
1.2 History:
The Arduino project was started at the Interaction Design Institute Ivrea (IDII) in Ivrea, Italy.
At that time, the students used a BASIC Stamp microcontroller at a cost of $50, a
considerable expense for many students. In 2003 Hernando Barragan created the
development platform wiring as a Master's thesis project at IDII, under the supervision of
Massimo Banzi and Casey Reas. Casey Reas is known for co-creating, with Ben Fry, the
Processing development platform. The project goal was to create simple, low cost tools for
creating digital projects by non- engineers. The Wiring platform consisted of a printed circuit
board (PCB) with an ATmega168 microcontroller, an IDE based on Processing and library
functions to easily program the microcontroller
In 2005, Massimo Banzi, with David Mellis, another IDII student, and David Cuartielles,
addedsupport for the cheaper ATmega8 microcontroller to Wiring. But instead of continuing
the work on Wiring, they forked the project and renamed it Arduino
The initial Arduino core team consisted of Massimo Banzi, David Cuartielles, Tom Igoe,
Gianluca Martino, and David Mellis, but Barragán was not invited to participate
Following the completion of the Wiring platform, lighter and less expensive versions were
distributed in the open-source community
It was estimated in mid-2011 that over 300,000 official Arduinos had been commercially
produced, and in 2013 that 700,000 official boards were in users' hands.
In October 2016, Federico Musto, Arduino's former CEO, secured a 50% ownership of the
company. In April 2017, Wired reported that Musto had "fabricated his academic record. On
his company's website, personal LinkedIn accounts, and even on Italian business documents,
Musto was until recently listed as holding a PhD from the Massachusetts Institute of
Technology. In some cases, his biography also claimed an MBA from New York University."
Wired reported that neither university had any record of Musto's attendance, and Musto later
admitted in an interview with Wired that he had never earned those degrees.
Around that same time, Massimo Banzi announced that the Arduino Foundation would be "a
new beginning for Arduino. But a year later, the Foundation still hasn't been established, and
the state of the project remains unclear.
The controversy surrounding Musto continued when, in July 2017, he reportedly pulled many
Open source licenses, schematics, and code from the Arduino website, prompting scrutiny
and outcry.
In October 2017, Arduino announced its partnership with ARM Holdings (ARM). The
announcement said, in part, "ARM recognized independence as a core value of Arduino
without any lock-in with the ARM architecture.” Arduino intends to continue to work with all
technology vendors and architectures.
1.3 Hardware:
Arduino is open-source hardware. The hardware reference designs are distributed under a
Creative Commons Attribution Share-Alike 2.5 license and are available on the Arduino
website. Layout and production files for some versions of the hardware are also available.
Although the hardware and software designs are freely available under copyleft licenses, the
developers have requested the name Arduino to be exclusive to the official product and not
be used for derived works without permission. The official policy document on use of the
Arduino name emphasizes that the project is open to incorporating work by others into the
official product. Several Arduino-compatible products commercially released have avoided
the project name by using various names ending in – duino
The Arduino board exposes most of the microcontroller's I/O pins for use by other circuits.
The Diecimila, Duemilanove, and current Uno[ provide 14 digital I/O pins, six of which can
produce pulse-width modulated signals, and six analog inputs, which can also be used as six
digital I/O pins. These pins are on the top of the board, via female 0.1-inch (2.54 mm)
headers. Several plug-in application shields are also commercially available. The Arduino
Nano, and Arduino-compatible Bare Bones Board and Boarduino boards may provide male
header pins on the underside of the board that can plug into solderless breadboards.
Many Arduino-compatible and Arduino-derived boards exist. Some are functionally
equivalent to an Arduino and can be used interchangeably. Many enhance the basic Arduino
by adding output drivers, often for use in school-level education, to simplify making buggies
and small robots. Others are electrically equivalent, but change the form factor, sometimes
retaining compatibility with shields, sometimes not. Some variants use different processors,
of varying compatibility.
Arduino Uno
Arduino due
Arduino Leonardo
2KB SRAM,
Arduino Uno 16Mhz ATmega328 14 6 input, 0 output
32KB flash
The Uno is a huge option for your initial Arduino. It consists of 14-digital I/O pins, where 6-
pins can be used as PWM (pulse width modulation outputs), 6-analog inputs, a reset button, a
power jack, a USB connection and more. It includes everything required to hold up the
microcontroller; simply attach it to a PC with the help of a USB cable and give the supply to
get started with a AC-to-DC adapter or battery.
The Lily Pad Arduino board is a wearable e-textile technology expanded by Leah
“Buechley” and considerately designed by “Leah and SparkFun”. Each board was
imaginatively designed with huge connecting pads & a smooth back to let them to be sewn
into clothing using conductive thread. This Arduino also comprises of I/O, power, and also
sensor boards which are built especially for e-textiles. These are even washable.
The Arduino Mega is similar to the UNO’s big brother. It includes lots of digital I/O pins
(fromthat, 14-pins can be used as PWM o/ps), 6-analog inputs, a reset button, a power jack, a
USB connection and a reset button. It includes everything required to hold up the
microcontroller; simply attach it to a PC with the help of a USB cable and give the supply to
get started with a AC-to-DC adapter or battery. The huge number of pins makes this Arduino
board very helpful for designing the projects that need a bunch of digital i/ps or o/ps like lots
buttons.
The first development board of an Arduino is the Leonardo board. This board uses one
microcontroller along with the USB. That means, it can be very simple and cheap also.
Because this board handles USB directly, program libraries are obtainable which let the
Arduino board to follow a keyboard of the computer, mouse, etc.
1.10 LM358 IC :
The LM358 IC is a great, low power and easy to use dual channel op-amp IC. It is designed
and introduced by national semiconductor. It consists of two internally frequency
compensated, high gain, independent op-amps. This IC is designed for specially to operate
from a single power supply over a wide range of voltages. The LM358 IC is available in a
chip sized package and applications of this op amp include conventional op-amp circuits, DC
gain blocks and transducer amplifiers. LM358 IC is a good, standard operational amplifier
and it is suitable for your needs. It can handle 3-32V DC supply & source up to 20mA per
channel. This op-amp isapt, if you want to operate two separate op-amps for a single power
supply. It’s available in an8-pin DIP package
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 more easy 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.
CHAPTER-2
Usually, the source of light in a heartbeat sensor would be an IR LED and the detector would
be any Photo Detector like a Photo Diode, an LDR (Light Dependent Resistor) or a Photo
Transistor.
With these two i.e. a light source and a detector, we can arrange them 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.
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.
Heart beat sensor module’s output pin is directly connected to pin 8 of arduino.
Vcc andGND 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 connectedto pin 6 of arduino with
respect to ground.
CHAPTER-3
Components Required
Arduino UNO x 1
16 x 2 LCD Display x 1
10KΩ Potentiometer
330Ω Resistor (Optional – for LCD backlight)
Push Button
Heartbeat Sensor Module with Probe (finger based)
Mini Breadboard
Connecting Wires
Cost Table:-
Arduino Uno (1) Rs - 1,440
The 14 digital input/output pins can be used as input or output pins by using pin
Mode, digital Read and digital Write functions in Arduino programming. Each pin
operates at 5V and can provide or receive a maximum of 40mA current and has an
internal pull-up resistor of 20- 50 K Ohms which are disconnected by default. Out
of these 14 pins, some pins have specific functions as listed below:
Serial Pins 0 (Rx) and 1 (Tx): Rx and Tx pins are used to receive and transmit TTL serial
data. They are connected with the corresponding ATmega328P USB to TTL serial chip.
External Interrupt Pins 2 and 3: These pins can be configured to trigger an interrupt on a
low value, a rising or falling edge, or a change in value.
PWM Pins 3, 5, 6, 9 and 11: These pins provide an 8-bit PWM output by using analog write
function.
SPI Pins 10 (SS), 11 (MOSI), 12 (MISO) and 13 (SCK): These pins are used for SPI
communication.
In-built LED Pin 13: This pin is connected with a built-in LED, when pin 13 is HIGH –
LED is on and when pin 13 is LOW, it’s off.
Along with 14 Digital pins, there are 6 analog input pins, each of which provides 10 bits of
resolution, i.e. 1024 different values. They measure from 0 to 5 volts, but this limit can be
increased by using AREF pin with analog Reference () function.
Analog pin 4 (SDA) and pin 5 (SCA) also used for TWI communication using Wire
library. Arduino Uno has a couple of other pins as explained below:
AREF: Used to provide reference voltage for analog inputs with analog Reference function.
Reset Pin: Making this pin LOW, resets the microcontroller.
The measuring instrument called a potentiometer is essentially a voltage divider used for
measuring electric potential (voltage); the component is an implementation of the same
principle, hence its name.
Potentiometers are commonly used to control electrical devices such as volume controls on
audio equipment. Potentiometers operated by a mechanism can be used as position
transducers, for example, in a joystick. Potentiometers are rarely used to directly control
significant power (more than a watt), since the power dissipated in the potentiometer would be
comparable to thepower in the controlled load.
A heart rate monitor (HRM) is a personal monitoring device that allows one to
measure/display heart rate in real time or record the heart rate for later study. It is largely
used to gather heart rate data while performing various types of physical exercise. Measuring
electrical heart information is referred to as Electrocardiography (ECG or EKG).
Medical heart rate monitoring used in hospitals is usually wired and usually multiple sensors
are used. Portable medical units are referred to as a Holter monitor. Consumer heart rate
monitors are designed for everyday use and do not use wires to connect.
Jumper wires are simply wires that have connector pins at each end, allowing them tobe used
to connect two points to each other without soldering. Jumper wires are typically used with
breadboards and other prototyping tools in order to make it easy to change a circuitas needed.
CHAPTER-4
A simple Heartbeat Sensor consists of a sensor and a control circuit. The sensorpart of the
Heartbeat Sensor consists of an IR LED and a Photo Diode placed in a clip.
The Control Circuit consists of an Op-Amp IC and few other components that help in
connecting the signal to a Microcontroller. The working of the Heartbeat Sensor can be
understood better if we take a look at its circuit diagram.
The above circuit shows the finger type heartbeat sensor, which works by detecting thepulses.
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 Photo Diode will also vary.
The output of the photo diode is given to the non – inverting input of the first op – amp
through a capacitor, which blocks the DC Components of the signal. The first op – amp cats
as a non– inverting amplifier with an amplification factor of 1001.
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.
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:
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 subtract 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, dividing 600000 ms by single pulse time.
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.
The circuit design of Arduino based Heart rate monitor system using Heart beat Sensor is
very simple. First, in order to display the heartbeat readings in bpm, we have to connect a
16×2 LCD Display to the Arduino UNO.
The 4 data pins of the LCD Module (D4, D5, D6 and D7) are connected to Pins 1, 1, 1 and 1
of the Arduino UNO. Also, a 10KΩ Potentiometer is connected to Pin 3 of LCD (contrast
adjust pin). The RS and E (Pins 3 and 5) of the LCD are connected to Pins 1 and 1 of the
Arduino UNO.
Next, connect the output of the Heartbeat Sensor Module to the Analog Input Pin (Pin 1) of
Arduino.
This project uses bright infrared (IR) LED and a phototransistor to detect the pulse ofthe
finger, a red LED flashes with each pulse. Pulse monitor works as follows: The LED is the
light side of the finger, and phototransistor on the other side of the finger, phototransistor
usedto obtain the flux emitted, when the blood pressure pulse by the finger when the
resistance of the photo transistor will be slightly changed. The project's schematic circuit as
shown, we chose a very high resistance resistor R1, because most of the light through the
finger is absorbed,it is desirable that the phototransistor is sensitive enough. Resistance can
be selected by experiment to get the best results. The most important is to keep the shield
stray light into the phototransistor. For home lighting that is particularly important because
the lights at home mostly based 50HZ or 60HZ fluctuate, so faint heartbeat will add
considerable noise.
When running the program the measured values are printed. To get a real heartbeat from this
could be challenging.
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 value.
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
CHAPTER-5
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;
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);
}
CHAPTER-6
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.
CHAPTER-7
CONCLUSION
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.
CHAPTER-8
References:-
https://www.electronicshub.org/heartbeat-sensor-using-arduino-heart-rate-
monitor/#Applications_of_Heart_Rate_Monitor_using_Arduino
https://www.youtube.com/watch?v=_J7pyL_3-AI