heart beat +gsm engineering final year projectthesis
DESCRIPTION
thesis by Abdur RaufTRANSCRIPT
-
1
City University of Science and Information Technology
Dalazak road, Peshawar, Pakistan
Electrical Engineering Department
CERTIFICATE
This is to certify that the project thesis entitled Measuring heartbeat and
temperature and sending data through GSM modem is prepared by
NAME ID
Zartash Haider 2988
Hadi Hassan 3097
Abdur Rauf 2984
Muhammad Arif 2978
Students of final year B.Sc Electrical (Telecom.) have satisfactory completed their work.
Approved:
Internal Examiner External Examiner
__________________ __________________
Supervisor
Engr. Asar Ali
________________________
A thesis submitted in partial fulfillment of the requirements for the degree of B.Sc Electrical
(Telecom.) engineering, The city university of science and information technology Peshawar.
-
0
TABLE OF CONTENTS
Acknowledgements ................................................................................................................. i
Abstract ................................................................................................................................. ii
List Of Acronyms .................................................................................................................. iii
List Of Figures ........................................................................................................................ v
List Of Tables ...................................................................................................................... vii
Chapter 1: INTRODUCTION .................................................................................................. 1
1.1 Aim of the project .................................................................................................... 1
1.2 Objective ................................................................................................................. 1
1.3 Problem definition ................................................................................................... 2
1.4 Methodology ........................................................................................................... 2
1.5 Simulation and Simulation tools ............................................................................... 3
1.6 Analysis of result ..................................................................................................... 3
1.7 Goals ...................................................................................................................... 4
1.8 Guidelines of thesis ................................................................................................. 4
1.9 Research work ......................................................................................................... 4
Chapter 2: BACKGROUND ....................................................................................................5
2.1 QRS complex .......................................................................................................... 5
2.1.1 R wave progression .......................................................................................... 6
2.2 Heartbeat measurement (medical point of view) ....................................................... 7
2.2.1 At rest ............................................................................................................. 8
2.2.2 Maximum ...................................................................................................... 10
2.3 Target rate ............................................................................................................. 14
2.3.1 Karvonen method ............................................................................................ 15
2.3.2 Zoladz method ................................................................................................ 15
2.4 Heart rate reserve ................................................................................................... 15
2.5 Recovery heart rate ................................................................................................ 16
2.6 Abnormalities ........................................................................................................ 16
2.6.1 Tachycardia ................................................................................................... 16
2.6.2 Bradycardia .................................................................................................... 17
2.6.3 Arrhythmia ..................................................................................................... 17
2.7 Risk factor ............................................................................................................. 17
2.8 Light-emitting diode .............................................................................................. 18
-
1
2.8.1 LED Lamp (Light-Emitting Diode) ................................................................. 20
2.9 Liquid crystal display ............................................................................................ 20
2.9.1 Applications of LCD ...................................................................................... 21
2.10 GSM ..................................................................................................................... 22
2.10.1 GSM demonstration ....................................................................................... 23
2.10.2 GSM Network Infrastructure .......................................................................... 23
Chapter 3: MICROCONTROLLER, ITS INTERFACES AND PROJECT CIRCUIT .............. 25
3.1 Microcontroller description (AT89S52) .................................................................. 25
3.2 Pin configuration of AT89S52 ............................................................................... 27
3.3 Pin Description of AT89S52 .................................................................................. 31
3.3.1 VCC ................................................................................................................ 31
3.3.2 GND ............................................................................................................. 31
3.3.3 Port 0 ............................................................................................................ 31
3.3.4 Port 1 ............................................................................................................ 31
3.3.5 Port 2 ............................................................................................................ 31
3.3.6 Port 3 ............................................................................................................ 32
3.3.7 RST ............................................................................................................... 32
3.3.8 ALE/PROG ................................................................................................... 32
3.3.9 PSEN ............................................................................................................ 33
3.3.10 EA/VPP ......................................................................................................... 33
3.3.11 XTAL1 .......................................................................................................... 33
3.3.12 XTAL2 .......................................................................................................... 33
3.4 Special Function Registers of AT89S52 ................................................................. 33
3.4.1 Timer 2 Registers ........................................................................................... 34
3.4.2 Interrupt Registers .......................................................................................... 34
3.4.3 Dual Data Pointer Registers ............................................................................ 34
3.4.4 Power off Flag ............................................................................................... 34
3.5 Watchdog Timer of AT89S52 ................................................................................ 34
3.5.1 Using the WDT .............................................................................................. 35
3.5.2 WDT during Power-down and Idle ................................................................. 35
3.6 ADC0804 IC ......................................................................................................... 36
3.7 Interfacing of microcontroller with ADC0804 ........................................................ 38
3.8 Pin description of ADC0804 .................................................................................. 40
3.8.1 CS, Chip Select .............................................................................................. 40
3.8.2 RD, Read ....................................................................................................... 40
-
2
3.8.3 WR, Write ..................................................................................................... 41
3.8.4 CLK IN, Clock IN ......................................................................................... 41
3.8.5 INTR, Interrupt .............................................................................................. 41
3.8.6 Vin+ .............................................................................................................. 41
3.8.7 Vin- ............................................................................................................... 41
3.8.8 AGND ........................................................................................................... 41
3.8.9 Vref/2 ............................................................................................................ 41
3.8.10 DGND ........................................................................................................... 42
3.8.11 D7-D0 ........................................................................................................... 42
3.8.12 CLKR ........................................................................................................... 42
3.8.12 Vcc ............................................................................................................... 42
3.9 Description of AT89C2051 .................................................................................... 42
3.9.1 Pin Configuration ........................................................................................... 43
3.10 Interface of LCD with micro controller .................................................................. 43
3.10.1 Command/Instruction Register ....................................................................... 44
3.10.2 Data Register ................................................................................................. 44
3.10.3 Displaying character on screen ....................................................................... 44
3.11 SIM900(D) ............................................................................................................ 45
3.11.1 General features ............................................................................................. 46
3.11.2 Specifications for Fax .................................................................................... 46
3.11.3 Specifications for Data ................................................................................... 46
3.11.5 Special firmware ............................................................................................ 47
3.11.6 Specifications for Voice ................................................................................. 47
3.11.7 Interfaces ....................................................................................................... 47
3.11.8 Compatibility ................................................................................................. 48
3.11.9 Certificates .................................................................................................... 48
3.11.10 Carrier Approvals .......................................................................................... 48
3.11.11 Specifications for SMS via GSM/GPRS .......................................................... 48
3.12 Heartbeat sensor of project (LDR) .......................................................................... 49
3.12.1 Specification and model ................................................................................. 50
3.12.2 Applications .................................................................................................. 50
3.13 Heat sensor of project, LM35 series (LM35DZ) ....................................................... 51
3.13.1 General description ......................................................................................... 51
3.13.2 Features ......................................................................................................... 52
3.14 LM358 IC ............................................................................................................. 52
-
3
3.14.2 Features ......................................................................................................... 54
3.15 Microcontroller interfacing and circuit of project .................................................... 55
3.15.1 LM35P circuitry with heartbeat sensor ............................................................ 60
3.16 Sensor Clip ........................................................................................................... 65
3.17 Project device source .............................................................................................. 71
3.18 Project device in operation ..................................................................................... 72
Chapter 4: SIMULATION (PHYSICAL MODELING AND CODING) ................................. 74
4.1 Introduction (of the project for simulation) ............................................................. 74
4.2 Theory (of the project for simulation) ..................................................................... 74
4.3 Simulation circuits ................................................................................................. 75
4.4 Coding .................................................................................................................. 79
4.4.1 AT89S52 coding ............................................................................................ 79
4.4.2 AT89C2051 coding ........................................................................................ 86
Chapter 5: ANALYSIS AND RESULTS OF SIMULATION ................................................. 87
5.1 Analysis and results ............................................................................................... 87
5.1.1 Conditioning circuit with heartbeat sensor....................................................... 88
5.1.2 Power for GSM modem ................................................................................. 94
5.2 Summary .............................................................................................................. 95
5.3 Conclusion ............................................................................................................ 95
5.4 Future work ........................................................................................................... 95
References ........................................................................................................................... 97
-
i
Acknowledgements
First and for most our profound gratitude and humble thanks to Almighty Allah
who gave us strength and intellectual ability to accomplish this task successfully.
Without the support and encouragement of numerous persons both within and
outside our university (CUSIT City University), the completion of this thesis would have
been a nearly insurmountable task.
We are highly indebted to our supervisor Engr. Asar Ali, Lecturer, Engineering
Department, CUSIT for his support and encouragement at all stages of the project.
Without his guidance and support it would have been impossible for us to accomplish
this task successfully.
We also express our thanks to the other faculty members of Engineering
Department for giving us the valuable suggestions throughout the year. We sincerely
thank them for their guidance and help through the hard and easy timing during the
development of this project.
-
ii
Abstract
The thesis describes the design of Heartbeat and temperature monitoring using
Global System for Mobile (GSM) modem. Human being heartbeat rate can be monitored
within a preset range by the user. In order to improve the portability, the system is
developed using a version of 8052 series microcontroller from Atmel (AT89S52) [we
can also use PIC microcontroller (PIC16F628A)] and a GSM modem is implemented to
send Short Messaging Service (SMS) to the preset user mobile. The system allows the
user to set the upper and lower limit of heartbeat rate. An LCD screen is connected to
the microcontroller to display the current heartbeat. A prototype based on the design is
built and tested successfully
We developed an electronic device that can be used to measure things for which
we normally use mechanical methods or do it manually, like heartbeat measurement by
holding hand of a patient/person and counting beats for heartbeat rate manually or using
thermometer to measure temperature of a patient/person.
The Project is comprised of basically two major modules, which handles all the
basic functionalities of the device.
The modules we intend to develop are:
1. Heartbeat and temperature sensing using sensor 2. Measured data transmission through GSM modem
This report discusses design, constructional details, applications, and economics of
the Heartbeat and temperature monitoring using Global System for Mobile (GSM)
modem.
The Electronics of the device has been primarily built around the Atmel
8052microcontroller which controls data transmission of measured data, and controls the
system.
Keywords: Heartbeat measurement, GSM modem, Temperature sensor, LDR sensor.
-
iii
List Of Acronyms
A/D Analog to Digital
ADC Analog to Digital Converter
ASCII Stands For American Standard Code for Information Interchange
AUC Authentication Center
BSC Base Station Controller
BSS Base Station Subsystem
BTS Base Transceiver System (Antenna System + Radio Base Station)
CISC Complex Instruction Set Computer
CMOS Complementary MetalOxideSemiconductor
CPU Central Processing Unit
ECG Electro Cardiogram
EDGE Enhanced Data rate for GSM Evolution
EEPROM Electrically Erasable Programmable Read-Only Memory
EIR Equipment Identification Register (for IMEI verification)
EMS Enhanced Messaging Services
EUSART Enhanced Universal Asynchronous Receiver Transmitter
FNR Flexible Numbering Register (for number portability)
FTP Special Function Registers
GMSC Gateway Mobile Switching Center (MSC)
GPRS General Packet Radio Service
GSM Groupe Speciale Mobile (original) or Global Specification for Mobile
HLR Home Location Register
HR Heart Rate
HSCSD High-Speed Circuit-Switched Data
I/O Input/Output
IC Integrated Circuit
ILR Interworking Location Register
IMEI International Mobile Equipment Identity
ISDN Integrated Services Digital Network
ITO Indium tin oxide or tin-doped indium oxide IWF Interworking Function
IWMSC Interworking Mobile Switching Centre (MSC)
LCD Liquid Crystal Display
LDR Light Dependent Resistor
LED Light Emitting Diode
MIPS Million Instructions Per Second
MMS Multimedia Messaging Services
MS Mobile Station
MSC Mobile Switching Center
NMS Network Management Subsystem
NSS Network Switching Subsystem
OSS Operation and Support System
PDIP Plastic Dual Inline Package
PDN Public Data Network
-
iv
PEROM Programmable And Erasable Read Only Memory
PLCC Plastic Leaded Chip Carrier
PLMN Public Land Mobile Network
PSTN Public Switched Telephone Network
RAM Random Access Memory
RISC Reduced Instruction Set Computer
SMS Short Message Service
SPI Serial Peripheral Interface
TQFP Thin Quad Flat Pack
VLR Visitor Location Register
-
v
List Of Figures
Figure 2.1: (a) Schematic representation of normal ECG, (b) Schematic representation
of the QRS complex, (c) Diagram showing how the polarity of the QRS
complex in leads I, II, and III can be used to estimate the heart's electrical
axis in the frontal plane ............................................................................................ 6
Figure 2.2: Fox and Haskell formula; widely used. .................................................................. 11
Figure 2.3: Electronic symbol and Pin configuration anode and cathode ................................ 19
Figure 2.4: Parts of an LED ...................................................................................................... 19
Figure 2.5: Reflective twisted nematic liquid crystal display ................................................... 21
Figure 2.6: Wireless communications systems and networks .................................................. 23
Figure 2.7: Hexa cellular range of BTS based network diagram .............................................. 24
Figure 3.1: Pin configuration of microcontroller AT89S52 different versions ........................ 29
Figure 3.2: Block diagram of AT89S52 ................................................................................... 30
Figure 3.3: Pin diagram of ADC0804 IC .................................................................................. 37
Figure 3.4: Block diagram of ADC0804 .................................................................................. 37
Figure 3.5: Diagram of general connections for ADC0804 ...................................................... 39
Figure 3.6: Circuit diagram for ADC0804 IC interfacing with microcontroller ...................... 40
Figure 3.7: Pin configuration of AT89C2051 ........................................................................... 43
Figure 3.8: (a) Circuit diagram of interfacing LCD with micro controller, (b) project
LCD screen ............................................................................................................. 45
Figure 3.9: Pre-assembled/Readymade SIM900D module GSM modem with Antenna ......... 48
Figure 3.10: The symbol for a Photoresistor .............................................................................. 49
Figure 3.11: A Light Dependent Resistor (LDR) ....................................................................... 50
Figure 3.12: LM35DZ IC ........................................................................................................... 51
Figure 3.13: LM358P ................................................................................................................. 53
Figure 3.14: Pin diagram of LM358 ........................................................................................... 53
Figure 3.15: Schematic diagram of LM35 .................................................................................. 54
Figure 3.16: Block diagram of the measuring device ................................................................. 56
Figure 3.17: Complete diagram of the project circuit ................................................................. 57
Figure 3.18: Left side of the complete project diagram .............................................................. 58
Figure 3.19: Right side of the complete project diagram ........................................................... 59
Figure 3.20: LM35P circuitry with heartbeat sensor .................................................................. 60
Figure 3.21: Project initial stage diagram when photodiode and IR diode was used ................. 61
Figure 3.22: This figure is available on internet, (a) In this picture we only used the LDR
& High intensity LED portion on right in our project for reference ...................... 64
Figure 3.23: Components used in making a sensor clip ............................................................. 65
Figure 3.24: Making holes in the clip for sensor components placement .................................. 66
Figure 3.25: Ready clip and placement of finger in the clip ....................................................... 66
Figure 3.26: Soldering iron of rating 30W, 220V/240V ............................................................. 67
Figure 3.27: Chip holder soldered on the bread board ............................................................... 67
Figure 3.28: Complete project picture with soldering iron ......................................................... 68
-
vi
Figure 3.29: Complete project Picture ........................................................................................ 69
Figure 3.30: Circuital picture of project, some similarity is found (from components
placement point of view) when this picture is compared with
Figure 3.17 to 3.19 ................................................................................................. 70
Figure 3.31: 9V batteries and variable adapter (rating: 1.5V-12V, 2A) ..................................... 71
Figure 3.32: Device running on battery ...................................................................................... 71
Figure 3.33: Device running on adapter ..................................................................................... 72
Figure 3.34: Any mobile SIM (with balance) placement in the GSM modem ........................... 72
Figure 3.35: Turn on device using battery or adapter, place finger in the sensor clip ................ 73
Figure 3.36: Readings after one minute ...................................................................................... 73
Figure 4.1: These circuits were made on Multisim 11 at initial stages, this version (old)
of project did not included GSM system and used 7-segment display ................... 75
Figure 4.2: These circuits were made on Proteus 7 Pro., this version (new) of project
included temperature sensor and hypothetical GSM system, and used LCD
display .................................................................................................................... 78
Figure 5.1: Complete circuit in running condition ................................................................... 88
Figure 5.2: Conditioning circuit for heartbeat sensor in simulator ........................................... 89
Figure 5.3: Result on Oscilloscope by increasing value of comparators potentiometer ......... 91
Figure 5.4: Result on Oscilloscope by increasing value of amplifiers potentiometer ............. 93
Figure 5.5: Actual amplitude levels (same scaled in Oscilloscope) of signals comparison ..... 94
Figure 5.6: Circuit for GSM modem (SIM900D module based) voltage supply ..................... 94
-
vii
List Of Tables
Table 2.1: Table of heart rates for men ....................................................................................... 9
Table 2.2: Table of heart rates for women ................................................................................ 10
Table 3.1: Table for pin configuration of ADC0804 ................................................................ 38
Table 3.2: Port 3 also receives some control signals for Flash programming and
verification. .............................................................................................................. 43
.
-
1
Chapter 1: INTRODUCTION
1.1 Aim of the project
This project is the design of a simple, low-cost microcontroller based
heart rate and temperature measuring device with LCD, mobile phone
output. Heart rate and temperature of a patient/person is measured from the
finger using optical sensors, and temperature from LM358 and the rate is
then averaged and displayed on a text based LCD and mobile phone
through GSM service.
Heart rate measurement is one of the very important parameters of
the human cardiovascular system. The heart rate of a healthy adult at rest is
around 72 beats per minute (bpm). Athletes normally have lower heart rates
than less active people. Babies have a much higher heart rate at around 120
bpm, while older children have heart rates at around 90 bpm. The heart rate
rises gradually during exercises and returns slowly to the rest value after
exercise. The rate when the pulse returns to normal is an indication of the
fitness of the person. Lower than normal heart rates are usually an
indication of a condition known as bradycardia, while higher than normal
heart rates are known as tachycardia.
1.2 Objective
Heart rate is simply and traditionally measured by placing the thumb
over the subjects 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 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,
-
2
and temperature of the subject. Although such devices are useful, their cost
is usually high and beyond the reach of individuals.
Thesis describes the design of a very low-cost device which
measures the heart rate and temperature of the subject by clipping sensors
on one of the fingers and then displaying the result on a text based LCD.
The device has the advantage that it is microcontroller based and thus can
be programmed to display various quantities, such as the average,
maximum and minimum rates over a period of time and so on. Another
advantage of such a design is that it can be expanded and can easily be
connected to a recording device or a PC to collect and analyze the data for
over a period of time.
1.3 Problem definition
The basic problem with heartbeat measuring manually is that its time
consuming And the person who is measuring heart rate has to pay attention
continuosly for conting heartbeat pulses by holding the wrist of apatient.
Another problem is that the doctor cannot stay with a patient continuosly to
keep an eye on the patient heart rate. Other then this there are still many
people who do not know how find heart rate of a person manually by
holding thee wrist. Heart rate is not only effected by heart condition; things
such sickness or non still state (running joging etc.) also effect a persons
heart rate.
1.4 Methodology
Methodology of this project is very simple. As we know that our
heart pumps blood in our body per beat this means that evey time our
heartbeats the pressure of blood in our body changes. Research shows that
high entensity or Infra Red light reflects from our blood and the amount of
rays depends on the density or pressure of our blood. Using this idea we
formed the bases for or project. The reflected rays will detected by a sensor,
in our project case LDR (Light Depended Resistor). We have also used a
heat/thermal sensor (LM35) for measuring temperature of the patient in
Celcius because the LM35 is specifically designed/callibrated for output in
-
3
Celcius. The result in Celsius caneasily be transformed in Fahrenheit using
formula:
[F] = [C] 95 + 32
Also the program of the project can also be modified to display
answer in Fahrenheit but for that the formula mentioned above is needed to
be integrated in the program.
1.5 Simulation and Simulation tools
The Simulators or Simulation tools that we used for this project are:
Hardware Simulation: MultiSim 11.0.1 Ultiboard PowerPro
Hardware Simulation: Proteus Professional V7.6 SP4
Program testing(C language): Borland C++
Program testing(Assembly): Keil-uVision3-v8.12-C51
Program testing(Assembly): MDA-WinIDE Studio-51
Hardware Simulation was done in stages through out which we
made changes in our project and siwtched simulators,specifically among
two simulators that our mentioned above mentioned above. Same in case of
prgram testing. Note that the program and hardware structure was
developed together in stages because programing cannot work without
hardware and hardware cannot work without the program.
1.6 Analysis of result
Heart rate result of our project is satisfactory because the electronic
components we bought for the project are cheap and not very sensitive in
terms of sensing and are effected by the environmental conditions more.
Which means that by using good quality components the overall
performance will step up in terms of accuracy of measurement. Our project
heartbeat measurement has a tolerance of about 2 to 5 heartbeats while the
temperature has a tolerance of about 1 to 3 Centigrade. Other than the
reasons defined before, another thing that is effecting our accuracy is the
-
4
stability of the physical parts of the project/device such as, we have used a
cloth clip for sensors to hold the finger as shown below.
1.7 Goals
The main goal of this project is to make it easy to keep an eye on the
heart condition of a heart patient thus extending the range of treatment of
patients for the doctor meaning that heartbeat monitoring will be done by
this device while in the meantime the doctor can analyze another patient.
And he will also be kept informed by the device through SMS (the device
program can also be edited such that it will send SMS only when the patient
is in critical state).
1.8 Guidelines of thesis
The chapters in this thesis are divided on the basis of technicality and
in order of from basic to complex, meaning that at every next chapter the
depthness in the project will increment. The chapter names define there
main and core contents.
1.9 Research work
Related to this project lot of work has be done but due some technical
point, further research is still needed to perfect this device. The research on
those technical points is in progress. One of the basic problem is related to
the formulae used to calculate the heart rate of a person which will be
discussed in the next chapter. The references related to this project are
mentioned at the end of the thesis on Reference page.
-
5
Chapter 2: BACKGROUND
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 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.1 QRS complex
The QRS complex is a name for the combination of three of the
graphical deflections seen on a typical electrocardiogram (ECG). It is
usually the central and most visually obvious part of the tracing. It
corresponds to the depolarization of the right and left ventricles of the
human heart. In adults, it normally lasts 0.06 - 0.10 s; in children and during
physical activity, it may be shorter.
Typically an ECG has five deflections, arbitrarily named "P" to "T"
waves. The Q, R, and S waves occur in rapid succession, do not all appear
in all leads, and reflect a single event, and thus are usually considered
together. A Q wave is any downward deflection after the P wave. An R
wave follows as an upward deflection, and the S wave is any downward
deflection after the R wave. The T wave follows the S wave, and in some
cases an additional U wave follows the T wave.
-
6
(a) (b)
(c)
Figure 2.1: 1(a) Schematic representation of normal ECG, (b) Schematic
representation of the QRS complex, (c) Diagram showing how the polarity of the
QRS complex in leads I, II, and III can be used to estimate the heart's electrical
axis in the frontal plane
2.1.1 R wave progression
Looking at the precordial leads, the r wave usually progresses from
showing arS-type complex in V1 with an increasing R and a decreasing S
wave when moving towards the left side. There is usually anqR-type of
complex in V5 and V6 with the R-wave amplitude usually taller in V5 than
in V6. It is normal to have a narrow QS and rSr' patterns in V1, and so is
-
7
also the case for qRs and R patterns in V5 and V6. The transition zone is
where the QRS complex changes from predominately negative to
predominately positive (R/S ratio becoming >1), and this usually occurs at
V3 or V4. It is normal to have the transition zone at V2 (called "early
transition"), and at V5 (called "delayed transition").
The definition of poor R wave progression (PRWP) varies in the
literature, but a common one is when the R wave is less than 24 mm in leads V3 or V4 and/or there is presence of a reversed R wave progression,
which is defined as R in V4< R in V3 or R in V3< R in V2 or R in V2< R in
V1, or any combination of these.Poor R wave progression is commonly
attributed to anterior myocardial infarction, but it may also be caused by
left bundle branch block, WolffParkinsonWhite syndrome, right and left ventricular hypertrophy as well as by faulty ECG recording technique.
2.2 Heartbeat measurement (medical point of view)
Heart rate is measured by finding the pulse of the body. This pulse
rate can be measured at any point on the body when 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.[1]
Possible points for measuring the heart rate are:
1. The ventral aspect of the wrist on the side of the thumb (radial artery).
2. The ulnar artery.
3. The neck (carotid artery).
4. The inside of the elbow, or under the biceps muscle (brachial artery).
5. The groin (femoral artery).
6. Behind the medial malleolus on the feet (posterior tibial artery).
7. Middle of dorsum of the foot (dorsalispedis).
8. Behind the knee (popliteal artery).
9. Over the abdomen (abdominal aorta).
10. The chest (apex of heart), which can be felt with one's hand or fingers.
However, it is possible to auscultate the heart using a stethoscope.
11. The temple (superficial temporal artery).
-
8
12. The lateral edge of the mandible (facial artery).
13. The side of the head near the ear (basilar artery).
A more precise method of determining pulse involves the use of
an electrocardiograph, or ECG (also abbreviated EKG). Continuous
electrocardiograph monitoring of the heart is routinely done in many
clinical settings, especially in critical care medicine. Commercial heart rate
monitors are also available, consisting of a chest strap with electrodes. The
signal is transmitted to a wrist receiver for display. Heart rate monitors
allow accurate measurements to be taken continuously and can be used
during exercise when manual measurement would be difficult or impossible
(such as when the hands are being used).
Another way of determining the heart rate is by recording of the
body vibrations: (seismocardiography). Probably the first scientific paper
on this topic was presented by Salerno, DM and Zanetti, J in the Journal of
Cardiovascular Technology in year 1990 (Title: Seismocardiography - a
new technique for recording cardiac vibrations - concept, method, and
initial observations). In 2012 the first smart phone application incorporating
this principle was presented seismoCardiograph.
2.2.1 At rest
The resting heart rate (HRrest) is a person's heart rate when they are at
rest, that is lying down but awake, and not having recently exerted
themselves. The typical resting heart rate in adults is 60-90 beats per minute
(bpm)[2]
. Rates below 60 bpm are referred to as bradycardia and rates above
100 bpm are referred to as tachycardia.
Conditioned athletes often have resting heart rates below 60 bpm,
with values of below 40 bpm not unheard of. The cyclist Miguel
Indurain had a resting heart rate of 28 bpm[3]
.
The low pulse in conditioned athletes is due to the increased
efficiency of the heart as a pump coupled with more effective vascular
networks among peripheral muscle beds. Exercise leads to the healthy
-
9
enlargement of the ventricles of the heart and a condition known
as Athlete's heart.
Average resting heart rate depends on age.[4]
Men
Age: 18-25 26-35 36-45 46-55 56-65 65+
Athlete 49-55 49-54 50-56 50-57 51-56 50-55
Excellent 56-61 55-61 57-62 58-63 57-61 56-61
Good 62-65 62-65 63-66 64-67 62-67 62-65
Above Average 66-69 66-70 67-70 68-71 68-71 66-69
Average 70-73 71-74 71-75 72-76 72-75 70-73
Below Average 74-81 75-81 76-82 77-83 76-81 74-79
Poor 82+ 82+ 83+ 84+ 82+ 80+
Table 2.1:1Table of heart rates for men
-
10
Women
Age: 18-25 24-35 36-45 46-55 56-65 65+
Athlete 54-60 54-59 54-59 54-60 54-59 54-59
Excellent 61-65 60-64 60-64 61-65 60-64 60-64
Good 66-69 65-68 65-69 66-69 65-68 65-68
Above Average 70-73 69-72 70-73 70-73 69-73 69-72
Average 74-78 73-76 74-78 74-77 74-77 73-76
Below Average 79-84 77-82 79-84 78-83 78-83 77-84
Poor 85+ 83+ 85+ 84+ 84+ 84+
Table 2.2:2Table of heart rates for women
In children: The normal heart rate in children is variable and depends on the child's
age. Children exercising can have heart rates up to 200 bpm.[5]
2.2.2 Maximum
The maximum heart rate (HRmax) is the highest heart rate an
individual can safely achieve through exercise stress, and depends on age.
The most accurate way of measuring HRmax is via a cardiac stress test. In
such a test, the subject exercises while being monitored by an ECG. During
-
11
the test, the intensity of exercise is periodically increased (if a treadmill is
being used, through increase in speed or slope of the treadmill), continuing
until certain changes in heart function are detected in the ECG, at which
point the subject is directed to stop. Typical durations of such a test range
from ten to twenty minutes.
Standard textbooks of physiology and medicine mention that heart
rate (HR) is readily calculated from the ECG as follows: HR = 1,500/RR
interval in millimeters, HR = 60/RR interval in seconds, or HR =
300/number of large squares between successive R waves. In each case, the
authors are actually referring to instantaneous HR, which is the number of
times the heart would beat if successive RR intervals were constant.
Conducting a maximal exercise test can require expensive
equipment. People just beginning an exercise regimen are normally advised
to perform this test only in the presence of medical staff due to risks
associated with high heart rates. For general purposes, people instead
typically use a formula to estimate their individual maximum heart rate.
Formula
Figure 2.2:2Fox and Haskell formula; widely used.
-
12
Various formulas are used to estimate individual maximum heart
rates, based on age, but maximum heart rates vary significantly between
individuals.[6]
Even within a single elite sports team, such as Olympic
rowers in their 20s, maximum heart rates can vary from 160 to 220.[6]
This
variation is as large as a 60 or 90 year age gap by the linear equations given
below, and indicates the extreme variation about these average figures.
The most common formula encountered, with no indication of
standard deviation, is:
HRmax = 220 age
The formula has been attributed to various sources, but is widely
thought to have been devised in 1970 by Dr. William Haskell and Dr.
Samuel Fox.[6]
Inquiry into the history of this formula reveals that it was not
developed from original research, but resulted from observation based on
data from approximately 11 references consisting of published research or
unpublished scientific compilations.[7]
It gained widespread use through
being used by Polar Electro in its heart rate monitors,[6]
which Dr. Haskell
has "laughed about",[6]
as it "was never supposed to be an absolute guide to
rule people's training".[6]
While the most common (and easy to remember and calculate), this
particular formula is not considered by reputable health and fitness
professionals to be a good predictor of HRmax. Despite the widespread
publication of this formula, research spanning two decades reveals its large
inherent error (Sxy = 711 b/min). Consequently, the estimation calculated
by HRmax = 220 age has neither the accuracy nor the scientific merit for
use in exercise physiology and related fields.[7]
A study in year 2002[7]
of 43 different formulae for HRmax (including
the one above) concluded the following:
1. No "acceptable" formula currently existed, (they used the term
"acceptable" to mean acceptable for both prediction of VO2(VO2 falls
under the umbrella of exercise science. VO2 is defined as the
maximum amount of oxygen that the human body can utilize while
exercising aerobically. VO2, also called VO2 max, is a way to not only
show quantitatively the limits of the human cardiovascular system but
-
13
also to serve as a way to measure individual fitness. VO2 tests can
serve as an indicator for a physiological advantage in endurance
oriented sports) and prescription of exercise training (HR ranges)
2. The formula deemed least objectionable was:
HRmax = 205.8 (0.685 age)
This was found to have a standard deviation that, although large
(6.4 bpm), was still considered to be acceptable for the use of prescribing
exercise training HR ranges.
Other often cited formulae are going to be:
HRmax = 206.3 (0.711 age)
(Often attributed to "Londeree and Moeschberger from the University of
Missouri")
HRmax = 217 (0.85 age)
(Often attributed to "Miller et al. from Indiana University")
HRmax = 208 (0.7 age)
(Another "tweak" to the traditional formula is known as the Tanaka method.
Based on a study of thousands of individuals, a new formula was devised
which is believed to be more accurate).[8]
In year 2007, researchers at the Oakland University analysed
maximum heart rates of 132 individuals recorded yearly over 25 years, and
produced a linear equation very similar to the Tanaka formulaHRmax =
206.9 (0.67 age)and a nonlinear equationHRmax = 191.5 (0.007
age2). The linear equation had a confidence interval of 58 bpm and the
nonlinear equation had a tighter range of 25 bpm. Also a third nonlinear
equation was produced HRmax = 163 + (1.16 age) (0.018 age2).
[9]
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. While each may have predicted
heart rates of 180 (= 220 age), these two people could have actual
HRmax 20 beats apart (e.g., 170190).
-
14
Further, note that individuals of the same age, the same training, in
the same sport, on the same team, can have actual HRmax 60 bpmapart (160
to 220):[6]
the range is extremely broad, and some say "The heart rate is
probably the least important variable in comparing athletes."[6]
Year 2010 research conducted at Northwestern University revised the
maximum heart rate formula for women. According to Martha Gulati, et al.,
it is:
HRmax = 206 (0.88 age)[10][11]
A study from Lund, Sweden gives reference values (obtained during
bicycle ergometry).
for men:
HRmax = 203.7 / (1 + exp (0.033 x (age - 104.3)))[12]
and for women:
HRmax = 190.2 / (1 + exp (0.0453 x (age - 107.5)))[13]
The Target Heart Rate or Training Heart Rate (THR) is a desired
range of heart rate reached duringaerobic exercise which enables.
2.3 Target rate
The Target Heart Rate or Training Heart Rate (THR) is a desired
range of heart rate reached during aerobic exercise which enables one's
heart and lungs to receive the most benefit from a workout. This theoretical
range varies based mostly on age; however, a person's physical condition,
gender, and previous training also are used in the calculation. Below are
two ways to calculate one's THR. In each of these methods, there is an
element called "intensity" which is expressed as a percentage. The THR can
be calculated as a range of 65%85% intensity. However, it is crucial to derive an accurate HRmax to ensure these calculations are meaningful (see
above).
Example for someone with a HRmax of 180(age 40, estimating HRmaxAs 220
age):
-
15
65% Intensity: (220 (age = 40)) 0.65 117 bpm
85% Intensity: (220 (age = 40)) 0.85 153 bpm
2.3.1 Karvonen method
The Karvonen method factors in resting heart rate (HRrest) to
calculate target heart rate (THR), using a range of 5085% intensity: THR = ((HRmax HRrest) % intensity) + HRrest
Example for someone with a HRmax of 180 and a HRrest of 70:
50% Intensity: ((180 70) 0.50) + 70 = 125 bpm 85% Intensity: ((180 70) 0.85) + 70 = 163 bpm
2.3.2 Zoladz method
An alternative to the Karvonen method is the Zoladz method, which
derives exercise zones by subtracting values from HRmax:
THR = HRmax Adjuster 5 bpm Zone 1 Adjuster = 50 bpm
Zone 2 Adjuster = 40 bpm
Zone 3 Adjuster = 30 bpm
Zone 4 Adjuster = 20 bpm
Zone 5 Adjuster = 10 bpm
Example for someone with a HRmax of 180:
Zone 1(easy exercise): 180 50 5 125 135 bpm Zone 4(tough exercise): 180 20 5 155 165 bpm
2.4 Heart rate reserve
The Heart rate reserve (HRR) is a term used to describe the
difference between a person's measured or predicted maximum heart rate
and resting heart rate. Some methods of measurement of exercise intensity
measure percentage of heart rate reserve. Additionally, as a person
increases their cardiovascular fitness, their HRrest will drop, thus the heart
-
16
rate reserve will increase. Percentage of HRR is equivalent to percentage of
VO2 reserve.
HRR = HRmax HRrest
This is often used to gauge exercise intensity (first used in 1957 by
Karvonen).[14]
Karvonen's study findings have been questioned, due to the following:
1. The study did not use VO2 data to develop the equation. 2. Only six subjects were used, and the correlation between the
percentages of HRR and VO2 max was not statistically significant.[15]
2.5 Recovery heart rate
The Recovery heart rate is the heart rate measured at a fixed (or
reference) period after ceasing activity, typically measured over a one
minute period.
A greater reduction in heart rate after exercise during the reference
period indicates a better-conditioned heart. Heart rates that do not drop by
more than 12 bpm one minute after stopping exercise are associated with an
increased risk of death.[16]
Training regimes sometimes use recovery heart rate as a guide of
progress and to spot problems such as overheating or dehydration.[17]
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.
2.6 Abnormalities
2.6.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 condition when tachycardia occurs are:
1. Exercise. 2. Pregnancy. 3. Emotional conditions such as anxiety or stress.
-
17
Pathological conditions when tachycardia occurs are:
1. Fever. 2. Anemia. 3. Hypoxia. 4. Hyperthyroidism. 5. Hypersecretion of catecholamines. 6. Cardiomyopathy. 7. Valvular heart diseases. 8. Acute Radiation Syndrome.
2.6.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.
2.6.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.
2.7 Risk factor
A number of investigations indicate that faster resting heart rate has
emerged as a new risk factor for mortality in homeothermic mammals,
particularly cardiovascular mortality in human beings. Faster heart rate may
accompany increased production of inflammation molecules and increased
-
18
production of reactive oxygen species in cardiovascular system, in addition
to increased mechanical stress to the heart. There is a correlation between
increased resting rate and cardiovascular risk. This is not seen to be "using
an allotment of heartbeats" but rather an increased risk to the system from
the increased rate.[18]
An Australian-led international study of patients with cardiovascular
disease has shown that heartbeat rate is a key indicator for the risk of heart
attack. The study, published in The Lancet (September 2008) studied
11,000 people, across 33 countries, who were being treated for heart
problems. Those patients whose heart rate was above 70 beats per minute
had significantly higher incidence of heart attacks, hospital admissions and
the need for surgery. University of Sydney professor of cardiology Ben
Freedman from Sydney's Concord hospital, said "If you have a high heart
rate there was an increase in heart attack, there was about a 46 percent
increase in hospitalizations for non-fatal or fatal heart attack."[19]
Standard textbooks of physiology and medicine mention that heart
rate (HR) is readily calculated from the ECG as follows:
HR = 1,500/RR interval in millimeters, HR = 60/RR interval in
seconds, or HR = 300/number of large squares between successive R
waves. In each case, the authors are actually referring to
instantaneous HR, which is the number of times the heart would beat
if successive RR intervals were constant. However, because the
above formula is almost always mentioned, students determine HR
this way without looking at the ECG any further.
2.8 Light-emitting diode
A number of investigations indicate that faster resting heart rate has
A light-emitting diode (LED) is a semiconductor light source. LEDs are
used as indicator lamps in many devices and are increasingly used for other
lighting. Introduced as a practical electronic component in 1962, early
LEDs emitted low-intensity red light, but modern versions are available
across the visible, ultraviolet, and infrared wavelengths, with very high
brightness.
When a light-emitting diode is forward-biased (switched on),
electrons are able to recombine with electron holes within the device,
releasing energy in the form of photons. This effect is called
electroluminescence and the color of the light (corresponding to the energy
-
19
of the photon) is determined by the energy gap of the semiconductor. LEDs
are often small in area (less than 1 mm2), and integrated optical components
may be used to shape its radiation pattern. LEDs present many advantages
over incandescent light sources including lower energy consumption,
longer lifetime, improved physical robustness, smaller size, and faster
switching. LEDs powerful enough for room lighting are relatively
expensive and require more precise current and heat management than
compact fluorescent lamp sources of comparable output.
Light-emitting diodes are used in applications as diverse as aviation
lighting, automotive lighting, advertising, general lighting, and traffic
signals. LEDs have allowed new text, video displays, and sensors to be
developed, while their high switching rates are also useful in advanced
communications technology. Infrared LEDs are also used in the remote
control units of many commercial products including televisions, DVD
players, and other domestic appliances.[20]
Figure 2.3:3Electronic symbol and Pin configuration anode and cathode
Figure 2.4:4Parts of an LED
-
20
The flat bottom surfaces of the anvil and post embedded inside the
epoxy act as anchors, to prevent the conductors from being forcefully
pulled out from mechanical strain or vibration.
2.8.1 LED Lamp (Light-Emitting Diode)
Light-emitting diode features:[21]
1. Viewing angle: +10 to +200 degrees (as required).
2. Super high intensity luminary: 100 - 20,000mcd.
3. Wave length: 375 - 700nm.
4. Reliable, long lifespan with over 60,000 ~ 100,000 hours.
5. Choice of various viewing angles and colors emitted: red, green, blue,
white, yellow, amber (optional).
6. Applications:
a. Commercial outdoor signs.
b. Automotive interior lights.
c. Front panel indicators.
d. Front panel backlights.
e. City beautification of night piece.
f. Traffic light.
g. Display.
7. All kinds of shapes including: round, columni form, square shape,
elliptica shape, tower shape, super flux, triangular shape.
8. Its outer packing comes in Anti-static bag and exporting carton.
2.9 Liquid crystal display
A liquid crystal display (LCD) is a flat panel display, electronic
visual display, or video display that uses the light modulating properties of
liquid crystals (LCs). LCs do not emit light directly.
LCD displays are available to display arbitrary images (as in a
general-purpose computer display) or fixed images which can be displayed
or hidden, such as preset words, digits, 7-segment displays, etc., as in a
digital clock. They use the same basic technology, except that arbitrary
-
21
images are made up of a large number of small pixels, while other displays
have larger elements.[22]
2.9.1 Applications of LCD
LCDs are used in a wide range of applications, including computer
monitors, television, instrument panels, aircraft cockpit displays, signage,
etc. They are common in consumer devices such as video players, gaming
devices, clocks, watches, calculators, and telephones. LCDs have replaced
cathode ray tube (CRT) displays in most applications. They are available in
a wider range of screen sizes than CRT and plasma displays, and since they
do not use phosphors, they cannot suffer image burn-in. LCDs are,
however, susceptible to image persistence.[23]
The LCD is more energy efficient and offers safer disposal than a
CRT. Its low electrical power consumption enables it to be used in battery-
powered electronic equipment. It is an electronically modulated optical
device made up of any number of segments filled with liquid crystals and
arrayed in front of a light source (backlight) or reflector to produce images
in color or monochrome. Liquid crystals were first developed in 1888.[24]
By 2008 worldwide sales of televisions with LCD screens exceeded annual
sales of CRT units; the CRT became obsolete for most purposes.
Figure 2.5:5Reflective twisted nematic liquid crystal display
1. Polarizing filter film with a vertical axis to polarize light as it enters. 2. Glass substrate with Indium tin oxide or tin-doped indium oxide (ITO)
electrodes. The shapes of these electrodes will determine the shapes
that will appear when the LCD is turned ON. Vertical ridges etched on
the surface are smooth.
3. Twisted nematic liquid crystal.
-
22
4. Glass substrate with common electrode film (ITO) with horizontal ridges to line up with the horizontal filter.
5. Polarizing filter film with a horizontal axis to block/pass light. 6. Reflective surface to send light back to viewer. (In a backlit LCD, this
layer is replaced with a light source.).
2.10 GSM
The Global System for Mobile Communication known as GSM is a
technology that dominated mobile communication industry over the past
decade. GSM originated from Europe and spread into many other countries
to become a popular standard for mobile communication. GSM started
mainly with voice communication, offering few basic services, then data
communication was introduced, but due to slow data rate, it was useful to
very few applications. Research and development brought about the
different evolutions of GSM, namely HSCSD (High Speed Circuit
Switched Data), GPRS (General Packet Radio Service) and EDGE
(Enhanced Data rate for GSM Evolution). Presently, GSM network
operators provide a wide range of services, including many new services
such as web surfing, MMS (Multimedia Messaging Services), and EMS
(Enhanced Messaging Services). There are a lot of useful technological
products developed in the world to make life much easier, products which
are not used by many simply because these are not well known or not
properly understood.[25]
Public understanding of science and technology is a very important
aspect of our modern world. Scientific discoveries and new technologies
serve the purpose of pushing back the frontiers of human ignorance and
make life and the actual way humans do things much simpler. It is therefore
of little use keeping them in laboratories and libraries alone. Information
on scientific discoveries and new technologies should be disseminated to
the general public so that people can be aware of them and make informed
choices.[25]
-
23
2.10.1 GSM demonstration
Many companies invest significant capital in the development of new
technologies, new products or new services, which they have to
commercialize at the end. It is a serious problem for these companies when
the public is not aware of the existence of these new products on the
market, or when the public is not ready to use the new technology.
Therefore educating people about new technologies, their importance and
their use is extremely important for such companies. The quicker people
can be educated about new technologies, the better for themselves, for the
companies developing these technologies, for the government and society
in general.[25]
2.10.2 GSM Network Infrastructure
The following figure below depicts a typical GSM network (called,
Public Land Mobile Network or PLMN) infrastructure.[26]
Figure 2.6:6Wireless communications systems and networks
-
24
Dont need to go in depth of how internal structure of components of GSM network works because we are only interested in sending SMS
through a mobile, not with which process it will have to go through. GSM
infrastructure is for extra knowledge and to know that how your SMS will
reach the receiver (in this project case the doctor).
Figure 2.7:7Hexa cellular range of BTS based network diagram
The GSM divides the infrastructure into the following three parts.[26]
Network Switching Subsystems (NSS) Base Station Subsystem (BSS) Network Management Subsystem (NMS)
If we count the Mobile Station (MS) or cell-phone is the 4 the
element.[26]
Any telecommunications network requires some kind of NMS. A
part of NMS is generic for any telecom system. The billing and messaging
are two examples. The core of the NSS is the MSC (Mobile Switching
Center) which is basically a PSTN switch with mobility management
related enhancement/add-on. The BSS is entirely new (compared to PSTN)
that are required for wireless access and mobility. The following sections of
this document provide an overview of the network elements and their
functions. The role of these elements will be clearer as we learn more.[26]
-
25
Chapter3: MICROCONTROLLER, ITS
INTERFACES AND PROJECT CIRCUIT
3.1 Microcontroller description (AT89S52)
The AT89S52 is a low-power, high-performance Static CMOS 8-bit
microcontroller with 8K bytes of in-system programmable Flash memory.
The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industry-standard 80C51
instruction set and pin out.[27]
The on-chip Flash allows the program memory to be reprogrammed
in-system or by a conventional nonvolatile memory programmer. By
combining a versatile 8-bit CPU with in-system programmable Flash on a
monolithic chip, the Atmel AT89S52 is a powerful microcontroller which
provides a highly-flexible and cost-effective solution to many embedded
control applications.[27]
The AT89S52 provides the following standard features: 8K bytes of
Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers,
three 16-bit timer/counters, axis-vector two-level interrupt architecture, a
full duplex serial port, on-chip oscillator, and clock circuitry. In addition,
the AT89S52 is designed with static logic for operation down to zero
frequency and supports two software selectable power saving modes. The
Idle Mode stops the CPU while allowing the RAM, timer/counters, serial
port, and interrupt system to continue functioning. The Power-down mode
saves the RAM contents but freezes the oscillator, disabling all other chip
functions until the next interrupt or hardware reset.[27]
When choosing a controller chip for the tracking system, it was
important to consider the functions it would need to perform. The functions
include converting the analog voltages from the sensor circuits into digital
values that can then be compared. The controller also needs the capacity to
handle inputs from the user interface and the outputs to the dc motor control
circuit.
These inputs and Outputs need to be clarified before the controller is
chosen. To handle the analog to digital (A/D) conversions, the control chip
must read four voltage levels simultaneously and continuously. After
researching an appropriate 28control chip, the AT89S52 microcontroller
was found to be the preferred choice as it can perform all required functions
-
26
using only a single chip. The chip contains an on chip A/D converter,
adequate programmable memory space, ample input and output pins and a
supply voltage of five volts. This powerful 10 MIPS (100 nanosecond
instruction execution) yet easy-to-program (only 77 single word
instructions) CMOS FLASH-based 8-bit microcontroller packs Microchip's
powerful architecture into an 40 -pin package and is upwards compatible
with theAT89ASXX , devices and thus providing a seamless migration
path of software code to higher level of hardware integration.
The AT89S52 features a 'C' compiler friendly development
environment, 256 bytes of EEPROM, Self-programming, an ICD, 2
capture/compare/PWM functions, 8 channels of 10-bit Analog-to-Digital
(A/D)converter, the synchronous serial port can be configured as either 3-
wire Serial Peripheral Interface (SPI) or the 2-wire Inter-Integrated Circuit
bus and Enhanced Universal Asynchronous Receiver Transmitter
(EUSART). We will describe about the AT89S52 and at the same time, it
will give more understanding for me to employ this controller. Almost all
type of AT89S microcontroller is included in a class of 8-bit
microcontrollers of RISC architecture. Basically, the AT89S52 architecture
is minimized to be a simpler item but it still operates at the same function.
The Harvard architecture is a newer concept than von-Neumann. It was
designed as a response for the need to speed up the work of a
microcontroller. In Harvard architecture, data bus and address bus are
separate. Thus, the data will flow directly through the central processing
unit and the address bus is neglected. This greater flow of data will impact
for a greater speed of work. Besides that, the architecture will involve for a
small number of a fixed length instruction. It means the instruction is not to
have to be 8-bit words but it can use 14 bits for instructions which allows
for all instruction to be one word instructions.
Microcontrollers with Harvard architecture are called "RISC
microcontrollers". RISC is a short form for Reduced Instruction Set
Computer. Micro controllers with von-Neumann's architecture are called
CISC microcontrollers. CISC is a short form for Complex Instruction Set Computer. Same as discussion before, RISC microcontroller has a reduced
set of instructions, maybe 35 instructions for one cycle. If we compared it
with Intels and Motorolas microcontroller, it has over hundred instructions. Simplified point, we can say that the features of
microcontroller are:
1. Separate code and data spaces (Harvard architecture). 2. A small number of fixed length instructions.
-
27
3. Most instructions are single cycle execution with single delay cycles upon branches and skips.
4. All RAM locations function as registers as both source and/or Destination of math and other functions.
5. A hardware stack for storing return addresses. 6. A fairly y small amount of addressable data space (typically 256
bytes), extended through banking.
7. Data space mapped CPU, port and peripheral registers. 8. The program counter is also mapped into the data space and writable.
Microprocessor divides to 6 parts. Those are program memory,
EEPROM, RAM, PORTA and PORTB. AT89S52 has a total of 40 pins.
The program counter is also mapped into the data space and writable. So,
the result for AT89S52 microcontroller reaches of 2:1 in code compression
an in speed in relation to other 8-bit microcontrollers in its class. AT89S52
microprocessor divides to 6 parts. Those are program memory, EEPROM,
RAM, PORTA and PORTB, free-run timer and central processing unit.
Furthermore, AT89S52 (PDIP)will be used in this project as base
controller.
As mentioned in previous paragraph, AT89S52 has a total of 40 pins.
Each pin has its meaning. The program counter is also mapped into the data
space and writable. So, the result for microcontroller reaches of 2:1 in code
compression and 4:1 bit microcontrollers in its class.
The AT89S52 pin no. 40 (VDD), pin no. 31 (VDD), these pins will
be connecting to the 5V voltage. For pin no. 20 pin no. this pin will be
connecting to the ground (GND). For pin no. 18 (OSC1) and pin no. 19
(OSC2), these pins will be connecting to the oscillator. For other pins, we
take point for the input and output. The most important part is how to
program this AT89S52.For program this Microcontroller we used pin no
6,7,8,9,10,11. And program is written in Assembly language.
3.2 Pin configuration of AT89S52
In this Project 8051 series microcontroller will be used. The 8051
series microcontroller we have used as base control is an Atmel corporation
AT89S52 40-Lead PDIP type microcontroller.
-
28
(a)
(b)
-
29
(c)
Figure 3.1: 8Pin configuration of microcontroller AT89S52 different versions
-
30
Figure 3.2: 9Block diagram of AT89S52
-
31
3.3 Pin Description of AT89S52
3.3.1 VCC
Supply voltage.[27]
3.3.2 GND
GND stands for ground. Used to provide a ground. [27]
3.3.3 Port 0
Port 0 is an 8-bit open drain bidirectional I/O port. As an output port,
each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the
pins can be used as high impedance inputs. Port 0 can also be configured to
be the multiplexed low order address/data bus during accesses to external
program and data memory. In this mode, P0 has internal pull-ups Port 0
also receives the code bytes during Flash programming and outputs the
code bytes during program verification. External pull-ups are required
during program verification.[27]
3.3.4 Port 1
Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1
output buffers can Sink/source four TTL inputs. When 1s are written to Port
1 pins, they are pulled high by the internal pull-ups and can be used as
inputs. As inputs, Port 1 pins that are externally being Pulled low will
source current (IIL) because of the internal pull-ups. In addition, P1.0 and
P1.1Can be configured to be the timer/counter 2 external count input
(P1.0/T2) and the Timer/counter 2 trigger input (P1.1/T2EX), respectively,
Port 1 also receive s the low-order address bytes during Flash programming
and verification.[27]
3.3.5 Port 2
Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2
output buffers can Sink/source four TTL inputs. When 1s are written to Port
2 pins, they are pulled high by the internal pull-ups and can be used as
-
32
inputs. As inputs, Port 2 pins that are externally being pulled low will
source current (IIL) because of the internal pull-ups. Port 2 emits the high-
order address byte during fetches from external program memory and
During accesses to external data memory that use 16-bit addresses (MO VX
@DPTR) In this application, Port 2 uses strong internal pull-ups when
emitting 1s. During Accesses to external data memory that uses 8-bit
addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special
Function Register. Port 2 also receives the high-order address bits and some
control signals during Flash programming and verification.[27]
3.3.6 Port 3
Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3
output buffers can sink/source four TTL inputs. When 1s are written to Port
3 pins, they are pulled high by the internal pull-ups and can be used as
inputs. As inputs, Port 3 pins that are externally being pulled low will
source current (IIL) because of the pull-ups. Port 3 also serves the functions
of various special features of the AT89S52, as shown in the following table.
Port 3 also receives some control signals for Flash programming and
verification.[27]
3.3.7 RST
Reset input. A high on this pin for two machine cycles while the
oscillator is running resets the device. This pin drives High for 96 oscillator
periods after the Watchdog times out. The DISRTO bit in SFR AUXR
(address 8EH) can be used to disable this feature. In the default state of bit
DISRTO, the RESET HIGH out feature is enabled.[27]
3.3.8 ALE/PROG
Address Latch Enable (ALE) is an output pulse for latching the low byte
of the address during Accesses to external memory. This pin is also the
program pulse input (PROG) During Flash programming. In normal
operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency
and may be used for external timing or clocking purposes. Note, however,
that one ALE pulse is skipped during each access to external data memory.
If desired, ALE operation can be disabled by setting bit 0 of SFR location
8EH. With the bit set, ALE is active only during a MOVX or MOVC
instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-
-
33
disable bit has no effect if the microcontroller is in external execution
mode.[27]
3.3.9 PSEN
Program Store Enable (PSEN) is the read strobe to external program
memory. When the AT89S52 is executing code from external program
memory, PSEN is activated twice each machine cycle, except that two
PSEN activations are skipped during each access to external data
memory.[27]
3.3.10 EA/VPP
External Access Enable. EA must be strapped to GND in order to enable
the device to fetch code from external program memory locations starting at
0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA
will be internally latched on reset. EA should be strapped to VCC for
internal program executions. This pin also receives the 12-volt
programming enable voltage (VPP) during Flash programming.[27]
3.3.11XTAL1
Input to the inverting oscillator amplifier and input to the internal clock
operating circuit.[27]
3.3.12 XTAL2
Output from the inverting oscillator amplifier.[27]
3.4 Special Function Registers of AT89S52
A map of the on-chip memory area called the Special Function Register
(SFR) space. Note that not all of the addresses are occupied, and
unoccupied addresses may not be implemented on the chip. Read accesses
to these addresses will in general return random data, and write accesses
will have an indeterminate effect. User software should not write 1s to these
unlisted locations, since they may be used in future products to invoke new
-
34
features. In that case, the reset or inactive values of the new bits will always
be 0.[27]
3.4.1 Timer 2 Registers
Control and status bits are contained in registers T2CON and T2MOD
for Timer 2. The register pair (RCAP2H, RCAP2L) is the Capture/Reload
registers for Timer 2 in 16-bit capture mode or 16-bit auto-reload mode.[27]
3.4.2 Interrupt Registers
The individual interrupt enable bits are in the IE register. Two priorities
can be set for each of the six interrupt sources in the IP register.[27]
3.4.3 Dual Data Pointer Registers
To facilitate accessing both internal and external data memory, two
banks of 16-bit Data Pointer Registers are provided: DP0 at SFR address
locations 82H-83H and DP1 at 84H-85H. Bit DPS = 0 in SFR AUXR1
selects DP0 and DPS = 1 selects DP1. The user should always initialize the
DPS bit to the appropriate value before accessing the respective Data
Pointer Register.[27]
3.4.4 Power off Flag
The Power off Flag (POF) is located at bit 4 (PCON.4) in the PCON
SFR. POF is set to 1 during power up. It can be set and rest under software control and is not affected by reset.2.2.5 Memory Organization
MCS-51 devices have a separate address space for Program and Data
Memory. Up to 64K bytes each of external Program and Data Memory can
be addressed.[27]
3.5 Watchdog Timer of AT89S52
(One-time Enabled with Reset-out) The WDT is intended as a recovery
method in situations where the CPU may be subjected to software upsets.
The WDT consists of a 13-bit counter and the Watchdog Timer Reset
(WDTRST) SFR. The WDT is defaulted to disable from exiting reset. To
-
35
enable the WDT, a user must write 01EH and 0E1H in sequence to the
WDTRST register (SFR location 0A6H). When the WDT is enabled, it will
increment every machine cycle while the oscillator is running. The WDT
timeout period is dependent on the external clock frequency. There is no
way to disable the WDT except through reset (either hardware reset or
WDT overflow reset). When WDT overflows, it will drive an output
RESET HIGH pulse at the RST pin.[27]
3.5.1 Using the WDT
To enable the WDT, a user must write 01EH and 0E1H in sequence to
the WDTRST register (SFR) location 0A6H). When the WDT is enabled,
the user needs to service it by writing 01EH and 0E1H to WDTRST to
avoid a WDT overflow. The 13-bit counter overflows when it reaches 8191
(1FFFH), and this will reset the device. When the WDT is enabled, it will
increment every machine cycle while the oscillator is running. This means
the user must reset the WDT at least every 8191 machine cycles. To reset
the WDT the user must write 01EH and 0E1H to WDTRST. WDTRST is a
write-only register. The WDT counter cannot be read or written. When
WDT overflows, it will generate an output RESET pulse at the RST pin.
The RESET pulse duration is 96xTOSC, where TOSC=1/FOSC. To make
the best use of the WDT, it should be serviced in those sections of code that
will periodically be executed within the time required to prevent a WDT
reset.[27]
3.5.2 WDT during Power-down and Idle
Power-down mode the oscillator stops, which means the WDT also
stops. While in Power- down mode, the user does not need to service the
WDT. There are two methods of exiting Power-down mode: by a hardware
reset or via a level-activated external interrupt which is enabled prior to
entering Power-down mode. When Power-down is exited with hardware
reset, servicing the WDT should occur as it normally does whenever the
AT89S52 is reset. Exiting Power-down with an interrupt is significantly
different. The interrupt is held low long enough for the oscillator to
stabilize. When the interrupt is brought high, the interrupt is serviced. To
prevent the WDT from resetting the device while the interrupt pin is held
low, the WDT is not started until the interrupt is pulled high. It is suggested
that the WDT be reset during the interrupt service for the interrupt used to
exit Power-down mode. To ensure that the WDT does not overflow within
a few states of exiting Power-down, it is best to reset the WDT just before
-
36
entering Power-down mode. Before going into the IDLE mode, the
WDIDLE bit in SFR AUXR is used to determine whether the WDT
continues to count if enabled. The WDT keeps counting during IDLE
(WDIDLE bit = 0) as the default state. To prevent the WDT from resetting
the AT89S52 while in IDLE mode, the user sho