HEARTBEAT SENSOR USING ARDUINO
Acknowledgement
A number of individuals have contributed to the completion of this Project Report on
“Heartbeat Sensor Using Arduino” We gratefully acknowledge the contribution of each one
of them. We would like to express my sincere thanks to our guide Prof.Dive N.A. Department
of Electronics & telecommunication, RGCOE, who has given his valuable time and guidance
during the preparation of this project work, without which this success was imposable. This
project report provides us with an opportunity to put into knowledge of advance technology.
We feel Pleasure in thanking Prof.Auti P.D. Head of Department of Electronics &telecommini
cation, RGCOE, for rendering all the necessary facilities during the work on this Project.
Lastly we would like to express my gratitude to all those who helped us directly and
indirectly to complete this project work
Department TE E &TC Engineering, RGCOE,
1
HEARTBEAT SENSOR USING ARDUINO
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.
Department TE E &TC Engineering, RGCOE,
2
HEARTBEAT SENSOR USING ARDUINO
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
Department TE E &TC Engineering, RGCOE,
3
HEARTBEAT SENSOR USING ARDUINO
CHAPTER-1
Introduction to Heartbeat Sensor
1.1 Defining Arduino Uno:
An Arduino is actually a microcontroller based kit which can be either used
directly by purchasing from the vendor or can be made at home using the
components, owing to its open source hardware feature. It is basically used in
communications and in controlling or operating many devices.
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)
16 MHz crystal oscillator
Out of 14 digital pins, 6 can be used for PWM (pulse width modulation)
USB port
TX and RX pins (for serial communication)
Arduino is an open-source hardware and software company, project and
user community that designs and manufactures single-board
microcontrollers and microcontroller kits for building digital devices. Its
products are licensed under the GNU Lesser General Public License
(LGPL) or the GNU General Public License (GPL), permitting the
manufacture of Arduino boards and software distribution by anyone.
Department TE E &TC Engineering, RGCOE,
4
HEARTBEAT SENSOR USING ARDUINO
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.
Department TE E &TC Engineering, RGCOE,
5
HEARTBEAT SENSOR USING ARDUINO
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.
Department TE E &TC Engineering, RGCOE,
6
HEARTBEAT SENSOR USING ARDUINO
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
Most Arduino boards consist of an Atmel 8-bit AVR microcontroller (ATmega8,
ATmega168, ATmega328, ATmega1280, or ATmega2560) with varying
amounts of flash memory, pins, and features. The 32-bit Arduino Due, based on
the Atmel SAM3X8E was introduced in 2012. The boards use single or double-
row pins or female headers that facilitate connections for programming and
incorporation into other circuits. These may connect with add-on modules termed
shields. Multiple and possibly stacked shields may be individually addressable
via an I²C serial bus. Most boards include a 5 V linear regulator and a 16 MHz
crystal oscillator or ceramic resonator. Some designs, such as the Lily Pad, run at
8 MHz and dispense with the onboard voltage regulator due to specific form-
factor restrictions.
Arduino microcontrollers are pre-programmed with a boot loader that simplifies
uploading of programs to the on-chip flash memory. The default bootloader of
the Arduino Uno is the Optiboot bootloader. Boards are loaded with program
code via a serial connection to another computer. Some serial Arduino boards
contain a level shifter circuit to convert between RS232 logic levels and
transistor–transistor logic (TTL) level signals. Current Arduino boards are
programmed via Universal Serial Bus (USB), implemented using USB-to-serial
adapter chips such as the FTDI FT232.
Some boards, such as later-model Uno boards, substitute the FTDI chip with a
separate AVR chip containing USB-to-serial firmware, which is reprogrammable
via its own ICSP header. Other variants, such as the Arduino Mini and the
unofficial Boarduino, use a detachable USBto-serial adapter board or cable,
Bluetooth or other methods.
When used with traditional microcontroller tools, instead of the Arduino IDE,
standard AVR in-system programming (ISP) programming is used
Department TE E &TC Engineering, RGCOE,
7
HEARTBEAT SENSOR USING ARDUINO
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.
1.4 Different Types of Arduino Boards
Arduino Uno
Arduino due
Arduino Mega (R3)
Arduino Leonardo
Department TE E &TC Engineering, RGCOE,
8
HEARTBEAT SENSOR USING ARDUINO
1.5 Features of Arduino Boards
Arduino Board Processor Memory Digital I/O Analogue I/O
2KB SRAM,
Arduino Uno 16Mhz ATmega328 14 6 input, 0 output
32KB flash
84MHz 96KB SRAM, 12 input, 2
Arduino Due 54
AT91SAM3X8E 512KB flash output
8KB SRAM, 16 input, 0
Arduino Mega 16MHz ATmega2560 54
256KB flash output
Arduino Leonardo 2.5KB SRAM, 12 input, 0
16MHz ATmega32u4 20
32KB flash output
Department TE E &TC Engineering, RGCOE,
9
HEARTBEAT SENSOR USING ARDUINO
1.6 Arduino Uno
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.
Department TE E &TC Engineering, RGCOE,
10
HEARTBEAT SENSOR USING ARDUINO
1.7 Lily Pad Arduino Board
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.
1.8 Arduino Mega (R3) Board
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.
Department TE E &TC Engineering, RGCOE,
11
HEARTBEAT SENSOR USING ARDUINO
1.9 Arduino Leonardo Board
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.
Department TE E &TC Engineering, RGCOE,
12
HEARTBEAT SENSOR USING ARDUINO
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
Department TE E &TC Engineering, RGCOE,
13
HEARTBEAT SENSOR USING ARDUINO
1.11 Pin Configuration of LM358 IC
The pin diagram of LM358 IC comprises of
8 pins, where Pin-1 and Pin-8 are o/p of the
comparator
Pin-2 and Pin-6 are inverting i/ps
Pin-3 and Pin-5 are non
inverting i/ps Pin-4 is
GND terminal
Pin-8 is VCC+
1.12 Features of LM358 IC
The features of the LM358 IC are
It consists of two op-amps internally and frequency compensated for unity gain
The large voltage gain is 100 dB
Wide bandwidth is 1MHz
Range of wide power supplies includes single and dual power supplies
Range of Single power supply is from 3V to 32V
Range of dual power supplies is from + or -1.5V to + or -16V
The supply current drain is
very low, i.e., 500 μA
2mV low i/p offset voltage
Department TE E &TC Engineering, RGCOE,
14
HEARTBEAT SENSOR USING ARDUINO
Common mode i/p voltage range comprises ground
The power supply voltage and differential i/p voltages are similaro/p
voltage swing is large.
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.
Department TE E &TC Engineering, RGCOE,
15
HEARTBEAT SENSOR USING ARDUINO
CHAPTER-2
2.1 Principle of Heartbeat Sensor
The principle behind the working of the Heartbeat Sensor is
Photoplethysmograph.According to this principle, the change in the volume of
blood in an organ is measured by thechanges in the intensity of the light passing
through that organ.
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.
Department TE E &TC Engineering, RGCOE,
16
HEARTBEAT SENSOR USING ARDUINO
2.2 Architecture of Project
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.
Department TE E &TC Engineering, RGCOE,
17
HEARTBEAT SENSOR USING ARDUINO
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
16 x 2 LCD Display (1) Rs - 270
10KΩ Potentiometer (1) Rs - 10
330Ω Resistor Rs – 5 (Approx)
(Optional – for LCD backlight)
Push Button (1) Rs – 50
Heartbeat Sensor Module with Probe (finger Rs - 880
based) (1)
Mini Breadboard (1) Rs - 70
Connecting Wires Rs - 120
TOTAL Rs – 2,845 (approx)
Department TE E &TC Engineering, RGCOE,
18
HEARTBEAT SENSOR USING ARDUINO
3.1 Arduino UNO x 1
Defining Arduino: An Arduino is actually a microcontroller-based kit which can
be either used directly by purchasing from the vendor or can be made at home
using the components, owing to its open source hardware feature. It is basically
used in communications and in controlling or operating many devices.
How to use Arduino Board?
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.
Department TE E &TC Engineering, RGCOE,
19
HEARTBEAT SENSOR USING ARDUINO
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.
How to program on arduino:
The Arduino tool window consists of the toolbar with the buttons like verify,
upload, new, open, save, serial monitor. It also consists of a text editor to write
the code, a message area which displays the feedback like showing the errors, the
text console which displays the output and a series of menus like the File, Edit,
Tools menu. Thus, the code is uploaded by the bootloader onto the
microcontroller
3.2 16 x 2 LCD Display x 1
Department TE E &TC Engineering, RGCOE,
20
HEARTBEAT SENSOR USING ARDUINO
A liquid-crystal display (LCD) is a flat-panel display or other electronically
modulated optical device that uses the light-modulating properties of liquid
crystals combined with polarizers. Liquid crystals do not emit light
directly, instead using a backlight or reflector to produce images in color or
monochrome. LCDs are available to display arbitrary images (as in a general-
purpose computer display) or fixed images with low information content, which
can be displayed or hidden, such as preset words, digits, and seven- segment
displays, as in a digital clock. They use the same basic technology, except that
arbitrary images are made from a matrix of small pixels, while other displays
have larger elements. LCDs can either be normally on (positive) or off (negative),
depending on the polarizer arrangement. For example, a character positive LCD
with a backlight will have black lettering on a background that is the color of the
backlight, and a character negative LCD will have a black background with the
letters being of the same color as the backlight. Optical filters are added to white
on blue LCDs to give them their characteristic appearance.
3.3 10KΩ Potentiometer
A potentiometer is a three-terminal resistor with a sliding or rotating contact that
forms an adjustable voltage divider. If only two terminals are used, one end and
the wiper, it acts as a variable resistor or rheostat.
The measuring instrument called a potentiometer is essentially a voltage divider
used for measuring electric potential (voltage); the component is an
Department TE E &TC Engineering, RGCOE,
21
HEARTBEAT SENSOR USING ARDUINO
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.
3.4 Heartbeat Sensor Module with Probe (finger based)
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.
Department TE E &TC Engineering, RGCOE,
22
HEARTBEAT SENSOR USING ARDUINO
3.5 Mini Breadboard
3.6 Connecting Wires
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
Department TE E &TC Engineering, RGCOE,
23
HEARTBEAT SENSOR USING ARDUINO
CHAPTER-4
Working of Heartbeat Sensor
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.
Department TE E &TC Engineering, RGCOE,
24
HEARTBEAT SENSOR USING 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:
Five pulse time=time2-time1;
Single pulse time= Five pulse 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
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.
Rate= 600000/single pulse time.
Department TE E &TC Engineering, RGCOE,
25
HEARTBEAT SENSOR USING ARDUINO
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.
4.1 Circuit Design of Interfacing Heartbeat Sensor with Arduino
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.
Department TE E &TC Engineering, RGCOE,
26
HEARTBEAT SENSOR USING ARDUINO
4.2 Finger measuring heartbeat module
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.
4.3 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
Department TE E &TC Engineering, RGCOE,
27
HEARTBEAT SENSOR USING ARDUINO
(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
Department TE E &TC Engineering, RGCOE,
28
HEARTBEAT SENSOR USING ARDUINO
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;
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);
Department TE E &TC Engineering, RGCOE,
29
HEARTBEAT SENSOR USING ARDUINO
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=milli s();
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);
Department TE E &TC Engineering, RGCOE,
30
HEARTBEAT SENSOR USING ARDUINO
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);
}
Department TE E &TC Engineering, RGCOE,
31
HEARTBEAT SENSOR USING ARDUINO
CHAPTER-6
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.
Department TE E &TC Engineering, RGCOE,
32
HEARTBEAT SENSOR USING ARDUINO
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.
Department TE E &TC Engineering, RGCOE,
33
HEARTBEAT SENSOR USING ARDUINO
CHAPTER-8
References:-
https://www.electronicshub.org/heartbeat-sensor-using-
arduino-heart-rate-
monitor/#Applications_of_Heart_Rate_Monitor_using_Ardu
ino
https://www.youtube.com/watch?v=_J7pyL_3-AI
Department TE E &TC Engineering, RGCOE,
34