Heart Rate Monitoring Ir Sensor
Heart Rate Monitoring Ir Sensor
maintenance of patient health have enabled the evolution of fields such as monitoring
systems. Heart rate is a very vital health parameter that is directly related to the
soundness of the human cardiovascular system. Heart rate is the number of times the
heart beats per minute, reflects different physiological conditions such as biological
workload, stress at work and concentration on tasks, drowsiness and the active state of
the autonomic nervous system. It can be measured either by the ECG waveform or by
sensing the pulse - the rhythmic expansion and contraction of an artery as blood is
forced through it by the regular contractions of the heart. The pulse can be felt from
those areas where the artery is close to the skin. This paper describes a technique of
measuring the heart rate through a fingertip and Arduino. It is based on the principal
of photophelthysmography (PPG) which is non-invasive method of measuring the
variation in blood volume in tissue using a light source and detector. While the heart is
beating, it is actually pumping blood throughout the body, and that makes the blood
volume inside the finger artery to change too. This fluctuation of blood can be
detected through an optical sensing mechanism placed around the fingertip. The signal
can be amplified and is sent to arduino with the help of serial port communication.
With the help of processing software heart rate monitoring and counting is performed.
The sensor unit consists of an infrared light-emitting-diode (IR LED) and a photo
diode. The IR LED transmits an infrared light into the fingertip, a part of which is
reflected back from the blood inside the finger arteries. The photo diode senses the
portion of the light that is reflected back. The intensity of reflected light depends upon
the blood volume inside the fingertip. So, every time the heart beats the amount of
reflected infrared light changes, which can be detected by the photo diode. With a high
gain amplifier, this little alteration in the amplitude of the reflected light can be
converted into a pulse.
INTRODUCTION A heart rate monitor is a personal monitoring device that allows a
subject to measure their heart rate in realtime or record their heart rate for later study.
Early models consisted of a monitoring box with a set of electrode leads that attached
to the chest. The heart rate of a healthy adult at rest is around 72 beats per minute
(bpm) & Babies at around 120 bpm, while older children have heart rates at around 90
bpm. The heart rate rises gradually during exercises and returns slowly to the rest
value after exercise [2]. The rate when the pulse returns to normal is an indication of
the fitness of the person. Lower than normal heart rates are usually an indication of a
condition known as bradycardia, while higher is known as tachycardia. Heart rate is
simply measured by placing the thumb over the subject’s arterial pulsation, and
feeling, timing and counting the pulses usually in a 30 second period. Heart rate (bpm)
of the subject is then found by multiplying the obtained number by 2. This method
although simple, is not accurate and can give errors when the rate is high. More
sophisticated methods to measure the heart rate utilize electronic techniques. Electro-
cardiogram (ECG) is one of frequently used method for measuring the heart rate. But
it is an expensive device. Low-cost devices in the form of wrist watches are also
available for the instantaneous measurement of the heart rate. Such devices can give
accurate measurements but their cost is usually in excess of several hundred dollars,
making them uneconomical. So this heart rate monitor with a temperature sensor is
definitely a useful instrument in knowing the pulse and the temperature of the subject
or the patient.
The heart acts as a pump that circulates oxygen and nutrient carrying blood around the
body in order to keep it functioning. When the body is exerted the rate at which the
heart beats will vary proportional to the amount of effort being exerted. By detecting
the voltage created by the beating of the heart, its rate can be easily observed and used
for a number of health purposes. Heart pounds to pump oxygen-rich blood to your
muscles and to carry cell waste products away from your muscles. The heart rate gives
a good indication during exercise routines of how effective that routine is improving
your health.
Electrical Method The chest strap of a heart rate monitor uses electrodes to monitor
the electric volts that occur when your heart beats. The receiver detects this
information from the electrodes via radio signal from the chest strap. The receiver,
then, uses this information to determine your heart rate. Some monitors also include a
"coded signal" which uses a special code in the radio signal, so that the receiver does
not receive radio signals from other nearby transmitters. This is not always a huge
problem, but can be annoying or corrupt your data. This method has several
disadvantages like inaccurate results hectic wired connections over the body etc .
Optical Method Optical technique exploits the fact that tiny subcutaneous blood
vessels (capillaries) in any patch of skin (fingertip, ear lobe, etc.) furnished with a
good blood supply, alternately expand and contract in time with the heartbeat. An
ordinary infrared LED/phototransistor pair can sense this rhythmic change as small
but detectable variations in skin contrast. This method uses both transmittance and
reflectance principles. It is a noninvasive method of finding heart rate i.e. no
attachments or insertions on the body. It is precise and cost effective.
Circuit Description The full circuit has been constructed in three steps: external
biasing circuit, first stage signal conditioning circuit, and second stage signal
conditioning circuit [3]. In this paper the circuit has been integrated with an Arduino
board and processing software.
Signal Conditioning Circuit The reflected IR signal detected by the photo diode is fed
to a signal conditioning circuit that filters the unwanted signals and boost the desired
pulse signal. The circuit diagrams below shows the IR LED (D1) and the photo diode
(D2) along with the signal conditioning circuit made of two stage operational
amplifiers configured as active low pass filters. The cut-off frequencies of both the
filters are set to about 2.5 Hz, and so it can measure the pulse rate up to 2.5*60 = 150
bpm. The gain of each filter is about 100, which gives the total 2-stage amplification
of 10000. This is good enough to convert the weak pulsating signal into a TTL pulse.
Note that at the input of each OpAmp filter stage, there is a 1 uF capacitor to block
any DC component in the signal. At the output is connected a LED that will blink with
heart beat. The output of the sensor is sent to arduino port for monitoring and counting
purpose.
Fig1. Circuit diagram of sensor
An infrared sensor is an electronic device, that emits in order to sense some aspects of
the surroundings. An IR sensor can measure the heat of an object as well as detects the
motion.These types of sensors measures only infrared radiation, rather than emitting it
that is called as a passive IR sensor. Usually in the infrared spectrum, all the objects
radiate some form of thermal radiations. These types of radiations are invisible to our
eyes, that can be detected by an infrared sensor.The emitter is simply an IR LED
(Light Emitting Diode) and the detector is simply an IR photodiode which is sensitive
to IR light of the same wavelength as that emitted by the IR LED. When IR light falls
on the photodiode, The resistances and these output voltages, change in proportion to
the magnitude of the IR light received.
IR Sensor
IR Sensor Circuit Diagram and Working Principle
An infrared sensor circuit is one of the basic and popular sensor module in
an electronic device. This sensor is analogous to human’s visionary senses, which can
be used to detect obstacles and it is one of the common applications in real time.This
circuit comprises of the following components
o Variable resistors.
IR Sensor Circuit
In this project, the transmitter section includes an IR sensor, which transmits
continuous IR rays to be received by an IR receiver module. An IR output terminal of
the receiver varies depending upon its receiving of IR rays. Since this variation cannot
be analyzed as such, therefore this output can be fed to a comparator circuit. Here
anoperational amplifier (op-amp) of LM 339 is used as comparator circuit.
When the IR receiver does not receive a signal, the potential at the inverting input
goes higher than that non-inverting input of the comparator IC (LM339). Thus the
output of the comparator goes low, but the LED does not glow. When the IR receiver
module receives signal to the potential at the inverting input goes low. Thus the output
of the comparator (LM 339) goes high and the LED starts glowing. Resistor R1
(100 ), R2 (10k ) and R3 (330) are used to ensure that minimum 10 mA current passes
through the IR LED Devices like Photodiode and normal LEDs respectively. Resistor
VR2 (preset=5k ) is used to adjust the output terminals. Resistor VR1 (preset=10k ) is
used to set the sensitivity of the circuit Diagram. Read more about IR sensors.
IR Sensor Applications
IR sensors are used in various Sensor based projects and also in various electronic
devices which measures the temperature that are discussed in the below.
Radiation Thermometers
IR sensors are used in radiation thermometers to measure the temperature depend
upon the temperature and the material of the object and these thermometers have some
of the following features
o Faster response
Flame Monitors
These types of devices are used for detecting the light emitted from the flames and to
monitor how the flames are burning. The Light emitted from flames extend from UV
to IR region types. PbS, PbSe, Two-color detector, pyro electric detector are some of
the commonly employed detector used in flame monitors.
Moisture Analyzers
Moisture analyzers use wavelengths which are absorbed by the moisture in the IR
region. Objects are irradiated with light having these wavelengths(1.1 µm, 1.4 µm, 1.9
µm, and 2.7µm) and also with reference wavelengths. The Lights reflected from the
objects depend upon the moisture content and is detected by analyzer to measure
moisture (ratio of reflected light at these wavelengths to the reflected light at reference
wavelength). In GaAs PIN photodiodes, Pbs photoconductive detectors are employed
in moisture analyzer circuits.
Gas Analyzers
IR sensors are used in gas analyzers which use absorption characteristics of gases in
the IR region. Two types of methods are used to measure the density of gas such as
dispersive and non dispersive.
IR Imaging Devices
IR image device is one of the major applications of IR waves, primarily by virtue of
its property that is not visible. It is used for thermal imagers, night vision devices, etc.
For examples Water, rocks, soil, vegetation, an atmosphere, and human tissue all
features emit IR radiation. The Thermal infrared detectors measure these radiations in
IR range and map the spatial temperature distributions of the object/area on an image.
Thermal imagers usually composed of a Sb (indium antimonite), Gd Hg (mercury-
doped germanium), Hg Cd Te (mercury-cadmium-telluride) sensors.
Working:
4.1 PIC16F877AMICROCONTROLLER:
PIC stands for Peripheral Interface Controller. It encodes and decodes
the data. It has flash memory so we can rewrite up to 100,000 times. It is a 28
pin DIP package. The architecture of the PIC is HARVARD. It has three ports
for the input/output operation. The analog signal can be directly given to the
PIC hence there is no need for external analog to digital converter.
PERIPHERAL FEATURES
Timer0: 8 bit timer/counter with 8 bit prescaler.
Timer1: 16 bit timer/counter with prescaler can be incremented during
sleep.
Timer2: 8 bit timer/counter with 8 bit period register, prescaler and
postscaler.
10 bit multi channel Analog to Converter.
USART with 9 bit address detection.
ADVANTAGES
Very low power consumption.
Flash memory (rewrite up to 100,000 times).
Easily writable.
Easily changeable.
Easily debuggable.
Low cost.
Good availability of parts.
FEATURES
Operate from Single +5V Power Supply (+5V and +12V)
Low-Power Receive Mode in Shutdown (MAX232/MAX242)
Meet All EIA/TIA-232E and V.28 Specifications
Multiple Drivers and Receivers
3-State Driver and Receiver Outputs
1 2 3 4 5
6 7 8 9
DCE READY
REQUEST TO SEND CLEAR RING INDICATOR
TO SEND
Pin
Number Name Use
1 Vss Ground
2 Vdd Power
3 Vee To adjust the contrast
1=Data input
4 RS 0=Instruction input
1=Read from LCD
5 R/W 0=Write to LCD
6 Enable (EN) From 1 to 0 = Data is written to the LCD
7 DB0 Data Bus Lines
8 DB1
9 DB2
10 DB3
11 DB4
12 DB5
13 DB6
14 DB7
15 LED+
16 LED- Backlight
The LCD can work in two modes, 4-bit and 8-bit. In this tutorial, we have used the 4-
bit mode which uses only 4 data lines, thus saving pins of the microcontroller.
LCD Connections
Connect pin1 of LCD to ground and pin2 to Vdd.
Pin3 of LCD is used to adjust the contrast of the display. Leave it unconnected.
RS (pin4) of LCD is connected to RB2 of PORTB. It distinguishes between
data input and command input.
RW (pin5) is grounded, since we have to write the data on LCD.
E (pin6) is connected to RB3 of PORTB. It is a control line to inform the LCD
that data has been sent.
D0-D3 of the LCD are grounded, since we are using a 4-bit mode. D4-D7 are
connected to the PORTB pins (RB4-RB7) of the controller.
APPLICATIONS
Programmed LCDs are vastly used for industrial as well as commercial
applications. LCDs are used in UPSs or inverters, where voltage and current readings
are displayed on the screen. Instructions to be followed are displayed on an LCD
screen in airports, banks, hospitals etc.
Counting the PPG Signal The PC application first reads 600 consecutive samples sent
by Arduino. Since the sampling rate was 5ms, it takes 3 sec to read the 6000 samples.
The DC component (minima of 600 samples) is subtracted out from the samples.
Next, the range of the samples is computed. If the range is less than 50 counts, the
received PPG waveform is very weak, and is considered to be a noise. This could
happen when no PPG signal is detected through fingertip (sensor is faulty or
disconnected) or the gain of the amplifier on Easy Pulse board is set very low. The
gain can be increased through potentiometer P1 on the Easy Pulse board. If the range
of ADC samples is greater than 50, it is considered as a valid PPG signal and is
displayed on the PC screen. The samples are scaled to 1-1023 for full swing of
display. Next, a 21-point moving average filter is applied to remove the unnecessary
high frequency components (usually noise) in the PPG signal. The resulting samples
are plotted against time to obtain a clean and smooth PPG waveform. Note that we
lose 10 samples at the beginning and 10 samples at the end while applying the moving
average filter. The heart beat rate can be computed by knowing the time period of the
PPG waveform. For this, we identify three consecutive peaks in the waveform based
on where the slope of the curve changes from positive to negative, and the magnitude
of the signal is greater than 80% of the maxima of all the samples. Since two
consecutive samples are 5ms apart, time difference between any two peaks can be
easily computed from their indices (or sequence numbers). Two heart rates are
computed from the three consecutive PPG peaks and their average value is displayed
as an instantaneous heart rate. The identified peaks are also marked on the display
with a cross (X) symbol (see the PPG waveform plotted by the PC application on the
computer screen) .
Reflective photoplethysmography
Counting pulse in BPM
Introduction
In the example project we will look at the development and simulation of a complete
program using FED PIC C. Purchasers of WIZ C are recommended to run through the
tutorial of that program before running this example for which the Application
Designer should be disabled (once the project has been opened use the Project | Use
Application Designer menu option to turn it off). The program we will look at is
designed for a 16F84 processor (although in practice any 18 pin PIC could be used
with the same program), and is intended as a simple serial to parallel converter utility.
Note that if a PIC which does not have PORTB pull ups is used then Port B pins must
be pulled up with an external resistor array (Nearly all PIC’s have this capability). Port
A bit 2 is the received data bit,
Port A bit 3 is the transmitted data bit. The commands that will be accepted on the link
will be:
A This character forces the PIC to send a K character back on the serial link to
confirm that the PIC is present.
W This character is followed by another byte, the second byte is written to Port B as
an output, whilst bit 1 of Port A is set low and then high again as a clock signal.
R This forces the PIC to read Port B, whilst it strobes Port A, bit 0 low.
In either event a K character is sent back on the serial interface. If any other character
is received then an F character is sent back on the link.
To open the new project then use the Project | Open/New Project menu item (on the
professional version this will be Open/New Project Group). A File dialog box will be
brought up. Create a new directory by using the small icon of a folder with a star in
the right hand corner. Call the directory
Initially this project consists of one C file. Use File | New to create a blank file, now
use File | Save As to select a file name. This will bring up a file open dialog box. No
files will be present so enter the filename “SToP” and click on OK.
Select the project window which has the title StoP and will be blank and press the
insert key. This will bring up a file open dialog box. One file "STop.C" will be present
so select this file and click on OK. A dialog box will now appear with this file name
and a number of options, we can define files as being C files, or as a comment file. In
this case the file is used for compilation, so make sure that the file type C is selected
and click OK.
Double click the file to open it, now enter the following code to start the program:
//
//
void main(void)
This code includes the header file for the PIC16F84, and the header file which
includes the definitions for the serial interface routines. It also initialises Port A to be
all outputs except for bit 2 which is an input used for serial receive data.
Now finish the project by entering the following code (alternatively clear the edit
window by selecting all the text and press delete, and then use File | Insert to enter
the file "STop.C" which is in the home directory for FED PIC C).
//
#include <pic.h>
#include <datalib.h>
//
// Functions
//
void main(void);
void ReadPort(void);
void WritePort(void);
void main(void)
{
char rx;
while(1)
grx=rx=pSerialIn();
pSerialOut('F');
//
//
void ReadPort(void)
char tx;
//
//
void WritePort(void)
{
char rx;
Note that this program contains an error. Save it using the file menu, save option.
Compile it again and this time the error will be shown in the error window. Double
click the error and the edit window will be moved to show the line with the error -
SerialOut(tx) should read pSerialOut. Put the cursor on the word SerialOut and press
Control and F1, the help file will be bought up at the right entry for both functions.
You can see here that we are trying to use the pSerialOut function, the help file also
explains the need for the constants defined at the top of the file to tell the serial
routines which port and bits to be used. Correct the error and compile again, this time
the program will compile successfully and will be assembled into a hex file ready for
debugging.
We also now have an assembly language file which has been assembled into PIC Hex
code for programming into a real device.
Initial simulation
Now we need to show the debugging window. Press ALT+D. This will rearrange the
windows to show the debugging window. Note that you can edit and assemble quite
happily in this view, its just that for initial work the edit view (press ALT+E) gives
more screen to the editor.
When the program is first assembled the program counter is reset and the edit window
will show the initial word of the program in the first C file. Now we can test program
operation for the first few lines.Press F7 which executes each line of the program
within the C file. The program should have set PORT A to output 1's on all pins except
for the receive serial data pin. However Port A will still hold thevalue 1F hex so we
cannot tell by looking at the debugging window.
To check add the TRIS A register (TRISA) to the variables window. Use the Simulate
| Watch | Add Watch menu option (which has the same effect as pressing the insert
key in the variables window). Click on the browse button and select the TRISA line
from the list box, and click on the >> button.
Press the OK button to add this file variable to the list. You may want to adjust the
width of the fields in the debugging window, do this by selecting and dragging the
headers in the window. Check that TRISA holds the value 4.
Professional Version
If the professional version is in use there is another option on the Debug Watch dialog
box which allows the variable to be examined by using the C definition. This option
(“Use C Definition”) is set by default and allows the debugger to decompose
structures and arrays when displaying their contents.
[2] Souvik Das “The Development of a Microcontroller Based Low Cost Heart Rate
Counter for Health Care Systems” International Journal of Engineering Trends and
Technology- Volume4Issue2- 2013.
[3] Embedded Lab. Introducing Easy Pulse: A DIY photoplethysmographic sensor for
measuring heart rate. http://embedded-lab.com/blog/?p=5508, 2012.
[7] Nazmus Saquib, Md. Tarikul Islam Papon, Ishtiyaque Ahmad, and Ashikur
Rahman “Measurement of Heart Rate Using Photoplethysmography” .
[8] Embedded Lab. PC-based heart rate monitor using Arduino and Easy Pulse sensor.
http://embeddedlab.com/blog/?p=7485, 2013.
[9] R. Raj and S.J. Jothi. Estimation of Heart Rate from Photoplethysmographic
Signal Using SVR Method. The International Journal of Science & Technoledge,
Volume 2, Issue 2, 2014.
[10] Hashem et al., ―Design and Development of a Heart Rate Measuring Device
using Fingertip‖, IEEE International Conference on Computer and Communication
Engineering (ICCCE), ISBN: 978-1- 4244-6235-3, 2010.