You are on page 1of 38

HO CHI MINH CITY NATIONAL UNIVERSITY

UNIVERSITY OF TECHNOLOGY
FACULTY OF ELECTRICAL & ELECTRONICS ENGINEERING
---------------o0o---------------

THESIS
HEART RATE MEASUREMENT

Supervisor
Assoc. Professor DANG Thanh Tin

Students
VO Phi Long 31201993
LE Huu Nhan 41202514

HO CHI MINH CITY, DECEMBER 2015


ACKNOWLEDGEMENTS
The authors would like to thank our thesis supervisor, Assoc. Professor DANG Thanh Tin
for the enriching discussions he had with us and his constant support and guidance. We
find it remarkable that Professor Tin has always had our best interest in mind. He has
done his very best to teach us how to conduct quality research. We probably don’t realize
how fortunate we are to have a supervisor so willing to dive into any problem we bring to
him. His enthusiasm for research has been a source of motivation and energy for us.
We also would like to thank everyone in the class VP12VT and VP12NL for all the effort
we make together. Specifically, we would like to thank HOANG Duc Tai, PHAM Quoc
Viet, NGUYEN Tran Quang Khai for helping us create the printed circuit board. Without
you, we could have not made a board in good quality like that. TRINH Quoc Anh is an
awesome classmate. I am always amazed at how willing he is to drop what he is doing to
help me with template or to figure out some problem from research. Finally, for all others,
thank you very much, with your help, we have clarified a lot of problems to pursue a better
result.

ii
ABSTRACT
In this thesis, we presented the design and development of a new 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.
We describe a microcontroller based heart rate measurement system that uses optical
sensors to measure the alteration in blood volume at fingertip with each heartbeat. The
sensor unit consists of an infrared light-emitting-diode (IR LED) and a photodiode, placed
side by side.
The problem of measuring heart rate using optical sensor unit is approached by three
steps in this thesis. First, optical sensor unit is designed to receive the raw light signal.
Second, these signals were counted by a microcontroller module. Finally, display on
computer screen.
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 reports and manual pulse
measurement of heartbeat of 90 human subjects of different ages. The results showed
that the error rate of the device is negligible.
The proposed system is applicable for family, hospital, clinic, community medical
treatment, sports healthcare and other medical purposes. Also, fit for the adults and the
pediatrics. However, presented method in the developed system needs further
investigation and need more functionality, which may be useful to consider advance in
future research.
Thesis Supervisor: Assoc. Professor DANG Thanh Tin
Faculty of Electrical and Electronics Engineering
Ho Chi Minh City University of Technology

iii
PREFACE
This thesis is submitted in partial fulfilment of the requirements for a subject in the
Bachelor of Engineering for both authors. It contains work done from August to November
2015. Our supervisor on the project has been Assoc. Professor Dang Thanh Tin, Ho Chi
Minh City University of Technology. The thesis has been made solely by the authors;
most of the text, however, is based on the research of others, and we have done our best
to provide references to these sources.
In August 2015, our teacher in “Computer system architecture, networking and
microprocessor” at that time, Assoc. Professor Dang Thanh Tin, introduced us to one of
his latest topics: a card intended to measure heart rate automatically. We were both
impressed and intrigued by this means of card, so when he presented a list of projects to
us, including the present one, the choice of the heart rate measurement project was
obvious.
Writing this thesis has been hard but in the process of writing we feel we have
learned a lot and our initial conceptions of heart rate measurement have certainly
changed! We have dealt with a lot of subjects, in an attempt to give this thesis a broad
perspective on heart rate measurement.

iv
Contents
Chapter One INTRODUCTION ...................................................................................... 1
1.1 All about Heart Rate (Pulse) .................................................................................. 1
1.1.1 What should you know about you heart rate? ................................................. 1
1.1.2 Where is it and what is a normal heart rate? ................................................... 1
1.1.3 How other factors affect heart rate .................................................................. 2
1.2 Problem considered ............................................................................................... 2
1.3 Outline of the thesis ............................................................................................... 4
Chapter Two FUNDAMENTAL THEORIES ................................................................... 5
2.1 Overview of Infrared (IR) radiation ......................................................................... 5
2.1.1 Definition ......................................................................................................... 5
2.1.2 Types of IR sensors [8] ................................................................................... 5
2.2 Photoplethysmography (PPG) theory .................................................................... 6
2.3 The advantages of using finger-tip PPG for measuring heart rate ......................... 7
Chapter Three HARDWARE AND SOFTWARE SYSTEM ............................................ 8
3.1 Hardware ............................................................................................................... 8
3.1.1 Circuit diagram ................................................................................................ 8
3.1.2 Electronic elements ....................................................................................... 11
3.2 Software .............................................................................................................. 13
3.2.1 Design Interface with C # .............................................................................. 13
3.2.2 Connect to device ......................................................................................... 14
3.2.3 Algorithm ....................................................................................................... 15
3.2.4 Interface ........................................................................................................ 16
Chapter Four RESULT AND DISCUSSION ................................................................ 20
4.1 Result .................................................................................................................. 20
4.2 Discussion ........................................................................................................... 20
Chapter Five CONCLUSION ....................................................................................... 22
5.1 Conclusion ........................................................................................................... 22
5.2 Further work......................................................................................................... 22
REFERENCES .............................................................................................................. 23
APPENDIX .................................................................................................................... 25
Appendix A. User guide for the Heart Rate Measuring device. .................................. 25
Appendix B. Code for the program ............................................................................ 26
VITAE............................................................................................................................ 28

v
vi
LIST OF FIGURES
Figure 1.1 Human Heart [3] ............................................................................................. 1
Figure 1.2 An ECG normal wave form [5]........................................................................ 3
Figure 2.1 Infrared Region [7] ......................................................................................... 5
Figure 2.2 Active infrared sensor [9]................................................................................ 5
Figure 2.3 Finger PPG (reflectance approach)[11] .......................................................... 6
Figure 2.4 Artery and Vein .............................................................................................. 7
Figure 3.1 Circuit diagram ............................................................................................... 8
Figure 3.2 Computer signal input circuit .......................................................................... 8
Figure 3.3 Pulse sensor circuit [12] ................................................................................. 9
Figure 3.4 Stage I filtering and amplification [12] ............................................................ 9
Figure 3.5 Stage II instrumentation circuit [12] .............................................................. 10
Figure 3.6 Digital pulse output circuit [12] ..................................................................... 10
Figure 3.7 LM324 [13] ................................................................................................... 11
Figure 3.8 18F2550 [15] ................................................................................................ 12
Figure 3.9 C# interface .................................................................................................. 13
Figure 3.10 VID and PID ............................................................................................... 14
Figure 3.11 Flowchart of algorithm ................................................................................ 15
Figure 3.12 Heart Rate Measurement interface ............................................................ 16
Figure 3.13 Flow Chart of the interface ......................................................................... 17
Figure 3.14 Flowchart of “Reset” button ........................................................................ 18
Figure 3.15 Heart Rate pulse chart ............................................................................... 18
Figure 3.16 Heart Rate .................................................................................................. 19
Figure 3.17 Heart Rate each 15s .................................................................................. 19

vii
LIST OF TABLES

Table 1.1 Estimated target heart rates for different ages [4] ........................................... 2
Table 4.1 Comparison between HRM device and AHRM.............................................. 20
Table 4.2 Accuracy comparison with different finger size .............................................. 20

viii
LIST OF ABBREVIATIONS

ECG Electrocardiogram
HRM Heart Rate Measuring
IR Infrared
PPG Photoplethysmography
IR led Infrared light emitting diode
Bpm Beat per minute
HPF High-Pass Filter
LPF Low-Pass Filter
USB Universal Serial Bus
HID Human Interface Device
VID Vector Identification
PID Product Identification
AHRM Automatic Heart Rate Monitor

ix
Chapter One
INTRODUCTION
1.1 All about Heart Rate (Pulse)
1.1.1 What should you know about you heart rate?
The heart [1],[2] is one of the most vital organs within the human body. It acts as a pump
that circulates oxygen and nutrient carrying blood around the body in order to keep it
functioning. The circulated blood also removes waste products generated from the body
to the kidneys. When the body is exerted the rate at which the heart beats will vary
proportional to the amount of effort being exerted.
Even if you’re not an athlete, knowledge about your heart rate can help you monitor your
fitness level — and it might even help you spot developing health problems.
Heart rate, or heart pulse, is the speed of the heartbeat measured by the number of
contractions of the heart per unit of time — typically beats per minute (bpm). The heart
rate can vary according to the body's physical needs, including the need to absorb oxygen
and excrete carbon dioxide. Activities that can provoke change include physical exercise,
sleep, anxiety, stress, illness, ingesting, and drugs.

Figure 1.1 Human Heart [3]


1.1.2 Where is it and what is a normal heart rate?
Your heart rate can be taken at any spot on the body at which an artery is close to the
surface and a pulse can be felt. The places to find easily the pulse are the: wrists, inside
of your elbow, side of your neck, top of the foot. However, the most common places to
measure heart rate using the palpation method is at the wrist (radial artery) and the neck
(carotid artery).
Heartbeat rate is one of the very important parameters of the cardiovascular system. The
heart rate of a healthy adult at rest is around 72 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 at which the

1
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.
Table 1.1 Estimated target heart rates for different ages [4]

Age Target HR Zone 50-85% Average Maximum Heart Rate,


100%
20 years 100-170 beats per minute 200 beats per minute
30 years 95-162 beats per minute 190 beats per minute
35 years 93-157 beats per minute 185 beats per minute
40 years 90-153 beats per minute 180 beats per minute
45 years 88-149 beats per minute 175 beats per minute
50 years 85-145 beats per minute 170 beats per minute
55 years 83-140 beats per minute 165 beats per minute
60 years 80-136 beats per minute 160 beats per minute
65 years 78-132 beats per minute 155 beats per minute
70 years 75-128 beats per minute 150 beats per minute

1.1.3 How other factors affect heart rate


 Air temperature: When temperatures (and the humidity) soar, the heart pumps a
little more blood, so your pulse rate may increase, but usually no more than five to
10 beats a minute.
 Body position: Resting, sitting or standing, your pulse is usually the same.
Sometimes as you stand for the first 15 to 20 seconds, your pulse may go up a
little bit, but after a couple of minutes it should settle down. Emotions: If you’re
stressed, anxious or “extraordinarily happy or sad” your emotions can raise your
pulse.
 Body size: Body size usually doesn’t usually change pulse. If you’re very obese,
you might see a higher resting pulse than normal, but usually not more than 100.
 Medication use: Meds that block your adrenaline (beta blockers) tend to slow your
pulse, while too much thyroid medication or too high of a dosage will raise it.

1.2 Problem considered


Changes in lifestyle and unhealthy eating habits have resulted in a dramatic increase in
incidents of heart and vascular diseases. Furthermore, heart problems are being
increasingly diagnosed on younger patients. Worldwide, Coronary heart disease is now
the leading cause of death. Thus, any improvements in the diagnosis and treatment tools
are welcomed by the medical community. In a clinical environment, heart rate is
measured under controlled conditions like blood measurement, heart beat measurement,
and Electrocardiogram (ECG).

2
Figure 1.2 An ECG normal wave form [5]
However, there is a great need that patients are able to measure the heart rate in the
home environment as well. As aforementioned things, the rate of bpm varied on subject-
to-subject, like age, physical condition and activities. Therefore, to understand and count
the exact bpm from different subjects, it is necessary to develop an easy to use, portable
and low cost heart rate measuring device.
A heart rate measuring device (HRM) is a simple device that takes a sample of the
heartbeat signal and computes the bpm so that the information can easily be used to
track heart conditions.
The measurement of heart rate is used by medical professionals to assist in the diagnosis
and tracking of medical conditions. It is also used by individuals, such as athletes (during
prolonged exercise), who are interested to view their heart rate to acquire maximum
efficiency. There are many ways to count or measure the heart rate from the human body
where the rhythmical throbbing of arteries produced by the accepted contractions of the
heart (pulse-felt). For example, palpated at the wrist or in the neck, from the finger trip
and some other body part. After that an embedded system is needed to interface with
these body parts which will show the machine-readable digital data from the heart. Among
different heart rate monitoring systems, a microcontroller based heart rate monitoring
system from finger-trip (with blood volume) is one of the major concerns in biomedical
technology. In such type of system, the blood volume within a fingertip changes a little
with heart beat as the blood is being pumped. This transform in blood level within the
finger artery can be sensed with an uncomplicated optical sensor system and can be
further amplified using suitable signal conditioning circuit to produce a pulse of magnitude.
These pulses are able to count by a microcontroller chip to exhibit the measured heart
rate. This type of system having the ability to clearly present real heart rate using sensors
and instantly can display the results via computer.

3
1.3 Outline of the thesis
To help follow the thesis easily, we present with the following outline:
Chapter 2 introduces the basic theories needed for the thesis. The theories include the
overview of IR radiation and the photoplethysmography (PPG) theory.
In Chapter 3, hardware and software we have used are briefly introduced to make the
thesis easier to understand. In this chapter, we show the circuit diagrams and then we
explain the working principle of the diagrams. Finally, we introduce the electronic
elements that we use to create the circuit.
Chapter 4 show the results we got and make some discussions.
Finally, in Chapter 5, we come to a conclusion and scope to develop the project in the
future.

4
Chapter Two
FUNDAMENTAL THEORIES
2.1 Overview of Infrared (IR) radiation
2.1.1 Definition
Infrared waves are not visible to the human eye. In the electromagnetic spectrum, infrared
radiation can be found between the visible and microwave regions. The infrared waves
typically have wavelengths between 0.75 and 1000µm. [6]
The wavelength region which ranges from 0.75 to 3µm is known as the near infrared
regions. The region between 3 and 6µm is known as the mid-infrared and infrared
radiation which has a wavelength greater higher than 6µm is known as far infrared.

Figure 2.1 Infrared Region [7]


Infrared technology finds applications in many everyday products. Televisions use an
infrared detector to interpret the signals sent from a remote control. The key benefits of
infrared sensors include their low power requirements, their simple circuitry and their
portable features.
An infrared sensor is an electronic instrument which is used to sense certain
characteristics of its surroundings by either emitting and/or detecting infrared radiation.

2.1.2 Types of IR sensors [8]


Infrared sensors can be passive or active. Passive infrared sensors are basically Infrared
detectors. Passive infrared sensors do not use any infrared source and detects energy
emitted by obstacles in the field of view.

Figure 2.2 Active infrared sensor [9]

5
Active infrared sensors consist of two elements: infrared source and infrared detector.
Infrared sources include an LED or infrared laser diode. Infrared detectors include
photodiodes or phototransistors. The energy emitted by the infrared source is reflected
by an object and falls on the infrared detector.

2.2 Photoplethysmography (PPG) theory


This project is based on the principle of photoplethysmography (PPG) [10] which is a non-
invasive method of measuring the variation in blood volume in tissues using a light source
and a detector. Since the change in blood volume is synchronous to the heart beat, this
technique can be used to calculate the heart rate. Transmittance and reflectance are two
basic types of photoplethysmography. For the transmittance PPG, a light source is
emitted in to the tissue and a light detector is placed in the opposite side of the tissue to
measure the resultant light. Because of the limited penetration depth of the light through
organ tissue, the transmittance PPG is applicable to a restricted body part, such as the
finger or the ear lobe. However, in the reflectance PPG, the light source and the light
detector are both placed on the same side of a body part. The light is emitted into the
tissue and the reflected light is measured by the detector. As the light doesn’t have to
penetrate the body, the reflectance PPG can be applied to any parts of human body. In
either case, the detected light reflected from or transmitted through the body part will
fluctuate according to the pulsatile blood flow caused by the beating of the heart.

The following picture shows a basic reflectance PPG probe to extract the pulse signal
from the fingertip. A subject’s finger is illuminated by an infrared light-emitting diode. More
or less light is absorbed, depending on the tissue blood volume. Consequently, the
reflected light intensity varies with the pulsing of the blood with heart beat. A plot for this
variation against time is referred to be a photoplethysmographic or PPG signal.

Figure 2.3 Finger PPG (reflectance approach)[11]

6
Figure 2.4 Artery and Vein
The PPG signal has two components, frequently referred to as AC and DC. The AC
component is mainly caused by pulsatile changes in arterial blood volume, which is
synchronous with the heartbeat. So, the AC component can be used as a source of heart
rate information. This AC component is superimposed onto a large DC component that
relates to the tissues and to the average blood volume. The DC component must be
removed to measure the AC waveform with a high signal-to-noise ratio. Since the useful
AC signal is only a very small portion of the whole signal, an effective amplification circuit
is also required to extract desired information from it.

2.3 The advantages of using finger-tip PPG for measuring heart rate
In the aforementioned “Photoplethysmography (PPG) theory”, Because of the limited
penetration depth of the light through organ tissue, the transmittance PPG is applicable
to a restricted body part, such as the finger or the ear lobe. However, in the reflectance
PPG, the light source and the light detector are both placed on the same side of a body
part. The light is emitted into the tissue and the reflected light is measured by the detector.
As the light doesn’t have to penetrate the body, the reflectance PPG can be applied to
any parts of human body.
The reflective photoplethysmograph is more convenient to apply when only the heart rate
measurement is interested. The measurement can be taken at any site of skin surface
like: arms, hands other than earlobe and fingertips. However, because of using infrared
light as the main mechanism of action, it leads to a trouble. People who have tattoo on
their skin can’t not using the device. The drawings on their body with dark, bold colors
interfere the light waves then make the device not recognized any more the blood flow.
The user don’t want to remove the tattoos and up to now there is no method to measure
through the tattoos. So the best solution is choosing a place that doesn’t have tattoos and
the choice of using fingertip is reasonable.

7
Chapter Three
HARDWARE AND SOFTWARE SYSTEM
3.1 Hardware
3.1.1 Circuit diagram

Figure 3.1 Circuit diagram

Figure 3.2 Computer signal input circuit

8
The following circuit shows the ON/OFF control scheme for the infra-red light source.
Note that the Enable signal must be pulled high in order to turn on the IR LED. The
photodetector output (VSENSOR) contains the PPG signal that goes to a two-stage filter
and amplifier circuit for further processing.

Figure 3.3 Pulse sensor circuit [12]


The PPG signal coming from the photodetector is weak and noisy. So we need an
amplifier and filter circuits to boost and clean the signal. In Stage I instrumentation, the
signal is first passed through a passive (RC) high-pass filter (HPF) to block the DC
component of the PPG signal. The cut-off frequency of the HPF is 0.5Hz, and is set by
the values of R (=68K) and C (=4.7uF). The output from the HPF goes to an Opamp-
based active low-pass filter (LPF). The Opamp operates in non-inverting mode and has
gain and cut-off frequency set to 48 and 3.4Hz, respectively. In order to achieve a full
swing of the PPG signal at the output, the negative input of the Opamp is tied to a
reference voltage (Vref) of 2.0V. The Vref is generated using a zener diode. At the output
is a potentiometer (P1) that acts as a manual gain control. The output from the active LPF
now goes to Stage II instrumentation circuit, which is basically a replica of the Stage I
circuit. Note that the amplitude of the signal going to the second stage is controlled by
P1. The Opamp used in this project is LM324, which is a Quad-Opamp device and
provides rail-to-rail output swing.

Figure 3.4 Stage I filtering and amplification [12]

9
The second stage also consists similar HPF and LPF circuits. The two-step amplified and
filtered signal is now fed to a third Opamp, which is configured as a non-inverting buffer
with unity gain. The output of the buffer provides the required analog PPG signal. The
potentiometer P1 can be used to control the amplitude of the PPG signal appearing at the
output of the buffer stage.

Figure 3.5 Stage II instrumentation circuit [12]


The fourth Opamp inside the LM324 device is used as a voltage comparator. The analog
PPG signal is fed to the positive input and the negative input is tied to a reference voltage
(VR). The magnitude of VR can be set anywhere between 0 and Vcc through
potentiometer P2 (shown below). Every time the PPG pulse wave exceeds the threshold
VR, the output of the comparator goes high. Thus, this arrangement provides an output
digital pulse synchronous to heart beat. Note that the width of the pulse is also determined
by VR. An LED connected to the digital output blinks accordingly.

Figure 3.6 Digital pulse output circuit [12]

10
Output :
The use of this device is very simple. Turn the power on, and you will see all zeros on
display for few seconds. Wait till the display goes off. Now place your forefinger tip on the
sensor assembly, and press the start button. Just relaxed and don’t move your finger.
You will see the LED blinking with heart beats, and after 15 sec, the result will be
displayed.

3.1.2 Electronic elements


3.1.2.1 LM324 - Low Power Quad Operational Amplifiers [13]
General Description
The LM124 series [14] consists of four independent, high gain, internally frequency
compensated operational amplifiers which were designed specifically to operate from a
single power supply over a wide range of voltages. Operation from split power supplies
is also possible and the low power supply current drain is independent of the magnitude
of the power supply voltage. Application areas include transducer amplifiers, DC gain
blocks and all the conventional op amp circuits which now can be more easily
implemented in single power supply systems. For example, the LM124 series can be
directly operated off of the standard +5V power supply voltage which is used in digital
systems and will easily provide the required interface electronics without requiring the
additional ±15V power supplies.

Figure 3.7 LM324 [13]


Unique Characteristics
In the linear mode the input common-mode voltage range includes ground and the output
voltage can also swing to ground, even though operated from only a single power supply
voltage.
The unity gain cross frequency is temperature compensated
The input bias current is also temperature compensated
Advantages
Eliminates need for dual supplies
Four internally compensated op amps in a single package
Allows directly sensing near GND and VOUT also goes to GND

11
Compatible with all forms of logic
Power drain suitable for battery operation
Features
Internally frequency compensated for unity gain
Large DC voltage gain 100 dB
Wide bandwidth (unity gain) 1 MHz (temperature compensated)
Wide power supply range: Single supply 3V to 32V or dual supplies ±1.5V to ±16V
Very low supply current drain (700 µA) — essentially independent of supply voltage
Low input biasing current 45 nA (temperature compensated)
Low input offset voltage 2 mV and offset current: 5 nA
Input common-mode voltage range includes ground
Differential input voltage range equal to the power supply voltage
Large output voltage swing 0V to V +− 1.5V

3.1.2.2 18F2550

Figure 3.8 18F2550 [15]


The 18F2550 [15] is the same as the 18F4550 except it is in a 28 pin package and has
no SSP port but it does have the USB port.
The 18F2550 is a microcontroller for more demanding applications having lots of program
memory (16k) and RAM (2k) and a full USB interface - V2.0 Compliant (Low Speed
(1.5Mb/s) and Full Speed (12Mb/s).
You can run the external clock up to 48MHz and if using a lower external clock the internal
PLL will run high enough so that the USB clock operates at the correct speed. So this
microcontroller can operate at 48MHz! - but remember the internal clock is Fosc/4 so the
MIPS rate is 12MIPSi.e. the real operating frequency is 12MHz.
It comes in a 28 pin package and is also optimized for C programming (75 standard + 8
extra instrucitons) and it uses nano watt technology.
Once again the device uses ICSP for programming and you can program it in circuit if
you design the interface correctly.
As with all the 18F series there is a built in 8x8 hardware multiplier so your calculations
will run much faster.

12
3.2 Software
3.2.1 Design Interface with C #
C# (pronounced "C sharp") is a programming language that is designed for building a
variety of applications that run on the .NET Framework. C# is simple, powerful, type-safe,
and object-oriented. The many innovations in C# enable rapid application development
while retaining the expressiveness and elegance of C-style languages.
Visual C# is an implementation of the C# language by Microsoft. Visual Studio supports
Visual C# with a full-featured code editor, compiler, project templates, designers, code
wizards, a powerful and easy-to-use debugger, and other tools. The .NET Framework
class library provides access to many operating system services and other useful, well-
designed classes that speed up the development cycle significantly.
An interface contains only the signatures of methods, properties, events or indexers. A
class or struct that implements the interface must implement the members of the interface
that are specified in the interface definition.
C # interface includes 3 basic areas:

Figure 3.9 C# interface


Area 1: Toolbox, it allows us to add tools to the interface. Example: Button, Graph, Label,
Status,...
Area 2: Area where we design the interface.
Area 3: Where we can customize the parameters of the interface, tools and we can create
Events for Tools,... Includes several tabs: Properties, Solution Explorer, Class View, ..
An interface can be a member of a namespace or a class and can contain signatures of
the following members:
 Methods
 Properties
 Indexers
 Events

13
An interface can inherit from one or more base interfaces.
When a base type list contains a base class and interfaces, the base class must come
first in the list.
A class that implements an interface can explicitly implement members of that interface.
An explicitly implemented member cannot be accessed through a class instance, but only
through an instance of the interface.

3.2.2 Connect to device


3.2.2.1 Library for connect to device: USBHid
This is a library that allows us to communicate with HID (Human Interface Device) via
USB port.
Some basic functions:
• Connect the device.
• Receive data from the device.
• Disconnect the device.

3.2.2.2 VID and PID

Figure 3.10 VID and PID


To connect properly to the destination device we only need to declare a variable name
“Device” belong to class UsbHid which have the VID and PID coincide with the
parameters of the device.

14
3.2.3 Algorithm

Begin

Flag = false
Count = 0
timeStart = Environment.TickCount

signal > 350

True

Flag = true

signal < 350

True

Flag = true
Count = Count +1

t = Environment.TickCount - timeStart

False
t >= 15s

True

Heart rate = Count / t * 60s

Print the Heart rate

Figure 3.11 Flowchart of algorithm

15
Signal that we received via USB port from the heart rate circuit is a pulse that has
amplitude of 0 to 700. And this is a periodic pulse, every cycle is a heartbeat. Therefore,
to measure heart rate, we shall count the cycles that we receive from pulse.
To facilitate the heartbeat count, we use a “Flag” to mark up and down in value a pulse.
When the value of received pulses is greater than 350, we will give “Flag” = True, and
when the value of received pulses is less than 350, we will give “Flag” = False. To count
the heart rate, when “Flag” is ‘false’, we will add a cycle. And we will count the number of
beats for 15 seconds, then the number of beats divide by the total counted time and
multiply by 60s. This will give the heart rate for a minute (bpm).
And every 15 seconds, we will take the heart rate to the screen. While we reset the
variable to the initial value.

3.2.4 Interface

Figure 3.12 Heart Rate Measurement interface

16
BEGIN

‘Start’ button: Enable


‘Stop’ button: Disable

Click ‘Start’? False


Device is connected?

True
‘Start’ button: Disable
‘Stop’ button: Enable
Calculate the heart rate

Print the Heart rate


Pulse drawing

True Click ‘Stop’? False


Or
Device is disconnected?

Figure 3.13 Flow Chart of the interface

17
 Flowchart of ‘Reset’ button:

Current State

False Click
‘Reset’?

True

Reset ‘Time’ and “Count’


Clear the value in ‘textBox’

Figure 3.14 Flowchart of “Reset” button


 Pulse chart
Here, we use the library ZedGraph to draw the pulse we received from the device.
This library supports ZedGraphControl Toolbox to add graphs to the interface.
The basic functions:
 Changes ratio coordinate system.
 Data Collection (list of claims data received) to graph.
 Assign a name to the coordinate axes, the graph lines.

Figure 3.15 Heart Rate pulse chart

18
 Calculate and display the heart rate

Figure 3.16 Heart Rate


This ‘Textbox’ is used to display ‘Heart Rate’.
‘Heart rate’ is calculated by the following formula:

' Count(beat)
'Heart Rate (bpm)= ×60000(ms) (1)
Time(ms)

 ‘Heart Rate’: the number of beats per minute


 Count: the number of beats are counted in interval ‘Time’
 Time: the time to count the beat
In this textbox, the heartbeat value will be displayed continuously during measurement.
This value is not fixed for be calculated continuously during measurement. However, if
measured as long as the value is correct.

Figure 3.17 Heart Rate each 15s

This ‘Textbox’ is used to display ‘Heart Rate’ each 15s.


This value is calculated same as above, however, after each 15 seconds, then the 'Count'
and 'Time' value will be counted again. And in this textbox, the value is only displayed
after the end of 15s.
This value is fixed in 15s. However, the accuracy is not high because it only counts for a
period of 15s.

19
Chapter Four
RESULT AND DISCUSSION
4.1 Result
The performance of HRM device is tested with the output of an automatic heart rate
monitor –AHRM (National) for 10 patients. The error rate is calculated using (2)

𝜀 = (|𝐴 − 𝑀| × 100 ) ÷ 𝐴 (2)

Table 4.1 Comparison between HRM device and AHRM

Number Female HRM AHRM (National) Error (%)


1 62 63 1.58
2 x 119 120 0.83
3 62 63 1.58
4 69 69 0.00
5 76 75 1.33
6 75 73 2.74
7 x 91 92 1.10
8 x 100 101 0.99
9 123 125 1.60
10 65 65 0.00

4.2 Discussion
Overall evaluation
As we can notice, the board works very well in normal condition. The errors are small and
acceptable. However, we can find out the reasons that make the errors and minimize
them to have much accurate results.
Causes of the errors
Firstly, the errors are existed due to the limitation of the sensor. It is affected by the
environment light and the movement of the finger-tip. If the movement is considerable,
the error will be high.
Secondly, the accuracy may defer depending on the circumference size of the finger of
the user. We also measured the error rate depending on the finger size and found that
HRM device works well with medium-sized fingers. The result is shown in Table 4.2.

Table 4.2 Accuracy comparison with different finger size

Finger circumference size Error rate (%)


Big finger (3.0’’) 2.5
Medium finger (2.5’’) 0.65
Small finger (2.0’’) 1.6

20
Finally, the accuracy of the board is depend on the accuracy of the printed circuit board.
We have made two different printed circuit boards and the much precision works with
lower error.
Solutions to improve the accuracy
To solve the problems above, we would like to put forward some solutions below:
- Reduce all the movements of the finger-tip when measuring the heart rate. We can
do that by notice the users not to move theirs finger-tip while using the HRM device.
- Make the printed circuit board with higher accuracy so that we can have a HRM
device with higher performance.

21
Chapter Five
CONCLUSION
The aim of this work was to determine to the efficient of the heart rate measurement
device. Here follows a brief discussion as well as conclusions.

5.1 Conclusion
The design and development of a Heart Rate Measuring device is presented that
measures the heart rate efficiently in a short time and with less expense without using
time consuming and expensive clinical pulse detection systems.
The device is ergonomic, portable, durable and cost effectively. The Heart Rate
Measurement device is efficient and easy to use.
Tests have shown excellent agreement with actual heartbeat rates. The device could also
be used in clinical and nonclinical environments.

5.2 Further work


It is possible to see several different continuations to this work. Here are some
possibilities:
- Keep on studying the principle of IR sensor.
- Find other solutions to minimize the error of the device.
- Consider the ability of measuring heart rate not using the finger-tip or develop a
non-touch method to measure the heart rate.

22
REFERENCES
[1] “Human Heart”, available at : http://www.livescience.com/34655-human-heart.html,
accessed on Nov 4th 2015.

[2] “Heart”, available at: http://www.innerbody.com/image/card01.html, accessed on Nov


9th 2015.

[3] Wikipedia, “Heart Rate”, available at www.en.wikipedia.org/wiki/Heart_rate, accessed


on Nov 11th 2015.

[4] “Target Heart Rate”, available at:


http://www.heart.org/HEARTORG/GettingHealthy/PhysicalActivity/FitnessBasics/Targ
et-Heart-Rates_UCM_434341_Article.jsp, accessed on Dec 12th 2015.

[5] Normal ECG, available at: http://lifeinthefastlane.com/ecg-library/basics/p-wave/,


accessed on Dec 11th 2015.

[6] Wikipedia, “Infrared”, available at: https://en.wikipedia.org/wiki/Infrared, accessed on


Nov 2nd 2015.

[7] Infrared Waves, available at:


http://missionscience.nasa.gov/ems/07_infraredwaves.html, accessed on Dec 17th
2015.

[8] The Working Principle and Key Applications of Infrared Sensors, available at:
http://www.azosensors.com/Article.aspx?ArticleID=339, accessed on Nov 15th 2015.

[9] IR sensor, available at: http://www.electronicshub.org/ir-sensor/, accessed on Nov


19th 2015.

[10] Photoplethysmography and its application in clinical physiological measurement,


available at: http://iopscience.iop.org/article/10.1088/0967-3334/28/3/R01/meta,
accessed on Dec 3rd 2015.

[11] Introducing Easy Pulse, available at: http://embedded-lab.com/blog/introducing-easy-


pulse-a-diy-photoplethysmographic-sensor-for-measuring-heart-rate/, accessed on
Nov 6th 2015.

[12] Introducing Easy Pulse, available at: http://embedded-lab.com/blog/introducing-easy-


pulse-a-diy-photoplethysmographic-sensor-for-measuring-heart-rate/, accessed on
Nov 2nd 2015.

23
[13] LM324, available at: http://www.alldatasheet.com/view.jsp?Searchword=Lm324,
accessed on Dec 8th 2015.

[14] LMx24 series, available at: http://www.ti.com/lit/ds/symlink/lm124-n.pdf, accessed on


Dec 8th 2015.

[15] Pic18F2550, available at:


http://www.microchip.com/wwwproducts/Devices.aspx?product=PIC18F2550,
accessed on Nov 23rd 2015.

[16] M.M.A.Hashem, Rushdi Shams, Md. Abdul Kader, and Md. Abu Sayed, “Design and
Development of a Heart Rate Measuring Device using Fingertip”,

[17] Sharif Babiker, “Microcontroller based Heart Rate Monitor using Fingertip Sensors”

[18] Kimmo Lasanen, “Integrated Analogue CMOS and Structure for Heart Rate
detectors”

[19] MAMUN, A. L.,AHMED, “A Microcontroller-Based automatic Heart Rate counting


system from fingertip”

[20] Daniel Torres, “Build A Wrist Heart-Rate Monitor Using An Ultra-Low-Power MC”,
available at : http://electronicdesign.com/, accessed on Nov 8th 2015.

[21] Build Your Own Heart Rate Monitor, available at:


http://www.ni.com/example/31560/en/, accessed on Dec 10th 2015.

24
APPENDIX
Appendix A. User guide for the Heart Rate Measuring device.

Step 1: Connect the circuit board to the computer using the USB cable.
Step 2: Run the application Heart Rate Measurement as show in the figure below.

Step 3: Put the finger-tip on the sensor likes the figure below. Fix your finger-tip and avoid
making movements so as to minimize the error.

Step 4: Press “Start” button. The device is now measuring your heart rate and show the
result on screen. You will see 3 parameters:
- The pulse graph of your heart rate.
- The average Heart Rate.
- The average Heart Rate after each 15s.

25
Appendix B. Code for the program

Usb connect
private void Heart_Rate_Load(object sender, EventArgs e)
{
Device = new UsbHidDevice(0x1234, 0x0001);
Device.OnConnected += DeviceOnConnected;
Device.OnDisConnected += DeviceOnDisConnected;
Device.DataReceived += DeviceDataReceived;

GraphPane myPane = zedGraphControl1.GraphPane;


myPane.Title.Text = "Heart Rate";
myPane.XAxis.Title.Text = "Time (s)";
myPane.YAxis.Title.Text = "";

RollingPointPairList list1 = new RollingPointPairList(2000);

LineItem curve1 = myPane.AddCurve("", list1, Color.Blue,


SymbolType.None);
timer1.Interval = 5;
timer1.Enabled = true;
timer1.Start();

myPane.XAxis.Scale.Min = 0;
myPane.XAxis.Scale.Max = 1;
myPane.XAxis.Scale.MinorStep = 1;
myPane.XAxis.Scale.MajorStep = 5;

zedGraphControl1.AxisChange();

tickStart = Environment.TickCount;

Status.Text = "Device hasn't been connected! Click 'Start' ";


button_Stop.Enabled = false;
}

26
Calculate the Heart Rate

private void DeviceDataReceived(byte[] data)


{
double.TryParse(ByteArrayToString(data), out signal);

if (signal > 350)


{
flag = true;
}
if ((signal < 350) & (flag))
{
flag = false;
count = count + 1;
count1 = count1 + 1;
}
t = Environment.TickCount - timeStart;

if (t >= 15000)
{
avr = (int)(count / t * 60000);
AppendText1(avr.ToString());
count = 0;
timeStart = Environment.TickCount;
}
draw(signal);

t1 = Environment.TickCount - timeStart1;
avr1 = (int)(count1 / t1 * 60000);
AppendText(avr1.ToString());

27
VITAE

PERSONAL INFORMATION
Name : VO Phi Long
Date of Birth : 3rd April 1994
Gender : Male
Address : 09, street 442, Ben Co ward,
Phu Hoa Dong village, Cu Chi
district, Ho Chi Minh City.
Telephone No. : (+84)1692476086
Email : philong.hcmut@gmail.com

EDUCATION
 2012 – 2015 Ho Chi Minh University of Technology
Major : Energy system
Academic year :4
Current GPA : 7.12/10

ACADEMIC ACHIEVEMENTS
 Engineering design project:
Design IR Transmitter and Receiver Circuit using PT2248 and PT2249 (3rd
academic year).
 Informatics project:
Image compression and decompression using Fourier transform (3rd academic
year).
 Project of Analog and Digital Modulation:
AM- Amplitude Modulation using TMS320 c5515 (4th academic year).

28
PERSONAL INFORMATION
Name : LE Huu Nhan
Date of Birth : 17th April 1994
Gender : Male
Address : 20/24/18A Pham Ngoc Street,
Tan Phu District, Ho Chi Minh
City.
Telephone No. : (+84)1234433522
Email : nhanlehuu174@gmail.com

EDUCATION
 2012 – 2015 Ho Chi Minh University of Technology
Major : Energy system
Academic year :4
Current GPA : 6.92/10

ACADEMIC ACHIEVEMENTS
 Engineering design project:
Design IR Transmitter and Receiver Circuit using PT2248 and PT2249 (3rd
academic year).
 Informatics project:
Image compression and decompression using Fourier transform (3rd academic
year).
 Project of Analog and Digital Modulation:
SSB modulation with IC MC1496 (4th academic year).

29

You might also like