Microcontroller Based Heart Rate
Microcontroller Based Heart Rate
By
Supervisor
A thesis submitted to
University of Khartoum
Faculty of Engineering
Faculty of Engineering
July 2011
Declaration of Originality
Signature: ..............................................................
ii
Dedication
To my beloved family especially my parents and my siblings for their support, not to
forget to all my friends and lecturers...
iii
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.
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.
iv
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.
v
/012345ا
سJhi امMTUVJW XYZDت اJWA\ لM^L سJPZD `LJaUL زJcd AefgR وOPCQR JKLMN ، وعABCDا اF هHI
rdJkD اtkmnأ،مfe M^W JLfe MeاuUR XYZDJW rgmRACDاض اAL أن أJCW .XYZDت اJWA\ لM^L AeMZR jPhkUD lmnoا
.ةMPd rkn نJC\ `d أjL وريA\ AL أ,لfZ^L A^hW وvPN دXYZDت اJWA\ لM^L XNاAe زJcd xYy لfQkYD
تJWA\ لM^L سJPN زJcd .`C^D اrPW lmUR ًا وMd r~YaL XYZDت اJWA\ لM^L سJPN أدواتO^L نI ،D ذlLو
لjL مMD اvIMR jy BaYD rPfD اJPdfDfKaUDم اMTUheل وJC^UV` اcVدي وJQUNز اJcd fح هAUZCD اXYZDا
.rWJmhDا
ةACUhL r~QW XYZDت اJWA\ لM^L PZe r~YaUD~ اTKL زJcd OPCQR f ه،وعABCDا اF هjL فMcDا
rJ xYy ضA^e xYy rPUKDض اAy O lWJn اMiW
ً fnfL اءACkD اtkR r^D سJhi rgVاfW
Jً و وزJًCi mhae JCL rPZgKCDت اJCakUCD اxYy XYZDت اJWA\ لM^L XNاAL `Cy MCU^e .`JhDل اJUheAaDا
سJPNرات وJ` اPYkUD ةMi واrPZgKL OakUL rNJNام رMTUV اjaCe P آriوAح اABR .rآAkD اrPYWJN mhaeًوJ~P~
APeرfI
تefkR HZgKCD اOakUCDم اMTUhe ،وعABCDا اF هHI .HZPZkD اjLuD اHI HZPZkD اXYZDت اJWA\ لM^L
تJWA\ لM^L مJUم اMyء وW jL vZkUYD تJLfY^CD اYR rDJ^CW مfZe O jL و،XYZDت اJWA\ لM^L بJhkD
.W حfChCD اMkD اXYZDت اJW^` رL xgTR م اذاMTUhCD اAeFkR وXYZDا
jPPVرJCCD و اjPP\JeAD` اmN jL JC آ،XYZD اx\AL `mN jL امMTUV
D `WJN JW ،زJcDا اF هuPCUe
.rPLfPDة اJPkD اHI LاMTUVا واMR ارrDfcV ز وJcD وزن اr~ xDد اf^e D ذ.ارACUVJW r\JeAYD
O ،FP~KUD ا،OPCQUD` اiاACW تAL O ،مJy kW rPYC^W `C^D اrg أتMW ،وعABCDاف اM اهvPZkR OUe HaD
ح اهJ وعABCYD HJcKD` اPBUD اay DFD rPU و. ىAة اucd أlL زJcYD rNMDرات اJmUًا اAPر و اJmUا
.tm اJC آvPmgUYD JcUPYWJNو
vi
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
vii
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
viii
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
ix
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
x
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
xi
List of Abbreviations
HRM Heart Rate Monitor
HR Heart Rate
MCU Microcontroller
Msg Message
C C programming Language
IR Infra Red
xii
CHAPTER2 LITERATURE REVIEW
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].
13
CHAPTER2 LITERATURE REVIEW
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.
14
CHAPTER2 LITERATURE REVIEW
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.
• 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
15
CHAPTER2 LITERATURE REVIEW
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.
16
CHAPTER2 LITERATURE REVIEW
2 LITERATURE REVIEW
Figure 2.1 heart behavior and part of the generated signal [7]
17
CHAPTER2 LITERATURE REVIEW
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.
18
CHAPTER2 LITERATURE REVIEW
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].
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.
19
CHAPTER2 LITERATURE REVIEW
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
20
CHAPTER2 LITERATURE REVIEW
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]
5) USA Researchers[12]
6) UK Researchers [13]
To determine your maximum heart rate you could use the following, which
combines the Miller formula with the research from Londeree and Moeschberger.
21
CHAPTER2 LITERATURE REVIEW
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
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.
22
CHAPTER2 LITERATURE REVIEW
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].
23
CHAPTER2 LITERATURE REVIEW
24
CHAPTER2 LITERATURE REVIEW
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.
25
CHAPTER2 LITERATURE REVIEW
FSample ≥ 2 * FHighest
26
CHAPTER2 LITERATURE REVIEW
2.5.4.2. Resolution
The equation which ties the different resolution factors together can be expressed
as
27
CHAPTER2 LITERATURE REVIEW
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].
28
CHAPTER3 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.
29
CHAPTER3 MATERIALS
RIALS AND TOOLS
30
CHAPTER3 MATERIALS AND TOOLS
Component Usage
AVR chip programmer – Kanda Systems Download the HEX file into AMEGA32
STK 200+/300 chip
Interface between GSM modem and
Female RS232 connector
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
Required by crystal oscillator of the
20pf capacitor
microcontroller
To supply GSM voltage levels from a
MAX232
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 Required by the fingertip sensor and
680kΩ resistors microcontroller
Table 3.1 The Auxilary components
Component Usage
code vision AVR C compiler and To edit, simulate C code for Atmega32 and
programmer program it
Proteus simulator To design and simulate electronic circuits
Table 3.2: The software tools
31
CHAPTER4 PROJECT DESIGN
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.
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
32
CHAPTER4 PROJECT DESIGN
As illustrated in F
Figure 4.2, hardware design is classified into two categories:
sensors interfaces circuits
rcuits design, and the entire circuit layout design.
n. On the other hand,
the software design is cla
classified into three categories: microcontroller
roller C code design,
database design, and user iinterface design.
HR measuring
warning
procedures
Software
Design
send msg
procedure
overall
alogrithm
Project Design
Infrared Sensor
Sen
Figertip Sensor
Amplificat
ication
circuit
cuit
Hardware
Circuit Design GSM
M
Peripherals
LCD
interface
KEYPAD
PAD
33
CHAPTER4 PROJECT DESIGN
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.
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.
34
CHAPTER4 PROJECT DESIGN
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.
35
CHAPTER4 PROJECT DESIGN
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
π π
.µ!
36
CHAPTER4 PROJECT DESIGN
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.
37
CHAPTER4 PROJECT DESIGN
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.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.
38
CHAPTER4 PROJECT DESIGN
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.
39
CHAPTER4 PROJECT DESIGN
40
CHAPTER4 PROJECT DESIGN
41
CHAPTER4 PROJECT DESIGN
42
CHAPTER4 PROJECT DESIGN
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
43
CHAPTER4 PROJECT DESIGN
44
CHAPTER5 IMPLEMENTATION ANDRESULT
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:
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.
45
CHAPTER5 IMPLEMENTATION ANDRESULT
Amplification
stage
Microcontroller
46
CHAPTER5 IMPLEMENTATION ANDRESULT
47
CHAPTER5 IMPLEMENTATION ANDRESULT
5.4. Result
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).
48
CHAPTER5 IMPLEMENTATION ANDRESULT
49
CHAPTER5 IMPLEMENTATION ANDRESULT
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.
E ≡ Error rate
50
CHAPTER5 IMPLEMENTATION ANDRESULT
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)
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.
51
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.
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
52
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:
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.
53
REFERENCES
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.
[5] Carlos Casillas, RTAC Americas, “Heart Rate Monitor and Electrocardiograph
Fundamentals”, Guadalajara, Mexico, 2010 , p2,3.
[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.
54
REFERENCES
[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.
[13] John Moores, University in Liverpool ,the Int J Sports Med 2007;24.
[15] Yousuf Jawahar, Design of an Infrared based Blood Oxygen Saturation and Heart
Rate Monitoring Device, McMaster University Hamilton, Ontario, Canada April 10,
2009.
[18] Sanderson, K. Cozyris, “The Fourier Series and the Discrete Fourier Transform”,
College of the Redwoods.
55
APPENDICIES
APPE
8. APPEN
PPENDICIES
A-1
APPENDICIES
APPE
A-2
APPENDICIES
APPE
A-3
APPENDICIES
APPE
A-4
APPENDICIES
APPE
A-5
APPENDICIES
APPE
A-8
APPENDICIES
APPE
A-9
APPENDICIES
APPE
A-10
APPENDICIES
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.
B-1
APPENDICIES
C-1
APPENDICIES
C-2