Download measuring the heart rate

Document related concepts

Heart failure wikipedia , lookup

Coronary artery disease wikipedia , lookup

Quantium Medical Cardiac Output wikipedia , lookup

Myocardial infarction wikipedia , lookup

Cardiac surgery wikipedia , lookup

Electrocardiography wikipedia , lookup

Heart arrhythmia wikipedia , lookup

Dextro-Transposition of the great arteries wikipedia , lookup

Transcript
CHAPTER 1
INTRODUCTION
1.1 What is Heart Rate?
Heart rate is the number of heartbeats per unit of time, typically expressed as beats per minute
(bpm). Heart rate can vary as the body's need to absorb oxygen and excrete carbon dioxide
changes, such as during physical exercise or sleep.
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, who are
interested in monitoring their heart rate to gain maximum efficiency from their training. The
R wave to R wave interval (RR interval) is the inverse of the heart rate.[2]
Figure 1.1 Wave Interval
Heart rate is simply and traditionally measured by placing he thumb over the subject’s arterial
pulsation, and feeling, timing and counting the pulses usually in a 30 second period. Heart
rate (bpm) of the subject is then found by multiplying the obtained number by 2. This method
1
although simple, is not accurate and can give errors when the rate is high. More sophisticated
methods to measure the heart rate utilize electronic techniques. Electro-cardiogram (ECG) is
one of frequently used and accurate methods for measuring the heart rate. ECG is an
expensive device and its use for the measurement of the heart rate only is not economical.
Low-cost devices in the form of wrist watches are also available for the instantaneous
measurement of the heart rate. Such devices can give accurate measurements but their cost is
usually in excess of several hundred dollars, making them uneconomical. Most hospitals and
clinics in the UK use integrated devices designed to measure the heart rate, blood pressure,
and temperature of the subject. Although such devices are useful, their cost is usually high
and beyond the reach of individuals.[2]
1.1.2 Measurement of Heart Rate
Heart rate is measured by finding the pulse of the body. This pulse rate can be measured at
any point on the body where the artery's pulsation is transmitted to the surface by pressuring it
with the index and middle fingers; often it is compressed against an underlying structure like
bone. The thumb should not be used for measuring another person's heart rate, as its strong
pulse may interfere with correct perception of the target pulse.[2]
Possible points for measuring the heart rate are:
* The ventral aspect of the wrist on the side of the thumb (radial artery).
* The ulnar artery.
* The neck (carotid artery).
* The inside of the elbow, or under the biceps muscle (brachial artery).
* The groin (femoral artery).
* Behind the medial malleolus on the feet (posterior tibial artery).
2
1.1.3 Measuring HRmax
The most accurate way of measuring HRmax for an individual is via a cardiac stress test. In
such a test, the subject exercises while being monitored by an EKG. During the test, the
intensity of exercise is periodically increased (if a treadmill is being used, through increase in
speed or slope of the treadmill), or until certain changes in heart function are detected in the
EKG, at which point the subject is directed to stop. Typical durations of such a test range
from 10 to 20 minutes.
Conducting a maximal exercise test can require expensive equipment. If you are just
beginning an exercise regimen, you should only perform this test in the presence of medical
staff due to risks associated with high heart rates. Instead, people typically use a formula to
estimate their individual Maximum Heart Rate.[2]
1.1.4 Formula for HRmax
Various formulas are used to estimate individual Maximum Heart Rates, based on age, but
maximum heart rates vary significantly between individuals.
Even within a single elite sports team, such as Olympic rowers in their 20s, maximum heart
rates can vary from 160 to 220. It gained widespread use through being used by Polar Electro
in its heart rate monitors,)
These figures are very much averages, and depend greatly on individual physiology and
fitness. For example an endurance runner's rates will typically be lower due to the increased
size of the heart required to support the exercise, while a sprinter's rates will be higher due to
the improved response time and short duration., etc. may each have predicted heart rates of
180 (= 220-Age), but these two people could have actual Max HR 20 beats apart (e.g. 170190).
Further, note that individuals of the same age, the same training, in the same sport, on the
same team, can have actual Max HR 60 bpm apart (160 to 220):[2]
3
Training regimes sometimes use recovery heart rate as a guide of progress and to spot
problems such as overheating or dehydration . After even short periods of hard exercise it can
take a long time (about 30 minutes) for the heart rate to drop to rested levels.
1.1.5 Why do you need to monitor your heart rate?
Measuring heart rate gives very important information about your health. Any change from
normal heart rate can indicate a medical condition. It can help determine if the patient's heart
is still pumping, particularly in emergency situations.
The pulse measurement has another use as well. During exercise or immediately after
exercise, the heart rate can give information about your cardiovascular fitness level and
health. To receive the complete benefits of a workout, you need to stay in your working heart
rate range for at least 20 to 30 minutes continuously. Therefore, proper pacing during exercise
is important. There are three different heart rates which you should keep in mind:[3]
1.1.6 Resting Heart Rate
This is a person's heart rate at rest. The best time to find out your resting heart rate is after
sitting quietly for a while or before you get out of bed after a good night sleep. The normal
resting heart rate is about 60 to 80 beats a minute when we are at rest. Resting heart rate
usually rises with age, but generally lowers in physically fit people. Moreover, resting heart
rate is used to determine one's training target heart rate and to find out if you are overtrained[3]
1.1.7 Working Heart Rate Range
Figure 1.1.7 Heart Rate
4
Figure 1.1.7 Target Heart Rate
1.1.8 Understanding the Heart's Electrical System
To understand arrhythmias, it helps to understand the heart's internal electrical system. The
heart's electrical system controls the rate and rhythm of the heartbeat.
With each heartbeat, an electrical signal spreads from the top of the heart to the bottom. As
the signal travels, it causes the heart to contract and pump blood.
Each electrical signal begins in a group of cells called the sinus node or sinoatrial (SA) node.
The SA node is located in the heart's upper right chamber, the right atrium (AY-tree-um). In a
5
healthy adult heart at rest, the SA node fires off an electrical signal to begin a new heartbeat
60 to 100 times a minute.[3]
Figure 1.1.8 Electrical Signal Node
From the SA node, the electrical signal travels through special pathways in the right and left
atria. This causes the atria to contract and pump blood into the heart's two lower chambers,
the ventricles (VEN-trih-kuls).
The electrical signal then moves down to a group of cells called the atrioventricular (AV)
node, located between the atria and the ventricles. Here, the signal slows down just a little,
allowing the ventricles time to finish filling with blood.
The electrical signal then leaves the AV node and travels along a pathway called the bundle of
His. This pathway divides into a right bundle branch and a left bundle branch. The signal goes
down these branches to the ventricles, causing them to contract and pump blood to the lungs
and the rest of the body.
The ventricles then relax, and the heartbeat process starts all over again in the SA node.A
problem with any part of this process can cause an arrhythmia. For example, inatrial
fibrillation , a common type of arrhythmia, electrical signals travel through the atria in a fast
and disorganized way. This causes the atria to quiver instead of contract.[3]
6
1.2 ABNORMALITIES OF HEART RATE
Figure 1.2 The Heart
1.2.1 Tachycardia
Tachycardia is a resting heart rate more than 100 beats per minute. This number can vary as
smaller people and children have faster heart rates than average adults.
Physiological conditions when tachycardia occurs are [4]
1. Exercise
2. Pregnancy
3. Emotional conditions such as anxiety or stress.
Pathological conditions when tachycardia occurs are:
1. Fever
2. Anemia
3. Hypoxia
4. Hyperthyroidism
5. Hyper secretion of catecholamine
7
6. Cardiomyopathy
7. Valvular heart diseases
8. Acute Radiation Syndrome
Figure 1.2.1 Tachycardia
1.2.2 Bradycardia
Bradycardia is defined as a heart rate less than 60 beats per minute although it is seldom
symptomatic until below 50 bpm when a human is at total rest. This number can vary as
children and small adults tend to have faster heart rates than average adults. Bradycardia may
be associated with medical conditions such as hypothyroidism.
Trained athletes tend to have slow resting heart rates, and resting bradycardia in athletes
should not be considered abnormal if the individual has no symptoms associated with it. For
example Miguel Indurain, a Spanish cyclist and five time Tour de France winner, had a
resting heart rate of 28 beats per minute, one of the lowest ever recorded in a healthy
human.[5]
8
Figure 1.2.2 Bradycardia
1.2.3 Arrhythmia
Arrhythmias are abnormalities of the heart rate and rhythm (sometimes felt as palpitations).
They can be divided into two broad categories: fast and slow heart rates. Some cause few or
minimal symptoms. Others produce more serious symptoms of lightheadedness, dizziness and
fainting.
For the purpose of this project, I am going to focus on measurement of heart rate from the
finger. Before I begin, I would like to provide information on the human finger, so that this
topic will be very well understood and appreciated.[5]
Figure 1.2.3 Arrhythmia
9
1.3 The Finger(s)
A finger is a limb of the human body and a type of digit, an organ of manipulation and
sensation found in the hands of humans and other primates. Normally humans have five
digits, the bones of whom are termed phalanges, on each hand (exceptions are polydactyly,
oligodactyly and digit loss).
 The first digit is the Thumb
 followed by index finger
 middle finger
 ring finger
 And little finger or pinky.
Some other languages use the same generic term for all five digits of a hand[6]
1.3.1 Anatomy of the Human Fingers
10
1.3.1.1 Bones
The thumb (connected to the trapezium) is located on one of the sides, parallel to the arm.
The palm has five bones known as metacarpal bones, one to each of the 5 digits. Human
hands contain fourteen digital bones, also called phalanges, or phalanx bones: two in the
thumb (the thumb has no middle phalanx) and three in each of the four fingers. These are the
distal phalanx, carrying the nail, the middle phalanx, and the proximal phalanx.
Figure 1.3.1 Anatomy of The Human Fingers
11
Sesamoid bones are small ossified nodes embedded in the tendons to provide extra leverage
and reduce pressure on the underlying tissue. Many exist around the palm at the bases of the
digits; the exact number varies between different people.
The articulations are: interphalangeal articulations between phalangeal bones, and
metacarpophalangeal joints connecting the phalanges to the metacarpal bones. They’re all
synovial joints with synovial membranes and fibrous joint capsules.[7]
 Metacarpophalangeal joints: Connecting the proximal phalanges to the metacarpals
are condyloid joints with strong palmar and collateral ligaments that allow for
movement in different directions (flexion, extension, abduction, adduction,
circumduction). You may recognize them as your knuckles.
 Interphalangeal joints: These hinge joints allow flexion and extension. They join the
heads of the phalanges with the bases of the next distal phalanges. Each finger (digits
two through five) has one proximal interphalangeal joint and one distal
interphalangeal joint. The thumb has only one interphalangeal joint. [7]
The pulp of a finger is the fleshy mass on the palmar aspect of the extremity of the finger.
Figure 1.3.1.1 Finger Bones
Figure 1.3.1.1 Finger Joint
12
1.3.1.2 Muscles
Each finger may flex and extend, abduct and adduct, and so also circumduct. Flexion is by
far the strongest movement. In humans, there are two large muscles that produce flexion of
each finger, and additional muscles that augment the movement. Each finger may move
independently of the others, though the muscle bulks that move each finger may be partly
blended, and the tendons may be attached to each other by a net of fibrous tissue, preventing
completely free movement.[8]
Fingers do not contain muscles other than arrector pili muscles. The muscles that move the
finger joints are in the palm and forearm. The long tendons that deliver motion from the
forearm muscles may be observed to move under the skin at the wrist and on the back of the
hand.
Muscles of the fingers can be subdivided into extrinsic and intrinsic muscles. The extrinsic
muscles are the long flexors and extensors. They are called extrinsic because the muscle belly
is located on the forearm.
The fingers have two long flexors, located on the underside of the forearm. They insert by
tendons to the phalanges of the fingers. The deep flexor attaches to the distal phalanx, and the
superficial flexor attaches to the middle phalanx. The flexors allow for the actual bending of
the fingers. The thumb has one long flexor and a short flexor in the thenar muscle group. The
human thumb also has other muscles in the thenar group (opponens and abductor brevis
muscle), moving the thumb in opposition, making grasping possible.[8]
Figure 1.3.1.2 Hand Muscles
13
The extensors are located on the back of the forearm and are connected in a more complex
way than the flexors to the dorsum of the fingers. The tendons unite with the interosseous and
lumbrical muscles to form the extensorhood mechanism. The primary function of the
extensors is to straighten out the digits. The thumb has two extensors in the forearm; the
tendons of these form the anatomical snuff box. Also, the index finger and the little finger
have an extra extensor, used for instance for pointing. The extensors are situated within 6
separate compartments. The 1st compartment contains abductor pollicis longus and extensor
pollicis brevis. The 2nd compartment contains extensors carpi radialis longus and brevis. The
3rd compartment contains extensor pollicis longus. The extensor digitorum indicis and
extensor digititorum communis are within the 4th compartment. Extensor digiti minimi is in
the fifth, and extensor carpi ulnaris is in the 6th.
The intrinsic muscle groups are the thenar and hypothenar muscles (thenar referring to the
thumb, hypothenar to the small finger), the dorsal and palmar interossei muscles (between the
metacarpal bones) and the lumbrical muscles. The lumbricals arise from the deep flexor (and
are special because they have no bony origin) and insert on the dorsal extensor hood
mechanism.[8]
Table 1.3.1.2 Action of the Intrinsic Muscle
14
Figure 1.3.1.3 Arm Muscles
Nerve Supply and Blood Flow To The Wist and Hand
This aspect of my background report on my project is very important, as it brings us closer to
the measurement of blood flow / heart rate from the finger.
Busy muscles need plenty of nerve supply and blood flow. Three main nerves (plus all their
branches) work the wrist and hand, and many arteries and veins bring blood into and out of
the hand.
1.3.1.3 The Nerves
The main nerves you need to know for the wrist and hand come from the median, ulnar, and
radial nerves. These nerves supply the skin, muscles, joints, and other tissues. The nerves
allow you to feel what your hands and fingers are touching and help you move those muscles
around.[9]
15
Figure 1.3.1.3 The Nerves
 Median nerve: The median nerve enters the hand through the carpal tunnel, which is
a passageway between the tubercles of the scaphoid and trapezium bones laterally and
by the pisiform and the hook of the hamate on the medial side. It gives nerve supply to
the thenar muscles and the first two lumbricals, plus it sends sensory fibers to the skin
on the lateral part of the palm and to the sides and distal portions of the first three
digits.
The palmar cutaneous branch of the median nerve branches off before the carpal tunnel. It
innervates the middle of the palm.
 Ulnar nerve: The ulnar nerve comes from under the tendon of the flexor carpi ulnaris
and runs through the ulnar tunnel (or tunnel of Guyon), which is between the pisiform
and the hook of the hamate. The ulnar nerve and its dorsal cutaneous, palmar
cutaneous, and superficial branches innervate the medial portion of the wrist and hand
and the medial one and a half digits.
 Radial nerve: The radial nerve has two branches in the forearm: The deep branch
runs through the posterior part of the forearm, supplying motor innervation to the
extensor muscles. The superficial branch is a cutaneous nerve that runs under the
brachioradialis muscle and passes through the anatomical snuff box, which is a visible
depression formed near the base of the thumb by the tendons of the extensor pollicis
longus and extensor pollicis brevis muscles.
.
16
The arteries and veins
The ulnar and radial arteries carry blood down through the forearm into the wrist, where they
anastomose (join together) to form arches. These arches, along with several branches, supply
blood to the hand and digits.[9]
Here are the arteries that enter the wrist:
 Anterior interosseous artery: This artery runs from the ulnar artery anterior to the
interosseous membrane. It pierces the membrane distally to join the dorsal carpal
arch.
 Palmar carpal branch: This branch runs from the ulnar artery over the anterior part
of the wrist under the flexor digitorum profundus tendons.
 Dorsal carpal branch: This branch runs from the ulnar artery across the back of the
wrist under the extensor tendons.
 Palmar carpal branch: This branch runs from the radial artery across the anterior
wrist underneath the flexor tendons.
 Dorsal carpal branch: This branch runs from the radial artery across the wrist
beneath the pollicis and extensor radialis tendons.
These carpal branches of the ulnar arteries join together with the carpal branches of the
radial arteries to form two arches in the wrist:
 Palmar carpal arch: The area where the palmar carpal branches of the radial and
ulnar arteries meet
 Dorsal carpal arch: Formed by the anastomoses of the dorsal carpal branches of the
radial and ulnar arteries
Next up are the arteries and branches that supply blood to the hands and fingers. They also
come from the radial and ulnar arteries.
 Superficial palmar arch: This arch is formed by the ulnar artery anastomosing with a
superficial branch of the radial artery. It runs in front of the flexor tendons near the
middle of the metacarpal bones.
 Deep palmar arch: This arch is made by the radial artery and a deep branch of the
ulnar artery. It runs along the bases of the metacarpals.
 Common palmar digitals: These branches leave the superficial palmar arch to run
along the lumbricals to the webbing of the fingers.
17
 Proper palmar digitals: These branches start from the common palmar digitals and
run along the sides of the fingers, but not the thumb.
 Princeps pollicis: This artery starts at the radial artery at the palm and descends to
past the first metacarpal to the proximal phalanx of the thumb. There it splits into two
branches that run along the sides of the thumb.
 Radialis indicis: This branch arises from the radial artery and runs along the lateral
side of the index finger.[9]
The superficial and deep palmar venous arches return blood to the heart and are located near
the arterial arches. They drain into the deep veins of the forearm. Dorsal digital veins drain
into dorsal metacarpal veins, which form the dorsal venous network. This blood drains into
the cephalic and basilic veins.
1.3.1.Figure Arm Muscles
1.3.2 Figure Hand Bones
18
Figure 1.3.3 Radial and unlar Artery
Figure 1.3.4 arm nerves
19
CHAPTER 2
MEASURING THE HEART RATE
2.1 Overview
This Chapter provides brief information about what is ECG and commercially available in
markets.
2.1.1 ECG
The investigation of the ECG has been extensively used for diagnosing many cardiac
diseases. The ECG is a realistic record of the direction and magnitude of the electrical
commotion that is generated by depolarization and repolarization of the atria and ventricles.
One cardiac cycle in an ECG signal consists of the P-QRS-T waves. Figure 1 shows a sample
ECG signal. The majority of the clinically useful information in the ECG is originated in the
intervals and amplitudes defined by its features (characteristic wave peaks and time
durations). The improvement of precise and rapid methods for automatic ECG feature
extraction is of chief importance, particularly for the examination of long recordings. The
ECG feature extraction system provides fundamental features (amplitudes and intervals) to be
used in subsequent automatic analysis. In recent times, a number of techniques have been
proposed to detect these features .The previously proposed method of ECG signal analysis
was based on time domain method. But this is not always adequate to study all the features of
ECG signals. Therefore the frequency representation of a signal is required. The deviations in
the normal electrical patterns indicate various cardiac disorders. Cardiac cells, in the normal
state are electrically polarized.[11]
20
Figure 2.1.1 ECG
2.1.1.1 ECG Basic Operating Principle
The following sections of the ECG device consists of:
Electrodes:As a result of the heart's electrical activity of the ion current electricity converts
current converters.

Protection fault detection, isolation, and these three process units in a single unit be
carried out in more than one unit, such as in the true. protection and part of the circuit
insulation insulation, resulting ECG device and the patient,protects the patient may be
dangerous currents. Briefly, the device electrodes and provides isolation between the
power cables. Protection part, on the patient do not cause damage to the high voltage
device provides ECG.

If the fault detection part of the electrodes consist of a break with the connecting
cables points or offsets applied electrodes sensing alarm.

The selector unit: all the electrodes are applied to the patient on this unit input is
applied. With the aid of this unit, the desired electrodes ECG device applied. So
selecting the desired derivations are provided. Advanced ECG derivation selective
circuit control devices microprocessors operate with the sampling method. This
method simultaneously all gives you the chance to see derivations.[11]
21
The Necessity of Calibration
The main causes of accidents or faulty medical devices, the use of the device. Reasons
incorrect use of medical devices, inadequate user training, medical Lack of maintenance and
calibration of the device, be considered as a lack of experience and knowledge in the use of
new technologies. Occupational accidents leading to the negligence of one or more of the
above reasons. Health organizations as medical devices, users of these devices have a
mandate. From the moment a device sold to a hospital becomes the property of the hospital,
and all kinds of disruptions that may occur on the device and the patient security are
responsible for the hospital. Medical device for the calibration of the calibration procedure is
being performed at the same time provide better quality health care services in the hospital
with the quality of medical devices, the reliability of all types of transactions carried out with
these devices, medical devices, in the process of life, provide cost / effectiveness analyzes
provided significant benefits in making hospitals, as well as minimizing the risks that may
arise from negligence will be the result.[11]
Figure 2.1.1.1 QRS Interval
22
2.1.2 Pulse Oximeter
Pulse oximetry is a simple non-invasive method of monitoring the percentage of haemoglobin
(Hb) which is saturated with oxygen. The pulse oximeter consists of a probe attached to the
patient's finger or ear lobe which is linked to a computerised unit. The unit displays the
percentage of Hb saturated with oxygen together with an audible signal for each pulse beat, a
calculated heart rate and in some models, a graphical display of the blood flow past the probe.
Audible alarms which can be programmed by the user are provided. An oximeter detects
hypoxia before the patient becomes clinically cyanosed.[10]
Figure 2.1.2Transmission and Reflectance
Figure 2.1.3 Pulse Oximeter
How does an oximeter work?
A source of light originates from the probe at two wavelengths (650nm and 805nm). The light
is partly absorbed by haemoglobin, by amounts which differ depending on whether it is
saturated or desaturated with oxygen. By calculating the absorption at the two wavelengths
the processor can compute the proportion of haemoglobin which is oxygenated. The oximeter
is dependant on a pulsatile flow and produces a graph of the quality of flow. Where flow is
sluggish (eg hypovolaemia or vasoconstriction) the pulse oximeter may be unable to function.
The computer within the oximeter is capable of distinguishing pulsatile flow from other more
static signals (such as tissue or venous signals) to display only the arterial flow.[10]
23
Oxygen and Heart Rate Measuring Device Wireless(FLT-H37)
Pulse and Pulse Oxygen meter, a battery-powered oxygen meter that shows your heart rate at
the same time. Changes in the absorption of light by lighting the skin photoplethysmography
uses a method of providing information and measures heart rate and blood oxygen level
saturated.Connect the device to use your finger, your heart rate and blood oxygen content
immediately visible on the screen.
Figure 2.1.3 Wireless Pulse Oximeter
Pulse Oximetry and meter, to measure SPO2 and pulse oxygen saturated lightweight, and
inexpensive product, physicists, physicians, home doctors (mom), medical students, health
workers, athletes, pilots, sports centers, etc. open to the public.[10]
24
CHAPTER 3
DESIGN OF A DEVICE TO MEASURE HEART RATE FROM THE
FINGER
3.1 Overview
This Chapter briefly describes the features of the measure heart rate from the finger designed
and developed by the author. The actual hardware and software details of the designed system
are given in later Chapters.
Figure 3.1 measure heart rate from the finger designed
I have hopefully established in your minds that the blood supply to the finger tips are very
well supplied with blood from the circulation, and are hence very suitable for measurement of
25
the heart rate. Change in the heart rate affect the blood flow to the finger tips and the pulse
changes accordingly.
This is the main part of my project, where I will show you what I intend to achieve and how I
intend to achieve it.Heart rate measurement indicates the soundness of the human
cardiovascular system. This project demonstrates a technique to measure the heart rate by
sensing the change in blood volume in a finger artery while the heart is pumping the blood. It
consists of an infrared LED that transmits an IR signal through the fingertip of the subject, a
part of which is reflected by the blood cells. The reflected signal is detected by a photo diode
sensor. The changing blood volume with heartbeat results in a train of pulses at the output of
the photo diode, the magnitude of which is too small to be detected directly by a
microcontroller. Therefore, a two-stage high gain, active low pass filter is designed using two
Operational Amplifiers (OpAmps) to filter and amplify the signal to appropriate voltage level
so that the pulses can be counted by a microcontroller. The heart rate is displayed on a 3 digit
seven segment display. The microcontroller used in this project is PIC16F628A.[12]
3.2 Theory
Heart rate is the number of heartbeats per unit of time and is usually expressed in beats per
minute (bpm). In adults, a normal heart beats about 60 to 100 times a minute during resting
condition. The resting heart rate is directly related to the health and fitness of a person and
hence is important to know. You can measure heart rate at any spot on the body where you
can feel a pulse with your fingers. The most common places are wrist and neck. You can
count the number of pulses within a certain interval (say 15 sec), and easily determine the
heart rate in bpm.[12]
3.3 Sensor Assembly
This project describes a microcontroller based heart rate measurement system that uses optical
sensors to measure the alteration in blood volume at fingertip with each heartbeat. The sensor
unit consists of an infrared light-emitting-diode (IR LED) and a photodiode, placed side by
side as shown below. The IR diode transmits an infrared light into the fingertip (placed over
26
the sensor unit), and the photodiode senses the portion of the light that is reflected back. The
intensity of reflected light depends upon the blood volume inside the fingertip. So, each heart
beat slightly alters the amount of reflected infrared light that can be detected by the
photodiode. With a proper signal conditioning, this little change in the amplitude of the
reflected light can be converted into a pulse. The pulses can be later counted by the
microcontroller to determine the heart rate.[12]
Figure3.3 Sensor Assembly
3.4 Circuit Diagram
The signal conditioning circuit consists of two identical active low pass filters with a cut-off
frequency of about 2.5 Hz. This means the maximum measurable heart rate is about 150 bpm.
The operational amplifier IC used in this circuit is MCP602, a dual OpAmp chip from
Microchip. It operates at a single power supply and provides rail-to-rail output swing. The
filtering is necessary to block any higher frequency noises present in the signal. The gain of
each filter stage is set to 101, giving the total amplification of about 10000. A 1 uF capacitor
at the input of each stage is required to block the dc component in the signal. The equations
for calculating gain and cut-off frequency of the active low pass filter are shown in the circuit
diagram. The two stage amplifier/filter provides sufficient gain to boost the weak signal
coming from the photo sensor unit and convert it into a pulse. An LED connected at the
output blinks every time a heartbeat is detected. The output from the signal conditioner goes
to the T0CKI input of PIC16F628A.[12]
27
Figure 3.4 Circuit Diagram
3.5 Microcontroller and Display Circuit
The control and display part of the circuit is shown below. The display unit comprises of a 3digit, common anode, seven segment module that is driven using multiplexing technique. The
segments a-g are driven through PORTB pins RB0-RB6, respectively. The unit’s, ten’s and
hundred’s digits are multiplexed with RA2, RA1, and RA0 port pins. A tact switch input is
connected to RB7 pin. This is to start the heart rate measurement. Once the start button is
pressed, the microcontroller activates the IR transmission in the sensor unit for 15 sec. During
this interval, the number of pulses arriving at the T0CKI input is counted. The actual heart
rate would be 4 times the count value, and the resolution of measurement would be 4. You
can see the IR transmission is controlled through RA3 pin of PIC16F628A. The
microcontroller runs at 4.0 MHz using an external crystal. A regulated +5V power supply is
derived from an external 9 V battery using an LM7805 regulator IC.[12]
28
Figure 3.5 Microcontroller and Display Circuit
29
CHAPTER 4
THE HARDWARE
4.1 Overview
This Chapter describes the function of each hardware element used in the measure heart rate
from the finger designed measurement device.
4.2 Sensor
An important part of building a robot is the incorporation of sensors. Sensors translate
between the physical world and the abstract world of Microcontrollers. This month in Basics,
I will explain the common types of sensors used in personal robotics.[13]
4.2.1 Sensor Output Values
Sensors help translate physical world attributes into values that the computer on a robot can
use. The translation produces some sort of output value that the Microcontroller can use. In
general, most sensors fall into one of two categories:
1. Analog Sensors
2. Digital Sensors
An analog sensor, such as a CdS cell (Cadmium Sulfide cells measure light intensity), might
be wired into a circuit in a way that it will have an output that ranges from 0 volts to 5 volts.
The value can assume any possible value between 0 and 5 volts. An 'Analog Signal' is one
that can assume any value in a range. An interesting way to think about this is an Analog
Signal works like a tuner on an older radio. You can turn it up or down in a continuous
motion. You can fine tune it by turning the knob ever so slightly.[13]
30
Figure 4.2 Sensor
Digital sensors generate what is called a 'Discrete Signal'. This means that there is a range of
values that the sensor can output, but the value must increase in steps. There is a known
relationship between any value and the values preceding and following it. 'Discrete Signals'
typically have a stair step appearance when they are graphed on chart. If you consider a
television sets tuner, it allows you to change channels in steps.[13]
4.3 Infared Led
An infrared light-emitting diode (LED) is a type of electronic device that emits infrared light
not visible to the naked eye. An infrared LED operates like a regular LED, but may use
different materials to produce infrared light. This infrared light may be used for a remote
control, to transfer data between devices, to provide illumination for night vision equipment,
or for a variety of other purposes.
An infrared LED is, like all LEDs, a type of diode, or simple semiconductor. Diodes are
designed so that electric current can only flow in one direction. As the current flows, electrons
fall from one part of the diode into holes on another part. In order to fall into these holes, the
electrons must shed energy in the form of photons, which produce light.
The wavelength and color of the light produced depend on the material used in the diode.
Infrared LEDs use material that produces light in the infrared part of the spectrum, that is, just
below what the human eye can see. Different infrared LEDs may produce infrared light of
differing wavelengths, just like different LEDs produce light of different colors.
A very common place to find an infrared LED is in a remote control for a television or other
device. One or more LEDs inside the remote transmit rapid pulses of infrared light to a
31
receiver on the television. The receiver then decodes and interprets these pulses as a command
and carries out the desired operation.[14]
Figure 4.3Infrared sensor
Infrared light can also be used to transfer data between electronic devices. Mobile phones,
personal digital assistants (PDAs), and some laptops may have an infrared LED and receiver
designed for short-range data transfer. Some wireless keyboards and computer mice also use
an infrared LED and receiver to replace a cable.
Although invisible to human eyes, many types of cameras and other sensors can see infrared
light. This makes infrared LED technology well-suited to applications like security systems
and night vision goggles. Many security cameras and camcorders use infrared LEDs to
provide a night-vision mode. Hunters may use similar equipment to spot game at night, and
some companies sell flashlights with an infrared LED to provide extra illumination for nightvision cameras or devices.
Infrared LEDs can be used for a variety of other purposes. The U.S. Food and Drug
Administration has approved several products with infrared LEDs for use in medical or
cosmetic procedures. Robots may use an infrared LED to detect objects, and some utility
meters even have an infrared LED to transmit data to a tool for easy meter reading.[14]
4.4 Potantiometer
A potentiometer is a manually adjustable electrical resistor that uses three terminals. In many
electrical devices, potentiometers are what establish the levels of output. For example, in a
loudspeaker, a potentiometer is used to adjust the volume. In a television set, computer
monitor or light dimmer, it can be used to control the brightness of the screen or light bulb.
32
4.4.1 How It Works
Potentiometers, sometimes called pots, are relatively simple devices. One terminal of the
potentiometer is connected to a power source, and another is hooked up to a ground — a point
with no voltage or resistance and which serves as a neutral reference point. The third terminal
slides across a strip of resistive material. This resistive strip generally has a low resistance at
one end, and its resistance gradually increases to a maximum resistance at the other end. The
third terminal serves as the connection between the power source and ground, and it usually is
operated by the user through the use of a knob or lever.The user can adjust the position of the
third terminal along the resistive strip to manually increase or decrease resistance. The
amount of resistance determines how much current flows through a circuit. When used to
regulate current, the potentiometer is limited by the maximum resistivity of the strip.[15]
4.4.2 Controlling Voltage
Potentiometers also can be used to control the potential difference, or voltage, across circuits.
The setup involved in utilizing a potentiometer for this purpose is a little more complicated. It
involves two circuits, with the first circuit consisting of a cell and a resistor. At one end, the
cell is connected in series to the second circuit, and at the other end, it is connected to a
potentiometer in parallel with the second circuit.
The potentiometer in this arrangement drops the voltage by an amount equal to the ratio
between the resistance allowed by the position of the third terminal and the highest possible
resistivity of the strip. In other words, if the knob controlling the resistance is positioned at the
exact halfway point on the resistive strip, then the output voltage will drop by exactly 50
percent, no matter what the input voltage is. Unlike with electrical current regulation, voltage
regulation is not limited by the maximum resistivity of the strip.[15]
4.5 Rheostats
When only two of the three terminals are used, the potentiometer acts as a type of variable
resistor called a rheostat. One end terminal is used, along with the sliding terminal. Rheostats
typically are used to handle higher levels of current or higher voltage than potentiometers. For
example, rheostats might be used to control motors in industrial machinery.[15]
33
Figure 4.5 Rheostats
4.6 Resistance
There are many resistance used in this project. Part of the project is to design prop, 7resistance used.
Figure 4.6 Resistance
Potential high energy electrons conductor (iron, copper, aluminum, etc.) as it moves through a
different medium from an environment put, resistance against this force is called the
conductor. Withstand the electrical current conductor reveals a different form of energy that
we all know this is a form of energy ISI. Therefore computers and microprocessor CPU
(Central Pross unit ... central processing unit) has to be cooled in order to operate optimally.
According to Ohm's law, which causes voltage drop between the ends of the circuit element.
Electrical resistance, the electrical current passing through the circuit is calculated by dividing
the value of the voltage at the ends. Resistors raw Tiles. The reason for this is that it is very
durable ceramic electrical in yalıtkanlığa and resistance. Was coupled with the desired amount
34
of conductive ceramic two electron current is limited. So the other end of the current from one
end of the conductor loses some power loss of power electronic circuits to operate at the
optimum level is an absolute law of physics.
"R" or "r" and the unit is indicated by the letter Ohms (Ω) stop.
4.7 Photodiode
The Photo detector
The reverse-bias operation is another popular use for the photodiode.
This operation allows the photodiode to be used as a light intensity-to-voltage transducer.
Here is the common schematic symbol for a photodiode and some typical photodiode
packages.
Similarly the p-i-n junction photodiode is used for its selectable wavelength sensitivity. In
the reverse-bias mode the photodiode is used in a circuit similar to the way a zener diode is
placed, backward. The voltage across the photodiode will remain at full-scale voltage while
no current flows until light hits the metallurgical junction. Each photon of the appropriate
wavelength or greater will strike an electron with enough energy to pass it through the
junction, and thus current flows. This conduction across the photodiode appears as a voltage
drop and thus we have a voltage change to measure. The CCD is used in Digital cameras, still
and motion images are captured by focusing the desired frame onto a CCD just like one
would a film strip, the light intensity on each photodiode is then recorded digitally and
decoded as an image in software.[16]
Figure 4.7 Photodiode Arhitecture
Figure 4.7 Photodiode
35
4.8 Operational Amplifiers
741 and 747 are produced in the form of such integrated. It is integrated with the feedback
circuit elements connected to the outside, and hence the voltage gain of the amplifier circuit
can be checked. In general, OP-AMP, DC yükselteçtir a very high gain. OP-AMP circuit can
not be done with almost non-existent.[17]
Figure 4.8 Operational Amplifiers
This symbol is not shown in the ends of the supply voltage. Two operational amplifiers in
general, an inlet, an outlet, both located at the tip of the supply source. Symbol (-) sign
inverting input terminal (inverting, inverting), (+) sign non-inverting input terminal
(inverting, noninverting) input tip. (-) Sign is applied to the input end of the output signal is
an output signal 180 ° phase difference. Input signal (+) sign when applied to the input end of
the signal applied to the input of the output signal from the phase difference is not. An output
signal that is in phase with accepted.[17]
OP-AMP, 5 important features. These are:
 Gain is too much. (For example, 200000)
 Input impedance is very high. (5 MW)
 Output impedance is close to zero.
 Band width is greater. (1MHz)
 0 Volts is applied to the input, the output is achieved at about 0 volts.
36
Op-Amp Comparator
The circuit diagram and the working of an op-amp as a comparator are shown in the article.
There are mainly two types of comparators. One is the inverting comparator circuit, and the
other is the non-inverting comparator. Both of them are explained with neat waveforms, and
the different applications of the circuit are also given.
Schmitt Trigger Using Op-amp
The application of op-amp as a fast operating voltage level detector is shown in this main
article with the help of a circuit diagram and its corresponding waveform. The exact working
of the circuit is also explained with the equations of the different reference voltages when the
output is positively saturated and negatively saturated. The different characteristics of the
schmitt trigger is also explained along with its UTP and LTP.[17]
Astable Multivibrator Using Op-amp
The working of op-amp as a square wave generator is explained with the help of a circuit
diagram and waveform. The output voltage equation, and the capacitor charging equation is
also given. The reason for calling the circuit a “free-running multivibrator” is also explained.
Monostable Multivibrator
The basics of pulse generator is explained in this post. The circuit diagram and waveform is
illustrated in the article along with the steady state conditions and capacitor voltage equations.
Zero Crossing Detector
This is an applied form of an op-amp comparator circuit. Here the reference voltage is made
zero. The zero crossing detector using inverting op-amp comparator is explained with a circuit
diagram and waveform.[17]
37
Voltage Splitter Using Op-amp
A voltage divider circuit is connected to the non-inverting input of an op-amp. The circuit is
explained in detail in the original post.
Figure 4.8 Op-amp
4.9 The Ready for PIC KIT Wıth Microcontroller Development System
In our graduation project,we use ready for PIC kit with PIC18F45K22 microcontroller. That
ready to pic kit is available to operate with PIC16F887 microcontroller too. During this part
of our project, we will mention both microcontroller represented.
First of all, we will mention about the kit that we use in our graduation project. Ready for
PIC®Board is the best solutionfor fast and simple development of various microcontroller
applications. The boardis equipped with the PIC18F45K22(orPIC16F887)MCU that is placed
in DIP 40 socket andcontains male headers and connectionpads for all available
microcontroller ports.The pins are grouped according to theirfunctions, which is clearly
indicated on thesilkscreen. The MCU comes pre programmedwith mikroBootloader, but it can
also beprogrammed with mikroProg™ programmer.The board also contains USB-UART
module,prototyping area and a power supply circuit.It is specially designed to fit into the
special white plastic casing so that we can turnyour PIC project into a final product.
Here is our kit that we use in our project and its basic components;[17]
38
Figure4.9 The Ready for PIC KIT
4.9.1 Peripheral Interface Controllers (PIC)
Peripheral Interface Controllers (PIC) is one of the advanced microcontrollers developed by
microchip technologies. These microcontrollers are widely used in modern electronics
applications. A PIC controller integrates all type of advanced interfacing ports and memory
modules. These controllers are more advanced than normal microcontroller like INTEL 8051.
.
Figure 4.9.1 Peripheral Interface Controllers (PIC)
39
All PIC microcontroller family uses Harvard architecture. This architecture has the program
and data accessed from separate memories so the device has a program memory bus and a
data memory bus (more than 8 lines in a normal bus). This improves the bandwidth (data
throughput) over traditional von Neumann architecture where program and data are fetched
from the same memory (accesses over the same bus). Separating program and data memory
further allows instructions to be sized differently than the 8 bit wide dataword.Basic structure
of a modern Peripheral interface controller chip is show in the picture below.
Figure 4.9.1 Harvard Architecture.
4.9.1.1 Outter screw holes
These 6mm screw holes are used for enclosing white plastic casing.
Figure 4.9.1.1 Outter screw holes
40
4.9.1.2 IDC10 PORT headers
All microcontroller pins are available through four IDC10 connectors. They enable us to
easily attach many peripheral modules. Our kit is created by 4 ports. Those are
PORTA,PORTB,PORTC and PORTD.
4.9.1.3 IDC10 PORT headers
Breadboard
Place our additional components on available prototyping area and
expand your Ready for PIC with additional functionalities
Figure 4.9.1.3 Breadboard
Power LED
Power LED turns on when power supply is brought either using USB cable, or via external
power connectors.
Figure 4.9 Power LED
41
Crystal oscillator
On-board 8MHz crystal oscillator provides stable external clock to the PIC18F45K22
microcontroller and enables fast UART bootloader baudrates.
Figure 4.9 Crystal Oscillator
Communication LEDs
Board contains specialized RX and TX LEDs for monitoring UART communication.
Figure 4.9 Communication LEDs
FTDI Chip
FTDI chip allows your Ready for PIC board to be connected with a PC through USB cable
over UART connection.
42
USB Connector
Fast on-board FTDI chip with USB connector, allow us to communicate with a PC or other
UART devices using USB-UART connection.
Figure 4.9 USB Connector
Power connector
Standard power connector is available for providing external power supply to our Ready for
PIC board. We can provide 7-23V AC and 9-32V DC.
Figure 4.9 Power connector
Power Screw Terminal
For more easier connectivity Ready for PIC also contains screw terminals for providing
external power suppy. You can provide 7-23V AC and 9-32V DC.
43
Figure 4.9 Power Screw Terminal
Power Regulator
On board power regulators for 3.3V and 5V ensure that each part of the board gets neccessary
stable voltage and current levels.
Figure 4.9 Power Regulator
MikroProg connector
We can program the board using mikroProg™ external programmer with mikroICD™
support.
Figure 4.9 MikroProg connector
44
Reset Button
High quality reset button with surrounding reset circuitry ensures stable reset operation.
Figure 4.9 Reset Button
PIC18F45K22
With just enough RAM and Flash, PIC18F45K22 microcontroller will provide us with
enough power for most of your projects.
Figure 4.9 PIC18F45K22
4.9.1.3 Central Processor Unit (CPU)
As its name suggests, this is a unit which monitors and controls all processes within the
microcontroller and the user cannot affect its work. It consists of several smaller subunits, of
which the most important are:
45

Instruction decoder is a part of the electronics which recognizes program instructions
and runs other circuits on the basis of that. The abilities of this circuit are expressed in
the "instruction set" which is different for each microcontroller family.

Arithmetical Logical Unit (ALU) performs all mathematical and logical operations
upon data.

Accumulator is an SFR closely related to the operation of ALU. It is a kind of
working desk used for storing all data upon which some operations should be executed
(addition, shift etc.). It also stores the results ready for use in further processing. One
of the SFRs, called the Status Register, is closely related to the accumulator, showing
at any given time the "status" of a number stored in the accumulator (the number is
greater or less than zero etc.).[18]
The function of CPU in PIC is same as a normal microcontroller CPU. A PIC CPU consists of
several sub units such as instruction decoder, ALU, accumulator, control unit, etc. The CPU
in PIC normally supports Reduced Instruction Set Computer (RISC) architecture (Reduced
Instruction Set Computer (RISC), a type of microprocessor that focuses on rapid and efficient
processing of a relatively small set of instructions. RISC design is based on the premise that
most of the instructions a computer decodes and executes are simple. As a result, RISC
46
architecture limits the number of instructions that are built into the microcontroller but
optimizes each so it can be carried out very rapidly (usually within a single clock cycle.) .
These
RISC
structure
gives
the
following
advantages.
• The RISC structure only has 35 simple instructions as compared to others
• The execution time is same for most of the instructions (except very few numbers).
•
The execution time required is very less (5 million instructions/second (approximately).
Memory
The memory in a PIC chip used to store the data and programs temporary or permanently. As
like
normal
microcontrollers,
the
PIC
chip
also
has
certain
amount
of
RAM,ROM,EEPROM,other flash memory, etc.[18]
4.9.1.4 Electrically Erasable Programmable ROM (EEPROM)
The EEPROM is a special type of memory not contained in all microcontrollers. Its contents
may be changed during program execution (similar to RAM ), but remains permanently saved
even after the loss of power (similar to ROM). It is often used to store values, created and
used during operation (such as calibration values, codes, values to count up to etc.), which
must be saved after turning the power supply off. A disadvantage of this memory is that the
process of programming is relatively slow. It is measured in miliseconds.
ROM memory is used for permanent storage. The ROM memory also called as n program
memory.
EEPROM
A
PI
memory
chip
is
has
certain
another
amount
category
of
of
ROM
ROM
memory.
memory..
RAM memory is the one of the complex memory module in a PIC chip. This memory
associated with various type of registers (special function registers and general purpose
registers) and memory BANK modules (BANK 0, BANK 1, etc.). Once the power goes off,
the contents in the RAM will be cleared. As like normal microcontrollers, the RAM memory
is used to store temporary data and provide immediate results[18]
47
Flash memory
This is a special type of memory where READ, WRITE, and ERASE operations can be done
many times. This type of memory was invented by INTEL corporation in 1980. A PIC Chip
normally contains a certain amount of flash memory.[18]
Registers
Information is stored in a CPU memory location called a register. Registers can be thought of
as the CPU’s tiny scratchpad, temporarily storing instructions or data. Registers basically
classified into the following.[18]
General Purpose Register(GPR)
A general purpose register (or processor register) is a small storage area available on a CPU
whose contents can be accessed more quickly than other storage that available on PIC. A
general purpose register can store both data addresses simultaneously.[18]
Special Function Registers(SFR)
These are also a part of RAM memory locations. As compared to GPR, their purpose is
predetermined during the manufacturing time and cannot be changed by the user. It is only for
special dedicated functions.[18]
Interrupts
Interrupt is the temporary delay in a running program. These delays stop the current execution
for a particular interval. This interval/delay is usually called as interrupt. When an interrupt
request arrives into a current execution program, then it stops its regular execution. Interrupt
can be performed by externally (hardware interrupt) or internally (by using software).
48
Bus
BUS is the communication or data transmission/reception path in a microcontroller unit. In a
normal microcontroller chip, two types of buses are normally available.
Data Bus
Data bus is used for memory addressing. The function of data bus is interfacing all the
circuitry components inside the PIC chip.
Addres Bus
Address bus mostly used for memory addressing. The function of address bus is to transmit
the address from the CPU to memory locations.[18]
4.9.1.5 USART or UART
These ports are used for the transmission (TX) and reception (RX) of data. These
transmissions possible with help of various digital data transceiver modules like RF, IR,
Bluetooth, etc. This is the one of the simplest way to communicate the PIC chip with other
devices.[18]
4.9.1.6 STACK
The entire PIC chip has an area for storing the return addresses. This area or unit called Stack
is used in some Peripheral interface controllers. The hardware stack is not accessible by
software. But for most of the controllers, it can be easily accessible.
Input/output ports
These ports are used for the interfacing various input/output devices and memories.
According to the type of PIC, the number of ports may change.
49
Advanced functioning blocks
These sections include various advanced features of a PIC chip. According to the type of PIC,
these features may change. Various advanced features in a peripheral interface controller are
power up timer, oscillator start up timer, power on reset, watch dog timer, brown out reset, in
circuit debugger, low voltage programming, voltage comparator, CCP modules etc.
Limitations of PIC Architecture
• Peripheral Interface Controller has only one accumulator.
•
Small instruction set.
•
Register banking switch required to access RAM of other devices.
•
Operations and registers are not orthogonal.
•
Program memory is not accessible.
A PIC controlled system operates with minimal power consumption without sacrificing
performance. Power consumption can be reduced by independently and dynamically
controlling multiple power platforms.[18]
Program Counter
Program Counter is an engine running the program and points to the memory address
containing the next instruction to execute. After each instruction execution, the value of the
counter is incremented by 1. For this reason, the program executes only one instruction at a
time just as it is written. However…the value of the program counter can be changed at any
moment, which causes a “jump” to a new memory location. This is how subroutines and
branch instructions are executed. After jumping, the counter resumes even and monotonous
automatic counting +1, +1, +1…[18]
4.9.1.7 Input/output ports (I/O Ports)
In order to make the microcontroller useful, it is necessary to connect it to peripheral devices.
Each microcontroller has one or more registers (called a port) connected to the
microcontrollerpins..
50
4.9.1.8 Oscillator
Even pulses generated by the oscillator enable harmonic and synchronous operation of all
circuits within the microcontroller. It is usually configured as to use quartz-crystal or ceramics
resonator for frequency stabilization. It can also operate without elements for frequency
stabilization (like RC oscillator). It is important to say that program instructions are not
executed at the rate imposed by the oscillator itself, but several times slower. It happens
because each instruction is executed in several steps. For some microcontrollers, the same
number of cycles is needed to execute any instruction, while it's different for other
microcontrollers. Accordingly, if the system uses quartz crystal with a frequency of 20MHz,
the execution time of an instruction is not expected 50nS, but 200, 400 or even 800 nS,
depending on the type of the microcontroller.In figure 4.3.14.8 you can see diagram of
oscillator[18]
Figure 4.9.1.8 Oscillator
4.9.1.9 Timers/Counters
Most programs use these miniature electronic "stopwatches" in their operation. These are
commonly 8- or 16-bit SFRs the contents of which is automatically incremented by each
coming pulse. Once the register is completely loaded, an interrupt is generated.
51
If these registers use an internal quartz oscillator as a clock source, then it is possible to
measure the time between two events (if the register value is T1 at the moment measurement
has started, and T2 at the moment it has finished, then the elapsed time is equal to the result of
subtraction T2-T1 ). If the registers use pulses coming from external source, then such a timer
is turned into a counter.
This is only a simple explanation of the operation itself. It’s somehow more complicated in
practice.In figure 4.3.14.9 you can see diagram of timer.
Figure 4.9.1.9 Timers/Counters
4.9.1.10 Power Supply Circuit
There are two things worth attention concerning the microcontroller power supply circuit:

Brown out :is a potentially dangerous state which occurs at the moment the
microcontroller is being turned off or when power supply voltage drops to the lowest
level due to electric noise. As the microcontroller consists of several circuits which
52
have different operating voltage levels, this can causeits out of control performance. In
order to prevent it, the microcontroller usually has a circuit for brown out reset builtin. This circuit immediately resets the whole electronics when the voltage level drops
below the lower limit.

Reset pin: is usually referred to as Master Clear Reset (MCLR) and serves for external
reset of the microcontroller by applying logic zero (0) or one (1) depending on the
type of the microcontroller. In case the brown out is not built in the microcontroller, a
simple external circuit for brown out reset can be connected to this pin.
Serial communication
Parallel connections between the microcontroller and peripherals established over I/O ports
are the ideal solution for shorter distances up to several meters. However, in other cases, when
it is necessary to establish communication between two devices on longer distances it is
obviously not possible to use parallel connections. Then, serial communication is the best
solution.
Advantages of PIC Controlled System
• Reliability
The PIC controlled system often resides machines that are expected to run continuously for
many years without any error and in some cases recover by themselves if an error occurs(with
help of supporting firmware).
• Performance
Many of the PIC based embedded system use a simple pipelined RISC processor for
computation and most of them provide on-chip SRAM for data storage to improve the
performance.
• Power consumption
53
application and the type of PIC used, the oscillators and its frequencies may vary. RC
(Resistor-Capacitor), LC (Inductor-Capacitor), RLC (Resistor-Inductor-capacitor), crystal
oscillators, etc are the normal oscillators used with A PIC chip.
Advantages of Microcontrollers
The main advantages of microcontrollers are given.
a)
Microcontrollers act as a microcomputer without any digital parts.
b)
As the higher integration inside microcontroller reduce cost and size of the system.
c)
Usage of microcontroller is simple, easy for troubleshoot and system maintaining.
d)
Most of the pins are programmable by the user for performing different functions.
e)
Easily interface additional RAM, ROM,I/O ports.
f)
Low time required for performing operations.
Disadvantages of Microcontrollers
a)
Microcontrollers have got more complex architecture than that of microprocessors.
b)
Only perform limited number of executions simultaneously.
c)
Mostly used in micro-equipments.
d)
Cannot interface high power devices directly.
Applications
Microcontrollers are widely used in modern electronics equipments. Some basic applications
of microcontroller is given below.
a)
Used in biomedical instruments.
b)
Widely used in communication systems.
c)
Used as peripheral controller in PC.
d)
Used in robotics.
e)
Used in automobile fields.[18]
54
4.10 The LCD
The LCD module helps us to display output from our programs. Both text and numeric data
can be displayed on the LCD screen. Most LCDs are designed using the Hitachi HD44780
controller chip. The LCD is basically parallel device and can be driven directly from the
microcontroller I/O ports. The LCD used in the design was a 2 row by 16 column
alphanumeric LCD. The LCD is interfaced to the microcontroller using 4 data lines and 2
control lines.[19]
4.11 The Probe
IR LED and the sensor is located within the probe. There are three cables connected at circuit.
These are the plus, minus, and ground.[19]
Figure 4.11 Infrared transmitter and received sensor pair clipped to the
finger.
55
The circuit diagram of the measurement device is shown in Figure 3. The circuit basically
consists of 2 operational amplifiers, a low-pass filter, a microcontroller, and an LCD. The first
amplifier is set for a gain of just over 100, while the gain of the second amplifier is around
560. During the laboratory trials it was found necessary to use a low pass filter in the circuit to
filter out any unwanted high frequency noise from nearby equipment. The cut-off frequency
of the filter was chosen as 2Hz. Figure 4 shows the frequency and phase responses of the
amplifier together with the filter. The output time response of the amplifier and filter circuit is
shown in Figure 5 which consists of pulses. An LED, connected to the output of the
operational amplifiers flashes as the pulses are received and amplified by the circuit.
The output of the amplifier and filter circuit was fed to one of the digital inputs of a PIC16F84
type microcontroller . In order to reduce the cost of the circuit the microcontroller is operated
from a 4MHz resonator. The microcontroller output ports drive the LCD as shown in Figure
3. The circuit operates when a push-button switch connected to RB1 port of the
microcontroller is pressed.[19]
56
CHAPTER 5
THE SOFTWARE
5.1
Overview
This Chapter is about the software of the designed heart rate from the finger device. The
operation of the software is given in detail in the Chapter.
5.2
The Software
The software was developed using the popular PROTON+ Basic compiler developed and
distributed by Crownhill Associates . The operation of the software is described below as a
Program Description Language (PDL):
BEGIN
Initialize program variables
Configure input-output ports
Display message “READY”
Wait until switch is pressed
Sum = 0
DO 3 times
Get count in 10 seconds
Count = 6 * Count
Sum = Sum + Count
ENDDO
Calculate the average, Rate = Sum / 3
Display the average on the LCD
END
If the number of pulse counts in time T is n, then the heart rate per minute is given by N,
where,
N = 60n/T (1)
If the duration of a measurement is 10 seconds, then the heart rate is calculated as:
N = 6n
57
Figure 5.2 Frequency and phase responses of the amplifier and filter circuit
(obtained by connecting a PC based oscilloscope to the circuit)
Figure 5.2.1 Output response of the amplifier and filter circuit (obtained by
connecting a PC based oscilloscope to the circuit)
58
The operation of the program can be summarized as follows (this description isshown in the
form of a Program Description Language):
BEGIN
Initialize program variables
Configure input-output ports
Display message “READY”
Wait until switch is pressed
Sum = 0
DO 3 times
Get count in 10 seconds
Count = 6 * Count
Sum = Sum + Count
ENDDO
Calculate the average, Rate = Sum / 3
Display the average on the LCD
END
A 2x16 LCD is connected to PORT B of the microcontroller.Figure 5.2.2 gives the program
listing of the microcontroller. At the beginning of the program various variables used in the
program are declared and PORT B pins RB2 – RB7 are configured as outputs. RB1 is
configured as an input port. The program waits until the button is pressed. Then, the heart rate
is read 3 times and the average is calculated and displayed on the LCD in the following
format:
Heart = nn /min
'*******************************************************
'* File: HEART.BAS
'* Date: 23/10/2006
'* Version: 1.0
'* In this project a PIC16F84 type microcontroller is '* used and an infrared sensor is
connected to pin
59
'* RB0. Also, a button is connected to pin RB1 of
'* the microcontroller.
'* The average heart rate is measured and
'*displayed on a LCD
'*****************************************************
Device = 16F84
Symbol SVIC = PORTB.1
Dim Counter As Byte
Dim Heart As Word
Dim J As Byte
TRISB = %00000011
DelayMS 1000
Print "READY..."
'
' Wait until BUTTON pressed
'
While SVIC = 1
Wend
Cls
Heart = 0
For J = 1 To 3
Print "CALCULATING ",Dec J
Counter = Counter PORTB.0,10000
Counter = 6 * Counter
Heart = Heart + Counter
Cls
Next
Heart = Heart / 3
Cls
Print "Heart = ",Dec Heart," /min"
End
.Figure 5.2.2 Microcontroller program listing.
60
CHAPTER 6
APPLICATIONS
In this chapter , we used an embedded circuit board that provides the connection between the
probe and the microcontroller.
Figure 6.1 Embedded Circuit Diagram
61
Figure 6.2 Embedded Circuit Board
Figure 6.3 Circuit elements required for embedded circuit components
were purchased.
62
Figure 6.4 Soldering work up I
Figure 6.4 Soldering work up II
Figure 6.4 Soldering work up III
63
Figure 6.5 The circuit has been checked for correct paths.
Figure 6.6 Laboratory Aplications I
64
Figure 6.6 Laboratory Aplications II
Figure 6.7 Embeded Circuit
65
Figure 6.8 Inside Finger Probe
Figure 6.9 Soldering work up IV
66
CONCLUSIONS
In this project, the design and development of a low cost microcontroller based heart rate
measurement device has been presented. The device is based on an infrared emitter and
infrared sensor. The sensors are clipped to the finger of person and as the heart baets the
volume of the blood in the finger changes and the sensor detects this small chance. This
change is then amplifed and fed to a microcontroller based system. The microcontroller
calculates the heart rate and displays the results on an LCD every second.
The heart rate measurement device is efficient and easy to use. Both analog and digital signal
processing techniques are combined to keep the device simple and to efficiently suppress the
disturbance in signals.
Results showed that the heart rate can be filtered and digitized so that it can be counted to
calculate an accurate pulse rate. The device is able to detect, filter, digitize and display the
heart rate of a user ergonomically. The device has the advantage that it can be used by nonprofessional people at home to measure the heart rate easily and safely.
67
REFERENCES
[1] http://www.emo.org.tr/ekler/a568a2aa8c19a31_ek.pdf
[2] http://www.news-medical.net/health/What-is-Heart-Rate.aspx
[3] http://www.livestrong.com/article/159698-why-do-you-check-your-heart-rate-whileexercising/0
[4] http://www.medicalnewstoday.com/articles/8887.php
[5]http://www.heart.org/HEARTORG/Conditions/Arrhythmia/AboutArrhythmia/Bradycar
dia_UCM_302016_Article.jsp
[6] http://en.wikipedia.org/wiki/Finger
[7] http://en.wikipedia.org/wiki/Bone
[8] http://wiki.medpedia.com/Muscular_System
[9] http://en.wikipedia.org/wiki/The_Nerves
[10] ashmyo.kafkas.edu.tr/duyurular/ekg.pdf
[11] http://www.favoriteplus.com/pulse-oximeter.php
[12] http://embedded-lab.com/blog/?p=1671
[13] http://www.seattlerobotics.org/encoder/jul97/basics.html
[14] http://www.wisegeek.com/what-is-an-infrared-led.htm
[15] http://en.wikipedia.org/wiki/Potentiometer
[16] http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/photdet.html
[17] http://www.circuitstoday.com/op-amps-operational-amplifiers
[18] http://www.circuitstoday.com/peripheral-interface-controller-pic
[19] www.emo.org.tr/ekler/a568a2aa8c19a31_ek.pdf
68
APPENDIX
THE COMPLETE PROGRAM LISTING
/***************** BEGINNING OF MAIN PROGRAM *************************/
void main()
Lcd_Init();
Lcd_Out(1,1," ***NEU*** ");
Lcd_Out(2,1," **BME** ");
Lcd_Cmd(_
LCD_CURSOR_OFF);
Delay_Ms(8000);
Lcd_Init();
Lcd_Out(1,1," *MEASURING*");
Lcd_Out(2,1," *HEART- RATE*");
Lcd_Cmd(_LCD_CURSOR_OFF);
Delay_Ms(8000);
Lcd_Init();
Lcd_Out(1,1,"MORENIKE IHEME");
Lcd_Out(2,1," -20092907- ");
Lcd_Cmd(_LCD_CURSOR_OFF);
Delay_Ms(8000);
Lcd_Init();
Lcd_Out(1,1,"ESRA HACAT");
Lcd_Out(2,1," -20112570- ");
Lcd_Cmd(_LCD_CURSOR_OFF);
Delay_Ms(8000);
Lcd_Init();
Lcd_Out(1,1,"DERYA ERDOGAN");
Lcd_Out(2,1," -20080863- ");
Lcd_Cmd(_LCD_CURSOR_OFF);
69
Delay_Ms(8000);
Lcd_Init();
Lcd_Out(1,1,"HAZAL BILICI");
Lcd_Out(2,1," -20081361- ");
Lcd_Cmd(_LCD_CURSOR_OFF);
Delay_Ms(8000);
//
// Configure Timer 0 to operate in 16-bit mode with 1 microsecond time
//
T0CON = 0x02;
// Prescaler=8, 16-bit mode
70