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

Microcontroller Based Heart Beat and Temperature

Monitoring System using Fingertip Sensor

University of Wah

RESURCH BY
MOMIN KHAN UW-09-MTS-BE-023

EMAIL: [email protected] Skype engr-afridi


www.linkedin.com/in/engineermominkhan

Supervised By
Ms. Fadia Sohail

Department of Mechatronics Engineering WAH ENGINEERING COLLEGE


WAH CANTT – PAKISTAN
(2013)
RESURCH ON:

Microcontroller Based Heart Beat and


Temperature Monitoring System using
Fingertip Sensor
Acknowledgements
There are many people who helped us directly or indirectly in the successful completion of our
project. We would like to take this opportunity to thank one and all.

First of all we would like to express our deep sense of gratitude towards our project supervise
Ms. FADIA SOHAIL for always being available whenever we require her guidance as well as
for motivating us throughout the project work.

I would also like to thank Mr. WASEEM SHAHZAD our teacher ,for his guidance and
encouragement to work hard.We have found him very helpful while discussing and optimization
issues in this dissertation work. His critical comments on our work have certainly made to think
of new ideas and techniques.

We are also grateful to the Dr. ASIM FAROOQI, (Head of Dept. of MTS) for his valuable
guidance during our project. We would like to express our deep gratitude towards our teaching
and non-teaching stafff and giving their valuable suggestions and co operation for our project.
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

Abstract
The basic idea behind this project is that anyone can stay connected with the doctor 24 hrs. It
continuously provides following information to doctors.
 ➢ Heart pulse rate
➢ Temperature of human body

In this way doctor take action immediate action if necessary. The normal body temperature of a
healthy human is 98c. To sense the temperature and heart beat the sensor is connected to the
finger tip of patient. Moreover an indication is send to doctor when pulse rate start fluctuation
just below per above the normal pulse rate which is 72 pulse/mint. The project presents the
design and implementation of a micro controller based heart beat and temperature monitoring
system using finger tip sensor.

2
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

Table of Contents
CHAPTER 1: INTRODUCTION 7
1.1 Introduction 8
1.2 Objective 8
1.3 Scope of work 9
CHAPTER 2: CIRCUIT DISCRIPTION 10
2.1 Fingertip Sensors 11
2.2 Photodiode 11
2.3 Fingertip Sensors Working 12
2.4 Temperature Sensor 13
2.5 General Description Of LM358 14
2.6 Hardware Details 15
CHAPTER 3:8-BITMICROCONTROLLER WITH 8K BYTE 17
3.1 Overview 18
3.2 Description of AT89S52 18
3.3 Advantages 19
3.4 Features 19
3.5 Pin Description 21
3.6 Memory and SFRs 23
3.7 Design Tool/Language 26
3.8 Simulation of Project 27
3.9 Matrix Keypad 28
CHAPTER 4: LCD and BUZZER 31
4.1 Introduction 32
4.2 LCD Diagram 32
4.3 LCD Interference With Microcontroller 34
4.4 Diagram 35

3
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

4.5 Features 36
4.6 Advantages 36
4.7 Disadvantages 37
4.8 Buzzer 37
CHAPTER 5: GSM MODEM 38
5.1 Introduction 39
5.2 Purpose using GSM Modem 39
5.3 Need of use of GSM Modem 40
5.4 Block Diagram GSM Based Medi-kit System 41
5.5 Description of Block Diagram 41
5.6 Features of GSM 42
5.7 Advantages 42
5.8 Disadvantages 42
5.9 Application 42
5.10 Prototype Diagram 43
CHAPTER 6: SUMMARY AND CONCLUSION 44
6.1 Summary 45

6.2 Conclusion 45
6.3 Future Aspects 46
REFERENCES 47

4
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

List of Figures

Fig 2.1: Fingertip Sensor 12


Fig 2.2: Fingertip Sensor Circuit 13
Fig 2.3: Temperature Sensors 13
Fig 2.4: Dual Differential Amplifier 15
Fig 2.5: Flow Diagram 16
Fig 3.1: Microcontroller AT89S52 18
Fig 3.2: 40 Pin on the 8051 Chip 20
Fig 3.3: XTAL Connection to 8051 23
Fig 3.4: Simulation of Project 27
Fig 3.5: Matrix keypad 28
Fig 3.6: Columns selected 29
Fig 3.7: Short Circuit 29
Fig 3.8: 4x4 matrix keypad 30
Fig 4.1: 20x4 Character LCD 32
Fig 4.2: LCD Controllers Pins 32
Fig 4.3: Simulation Diagram 34
Fig4.4: LCD Display 36
Fig 4.5: Buzzer 37
Fig 5.1: GSM Modem 39
Fig 5.2: MEDI-KET 41
Fig 5.3: Prototype Diagram 43

5
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

List of Table

Table 3.1: Timer/Counter Control Register 24


Table 3.2: Interrupt Priority Register 25
Table 3.3: Special Purpose Register 25
Table 3.4: Timer Mode Register 26
Table 4.1: Pins Description 33

6
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

CHAPTER 1

INTRODUCTION

7
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

1.1 Introduction
Heart rate measurement demonstrates a technique to measure the heart rate by sensing the
change in blood volume in a finger artery while the heart is pumping the blood. It consists of an
infrared LED that transmits an IR signal through the fingertip of the subject, a part of which is
reflected by the blood cells. The reflected signal is detected by a photo diode sensor. The
changing blood volume with heartbeat results in a train of pulses at the output of the photo diode,
the magnitude of which is too small to be detected directly by a microcontroller. Therefore, a
two-stage high gain, active low pass filter is designed using two Operational Amplifiers
(OpAmps) to filter and amplify the signal to appropriate voltage level so that the pulses can be
counted by a microcontroller. The heart rate is displayed on LCD. The microcontroller used in
this project is 8051.Heart rate is the number of heartbeats per unit of time, typically expressed as
beats per minute (bpm). Heart rate can vary as the body's need to absorb oxygen and excrete
carbon dioxide changes during exercise or sleep. However, there is need that patients should able
to measure the heart rate in the home environment as well. A heart rate monitor (HRM) is a
simple device that takes a sample of the heartbeat signal and computes the bpm so that the
information can easily be used to track heart conditions. The HRM devices employ electrical and
optical methods as means of detecting and acquiring heart signals.Temperature of the body is
also a very important factor in this project we use the technique to measure the temperature of a
body.Heart rate is the number of heartbeats per unit of time and is usually expressed in beats per
minute (bpm). In adults, a normal heart beats about 60 to 100 times a minute during resting
condition. The resting heart rate is directly related to the health and fitness of a person and hence
is important to know. You can measure heart rate at any spot on the body where you can feel a
pulse with your fingers. The most common places are finger. You can count the number of
pulses within a certain interval (say 15 sec), and easily determine the heart rate in bpm.This
project describes a microcontroller based heart rate measurement system that uses optical sensors
to measure the alteration in blood volume at fingertip with each heartbeat. The sensor unit
consists of an infrared light-emitting-diode (IR LED) and a photodiode, The IR diode transmits
an infrared light into the fingertip (placed over the sensor unit), and the photodiode senses the
portion of the light that is reflected back. The intensity of reflected light depends upon the blood
volume inside the fingertip. So, each heart beat slightly alters the amount of reflected infrared
light that can be detected by the photodiode. With a proper signal conditioning, this little change
in the amplitude of the reflected light can be converted into a pulse. The pulses can be later
counted by the microcontroller to determine the heart rate.

1.3 Objective
Biomedical field serves as the benefit for human society. But in today’s rashly running world
people are becoming careless about their health.Cases of heart attacks treatment and recovery are
increasingresulting several deaths. For this purpose personal medi-kits are best solution.Few
years ago, there was joint family system hence patients were able to get medical help within
time. But nowadays one may lost his life because of not getting proper help within time. For
such heart patients this kit gives indication to their doctors and they immediately get medical
help.Whenever beat rate of person exceeds more than 72 pulse/min, doctor can get immediate
indication and help will be sent as fast as can. Cardiovascular diseases are often very critical and

8
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

serious condition, the change is so rapid, the one attack can bring about great suffering to
patients, and even lead to syncope or sudden death.Especially coronary heart disease,
cardiomyopathy, and arrhythmia history, family history of sudden cardiac death, heart
transplantation and other medical conditions. The diseases has a sudden, random, high rate
characteristics of sudden death, usually after the acute onset of symptoms within 1 hour may
cause death and malignant ventricular fibrillation within 12.Heart related disorders resulting
from lack of coronary circulation, such as a heart attack, have been and likely will continue to be
the most common cause of death in the today environment. An estimated 3-4 million people
suffer from heart attack per year. Approximately half of heart attacks are silent meaning they are
not felt by the patients. Half of the patients who sustain heart attacks die prior to arrival to
hospitals. The present innovation, therefore relates to early detection and long term monitoring
of heart related disorders.

1.4 Scope of the Work


Long waiting time for hospitalization or ambulatory patient monitoring/treatment, are other well-
known issues for both the healthcare institutions and the patients. This project provides
healthcare authorities to maximize the quality and breadth of healthcare services by controlling
costs. As the population increases and demand for services increases, the ability to maintain the
quality and availability of care, while effectively managing financial and human resources, is
achieved by this project. The use of modern communication technology in this context is the sole
decisive factor that makes such communication system successful.

9
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

CHAPTER 2

CIRCUIT DISCRIPTION

10
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

2.1 Fingertip Sensors


1.Infrared(IR) Diode (IR 333/HO/L10)
2. Photo Diode (L14G1)

2.1.1 Explanation of the sensors


The sensor consists of an IR light emitting diode transmitterand an IR photo detector acting as
the receiver. The IR lightpasses through the tissues. Variations in the volume of blood within the
finger modulate the amount of light incident on theIR detector.The finger can be placed between
theTransmitter and the receiver.The IR filter of the phototransistor reduces interference from the
mains 50Hz noise. The IR LED is forward biased through a resistor to create a current flow. The
values of resistors are chosen so that they produce the maximum amount of light output. The
photo-resistor isplaced in series with the resistor to reduce the current drawnby the detection
system and to prevent short-circuiting thepower supply when no light is detected by the photo
resister.

2.1.2 Features of IR Diode


 ➢ 
High reliability
 ➢ 
High radiant intensity
 ➢ 
Peak wavelength λp=940nm
 ➢ 
2.54mm Lead spacing
 ➢ 
Low forward voltage
 ➢ 
Pb free
➢ 
The product itself will remain within RoHS compliant version

2.1.3 Applications
 ➢ 
Free air transmission system.
 ➢ 
Infrared remote control units with high power requirement.
 ➢ 
Smoke detector.
➢ 
Infrared applied system.

2.2 Photo Diode


➢ 
L14G1

11
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

Fig 2.1: Fingertip Sensors

2.2.1 Introduction
Photodiodes are applicable for light detection in the wavelength range from 1000 nm to 2600 nm
and beyond on request. With their large diameter (1, 2, or 3 mm), they are specially designed for
environmental measurements or other analytical instruments.

2.2.2 Key Features



 Wavelength range from 1000 nm to 2600 nm.

 Photosensitive area 1, 2 or 3 mm in diameter.

 Hermetically sealed package.

Narrow reception angle.

2.2.3 Application Areas



 High performance gas sensing.

 Process and environmental control.

Analytical instruments.

2.3 Fingertip Sensors Working


Heart beat is sensed by using a high intensity type LED and LDR. The finger is placed between
the LED and LDR. As Sensor a photo diode or a photo transistor can be used. The skin may be
illuminated with visible (red) using transmitted or reflected light for detection. The very small
changes in reflectivity or in transmittance caused by the varying blood content of human tissue
are almost invisible. Various noise sources may produce disturbance signals with amplitudes
equal or even higher than the amplitude of the pulse signal. Valid pulse measurement therefore
requires extensive preprocessing of the raw signal.The setup described here uses a red LED for
transmitted light illumination and a LDR as detector. With only slight changes in the
preamplifier circuit the same hardware and software could be used with other illumination and

12
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

detection concepts. The detectors photo current is converted to voltage and amplified by an
operational amplifier (LM358N).

Fig 2.2: Fingertip Sensor Circuit

2.4 Temperature sensor


LM35sensor

2.4.1 Explanation
The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is
linearly proportional to the Celsius (Centigrade) temperature. The LM35 thus has an advantage
over linear temperature sensors calibrated in ° Kelvin, as the user is not required to subtract a
large constant voltage from its output to obtain convenient Centigrade scaling. The LM35 does
not require any external calibration or trimming to provide typical accuracies of ±1⁄4°C at room
temperature and ±3⁄4°C over a full −55 to +150°C temperature range. It can be used with single
power supplies, or with plus and minus supplies. As it draws only 60 μA from its supply.

Fig 2.3: Temperature Sensor

2.4.2 Features

 Calibrated directly in ° Celsius (Centigrade).

 Linear + 10.0 mV/°C scale factor.

0.5°C accuracy guarantee-able (at +25°C).

13
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor


 Rated for full −55° to +150°C range.

 Suitable for remote applications.

 Low cost due to wafer-level trimming.

 Operates from 4 to 30 volts.
➢ 
 Less than 60 μA current drain.
➢ 
Low self-heating, 0.08°C in still air.

2.4.3 Amplification and Filtration


Low Power Dual Operational Amplifiers (Lm358N)

2.5.0 General Description of LM358


The LM358 series consists of two independent, high gains, internallyfrequency compensated
operational amplifiers which were designed specifically to operate from a single power supply
over a wide range of voltages. Operation from split power supplies is also possible and the low
power supply current drain is independent of the magnitude of the power

supply voltage.Application areas include transducer amplifiers, dc gainblocks and all the
conventional op amp circuits which nowcan be more easily implemented in single power supply
systems.

2.5.1 Unique Characteristics


In the linear mode the input common-mode voltagerange includes ground and the output voltage
can alsoswing to ground, even though operated from only asingle power supply voltage. The
unity gain cross frequency is temperaturecompensated.
The input bias current is also temperature compensated.

2.5.2 Advantages

 Two internally compensated op amps.

 Eliminates need for dual supplies.

 Allows direct sensing near GND and VOUT also goes to GND.

 Compatible with all forms of logic.

 Power drain suitable for battery operation.

Pin-out same as LM1558/LM1458 dual op amp.

2.5.3 Features

 Internally frequency compensated for unity gain

 Large dc voltage gain: 100 dB

 Wide bandwidth (unity gain): 1 MHz (temperature compensated)

 Low input offset voltage: 2 mV

 Differential input voltage range equal to the powersupply voltage

Large output voltage swing: 0V to 1.5V

14
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

2.5.4 LM358 Diagram

Fig 2.4: Dual Differential Amplifier

2.5.5 Low-pass Filter

A low-pass filter is an electronic filter that passes low-frequencysignals and attenuates (reduces
the amplitude of) signals with frequencies higher than the cut-off frequency. The actual amount
of attenuation for each frequency varies from filter to filter. It is sometimes called a high-
cutfilter, or treble cut filter when used in audio applications. A low-pass filter is the opposite of a
high-pass filter. A band-pass filter is a combination of a low-pass and a high-pass.

Low-pass filters exist in many different forms, including electronic circuits (such as a hiss filter
used in audio), anti-aliasing filters for conditioning signals prior to analog-to-digital conversion,
digital filters for smoothing sets of data, acoustic barriers, blurring of images, and so on. The
moving averageoperation used in fields such as finance is a particular kind of low-pass filter, and
can be analysed with the same signal processingtechniques as are used for other low-pass filters.
Low-pass filters provide a smoother form of a signal, removing the short-term fluctuations, and
leaving the longer-term trend.

An optical filter could correctly be called low-pass, but conventionally is described as "longpass"
(low frequency is long wavelength), to avoid confusion.

2.6 Hardware Details


Hardware used in the Project as follows:
1. Microcontroller-89s52
2. LCD Display
3. Keypad

15
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

4. LM358
5. Photo Transistor
6. IR Emitter and Detector
7. LED
8. LM35
9. Regulators
10. Transistors
11. Resistors
12. Capacitors
13. Battery
14. Buzzer
15. Diodes

2.7 Flow Diagram

Fig 2.5: Flow Diagram

16
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

CHAPTER 3

8-BIT MICROCONTROLLER WITH 8K BYTES

17
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

3.1 Overview
The Intel 8051 is a very popular general purpose microcontroller widely used for small scale
embedded systems. The 8051 is an 8-bit microcontroller with 8 bit data bus and 16-bit address
bus. The 16 bit address bus can address a 64K( 216) byte code memory space and a separate 64K
byte of data memory space.

Fig 3.1: Microcontroller(AT89S52)

3.2 Description of AT89S52


The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of
in-system programmable Flash memory. The device is manufactured using Atmel’s high-density
nonvolatile memory technology and is compatible with the industry-standard 80C51 instruction
set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or
by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-
system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful
microcontroller which provides a highly-flexible and cost-effective solution to many embedded
control applications.

The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM,
32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector two-
level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In
addition, the AT89S52 is designed with static logic for operation down to zero frequency and
supports two software selectable power saving modes. The Idle Mode stops the CPU while
allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The
Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip
functions until the next interrupt or hardware reset.

18
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

3.3 Advantages
The main advantages of 89s52 over 8051 are

 Software Compatibility

 Program Compatibility

Rewritability

3.4 Features

 8K Bytes of In-System Programmable (ISP) Flash Memory

 4.0V to 5.5V Operating Range

 Fully Static Operation: 0 Hz to 33 MHz

 Three-level Program Memory Lock

 256 x 8-bit Internal RAM

 32 Programmable I/O Lines

 Three 16-bit Timer/Counters

Full Duplex UART Serial Channel

19
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

3.5 40 Pins on the 8051

Fig 3.2: 40 Pins on the 8051

20
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

3.6 Pin Description


Most of these pins are used to connect to I/O devices or external data and code memory.4 I/O
port take 32 pins(4 x 8 bits) plus a pair of XTALS pins for crystal clock.A pair of Vcc and GND
pins for power supply (the 8051 chip needs +5V 500mA to function properly) A pair of timer
pins for timing controls, a group of pins (EA, ALE, PSEN, WR, RD) for internal and external
data and code memory access controls.
The 8051 has four I/O ports

Port 0 (pins 32-39):P0(P0.0~P0.7)


Port 1(pins 1-8:P1(P1.0~P1.7)
Port 2(pins 21-28):P2(P2.0~P2.7)
Port 3(pins 10-17):P3(P3.0~P3.7)

Each port has 8 pins

Named P0.X (X=0,1,...,7), P1.X, P2.X, P3.X


Ex:P0.0 is the bit 0(LSB)of P0
Ex:P0.7 is the bit 7(MSB)of P0
These 8 bits form a byte.
Each port can be used as input or output (bi-direction).
Vcc(pin 40)
Vcc provides supply voltage to the chip.
The voltage source is +5V.
GND(pin 20)
Ground

3.6.1 PORT 0
Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink eight
TTL inputs. When 1s are written to port 0 pins, the pins can be used as highimpedanceinputs.
Port 0 can also be configured to be the multiplexed loworderaddress/data bus during accesses to
external program and data memory. In this mode, P0 has internalpullups .Port 0 also receives the
code bytes during Flash programmingand outputs the code bytes during program
verification.Externalpullups are required during program verification.

3.6.2 PORT 1
Port 1 is an 8-bit bidirectional I/O port with internal pullups. The Port 1 output buffers can
sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the
internal pullups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled
low will source current (IIL) because of the internal pullups. In addition, P1.0 and P1.1 can be
configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2

21
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

Trigger input (P1.1/T2EX), respectively, as shown in the following table. Port 1 also receives the
low-order address bytes during Flash programming and verification.

3.6.3 PORT 2
Port 2 is an 8-bit bidirectional I/O port with internal pullups. The Port 2 output buffers can
sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the
internal pullups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled
low will source current (IIL) because of the internal pullups. Port 2 emits the high-order address
byte during fetches from external program memory and during accesses toexternal data memory
that use 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal
pullupswhen emitting 1s. During accesses to external datamemory that use 8-bit addresses
(MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2 also
receives the high-order address bits and some control signals during Flash programming and
verification.

3.6.4 PORT 3
Port 3 is an 8-bit bidirectional I/O port with internal pullups. The Port 3 output buffers can
sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the
internal pullups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled
low will source current (IIL) because of the pullups. Port 3 also serves the functions of various
special features of the AT89S52, as shown in the following table. Port 3 also receives some
control signals for Flash programming and verification.

XTAL1 and XTAL2(pins 19,18)

XTAL1
Input to the inverting oscillator amplifier and input to the
Internal clock operating circuit.
XTAL2
Output from the inverting oscillator amplifier.
XTAL Connection to 8051
Using a quartz crystal oscillator we can observe the frequency on the XTAL2 pin.

22
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

Fig 3.3: Quartz Crystal Oscillator

RST(pin 9):reset

It is an input pin and is active high(normallylow).The high pulse must be high at least 2
machine cycles.It is a power-on reset.Upon applying a high pulse to RST, the microcontroller
will reset and all values in registers will be lost.

3.7 Memory and SFR


3.7.1 MEMORY
The 8051 code(program) memory is read-only, while the data memory is read/write accessible.
The program memory( in EPROM) can be rewritten by the special programmer circuit.
The 8051 memory is organized in a Harvard Architecture. Both the code memory space and data
memory space begin at location 0x00 for internal or external memory which is different from the
Princeton Architecture where code and data share same memory space.

3.7.2 Special Function Registers (SFRs)


The SFR is the upper area of addressable memory, from address 0x80 to 0xFF. This area consists
of a series of memory-mapped ports and registers.

All port input and output can therefore be performed by get and set operations on SFR port name
such as P3.Also, different status registers are mapped into the SFR for checking the status of the
8051, and changing some operational parameters of the 8051.All 8051 CPU registers, I/O ports,

23
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

timers and other architecture components are accessible in 8051 C through SFRs There are
following SFRs.
TCON (Timer Control)
TMOD (Timer Mode)
TH0/TH1 and TL0/TL1 (Timer’s high and low bytes)
SCON (Serial port control)
IP (Interrupt Priority)
IE (Interrupt Enable)

3.7.3 Timer/Counter Control Register

bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0


(88H)

TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0

Table 3.1: TCON (Timer/Counter Control Register) SFR for timer control

TF0/TF1: Timer0/1 overflow flag is set when the timer counter overflows, reset by program
TR0/TR1: Timer0/1 run control bit is set to start, reset to stop the timer0/1

IE0/IE1: External interrupt 0/1 edge detected flag1 is set when a falling edge interrupt on the
external port 0/1, reset(cleared) by hardware itself for falling edge transition-activated INT;
Reset by code for low level INT.

Timer 0 and Timer 1 in the AT89S52 operate the same way as Timer 0 and Timer 1 in the
AT89C51 and AT89C52.

Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event counter. The type
of operation is selected by bit C/T2 in the SFR T2CON.Timer 2 has three operating modes:
capture, auto-reload (up or down counting), and baud rate generator. The modes are selected by
bits in T2CON. Timer 2 consists of two 8-bit registers, TH2 and TL2. In the Timer function, the
TL2 register is incremented every machine cycle. Since a machine cycle consists of 12 oscillator
periods, the count rate is 1/12 of the oscillator frequency.

24
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

3.7.4 Interrupt Priority Register

bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0

PT2 PS PT1 PX1 PT0 PX0

Table 3.2: IP ( Interrupt Priority Register) SFR used for IP setting


PX0/1: External interrupt 0/1 priority level
PT0/1/2: Timer0, Timer1, Timer2(8052) interrupt priority level
PS: Serial port interrupt priority level

3.7.5 Special purposes register

bit bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0


7

RD WR T1 T0 INT1 INT0 TxD RxD

Table 3.3: P3( Port 3) SFR used for I/O and other special purposes
Addition to I/O usage, P3 can also be used for:
RXD/TXD: Receive/Transmit serial data for RS232
INT0, INT1: External interrupt port inputs
T0,T1: Alternative Timer 0/1 bit
WR/RD : Write/Read control bits used for external memory

25
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

3.7.6 Timer Mode Register

bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0

Gate C/T M1 M0 Gate C/T M1 M0

Table 3.4: TMOD ( Timer Mode Register)


Gate : When set, timer only runs while INT(0,1) is high.

C/T : Counter/Timer select bit.


M1 : Mode bit 1.
M0 : Mode bit 0.

3.8 Design Tool/Language



Proteous Tools is used for simulation of the Electronics Microcontroller
 Hardware.

 Kiel software is used for programming.

All the programming is done in C language.

26
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

3.9 Simulation of Project

Fig 3.4: Simulation of Project

27
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

3.10 Matrix Keypad


We want to avoid all these troubles so we use some clever technique. The technique is called
multiplexed matrix keypad. In this technique keys are connected in a matrix (row/column) style
as shown below.

Fig 3.5: Matrix Keypad

3.10.1 Matrix Keypad Basic Connection


The rows R0 to R3 are connected to Input lines of Microcontroller. The I/O pins where they are
connected are made Input. The column C0 to C3 are also connected to MCUs I/O line. These are
kept at High Impedance State, as soon as we change their DDR bit to 1 they become output with
value LOW.One by One we make each Column LOW (from high Z state) and read state of R0 to
R3

Column 0 Selected

As you can see in the image above C0 is made LOW while all other Columns are in HIGH Z
State. We can read the Value of R0 to R3 to get their pressed status. If they are high the button is
NOT pressed. As we have enabled internal pullups on them, these pullups keep their value high
when they are floating (that means NOT connected to anything). But when a key is pressed it is
connected to LOW line from the column thus making it LOW.

After that we make the C0 High Z again and make C1 LOW. And read R0 to R3 again. This
gives us status of the second column of keys. Similarly we scan all columns

28
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

Fig 3.6: Column o selected

3.10.2 Short circuit


Lets say we selected column number C0, so we make it LOW(i.e. GND or logic 0), in the same
time we make all other columns high impedance (i.e. input). If we don't make other lines high
impedance (Input) they are in output mode. And in output mode they must be either LOW(GND
or logic 0) or HIGH (5v or logic 1). We can't make other lines LOW as we can select only one
line at a time and C0 is already low as per assumption. So the only other possible state is all
other columns are HIGH. This is shown in figure below. Red color on column indicates high
state while green is for low state.

Fig 3.7: Short Ciruit

29
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

3.10.3 4x4 Matrix Keypad


This 16-button keypad provides a useful human interface component for microcontroller
projects.Convenient adhesive backing provides a simple way to mount the keypad in a variety of
applications.

3.10.4 Keypad Interfacing Microcontroller



Keypad Interface with PORT 1 of Microcontroller16 Button Keypad


Keypad is used for setting the range of upper and lower limit of Heart Beat and
Temperature

3.10.5 Features

 Ultra-thin design.

 Adhesive backing.

 Excellent price/performance ratio.

Easy interface to any microcontroller.

3.10.6 Key Specifications



 Maximum Rating: 24 VDC, 30 mA.

Interface: 8-pin access to 4x4 matrix.

3.10.7 Application Ideas



 Security systems.

 Menu selection.

Data entry for embedded systems.

3.10.8 Diagram

Fig 3.8: 4x4 Keypad

30
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

CHAPTER 4

LCD AND BUZZER

31
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

4.1 Introduction
LCD is the abbreviation of liquid crystal display. LCD is an electronically-modulated optical
device shaped into a thin, flat panel made up of any number of color or monochrome pixels filled
with liquid crystals and arrayed in front of a light source (backlight) or reflector. It is often
utilized in batterypowered electronic devices because it uses very small amounts of electric
power.Aliquid-crystal display (LCD) is a flatpaneldisplay, electronicvisualdisplay, or
videodisplay that uses the light modulating properties of liquid crystals. Liquid crystals do not
emit light directly.LCDs are available to display arbitrary images (as in a general-purpose
computer display) or fixed images which can be displayed or hidden, such as preset words,
digits, and 7-segment displays as in a digital clock. They use the same basic technology, except
that arbitrary images are made up of a large number of small pixels, while other displays have
larger elements.

4.2 LCDDiagram

Fig 4.1: 20 x 4 Character LCD

4.2.1 Pins on LCD

Fig4.2: LCD Controller Pins

32
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

4.2.2 Pins Description

Table 4.1: LCD Pins Description

33
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

4.3 LCD Interfacing with Microcontroller


In figure 4.3 is the connection diagram of LCD in 4-bit mode, where we only need 6 pins to
interface an LCD. D4-D7 are the data pins connection and Enable and Register select are for
LCD control pins. We are not using Read/Write (RW) Pin of the LCD, as we are only writing on
the LCD so we have made it grounded permanently. If you want to use it..then you may connect
it on your controller but that will only increase another pin and does not make any big difference.
Potentiometer RV1 is used to control the LCD contrast. The unwanted data pins of LCD i.e. D0-
D3 are connected to ground.

 PORT 2 is used for LCD

20 Characters by 4 Lines Display

4.3.1 LCD Simmulation Circuit

Fig 4.3: LCD Interfacing with Microcontroller

34
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

4.3.2 4-Bit Mode


There are many reasons why sometime we prefer to use LCD in 4-bit mode instead of 8-bit. One
basic reason is less than number of pins are needed to interface LCD. In 4-bit mode the data is
sent in nibbles, first we send the higher nibble and then the lower nibble. To enable the 4-bit
mode of LCD, we need to follow special sequence of initialization that tells the LCD controller
that user has selected 4-bit mode of operation. We call this special sequence as resetting the
LCD. Following is the reset sequence of LCD.

 Wait for about 20mS

 Send the first init value (0x30)

 Wait for about 10mS

 Send second init value (0x30)

 Wait for about 1mS

 Send third init value (0x30)

 Wait for 1mS

Select bus width (0x30 - for 8-bit and 0x20 for 4-bit)

4.3.3 Sending Data/Command in 4-Bit Mode


We will now look into the common steps to send data/command to LCD when working in 4-bit
mode. As i already explained in 4-bit mode data is sent nibble by nibble, first we send higher
nibble and then lower nibble. This means in both command and data sending function we need to
separate the higher 4-bits and lower 4-bits.

The common steps are:



 Mask lower 4-bits

 Send to the LCD port

 Send enable signal

 Mask higher 4-bits

 Send to LCD port

Send enable signal

35
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

4.4 Project Display LCD

Fig 4.4: Project Display LCD

4.5 Features

 5 X8 and 5X10 dot matrix possible

 4-bit or 8-bit MPU interface enabled

¼ Duty Cycle.

4.6 Advantages
Very compact and light.
Low power consumption.
Very little heat emitted during operation, due to low power consumption.
No geometric distortion.
The possible ability to have little or no flicker depending on backlight technology.
Razor sharp image with no bleeding/smearing when operated at
nativeresolution.
Emits much less undesirable electromagneticradiation than a CRT monitor (in the
extremelylowfrequency range).
Can be made in almost any size or shape.
 No theoretical resolution limit.





36
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

4.7 Disadvantages
➢ Limited viewingangle, causing color, saturation, contrast and brightness to vary, even
within the intended viewing angle, by variations in posture.

Uneven backlighting in some (mostly older) monitors, causing brightness distortion,
especially toward the edges.

Black levels may appear unacceptably bright due to the fact that individual liquid
crystals cannot completely block all light from passing through.

Loss of brightness and much slower response times in low temperature environments.
In sub-zero environments, LCD screens may cease to function without the use of
supplemental heating.

Loss of contrast in high temperature environments.

Not usually designed to allow easy replacement of the backlight.

4.8 Buzzer
A buzzerorbeeperis an audio signaling device, which may be mechanical, electromechanical, or
electronic. Typical uses of buzzers and beepers include alarms, timers and confirmation of user
input such as a mouse click or keystroke. A piezoelectric element may be driven by an
oscillating electronic circuit or other audio signal source. Sounds commonly used to indicate that
a button has been pressed are a click, a ring or a beep. Electronic buzzers find many applications.

Fig4.5: Buzzer

37
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

CHAPTER 5

GSM MODEM

38
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

5.1 Introduction
GSM (Global System for Mobile Communication; originally from Group Special Mobile) is the
most popular standard for mobile telephony systems in the world.

The implemented prototype utilizes a GSM modem. This modem can be operated by the micro-
controller by means of straight forward Hayes (ATA) commands, which follow the ETSI GSM
07.07 standard.

Using those commands, all functionality provided by a GSM terminal (voice, data, SMS) can be
exploited. It is easily available in the market and weighing less than 20gm, which is smaller than
a matchbox, thus allowing system reduction and integration.

A separate module can be demolished; especially suitable for the use of multiple machines at the
same time. It is used to avoid high communication costs to be incurred in a month; it sends in
clusters which can be sent automatically to a large number of goals the same information.

Fig5.1: GSM Modem

5.2 Purpose using GSM


The purpose of this project is to measure the heartbeat and send the heart beat to monitoring
system. Display system is the portable and best replacement for the old model stethoscope,
which is less efficient. It is a combination of high power LED and light detector sensor based
heart rate monitor interfaced with a GSM module to transmit the heart rate of the patient to a
remote location.
Depending upon the rate of circulation of blood, the heart rate per minute is calculated. This
Calculated value is communicated to a doctor through a GSM modem interfaced with it.

39
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

Based on several scenarios we present the functionality of a prototype we are building. The
application is capable of monitoring the health of high risk cardiac patients. The smart phone
application analyses in real-time sensor and environmental data and can automatically alert the
ambulance and pre-assigned caregivers when a heart patient is in danger.

It also transmits sensor data to a healthcare center for remote monitoring by nurse or
cardiologists. The system can be personalized and rehabilitation programs can neither monitor
the progress of a patient. GSM modem is interfaced with the microcontroller with the help of
ATA commands.

5.3 Need of Time of GSM Modem


The monitoring of a patient round the clock, however, is clumsy because of the nature of
equipment. Monitoring of the data generated by a patient throughout the day in a post recovery
mode is not possible because it would otherwise require the patient to simply live in the hospital
or in the adjunct exercise facility. That is not reasonably calculated to restore the patient to
normal living as defined by the life of that patient. The present monitor puts forward a novel
system that benefits from GSM mobile telephony standard widespread technology. This design
adds to the traditional capabilities, the attractive features of real time processing and possibility
of monitoring the patient’s heart anywhere, anytime.

Apart from traditional typical capabilities, the new system presents additional features, both in
automatic analysis and in the communications interface (GSM transmission).

40
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

5.4 Block Diagram with Technical Detail of GSM Based

Fig 5.2: MED KIT

5.5 Description of Block Diagram


Slight fluctuation in the normal heart rate and body temperature will be sensed by the heart
sensor and temperature sensor respectively attached to the index finger. It will forward data to
the microcontroller where it will be compared with the normal value of body temperature and
heart rate. Depending upon the parameters considered by monitor, if it finds any parameter
disturbed then the result is send to the doctor and he may immediately take the necessary action.
Thus without wasting the time patient can be treated whereas sending the report can be done
using GSM .The device will compare the three parameters with the ideal parameters, if some
fluctuations are noticed, the SMS is immediately sent to the doctor. This message may be in the
form of beeps to indicate the doctor. The system comprises an implantable medical device that
includes a sensor operable to produce an electrical signal representative of heart sounds, a sensor
interface circuit coupled to the sensor to produce a hear sound signal, and a controller circuit
coupled to the sensor interface circuit.

The heart sounds are associated with mechanical activity of patient’s heart and the controller
circuit is operable to detect a posture of the patient from a heart sound signal GSM based heart
rate monitoring and the display system is a portable and a best replacement for the old model

41
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

stethoscope, which is less efficient. It is a combination of a HIGH POWER LED based heart rate
monitor interface with a GSM module to transmit the heart rate of patient to a remote location.
The functioning of this device is based on the truth that the blood circulates for every heartbeat
that can be sensed by LED. Depending upon the rate of circulation of blood the heart beat per
minute is calculated. This calculated value is communicated to the person through a GSM
modem interfaced to it.

5.6 Feature of GSM



 Maximum transmission speed of 9.6 Kbps

 Coverage of 98% of the territory

 SMS of around 150 characters

 Cheap and are easily available

Support tri band mobile phones, a feature available with very few modules.

5.7 Advantages

 It is a small, low cost and a portable device which can be carried easily.

 Provides continuous monitoring.

 The mobility in the monitoring process is continuous.

 Low power consumption by means Ni-Cd batteries.
.

5.8 Disadvantages

 Using this for long durations could lead to soreness and chafing of the skin.

A sudden failure of network may hamper the working of the system.

5.9 Applications

We can also observe the ECG report of a patient on the cell phone with the help of this
system.By programming the GSM module with proper commands, the doctor as well as
the family members will be informed simultaneously about the fluctuations in patient’s
 condition.

We canalso observe the ECG report of a patient on the cell phone with the help of this
 system.

 For keeping track of cardiac system of an athlete to give him proper training.

In defence areas, where the remote location of a soldier can be determined.

42
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

5.10 Prototype Diagram

Fig 5.3: Prototype Diagram

43
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

CHAPTER 6

SUMMARY AND CONCLUSION

44
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

6.1 Summary
The major building blocks of this project are:

 Fingertip Sensors

 Amplification

 Filtration

 Microcontroller

 Buzzer that beeps along with heartbeat

 GSM Modem

LCD Display
Thus in Implementation of Wireless Systems for Patient Monitoring System, the heart beat and
body temperature are successfully sensed. Temperature is measured using LM35 and Heart beat
is measured using LED,LDR and operational amplifier. Hence both parameters are displayed on
a LCD display. Then both the parameters are transmitted and displayed in a distant location. We
also use the GSM Modem to transmit the heart rate of the patient to a remote location.This
project will eventually reduce man power in the very near future.

6.2 Conclusion
Mechatronics Engineering (MTS) is the application of engineering principles and techniques to
the medical field. It combines the design and problem solving skills of engineering with medical
and biological sciences to improve patients health care and the quality of life of individuals

In our project, the design and development of a low cost Heart Rate Monitoring System has been
presented. The device is portable, durable, and cost effective. The HRM device is efficient and
easy to use. By using Microcontroller and GSM modules we attached the fingertip sensor to
patient and accurately measure the heart rate signal and body temperature. The patient has a
freedom of doing daily activities and still be under continuous monitoring. Tests have shown
excellent agreement with actual heartbeat rates. This device could be used in clinical and
nonclinical environments. It can also be easily used by individual users, e.g. athletes during
sporting activities. The device provide the continuously monitoring of heart rate and
temperature.Wireless intelligent heart beat rate monitoring system have made possible a new
generation of noninvasive, unobtrusive personal medical monitors applicable during abnormal
activities. New technologies could also enhance the performance of the final project.

45
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

6.3 Future Aspects



EEG, ECG and other health parameters can also be monitored.


More than a single patient at different places can be monitored using single system.


The system can be further improved in several aspects. Once the system requirement has
been clearly defined, the hardware can be optimized, especially regarding its size, weight

and consumption.

Together with clinical analyses, the protocols to optimize the system performance should
be established. New technology suchas Bluetooth, GPRS and UMTS could also enhance

the performance of the final product.

The overall efficiency of the device could be improved by the use of Fast Fourier
Transforms.


Furthermore further enhancement is needed and integrate a real time multichannel
mobile telemedicine system capable of simultaneously transmitting medical data such as
Non Invasive Blood Pressure (NIBP) and SpO2 applying Bluetooth and GPRS
technologies could be done, to make the system more flexible.

46
Microcontroller Based Heart Beat and Temperature Monitoring System using Fingertip Sensor

References

1. Introduction of Sensors By Dr. MahmoodGhori(India)

2. A.B. Dande, G.A. Deshmukh, S.D. Deshmukh, P.M. Deshpande International Journal of
Engineering Research and Applications (IJERA) ISSN: 2248-9622 www.ijera.com Vol.
2, Issue 2,Mar-Apr 2012, pp.1322-1330

3. Dogan Ibrahim, KadriBuruncuk,“Hear Rate Measurement from the Finger using a low
cost Microcontroller”

4. M.M. A. Hashem, Rushdi Shams, Md. Abdul Kader, and Md. Abu Sayed, Design and
Development of a Heart Rate Measuring Device using Fingertip, Department of
Computer Science and Engineering Khulna University of Engineering & Technology
(KUET), Khulna 9203, Bangladesh, 2010.
47

You might also like