microcontroller based heart rate …...microcontroller based heart rate monitor using fingertip...
TRANSCRIPT
MICROCONTROLLER BASED HEART RATE
MONITOR USING FINGERTIP SENSOR
By
LIENA ELRAYAH ABDELKHAIR KHAIRELSEED
INDEX NO. 064053
Supervisor
Dr. Sharief F. Babikir
A thesis submitted to
University of Khartoum
Faculty of Engineering
In fulfillment of requirements for the award of the degree of
B.Sc. (HONS) Electrical and Electronic Engineering
(ELECTRONICS AND COMPUTER ENGINEERING)
Faculty of Engineering
Department of Electrical and Electronic Engineering
July 2011
ii
Declaration of Originality
I declare that this thesis entitled “MICROCONTROLLER BASED
FINGERTIP HEART RATE MONITOR” is the result of my own research except as
cited in the references. The thesis has not been accepted for any degree and is not
concurrently submitted in candidature of any other degree.
Signature: ..............................................................
Name : Liena ElRayah Abdelkhair khairelseed
Date : July 2011
iii
Dedication
To my beloved family especially my parents and my siblings for their support, not to
forget to all my friends and lecturers...
iv
Acknowledgement It has already been five years since I stood in front of the gate of Faculty
of Engineering-UofK for the first time. During that time, so many things have happened
to me. Some of them were very exciting and delighting, and some of them were sad and
discouraging. After all, I am so glad that I could finish my final project and write this
thesis. Thanks to Allah because he gave me such magnificent power from starting until
the end to finish the project and all this five years.
Most of all, I would like to express my best and sincere thanks to my thesis
advisor, Dr. Sharief F. Babikir, for his constant encouragement and guidance. His
valuable support and advice were the greatest factor that enabled me to write this
thesis.
I also would like to express deep gratitude to my project`s partner Samah
Makawi El-Basheer for his cooperation and kind sharing of his effort, time and
knowledge. Thanks are also due to all the technicians in the department and for all my
colleagues and for everybody helped and encouraged me.
I wish to put on record also my gratitude to my parents and all members of my
family for their continuous help and support.
Even after I graduate from UOfK, I will not be able to forget this
wonderful university , and I think what it has taught me these five years will be
the major thrust that will guide me through the rest of my life.
v
Abstract In this thesis, we presented the design and development of an integrated device
for measuring heart rate using fingertip to improve estimating the heart rate. As heart
related diseases are increasing day by day, the need for an accurate and affordable heart
rate measuring device or heart monitor is essential to ensure quality of health. However,
most heart rate measuring tools and environments are expensive and do not follow
ergonomics. Our proposed Heart Rate Measuring (HRM) device is economical and user
friendly and uses optical technology to detect the flow of blood through index finger.
The goal of this thesis is design low-cost device which measures the heart rate
of the subject by clipping sensors on one of the fingers and then displaying the result on a
text based LCD. Miniaturized heart rates monitor system based on a microcontroller. It
offers the advantage of portability over tape-based recording systems. The thesis explains
how a single-chip microcontroller can be used to analyze heart beat rate signals in real-
time.the Hardware and software design are oriented towards a single-chip
microcontroller-based system, hence minimizing the size. The important feature of this
project is the use of Fourier transforms to compute heart rate on real-time. It then
processes to provide the information of bradycardia and tachycardia of heart rates and
notified the user if the heart rate exceed the maximum allowable.
It will be shown that the device meets diverse and conflicting requirements,
including reliability, minimum loading effects, and low battery power consumption.
Qualitative and quantitative performance evaluation of the device on real signals
shows accuracy in heart rate estimation, even under intense of physical activity. We
compared the performance of HRM device with Electrocardiogram signal represent in
oscilloscope and manual pulse measurement of heartbeat. The results showed that the
error rate of the device is negligible.
vi
ا012345/
Jhiس وJcd AefgRز JPZD `LJaULس M^Lل \JWAت اMTUVJW XYZDام HI JKLMN OPCQR هFا اABCDوع ،
XYZDت اJWA\ لM^L AeMZR jPhkUD lmnoأن . ا JCWrgmRACDاض اALأ WXYZDJ rdJkDا tkmnم،أfe M^W JLfe MeاuUR
. أA\ ALوري jL أJC\ `dن MPd rknة, fQkYDل Jcd xYyز AeاM^L XNل \JWAت اXYZD دvPN وfZ^L A^hWل
ز JPNس M^Lل \JWAت rPW l .cdJ اmUR `C^D وlL ذI ،Dن O^L أدوات JPNس M^Lل \JWAت اMd r~YaL XYZDا و
ل jL مMDا vIMR jy BaYD rPfDا JPdfDfKaUDم اMTUheل وJC^UVا `cVدي وJQUNز اJcd fح هAUZCDا XYZDا
rWJmhDا.
jL فMcDوعاABCDا اFه، fهr~YaUDا ~TKL زJcd OPCQR XYZDت اJWA\ لM^L PZe ةACUhL r~QW
A^eض Ay O rJ xYyض اMiWlWJn xYy rPUKD ا اACkDاء fW r^D tkRfnfLاJhi rgVس
`JhDل اJUheAaDا . `Cy MCU^e XNاALXYZDت اJWA\ لM^L xYyDاCakUCrPZgKCDت اJ Jو وز JCi mhae JCL
rآAkDا rPYWJN mhaeوJ~P~ . حABRriوAام اMTUVا jaCe Pر آrNJN OakUL rPZgKL `PYkUD ةMiسواJPNرات وJا
HZPZkDا XYZDت اJWA\ لM^L HZPZkDا jLuDا HI. وعABCDا اFه HI، HZgKCDا OakUCDم اMTUhe APeرfI تefkR
ZDت اJWA\ لM^L بJhkDXY، jL وrDJ^CW مfZe O YR D تJLfY^CDا jL vZkUY مMyء وW مJUت اJWA\ لM^L
XYZDا W حfChCDا MkDا XYZDت اJWر `^L xgTR م اذاMTUhCDا AeFkR و .
MTUVام x\AL `mN jL اuPCUe، XYZD هFا اJcDزD `WJN JW، jPPVرJCCDو ا jPP\JeADا `mN jL JCآ
. ذf^e Dد اr~ xD وزن اJcDز و rDfcV ارMRا واMTUVاHI L اJPkDة اACUVJW r\JeAYD .rPLfPDار
OUe HaDvPZkR وعABCDاف اMم ،اهJy kW rPYC^W `C^Dا rg أتMW، OPCQUDا `iاACW تAL O، FP~KUDا، O
وay DFD rPU اPBUD` اABCYD HJcKDوع Jح اه . اJmUر و اAPا اJmUرات اJcYD rNMDز lL أucdة اAى
tmا JCآ vPmgUYD JcUPYWJNو.
vii
Table of Contents
Declaration of Originality ............................................................................................................ ii
Dedication…. ................................................................................................................................. iii
Acknowledgement....................................................................................................................... iv
Abstract….. ..................................................................................................................................... v
vi ................................................................................................................................... ..…ا
List of Figures ................................................................................................................................. x
List of Tables ................................................................................................................................. xi
List of Abbreviations .................................................................................................................. xii
1 INTRODUCTION ................................................................................. 13
1.1. Overview .............................................................................................................................. 13
1.2. Problem Statements ............................................................................................................ 13
1.3. MOTIVATION ........................................................................................................................ 14
1.4. Project scopes ...................................................................................................................... 14
1.5. Objectives ............................................................................................................................. 15
1.6. Document Overview ............................................................................................................ 15
2 LITERATURE REVIEW ......................................................................... 17
2.1. Heart Rate ............................................................................................................................ 17
2.1.1. Visual Representation of Electrocardiogram (ECG) signal ................................... 17
2.1.2. Measuring the Heart Rate ...................................................................................... 18
2.2. Maximum Hear Rate ............................................................................................................ 19
2.3. Fingertip sensor .................................................................................................................... 21
2.3.1. Photoelectric Photoplethysmogrpahy .................................................................... 22
2.3.2. Transmittance vs. Reflectance ............................................................................... 22
2.4.Embedded Systems .................................................................................................................. 24
2.5.Microcontrollers [19]
.................................................................................................................. 24
2.5.1. Memory System ..................................................................................................... 25
2.5.1.1. RAM .................................................................................................................. 25
2.5.1.2. ROM .................................................................................................................. 25
2.5.1.3. EEPROM ........................................................................................................... 25
viii
2.5.2. Central Processing Unit ......................................................................................... 25
2.5.3. Crystal Time Base .................................................................................................. 26
2.5.4. Analog-to-Digital Converter .................................................................................. 26
2.5.4.1. Sample Rate ....................................................................................................... 26
2.5.4.2. Resolution .......................................................................................................... 27
2.6. Fourier Transform Concept [17]
............................................................................................. 27
2.6.1. Discrete-Time Fourier Transform .......................................................................... 27
3 MATERIALS AND TOOLS .................................................................... 29
3.1. Overview .............................................................................................................................. 29
3.2. Hardware components ........................................................................................................ 29
3.2.1. The fingertip sensor ............................................................................................... 29
3.2.2. ATMEGA32 Microcontroller [19] ......................................................................... 29
3.2.3. GSM modem .......................................................................................................... 30
3.2.4. Other small auxiliary components ......................................................................... 30
3.3. Software Tools ..................................................................................................................... 31
4 PROJECT DESIGN ............................................................................... 32
4.1 Overview .............................................................................................................................. 32
4.2 High level design .................................................................................................................. 32
4.3 Detailed project design ........................................................................................................ 33
4.3.1 Hardware Design .................................................................................................... 34
4.3.2 Peripherals interfaces ............................................................................................ 36
4.4 Software Design ................................................................................................................... 38
4.4.1 Measuring HR ......................................................................................................... 38
.1.1.1. Overall software design ......................................................................................... 42
5 IMPLEMENTATIONS AND RESULTS .................................................... 45
5.1. Overview .............................................................................................................................. 45
5.2. Hardware Implementation ................................................................................................... 45
5.2.1. Fingertip sensor ...................................................................................................... 45
5.2.2. Overall circuit ......................................................................................................... 46
5.3. Software Implementation .................................................................................................... 48
5.4. Result .................................................................................................................................... 48
ix
5.4.1. Fingertip sensor ..................................................................................................... 48
5.4.2. Keypad and LCD ................................................................................................... 49
5.4.3. Microcontroller as frequency meter ....................................................................... 49
5.4.4. User heart beat pulse testing .................................................................................. 50
5.4.5. Send the SMS ......................................................................................................... 51
6 CONCLUSION ..................................................................................... 52
6.1. Discussion ............................................................................................................................. 52
6.2. Problems .............................................................................................................................. 52
6.3. Accomplishments ................................................................................................................. 53
6.4. Future work .......................................................................................................................... 53
References .............................................................................................. 54
APPENDICIES ........................................................................................... 56
Appendix A: C code for ATMEGA32………………………………………………………………………………………… A-1
Appendix B: Cost Analysis ............................................................................................................. B-1
Appendix C: snapshots for the implemented project .................................................................. C-1
x
List of Figures Figure 2.1 heart behavior and part of the generated signal [7] ........................................... 17 Figure 2.2 The ECG signal waveform .............................................................................. 18 Figure 2.3 Exercise target zone chart ................................................................................ 20 Figure 2.4 Transmittance and Reflectance configurations of transducer [16] .................... 23 Figure 2.5 Microcontroller block diagram ........................................................................ 24 Figure 2.6 Analog-to-digital conversion .......................................................................... 26 Figure 3.1 ATMEGA32 Microcontroller ........................................................................ 30 Figure 3.2 GSM modem .................................................................................................. 30 Figure 4.1 The system block diagram ............................................................................... 32 Figure 4.2 the system block diagram ............................................................................... 32 Figure 4.3 the system block diagram ............................................................................... 32 Figure 4.4 Interface between Atmega32 and Fingertip sensor ......................................... 34 Figure 4.5 Cross section of the ring .................................................................................. 35 Figure 4.6 The output signal form sensor ........................................................................ 35 Figure 4.7 The amplifier circuit ....................................................................................... 36 Figure 4.8 Connection between GSM modem and MCU ................................................. 37 Figure 4.9 LCD internal structure .................................................................................... 38 Figure 4.10 HR measuring algorithm chart ...................................................................... 39 Figure 4.11 The warning algorithm chart ......................................................................... 40 Figure 4.12 Send SMS algorithm chart............................................................................. 42 Figure 4.13 Overall algorithm chart .................................................................................. 44 Figure 4.14 Complete heart ate monitor flowchart ........................................................... 44 Figure 5.1 The Fingertip sensor ........................................................................................ 46 Figure 5.2 The amplification stages .................................................................................. 46 Figure 5.3 The complete circuit of HRM.......................................................................... 47 Figure 5.4 The output signal by OSCilliscope .................................................................. 48 Figure 5.5 Keypad and LCD testing result ....................................................................... 49
xi
List of Tables Table 3.1 The Auxilary components ................................................................................. 31
Table 3.2: The software tools............................................................................................ 31
Table 4.1 Commands sequence to send SMS ................................................................... 41
Table 5.1 The result of mesuring freqency of sinusoidal signals ..................................... 49
Table 5.2 The result of first testing ................................................................................... 51
Table 5.3 The result of the secod testing.......................................................................... 51
xii
List of Abbreviations HRM Heart Rate Monitor
HR Heart Rate
Bpm Beat per Minute
MCU Microcontroller
MAXHR maximum heart rate
LCD Liquid Crystal Display
GSM Global System for Mobile communications
SMS Short Message Service
SIM Subscriber Identity Module
Msg Message
C C programming Language
CPU Central Processing Unit
RAM Random Access Memory
ROM Read Only Memory
EEPROM Electrical Erasable Programmable Read Only Memory
ALU Arithmetic and Logic Unit
ADC Analog to Digital Converter
LED Light Emitting Diode
IR Infra Red
PCB Printed circuit Board
CHAPTER2 LITERATURE REVIEW
13
1 INTRODUCTION
1.1. Overview
Ambulatory patient care makes up the bulk of medical care and affords the best
opportunity for preventive medicine. The renaissance of interest in ambulatory care in
general, and for the hi-risk cardiac patient in particular, is gaining ever-increasing
momentum. With the aid of modern technology and a better understanding of
physiological processes, medical care is experiencing a rapid evolution in both
diagnostics and therapeutics. This technical progress now provides the potential for
improved care of the patient in the ambulatory environment [1].
Vital sign monitoring is becoming increasingly important for securing
independent lives as the population of aged people increases. Online, continuous
monitoring allows us to detect emergencies and abrupt changes in the patient’s condition.
Especially for cardiac patients, online, long-term monitoring plays a pivotal role. It
provides critical information for long-term assessment and preventive diagnosis for
which long-term trends and signal patterns are of special importance. Such trends and
patterns can hardly be identified by traditional examinations. Those cardiac problems
that occur frequently during normal daily activities may disappear the moment the
patient is hospitalized, causing diagnostic difficulties and consequently possible
therapeutic errors. In this sense, continuous and ambulatory monitoring systems are
needed to detect the traits [1].
1.2. Problem Statements
The heart rate monitor system is being developed for the following reasons:
Providing immediate notification of abnormalities in cardiac activity on a monitored
patient or user.
Providing low cost and low power consumption devices provides a cheap and
reliable method for monitoring patients in developing countries.
Providing microcontroller based QRS analysis.
Providing easily accessible, user friendly and portable device.
CHAPTER2 LITERATURE REVIEW
14
1.3. MOTIVATION
In 2002, ischemic heart disease is the second main cause of death in the Sudan at
8% of all deaths in that year [2].On Worldwide, coronary heart disease, the most common
type of heart disease, and the second main cause of death with 9.6 % of people death in
low income countries as Sudan and the percentage increase in middle and high income
countries claims over 7 million lives every year.[3] Up to half of these deaths occur even
before emergency services can step in to intervene. In countries without a low healthcare
system, this number is much closer to 100%.
A portable system equipped to monitor heart rhythms would serve as a means for
exposure of possibly fatal cardiac activity and would be a very useful product. This
statistics was the main motive to achieve this project.
Without microcontroller based heart rate monitor system, the heart monitor
process will be very expensive and thus it is provide only in hospitals, special clinics and
wealthy patients. The patient movement will be restricted by the area of the device and
thus the patient’s daily life will effected and changed. Thus this device is important and
critical.
With this device, continuous monitoring for the heart rate will be available, the
portability feature of the device and using the fingertip sensor as a ring is led to avoiding
motion artifacts and increase the accuracy which in turn increase the reliability and make
the device wearable during the work.
After doing exercise, the speed of blood increases and the heart rate will also
increase [4]. Thus the device appropriate to used by athletes and people doing exercises
frequently.
1.4. Project scopes
In order to achieve the project objectives, there are two main parts of the scopes
which are hardware and software. For the hardware part, the scope of this project is a
circuit of microcontroller that place at the prototype designs is build. This circuit is
CHAPTER2 LITERATURE REVIEW
15
connecting with the connection from fingertip sensor, GSM modem, and LCD and
keypad which act as user interface. To determine and control the range of heart rate in
human body, the code vision AVR software is used to program the ATMEGA32.
1.5. Objectives
The goal of this thesis is design low-cost device which measures the heart rate
of the subject by clipping sensors on one of the fingers and then displaying the result on a
text based LCD. Miniaturized heart rates monitor system based on a microcontroller. It
offers the advantage of portability over tape-based recording systems. The thesis explains
how a single-chip microcontroller can be used to analyze heart beat rate signals in real-
time.the Hardware and software design are oriented towards a single-chip
microcontroller-based system, hence minimizing the size. The important feature of this
project is the use of Fourier transforms to compute heart rate. It then processes on real-
time the information to bradycardia and tachycardia of heart rates. It will be shown that
the device meets diverse and conflicting requirements, including reliability, minimum
loading effects, and low battery power consumption.
1.6. Document Overview
This thesis is divided into 5 main chapters. Chapter one covers the overview of
this project, stating together its objectives and scopes. It is also inclusive of the project’s
problem statements, advantages.
• Chapter2: (Literature review) discusses the basic theories applicable for this
project. Discussion on these theories is based on the background studies or
literature reviews. It covers mainly on concept of heart rate, Fingertip sensor and
heart rate training zones.
• Chapter 3: (Materials and Tools) describes the general structure and operations
of the system, including all assumptions and considerations for the system‘s
operation.
• Chapter 4: (project design) this chapter is about the design phase; it begins to
discuss the high level design then the detailed design. All hardware and software
CHAPTER2 LITERATURE REVIEW
16
design steps are considered here including all physical requirements, algorithms,
circuits block diagrams, flowcharts, and etc.
• Chapter5: (Implementation and Results) this chapter is about the
implementation and testing phase of the project and it constitutes the real work in
order to achieve the project objectives.
• Chapter 6: Conclusions and Recommendations contain conclusions of system
performance and recommended future work, including the ethical issues
involved.
• Appendix A: Source Code for Programming the microcontroller ATMEGA32.
• Appendix B: cost analysis of the project.
• Appendix C: includes snapshots for the implemented project.
CHAPTER2 LITERATURE REVIEW
17
2 LITERATURE REVIEW
2.1. Heart Rate
The heart is the organ that responsible for pumping blood throughout the body. It
is located in the middle of the thorax, slightly offset to the left and surrounded by the
lungs basically; the human heart is composed of four chambers which are two atriums
and two ventricles. The right atrium receives blood returning to the heart from the whole
body. That blood passes through the right ventricle and is pumped to the lungs where it is
oxygenated and goes back to the heart through the left atrium, and then the blood passes
through the left ventricle and is pumped again to be distributed to the entire body through
the arteries [7].
Figure 2.1 heart behavior and part of the generated signal [7]
2.1.1. Visual Representation of Electrocardiogram (ECG) signal
An electrocardiogram (ECG), also called an EKG, is a graphic tracing of the
voltage generated by the cardiac or heart muscle during a heartbeat. It provides very
accurate evaluation of the performance of the heart [6]. The heart generates an
electrochemical impulse that spreads out in the heart in such a fashion as to cause the
cells to contract and relax in a timely order and, thus, give the heart a pumping
CHAPTER2 LITERATURE REVIEW
18
characteristic. An actual voltage potential of approximately 1 mV develops between
various body points [6].
Figure 2.2 The ECG signal waveform
Heart rate is measured in beats per minute (bpm). In measuring heart rate, there
are various ways to measure such as by using pulse oximeter, heart rate monitor, an
electrocardiograph, and ECG strap. The beats per minute is differ for many people which
depending on the ages, body physical condition and environmental factor. Center in the
brain is controlled the rate of heart beat [7]. According to information received from
muscles and sensors located, this center speeds up or slows down the heart.
2.1.2. Measuring the Heart Rate
By detecting the R peaks (shown in figure 2.2) and measuring their frequency, the
heart rate can be calculated and then displayed. A persons heart rate before, during and
after exercise is the main indicator of their fitness. Measuring this manually requires a
person to stop the activity they are doing in order to count the number of heart beats over
a period of time. Measuring the heart rate using an electrical circuit can be done much
quicker and more accurately.
CHAPTER2 LITERATURE REVIEW
19
Heart rate measurement is one of the very important parameters of the human
cardiovascular system. The heart rate of a healthy adult at rest is around 72 beats per
minute (bpm). Athletes normally have lower heart rates than less active people. Babies
have a much higher heart rate 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. 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 than normal heart rates are known as
tachycardia [8].
Endure athletes often have very low resting heart rates. Heart rate can be
measured by measuring one's pulse. Pulse measurement can be achieved by using
specialized medical devices, or by merely pressing one's fingers against an artery
(typically on the wrist or the neck). It is generally accepted that listening to heartbeats
using a stethoscope, a process known as auscultation, is a more accurate method to
measure the heart rate. There are many other methods to measure heart rates like
Phonocardiogram1 (PCG), ECG, blood pressure wave form and pulse meters but these
methods are clinical and expensive [8].
2.2. Maximum Hear Rate
The maximum Heart Rate (Max HR) is the fastest of heart can beat for one
minute. A generalized rule anchors Max HR using a mathematical formula. Inside each
zone, there are different exercise changes which occur as the result of spending training
time in the zone. Heart zones is expressed as a percentage of the maximum heart rate,
reflect exercise intensity and the result benefit. There are five heart zones of training
illustrated in figure 3.4.
1 A Phonocardiogram or PCG is a plot of high fidelity recording of the sounds and murmurs made by the
heart with the help of the machine called phonocardiograph, or "Recording of the sounds made by the
heart during a cardiac cycle.
CHAPTER2 LITERATURE REVIEW
20
Figure 2.3 Exercise target zone chart
Calculate the maximum rate of the heart is the subject of ongoing research for a
long time because of the inaccuracy of the calculation. So there are many methods of
calculating such
1) The easiest and best known method to calculate your maximum heart rate (MHR)
is to use the formula
• MAXHR = 220 – Age
2) Dr. Martha Gulati et al [9]
• For Male, MAXHR = 220-Age.
• For women, MHR= 206 - (0.88 x age).
3) Londeree and Moeschberger[10]
• For male and female, MHR = 206.3 - (0.711 × Age)
Studies have shown that MHR on a treadmill is consistently 5 to 6 beats
higher than on a bicycle ergo meter and 2 to 3 beats higher on a rowing ergometer.
Heart rates while swimming are significantly lower, around 14 bpm, than for
CHAPTER2 LITERATURE REVIEW
21
treadmill running. Elite endurance athletes and moderately trained individuals will
have a MHR 3 or 4 beats slower than a sedentary individual. It was also found that
well trained over 50s are likely to have a higher MHR than that which is average for
their age.
4) Miller et al[11]
• For male and female, MHR = 217 - (0.85 x Age)
5) USA Researchers[12]
• MHR = 206.9 - (0.67 x age)
6) UK Researchers [13]
• For Male, MHR = 202 - (0.55 x age)
• For Female, MHR = 216 - (1.09 x age)
7) Miller, Londeree and Moeschberger
To determine your maximum heart rate you could use the following, which
combines the Miller formula with the research from Londeree and Moeschberger.
• Use the Miller formula of MHR=217 - (0.85 × age) to calculate MHR.
• Subtract 3 beats for elite athletes under 30.
• Add 2 beats for 50 year old elite athletes.
• Add 4 beats for 55+ year old elite athletes.
• Use this MHR value for running training.
• Subtract 3 beats for rowing training.
• Subtract 5 beats for bicycle training.
2.3. Fingertip sensor
Use of light to measure heart rate is a field of study where abundant research
CHAPTER2 LITERATURE REVIEW
22
has been done in the past few decades. Fingertip sensor relies on measurement of a
physiological signal called Photoplethysmogrpahy (PPG) [14.], which is an optical
measurement of the change in blood volume in the arteries. Fingertip sensor acquires
PPG signals by irradiating wavelength of light through the tissue, and compares the
light absorption characteristics of blood under these wavelengths.
2.3.1. Photoelectric Photoplethysmogrpahy
The hardware and software for the MEDAC photoelectric plethysmography (PPG)
represent an integrated system for real time monitoring of relative changes in peripheral
blood flow and for recording heart rate using an easy to attach sensor. Under appropriate
conditions, the software can derive the following measures from the PPG signal: relative
blood volume pulse height, pulse wave rise time, pulse wave fall time, the inter-beat-interval
(IBI)2, and heart rate [15].
Plethysmography is a generic term referring to a variety of techniques for monitoring
volume changes in a limb or tissue segment. Volume changes occur in a pulsatile manner
with each beat of the heart as blood flows in and out of a portion of the body. The study of
vascular activity by fluid displacement methods dates back to at least 1890. Photoelectric
plethysmography (PPG) was developed in both Germany and the United States in the 1930's
[15]. Recent advances in photoelectronics make it possible to utilize photoelectric
plethysmography as a sensitive physiological monitoring technique that may be practically
applied in a clinical setting.
2.3.2. Transmittance vs. Reflectance
Fingertip sensor has traditionally been done in two methods: transmittance and
reflectance of light. In transmittance fingertip sensor, light is shone through the tissue
using an LED and is detected on the other end using a photodetector. In contrast,
reflectance fingertip sensor uses a photodetector on the same side as the LED to detect
the light reflected by the tissue (Figure 2.3).
2 Interbeat interval is a scientific term used in reference to the time interval between individual beats of the mammalian
heart. Interbeat interval is abbreviated "IBI”. It is also sometimes referred to as "beat-to-beat" interval.IBI is generally measured in units of milliseconds. Individual human heart IBI values can vary from as short as 5 milliseconds to as long as 70 milliseconds.
CHAPTER2 LITERATURE REVIEW
23
Figure 2.4 Transmittance and Reflectance configurations of transducer [16]
The opposite affect is on the reflected light. This can be intuitively justified, as the
more blood there is in the tissue, the more the light passing through the tissue gets
blocked. Since this improves the amount of light reflecting back, the signal observed in
the reflectance configuration increases. Similarly, as the light gets blocked, not enough
light reaches the photodetector in the transmittance configuration, and therefore a decline
in the signal is observed [15].
In terms of the application, the transmittance configuration is more suited to the
areas of the body that lend themselves better to light transmittance through them, e.g.
fingers or ear lobes. However, transmittance configuration cannot be used in other areas
of the body as the transmittance of light is significantly less when there are obstacles such
as bone or muscle in the way, besides the fact that the path of light is much longer than in
thin areas such as the ear lobes. In such scenarios, reflectance configuration is more
useful, provided that vasculature is available close to the surface of the skin, e.g.
forehead, wrist or forearm.
Reflectance configuration is not limited to areas where the transmittance
configuration cannot be used. It can be employed to measure PPG signal from the ear
lobes or the fingers just as the transmittance configuration. However, due to their thin
cross-sectional area, fingers and ear lobes transmit much of the light shone through them,
resulting in lower signal intensity in the reflectance configuration [15].
CHAPTER2 LITERATURE REVIEW
24
2.4. Embedded Systems
The basic idea of an embedded system is a simple one. If we take any
engineering product that needs control, and if a computer is incorporated within that
product to undertake the control, then we have an embedded system. An embedded
system can be defined as: A system whose principal function is not computational,
but which is controlled by a computer embedded within it. Embedded processors can
be broken into two broad categories: ordinary microprocessors and microcontrollers.
2.5. Microcontrollers [19]
A microcontroller (also microcontroller unit, MCU) is a small computer on a
single integrated circuit; its function is determined by a program loaded in it. Like all
computers microcontrollers are equipped with a central processing unit or CPU, a
memory system, an input/output system, a clock or timing system, and a bus system to
interconnect constituent systems. The bus system consists of an address bus, a data bus,
and a control bus. In Figure (2.1) we have provided the block diagram of a generic
microcontroller. We would like to emphasize that all systems shown in the diagram are
contained within the confines of a single integrated circuit package.
Figure 2.5 Microcontroller block diagram
We discuss each system briefly in a clockwise fashion beginning with the
memory system.
CHAPTER2 LITERATURE REVIEW
25
2.5.1. Memory System
As its name implies, the memory system contained within a microcontroller is
used to remember the algorithm executed by the microcontroller, key program variables,
and also system information.
A microcontroller’s memory system is usually a conglomeration of different
memory technologies. Most microcontrollers are equipped with a memory system
containing both random access memory (RAM) and read-only memory (ROM)
components.
2.5.1.1. RAM
RAM configurations are used to hold program variables that might change during
program execution.
2.5.1.2. ROM
ROM configurations are non-volatile, which makes them an ideal location to store
a main program. That way should the microcontroller lose power, it will not lose its main
program.
2.5.1.3. EEPROM
The EEPROM, or electrically erasable programmable ROM, is available in two
different varieties byte-addressable EEPROM and flash EEPROM. Most microcontrollers
are equipped with both types. Byte-addressable EEPROM, as its name implies, allows
modification of single bytes of information during program execution. This type of
memory is useful for storing program constants, security combinations, and fault status.
Flash EEPROM may be rewritten in bulk. It does not allow for updating a single memory
location. Flash EEPROM is used to store the microcontroller’s algorithm.
2.5.2. Central Processing Unit
The heart of the microcontroller is the central processing unit or CPU. The CPU
contains two main component parts: the arithmetic logic unit (ALU) and the control unit.
The ALU performs the arithmetic operations (addition, subtraction, shift right, etc.) and
logic operations (AND, OR, exclusive-OR, etc.) for the microcontroller.
CHAPTER2 LITERATURE REVIEW
26
2.5.3. Crystal Time Base
The time base for the processor is usually provided by a quartz crystal or a
ceramic resonator. The quartz crystal provides a more accurate, stable time base.
2.5.4. Analog-to-Digital Converter
Most microcontrollers are equipped with multi-channel analog-to-digital
converters (ADCs). The analog input signals are converted to a weighted binary
representation as shown in Figure2.6.
Figure 2.6 Analog-to-digital conversion
To convert an analog sample to a weighted binary value, three steps must be
performed:
1) Determining the sample rate,
2) Determining the required resolution of the converter, and
3) Encoding the voltage sample into a weighted binary value.
2.5.4.1. Sample Rate
The Nyquist criterion indicates that the analog sample must be sampled at a rate
that is at least twice the highest frequency in the sampled signal. This can be expressed as
FSample ≥ 2 * FHighest
CHAPTER2 LITERATURE REVIEW
27
2.5.4.2. Resolution
The equation which ties the different resolution factors together can be expressed
as
Resolution = (Vref_high – Vref_low)/2b
2.6. Fourier Transform Concept [17]
The Fourier transform is a mathematical operation that decomposes a signal into
its constituent frequencies. Thus the Fourier transform of a musical chord is a
mathematical representation of the amplitudes of the individual notes that make it up. The
original signal depends on time, and therefore is called the time domain representation of
the signal, whereas the Fourier transform depends on frequency and is called the
frequency domain representation of the signal. The term Fourier transform refers both to
the frequency domain representation of the signal and the process that transforms the
signal to its frequency domain representation.
In mathematical terms, the Fourier transform 'transforms' one complex-valued
function of a real variable into another. In effect, the Fourier transform decomposes a
function into oscillatory functions. The Fourier transform and its generalizations are the
subject of Fourier analysis. In this specific case, both the time and frequency domains are
unbounded linear continua. It is possible to define the Fourier transform of a function of
several variables, which is important for instance in the physical study of wave motion
and optics. It is also possible to generalize the Fourier transform on discrete structures
such as finite groups. The efficient computation of such structures, by fast Fourier
transform, is essential for high-speed computing.
2.6.1. Discrete-Time Fourier Transform
CHAPTER2 LITERATURE REVIEW
28
In mathematics, the discrete-time Fourier transform (DTFT) is one of the specific
forms of Fourier analysis. As such, it transforms one function into another, which is
called the frequency domain representation, or simply the "DTFT", of the original
function (which is often a function in the time-domain). But the DTFT requires an input
function that is discrete. Such inputs are often created by sampling a continuous function,
like a person's voice.
The DTFT frequency-domain representation is always a periodic function. Since
one period of the function contains all of the unique information, it is sometimes
convenient to say that the DTFT is a transform to a "finite" frequency-domain (the length
of one period), rather than to the entire real line. It is Pontryagin dual to the Fourier
series, which transforms from a periodic domain to a discrete domain.
The mathematical discrete time interval of the samples ∆t and the frequency
interval ∆f. Also note that N represents the total number of samples taken. The actual
DFT equation returns a set of coefficients for a given sample value [18].
CHAPTER3 MATERIALS AND TOOLS
29
3 MATERIALS AND TOOLS
3.1. Overview
In order to achieve the objectives of the project of microcontroller based heart rate
monitor , several hardware components and software tools are employed and used after
they have been selected among other alternatives due to some reasons and circumstances.
This chapter talks about all these tools and materials mentioning brief description
of the main component features that may be the primary reason behind the selection of
this component or tool.
3.2. Hardware components
3.2.1. The fingertip sensor
The heart rate monitor builds to test the value of users’ heart rate currently. The
circuit will base on the non-invasive PPG sensor which detects the variation of the blood
flow in finger when the mechanical contraction of heart. The sensor contains an infrared
LED as an IR transmitter and photodiode as an IR receiver. The light intensity of the
infrared and red light is measured by the photo detector after it has passed through the
finger. Electronically, the heart rate monitor consists of the following:
a. Analog signal conditioning and/or processing
b. Data acquisition
c. Digital signal processing
d. Display and control system
e. Internal system diagnostic functions
3.2.2. ATMEGA32 Microcontroller [19]
The high-performance, low-power Atmel 8-bit AVR RISC-based microcontroller
combines 16KB of programmable flash memory, 2KB SRAM, 1KB EEPROM, an 8-
channel 10-bit A/D converter, 2 capture/compare/PWM functions, 3 timers, a
synchronous serial port that can be configured as either 3-wire SPI or 2-wire I2C bus, a
USART, and a Parallel Slave Port. The device supports throughput of 16 MIPS at 16
CHAPTER3
MHz and
By executing instructions
approaching 1 MIPS per M
3.2.3. GSM modem
SIMCOM300 (Figu
Ltd. SIM300 is a Tri-band
an industry-standard inter
performance for voice, SM
consumption. It operates w
3.2.4. Other small auxili
These include the
components or employed
components.
MATERIALS AND
operates between 4.5-5.5
ctions in a single clock cycle, the device achiev
per MHz, balancing power consumption and processi
Figure 3.1 ATMEGA32 Microcontroller
(Figure 3.2) is an electronic device that offered by
band GSM/GPRS solution in a compact plug-in mo
interface, the SIM300 delivers GSM/GPRS 900/1
ce, SMS, Data, and Fax in a small form factor and w
ates with 12VDC.
Figure 3.2 GSM modem
auxiliary components
e the components that are either basic requirement
ployed for unnecessary purpose. Table 3.1 sum
RIALS AND TOOLS
30
5.5 volts.
achieves throughputs
ocessing speed.
red by SIMCOM Co.
in module featuring
900/1800/1900MHz
and with low power
ement for the above
summarizes theses
CHAPTER3 MATERIALS AND TOOLS
31
Component Usage
AVR chip programmer – Kanda Systems
STK 200+/300
Download the HEX file into AMEGA32
chip
Female RS232 connector Interface between GSM modem and
Microcontroller
SIM card Required by GSM modem
Antenna Require by GSM modem
9v DC battery Powers the circuit components
Battery clips connector Required for battery
12V DC power supply Powers the GSM modem
20pf capacitor Required by crystal oscillator of the
microcontroller
MAX232 To supply GSM voltage levels from a
single 5-V supply.
1µf capacitor Required by MAX232
Buzzer Required for warning process
FZT649 Control and protect the buzzer
Button switch Requires for MCU’s reset
150Ω470Ω, 5kΩ ,6.8kΩ ,33kΩ ,68kΩ and
680kΩ resistors
Required by the fingertip sensor and
microcontroller
Table 3.1 The Auxilary components
3.3. Software Tools
There are several software tools that have been used to program the system. The
microcontroller needs to program using their own software before the system operated.
Component Usage
code vision AVR C compiler and
programmer
To edit, simulate C code for Atmega32 and
program it
Proteus simulator To design and simulate electronic circuits
Table 3.2: The software tools
CHAPTER4 PROJECT DESIGN
32
4 PROJECT DESIGN
4.1 Overview This chapter is about the most important stage in the life cycle of each project,
thus it represents the biggest effort that takes the longest time among all project stages.
This chapter begins to discuss the high level design then the detailed design. All
hardware and software design steps are considered here including all physical
requirements, algorithms, circuits block diagrams, flowcharts…etc.
The design methodology proceeds from bottom to top by designing the small
pieces that forms the project and then integrate in them together to form the project as
whole.
4.2 High level design By high level design we mean to see the project from an overall view point, then
to get down and consider the project as a system of main parts.
Figure 4.1 The system block diagram
Fingertip sensor is used in the device as transducer converts the physical PPG
signal to into an electrical signal. This electrical signal is applied to the microcontroller
which is the main brain of the heart rate monitor. The microcontroller, according to the
CHAPTER4
algorithm saved in it, proce
rate, output it to the LCD a
to send SMS containing thi
4.3. Detailed projecThe previous sectio
whole, this section will go
the software design.
As illustrated in F
sensors interfaces circuits
the software design is cla
database design, and user i
Project Design
PROJECT
, processes that signal and measure its frequency that m
LCD and then commands the GSM modem via serial c
ing this reading if it exceed the maximum of heat rate
roject design section has given a brief and fast idea about the pr
ill go further to the detailed design of both the hardw
in Figure 4.2, hardware design is classified into
rcuits design, and the entire circuit layout design. On
is classified into three categories: microcontroller
user interface design.
Figure 4.2: Project design divisions
Software
Design
HR measuring
warning
procedures
send msg
procedure
overall
alogrithm
Hardware
Circuit Design
Figertip Sensor
Infrared Sen
Amplificat
circuit
Peripherals
interface
GSM
LCD
KEYPAD
PROJECT DESIGN
33
y that means the heart
serial communication
at rate.
the project design as
hardware design and
into two categories:
n. On the other hand,
roller C code design,
Sensor
ication
cuit
M
PAD
CHAPTER4 PROJECT DESIGN
34
4.2.1 Hardware Design
4.2.1.1 Fingertip Sensor
The sensor consists of a light source and photodetector; light is shone through the
tissues and variation in blood volume alters the amount of light falling on the detector.
The source and detector can be mounted side by side to look at changes in reflected light
or on either side of a finger to detect changes in transmitted light. This analog voltage
signal is applied to a one channel of the ADC module of the microcontroller (Figure 4.3).
The signal is converted into to digital value and calibrated according to the high
and low ADC voltage references. The particular arrangement here uses an elastic pannose
ring to hold an infrared light emitting diode and a matched photodiode. The infrared
filter of the phototransistor reduces interference from fluorescent lights, which have a
large AC component in their output.
Figure 4.4 Interface between Atmega32 and Fingertip sensor
Two holes were made in opposite sides of the lining of the ring at half the length
of the ring to insert infrared LED transmitter and photodiode as seen in figure 2.4.
CHAPTER4 PROJECT DESIGN
35
Figure 4.5 Cross section of the ring
4.2.1.2 Amplification and Filter stage
The signals from infrared sensor are very weak; the voltage is just around 50mV
with amount of voltage bias, and lots of noises in the signals. The graphic below shows
the output of signals from the infrared sensor through previous experiments:
Figure 4.6 The output signal form sensor
This project used LM358 two-class amplifier to adjust the voltage value to 5V for
being received by ATMEGA32. Because the signal acquisition is extremely weak and
vulnerable to interference by the external circuit, high-pass filter and low-pass filter are
used for normal heart beat signals.
The signal frequencies are boxed in by movement artifacts of the ring and the
mains-hum3 interference. The filtering is necessary to block these higher frequency
noises present in the signal. A 1 µF capacitor at the input of each stage is required to
block the dc component in the signal.
3 Mains hum is an audible oscillation of alternating current at the frequency of the mains electricity, which
is usually 50 Hz or 60 Hz, depending on the local power line frequency.
CHAPTER4 PROJECT DESIGN
36
The amplifier (see figure 4.9) uses an LM358 dual op amp to provide two
identical broadly-tuned low pass stages with the gain of each filter stage is set to 101 and
a cut-off frequency of about 2.34 Hz. So the maximum HR that could be read is
approximately equal 150. The equations for calculating gain and cut-off frequency of the
active low pass filter are expressed as
gain 1
1
. 101
Cutoff frequency
π
π .µ! = 2.34
Figure 4.7 The amplifier circuit
4.2.2 Peripherals interfaces
4.2.2.1 Interface between GSM modem and MCU
SIMCOM300 GSM modem is used here to send SMS containing the notification
about the heart rate. The microcontroller inputs the ECG signal and process it to find the
heart rate, if it is exceed certain calculated maximum HR, the microcontroller must send
to the GSM modem the appropriate commands to send SMS representing the warning
that heart rate is very high.
CHAPTER4 PROJECT DESIGN
37
The interface between ATMEGA32 microcontroller and the GSM modem is
serial communication, the GSM modem has RS-232 port and ATMEGA32 has USART
module. But ATMEGA32 MCU is 0-5 TTL/CMOS voltage level and GSM modem is
RS-232-±12 voltage level, Thus for the compatibility purpose between RS-232 ±12 V
logic and TTL/CMOS 0-5 V logic, MAX232 level converter is used as shown in Figure
(4.5).
Figure 4.8 Connection between GSM modem and MCU
4.2.2.2 LCD
In this project, a 16×2 LCD display will be used for displaying the value of heart
rate. There are 16 pins in whole in LCD. The pin diagram of LCD is shown as below.
From the datasheet, it is known that pin 1 & pin 2 and pin 15 & pin 16 both functions as
power supply ports. However, just pin 1 & pin 2 needed, and the lightness of LCD should
be controlled by a 10kΩ variable resistor.
The max voltage used on LCD is +7V, in this project, a +5V power provided by
the programmer 8-pin socket will supply the power to make LCD work successfully. The
highlight pins of datasheet below are connecting to PIC, as this project, a complete port
of ATMEGA32 microcontroller preserved to LCD. The four MSB of the port is used as
data lines of LCD connected with pins 10~14 and the three first LSB is used as control
lines of LCD connected with pins 4~6.
CHAPTER4 PROJECT DESIGN
38
Figure 4.9 LCD internal structure
The first row located in the address 80h-8Fh. The second row is in the address
C0h-CFh.Move to specific address by writing the address into command register (RS =
0).In the LCD are two registers: command reg. (RS = 0) and data register (RS = 1).
4.3.2.1. Keypad4x4
The keypad4x4 is used in order to let the user to insert its information. It has 8
pins connected to a complete port of MCU. The order of connection is depend on the
software code which the programmer defines the keypad’s port.
4.3 Software Design In the software part, ATMEGA32 functions as a frequency meter to measure the
heart rate after it take user`s information and display the heart rate currently with
notification if its exceed certain limit.
4.3.1 Measuring HR
The ADC module in ATMEGA32 has eight inputs; it also has high and low
voltage references which are always in our code set to 5 V and 0 V, respectively.
Fingertip sensor analog voltage output is applied to channel 0 (ADC0) of
ATMEGA32 which is pin. Hence the algorithm to measuring HR will be
1) Initialize the microcontroller
Clock frequency =8 HZ.
ADC configuration: ADC`s resolution is 8-bit and clock frequency equal
250KHZ.
Initialize I/O ports
CHAPTER4 PROJECT DESIGN
39
Initialize LCD16x2.
2) Set ADC channel for ADC0.
3) Acquire the data by reading the ADC every 50ms and store it in array of integer
has size equal 100.
4) For 100 times, Do Fourier transforms for this data and store the result in array of
double.
5) Find the maximum frequency that corresponding to maximum value in Fourier
transform array.
6) Display the frequency after multiplied by 60 into LCD.
7) Check if it exceeds the maximum HR, MCU performs the warning procedures.
Then the flow chart of the algorithm will be as in Figure (4.10):
Figure 4.10 HR measuring algorithm chart
CHAPTER4 PROJECT DESIGN
40
4.3.1.1 Warning procedures
The MCU performs warning procedures when the HR exceeds the maximum HR.
The algorithm to warning will be
1) Starts send message procedures.
2) Set counter to zero.
3) Set buzzer and buz_LED pins to 1(turn on the buzzer and LED).
4) Delay for 1s.
5) Reset buzzer and buz_LED pins to 1(turn off the buzzer and LED).
6) Delay for 1s.
7) If counter ≠ 5, go to step 3.
The flowchart of the warning procedures shown in figure (4.11):
Figure 4.11 The warning algorithm chart
CHAPTER4 PROJECT DESIGN
41
4.3.1.2 Send_msg procedures
All GSM modem operations are controlled by what is called “AT Commands”. A
brief explanation is introduced here to show how to send SMS using AT Commands as
shown in Table 4.1:
Table 4.1 Commands sequence to send SMS
Then the algorithm to send SMS will be:
1) Initialize the microcontroller:
Serial communication settings: RS232 (baud = 9600, parity = N, 1 stop bit)
2) Send AT to check the GSM connection is ok
3) Send (AT+CMGF=1) to set modem to the text mode.
4) Send (13 and 10) ASCII characters (equivalent to press Enter).
5) Wait one second for the modem response.
6) Send (AT+CMGS=”09xxxxxxxx”).
7) Send (13 and 10) ASCII characters.
8) Wait one second for the modem response.
9) Send the message content.
10) Send (26) ASCII character (equivalent to press Ctrl+z).
11) Wait one second for the modem response.
The flow chart of algorithm is shown in figure (4.12):
CHAPTER4 PROJECT DESIGN
42
Figure 4.12 Send SMS algorithm chart
.1.1.1. Overall software design
By the complete algorithm, it is meant the entire operation performed by the
ATMEGA32. Thus the algorithm for entire process done by ATMEGA32 will be:
1) Initialize the microcontroller:
Clock frequency =8 MHZ.
ADC configuration: ADC`s resolution is 8-bit and clock frequency
equal 250KHZ.
Initialize I/O ports.
CHAPTER4 PROJECT DESIGN
43
Initialize LCD16x2.
Serial communication settings: RS232 (baud = 9600, parity = N, 1
stop bit).
2) Insert the user’s information (i.e. name, age, gender, pone number…etc).
3) Calculate the maximum HR using user’s age and gender and the equation
expressed as
• For Male, MHR = 202 - (0.55 x age)
• For Female, MHR = 216 - (1.09 x age)
4) Start measuring the HR.
5) Display the HR.
6) If HR > MAXHR
a. Display HR into LCD.
b. Send text message to use’s specified phone number.
c. Set counter=0
d. Turn on the buzzer and LED.
e. Delay for 1s.
f. Turn off the buzzer and LED.
g. If counter < 5 , go to step d.
7) If HR< MAXHR, display HR into LCD
8) Go to step 4.
Then the flowchart of the algorithm will be as in Figure (4.13):
CHAPTER4 PROJECT DESIGN
44
Figure 4.13 Overall algorithm chart
CHAPTER5 IMPLEMENTATION ANDRESULT
45
5 IMPLEMENTATIONS AND RESULTS
5.1. Overview
This chapter is about the implementation and testing phase of the project and it
constitutes the real work in order to achieve the project objectives. The implementation
has been done by dividing the whole project into small parts; regarding the hardware
parts each one has passed through the following steps:
1. Simulation with computer using Proteus simulator software.
2. Real hardware implementation and testing in the lab.
3. Integration with other parts.
With respect to the software part, also it has been divided into small parts each
part performs a certain job, thus each one has passed through the following steps:
1. Algorithm design.
2. Real implementation and testing.
3. Integration with other parts.
5.2. Hardware Implementation
5.2.1. Fingertip sensor
Fingertip sensor has been implemented successfully in the Proteus simulator and
the result was observed using Oscilloscope as in Figure (5.1 and 5.2).
CHAPTER5 IMPLEMENTATION ANDRESULT
46
Figure 5.1 The Fingertip sensor
Figure 5.2 The amplification stages
5.2.2. Overall circuit
All above parts have been integrated into one circuit (Figure 5.6) and the real
hardware implementation was performed successfully and the result was observed by
sending SMS to my mobile phone representing the weather parameters with the
predefined message frame in the design chapter.
Amplification
stage
Microcontroller
CHAPTER5 IMPLEMENTATION ANDRESULT
47
Figure 5.3 The complete circuit of HRM
CHAPTER5 IMPLEMENTATION ANDRESULT
48
5.3. Software Implementation
Software implementation was performed by writing C code for ATMEGA32 and
(Appendix A) and then the appropriate performance was obtained as the previously
expected result.
5.4. Result
5.4.1. Fingertip sensor
The output signal is very important for the testing, the signal is correct, the testing
can go on to next step. For this reason, checking the signal before testing is done at the
first step. The circuit is supplied by 5V power. As considering the stable of infrared
sensor, finger needs to place very close to sensor. After checking the amplifier and filter,
the oscilloscope connector is connected to circuit to check the output signal.
Figure 5.4 The output signal by OSCilliscope
The figure (5.3) shown that the output signal is suitable to send to ATMEGA32
microcontroller which it’s similar to the ECG waveform shown in figure (2.2).
CHAPTER5 IMPLEMENTATION ANDRESULT
49
5.4.2. Keypad and LCD
This testing is focusing on the Keypad and LCD can work or not. Code is written
asking the user to enter its name by the keypad. The test is performed in Proteus
simulator environment and in the real world. The figure (5.4) shown that LCD and
keypad are work correctly.
Figure 5.5 Keypad and LCD testing result
5.4.3. Microcontroller as frequency meter
This testing is focusing on the microcontroller can measure the correct frequency.
The low frequency sinusoidal signals that have frequencies in range from 0.1 HZ to 3 HZ
are applied to ADC channel of ATMEGA32. This testing performs in Proteus simulator
and real world environment. In both environments, exact result is obtained shown in
table (5.1).
frequency Result on Proteus Result on real world
1 59 59
2 120 120
2.7 162 162
3 180 179
Table 5.1 The result of mesuring freqency of sinusoidal signals
This approval that Fourier transforms procedure is work correctly and
ATMEGA32 MCU is perfect frequency meter. Thus the heart rate monitor will be
efficient device and work correctly.
CHAPTER5 IMPLEMENTATION ANDRESULT
50
5.4.4. User heart beat pulse testing
After testing the circuit and LCD, the user heart beat pulse can test in complete
device. Five friends of mine attended this test. They are 5 boys and 5 girls.
User placed his finger in middle of the infrared sensor and took a break for 1
minute, next, the program started to run. The infrared sensor detected the heart beat pulse,
and signal was enlarged and filtered by circuit, then MCU take the signal and convert to
digital. This take about 5seconds and then the MCU perform the Fourier transform of the
signal that it takes about 9 seconds. After this, the MCU take about 4 seconds to find the
frequency. The whole process it takes less than minute if we consider the initialization
time and the time required by the user to enter its information.
The performance of HRM device is tested with the output signal
Electrocardiogram (ECG) of fingertip sensor on the oscilloscope for patients. The error
rate is calculated using
" #$ – & ' 100/ $
Here, A ≡Actual heart rate,
M ≡ Measured heart rate, and
E ≡ Error rate
The result of the testing process is represented in table (5.1).
gender Age HR on display HR on oscilloscope Error rate (%)
Male 22 97 96 1.03
Male 22 83 81 2.41
Male 20 78 78 0
Male 22 90 87 3.33
Male 20 80 79 1.25
Female 22 77 77 0
Female 22 104 103 0.96
Female 19 75 75 0
Female 20 69 71 2.81
CHAPTER5 IMPLEMENTATION ANDRESULT
51
Female 22 83 85 2.35
Table 5.2 The result of first testing
The accuracy of the device depends on the testing performed is about 1.414.
In general, the HR of females is higher than males. But this is not true where
difference in weight, daily life (i.e. kind of work, health, inheritance of heart disease,
doing exercises… etc).
Another experiment applied that ask two male volunteer to measure their heart
rate after taking rest for about two minutes and took another measure after running for
five minutes. The device measure compared with manual measurement was measuring by
counting pulse from wrist. The result shown in table (5.2)
age Case HR on display HR by manual measurement
24 Before exercise 65 64
After exercise 90 88
15 Before exercise 91 88
After exercise 110 100
Table 5.3 The result of the secod testing
As summarizing the result from testing, different kind of people have different heart rate;
the first volunteer is a boy who always takes exercise, his heart rate is the lowest. But the other
volunteer is a fat boy, so its HR is the highest during rest and without do any thing.
Before testing, all of them know heart rate is in around 70 times/minute but they think that out of
this range means health problem. After testing, the information is corrected by that the safe range
is between 60 to 120 bpm. Thus providing more response information of body condition such as
heart rate is very important to users, which can help them to know healthy condition, reduce
disease.
5.4.5. Send the SMS
Other test performed to ensure that the warning procedures will applied, when the HR
exceed the maximum allowable HR. this done by entering incorrect information about the age
and gender of the user, in order to get lower MAXHR that any one can exceed it. The testing is
success and the SMS send to the phone number which specified previously.
52
6. CONCLUSION
This chapter discusses the suggestion of future work for the project and
conclusion will be made according to the project development. This thesis has discussed
the development of the fingertip sensor and interfacing with microcontroller and other
peripherals units.
6.1. Discussion
Infrared sensor instead of pressure sensor was used in Heart Rate Monitor, it has
higher sensitivity, and the output signal is more stability. The infrared sensor depends on
the fact that the speed of blood is proportional to heart rate. That is to say, when people
are in high active, the heart rate will change. As the same theory as previous research,
heart rate changes when people are excited. The HR value displayed on LCD shows the
information that when people took exercise, the heart rate will increase; sometimes it is
out of healthy range. When people take a break, the normal heart rate will recover.
In totally, heart rate is physiological indicators to show what is going on in body.
People need to care about their healthy condition with the help of Heart Rate Monitor.
6.2. Problems
Throughout the project life cycle several problems and difficulties were
encountered from several internal and external causes. The following is brief description
of most problems and the ways to overcome them.
1) The fingertip sensor and its accuracy is the big problem since its output signal was
weak and boxed in by movement artifacts noise of the ring and the 50 HZ AC mains
interference. The solution was filtering block these higher frequency noises present in
the signal.
2) The component provide in market especially the component of infrared sensor are
provided without datasheet or name to search about it. This made a problem for us
because we did not know the electrical characteristics of the components. The best
53
solution is trying which this led us to purchase a lot of photodiodes until we found
the reasonable one.
6.3. Accomplishments
All in all, this project achieved a lot of its goals. The project implemented a low
cost, low power heart rate monitoring and alarm system using microcontroller
technology. Lists of accomplishments include:
Adequately acquiring biological signal
Adequately amplifying biological signal
ADC conversion of analog signal
Semi functional heart rate meter
Functional notification and alarm system
LCD heart rate display
Use of low power components for battery operation
6.4. Future work
To ensure the accuracy of heart rate monitor device, more testing can be
performed to larger number of people with different ages and weights.
In terms of making the device more portable, the device would be miniaturized
onto a printed circuit board making it light weight and more stable.
We can develop GUI program to show the heart beat in PCB. Another alternative
we can use free scale microcontroller which use widely in biomedical application to show
the heartbeat because they have GUI program that showing the signals at ADC channels.
The data acquisition system can to become decentralized which means localized
data acquisition systems that are part of the PCB of this device could be built that
wirelessly transmit the signals collected to the decentralized data acquisition system or
directly to the processing centre.
REFERENCES
54
7. References
[1] Sokwoo Rhee “DESIGN AND ANALYSIS OF ARTIFACT-
RESISTIVEFINGER PHOTOPLETHYSMOGRAPHIC SENSORS FOR VITAL
SIGN MONITORING” Massachusetts,U.S, 2001, chapter1,P9.
[2] World health organization, Mortality country fact sheet 2006, Sudan.
[3] World health organization website:
http://www.who.int/mediacentre/factsheets/fs310/en/
[4] Braunwald E. (Editor), “Heart Disease: A Textbook of Cardiovascular Medicine,
Fifth Edition”, Philadelphia, W.B. Saunders Co., 1997, p. 108.
[5] Carlos Casillas, RTAC Americas, “Heart Rate Monitor and Electrocardiograph
Fundamentals”, Guadalajara, Mexico, 2010 , p2,3.
[6] Ken Li CHONG, David HOLDEN, Tim OLIN , “ANALOGUE ELECTRONICS
- Heart Rate Monitor”, p2.
[7] Grajales, L. and I. Nicolaescu., Wearable multisensor heart rate monitor, 2006:
IEEE Journal, pp. 1-4.
[8] M.M.A.Hashem, Rushdi Shams, Md. Abdul Kader, and Md. Abu Sayed, Design
and Development of a Heart Rate Measuring Device using Fingertip, International
Conference on Computer and Communication Engineerin,ICCCE2101, Kuala
Lumpur, Malaysia ,2010.
REFERENCES
55
[9] Gulati M, Shaw LJ, Thisted RA, Black HR, Merz CN, Arnsdorf MF., "Heart Rate
Response to Exercise Stress Testing in Asymptomatic Women", June 2010.
[10] Londeree and Moeschberger (1982), 'Effect of age and other factors on HR max',
Research Quarterly for Exercise & Sport, 53(4), 297-304.
[11] Miller et al (1993), 'Predicting max HR', Medicine & Science in Sports &
Exercise, 25(9), 1077-1081.
[12] USA researchers,Med Sci Sports Exerc 2007 May; 39(5):822-9.
[13] John Moores, University in Liverpool ,the Int J Sports Med 2007;24.
[14] G. M. Azmal, A. Al-Jumaily and M. Al-Jaafreh, "Continuous Measurement of
Oxygen Saturation Level using Photoplethysmography Signal," biomedical and
Pharmaceutical Engineering, 2006. ICBPE 2006.
[15] Yousuf Jawahar, Design of an Infrared based Blood Oxygen Saturation and Heart
Rate Monitoring Device, McMaster University Hamilton, Ontario, Canada April 10,
2009.
[16] Yun-Thai Li, “Pulse Oximetry”, Department of Electronic Engineering, University
of Surrey, Guildford.
[17] Wikipedia – http://en.wikipedia.org/wiki/Main_Page.
[18] Sanderson, K. Cozyris, “The Fourier Series and the Discrete Fourier Transform”,
College of the Redwoods.
[19] “ATMEGA32 datasheet”, 8-bit AVR Microcontroller, 32KB Flash, 40/44-pin,
ATMEL production.
Appendix A: C code
APPE
8. APPEN
code for ATMEGA32
APPENDICIES
A-1
PPENDICIES
APPEAPPENDICIES
A-2
APPEAPPENDICIES
A-3
APPEAPPENDICIES
A-4
APPEAPPENDICIES
A-5
APPEAPPENDICIES
A-8
APPEAPPENDICIES
A-9
APPEAPPENDICIES
A-10
APPENDICIES
B-1
Appendix B: Cost Analysis
Part # Description Qty Manufacturer Unit Cost
(SDG)
Total Cost
(SDG)
ATMEGA32 Microcontroller 1 ATMEL
production
40.00 40.00
LM 358 Dual OP AMP 1 Texas
Instruments
5.00 5.00
Keypad Set of switches 1 shop 35.00 35.00
Infrared
Sensor
Fingertip
sensor
1 shop 5.00 5.00
Buzzer 1 shop 0.50 0.50
FZT649 Transistor 1 Zetex 2.00 2.00
Resistors 10 Shop 0.50 5.00
Capacitors 8 Shop 0.50 4.00
Battery clips 1 Shop 1.00 1.00
LCD 1 Shop 40.00 40.00
9V Battery 1 CODAK 8.00 8.00
GSM modem Lab component - -
TOTAL 145.5
Based on the table that shown the parts list and their costs, the total cost for this
device is SDG145.5. This is a reasonable price; however, it might be a bit expensive for
the users in mind. But these components were purchased individually so it can be cheaper
if we purchase large numbers totally for production.
APPENDICIES
C-1
Appendix C: snapshots for the implemented project
APPENDICIES
C-2