You are on page 1of 178

MAGIC MONITOR

Biomedical Engineering Department

INDEX
Chapter 1 Chapter 2

SUBJECT
ABSTRACT INTRODUCTION ECG
2.1. Introduction 2.2. Medical View 2.3. Electric activity of heart 2.4. Cardiac waveform 2.5. ECG Electrodes 2.6. ECG Leads 2.6.1. Limb Leads 2.6.2. Augmented Leads 2.7. Characteristic of ECG signal 2.8. Specification of ECG signal 2.9. Hardware Implementation 2.9.1. Block Diagram 2.9.2. Sensing Electrodes 2.9.3. Lead Selector 2.9.4. High pass filter 2.9.5. Instrumentation Amplifier 2.9.6. Low Pass Filter 2.9.7. Notch Filter 2.9.8. DC Shift 2.9.9. Microcontroller 2.9.10. PCB Circuit 2.9.11. Our Real Board 2.10. kinds of problems 2.11. ECG signal problems

page
6 8 11 12 14 18 22 25 27 28 30 32 33 34 34 34 36 36 37 39 40 40 41 42 44 45 48

Chapter 3

BLOOD PRESSURE MONITORING


3.1. Introduction and Medical background 3.2. How to measure blood pressure? 3.2.1. The aneroid monitor 3.2.2. The digital Blood pressure monitor 3.2.3. The finger/wrist blood pressure monitors 3.2.4. Using catheters in blood pressure measurement 3.2.5. Why replacing the mercury sphygmomanometers? 3.2.6. Oscillometric methods 3.3. Theory of operation of most pressure devices 3.4. Hardware Implementation 3.4.1. Block Diagram 3.4.2. Pressure Sensor 3.4.3. Hardware Diagram 3.4.4. Hardware Component 3.5. Blood pressure circuit 3.5.1. Simulation circuit 3.5.2. PCP circuits 3.5.3. Our circuit board 3.6. Software Design 3.6.1. Code 3.6.2. Flow chart 3.7. User Manual 3.8. Safety

49 50 53 53 54 54 55 65 57 58 61 61 61 64 66 69 69 76 78 79 79 81 84 86 87 88 89 92 92 92 93 94 95 98 98 99 100 100 101 104 106 107 107 107 108 109 110 110 111 111

Chapter 4

PULSE OXIMETER
4.1. Introduction 4.2. What does a pulse oximeter measure? 4.3. The Affecting Factors on Pulse Oximeter Reading 4.3.1. Patient factor 4.3.2. External factor 4.4. Skin Integrity Issues Associated with Pulse Oximetry 4.5. How Can We Calculate SPO2? 4.6. Pulse Oximeter Sensor 4.7. Hardware Implementation 4.7.1. Block Diagram 4.7.2. Simulation Circuit 4.7.3. LED Driving Circuit 4.7.4. Current to voltage converter 4.7.5. Filtration 4.7.6. PCB circuit 4.7.7. Our Real Board 4.8. Software Design 4.8.1. Microcontrooler 4.8.2. Code 4.8.3. Flow chart

Chapter 5

TEMPERATURE
5.1. Introduction 5.2. Normal body temperature 5.3. Locations of body temperature measurement 5.3.1. How to take an Oral temperature?

5.3.2. How to take a rectal temperature? 5.3.3. How to take an armpit (axillarys) temperature? 5.3.4. How to take an ear temperature? 5.4. Abnormalities in body temperature 5.4.1. Hypothermia 5.4.2. Hyperthermia 5.5. Hardware Implementation 5.5.1. Circuit Diagram 5.5.2. Temperature Sensor 5.5.3. Microcontroller 5.5.4. 7-Segment Display

112 113 113 113 113 115 117 117 118 119 120

Chapter 6

DISPLAYING DATA & PLOTTING SIGNAL


6.1. Displaying data 6.1.1. Design of 7-Segments 6.1.2. Concept and visual structure 6.1.3. Programmed 7-Segments 6.1.4. Display data on each module 6.2. Plotting signal 6.2.1. How plotting signal on Graphic LCD? 6.2.2. Circuit of Graphic LCD

121 122 122 123 123 125 126 127 129

Chapter 7

SERIAL COMMUNICATION
7.1. Protocol 7.2. RS232 Level Conversion 7.3. PCB Circuit

130 132 133 135 136 137 137 138 139 140 144 145 146 146 147 148 148 149 150 166

Chapter 8

COMPUTER INTERFACE
8.1. Display Monitor Data on PC 8.1.1 Read and Display input data 8.1.2. Plot ECG signal 8.2. Send Data to E-Mail 8.3. GUI

Chapter 9

MOBILE TECHNOLOGY
9.1. System data flow 9.1.1. Client server protocol 9.1.2. HTTP protocol 9.2. Java Platform, Micro Edition 9.2.1. Mobile devices 9.3. Software Requirements Specification 9.4. Domain Requirements

Chapter 10

DATASHEETS REFERENCES

Our Project, MAGIC ICU Monitor, is made to measure and observe different Vital signs using various electronic components in addition to diagnose some cardiovascular diseases by analyzing the data being measured. The aim of this advance ICU monitor is to give physicians in the ICU a pre-idea about diagnosis of the case & suggested emergency required. Our project measure blood pressure, pulse oximeter, human body temperature & detect ECG signal and display all this parameters.

There are 4 basic stages in our project ,the Hardware circuits stage , the software stage ,display stage and finally new technology stage (SENDING DATA VIA MAIL & MOBILE).

Our Project mainly consists of 5 separate hardware circuits 1. ECG Monitoring 2. Pressure Monitoring 3. Pulse Oximetry 4. Temperature Monitoring 5. Serial Interface each circuit connected to a Microcontroller to be processed ,then to serial circuit which connect modules data to Computer to be displayed and sending to mobile

and different mails with the help of a Java implemented program and matlap program ,as shown in the following block diagram :
Temp. Circuit Pressure Circuit

SpO2 Circuit ECG Circuit

PC
Serial circuit mobile

The development of intensive care units made the care for more seriously sick patients possible. It allowed utilizing more technically oriented tools to monitor and get information instantly about any changes of the patient's physiological parameters and developed new strategies to save life. On the other hand it raised ethical and professional issues related to some patients who had untreatable medical conditions or those who sustained unsalvageable damage to their vital organs. These units are special units where the effort is concentrated in one locality in the hospital and where the care of patients who are deemed recoverable but who need supervision and need or likely to need specialized techniques by skilled personnel. Among this specialized technique we can enumerate continuous artificial ventilation, supporting the circulation, management of chock and respiratory dialysis. The utilization of this unit in the management of critical ill patient improved the outcome by reduction in expected mortality up to 60%. The Units have the following major characteristics: (1) space, equipment and working staff and (2) continuous service and care all around the clock 24 hours including all the following: instantaneous monitoring of cardiovascular parameter, respiratory function, renal function and the nervous system status. These settings are not seen in any other place in the hospital. The patient's categories that can benefit from this unit are 1-Patients of myocardial infarction who usually need continuous cardiovascular monitoring.
7

2-Patients who needs artificial ventilation, cardiovascular support 3-Patients with major metabolic disturbances like patient with uncontrolled diabetes mellitus or patient after major abdominal surgeries. 4- Patients with major trauma like patients with head injuries, chest injuries and other multiple injuries. 5-Disaster medicine victims who are affected by multiple injuries. So, what do we get from the ECG and ICU Monitoring? 1. A feedback to control the oxygen supplay To the patient (in our design we will control stepper motor instead of ventilator) 2. Heart rate monitoring To differentiate between several states of different diseases giving wide view of the patient state during time of observation 3. Arrhythmias a. Supraventricular arrhythmias b. Ventricular arrhythmias 4. Disorders in the activation sequence a. Atrioventricular conduction defects (blocks) b. Bundle-branch block c. Wolff-Parkinson-White syndrome 5. Increase in wall thickness or size of the atria and ventricles a. Atrial enlargement (hypertrophy) b. Ventricular enlargement (hypertrophy) 6. Myocardial ischemia and infarction a. Ischemia b. Infraction If a coronary artery is occluded, the transport of oxygen to the cardiac muscle is decreased, causing an oxygen debt in the muscle, which is called ischemia. Ischemia causes changes in the resting potential and in the repolarization of the muscle cells, which is seen as changes in the T-wave. If the oxygen transport is terminated in a certain area, the heart muscle dies in that region. This is called an infarction.
8

to doctors

An infarct area is electrically silent since it has lost its excitability. According to the solid angle theorem the loss of this outward dipole is equivalent to an electrical force pointing inward. With this principle it is possible to locate the infarction. (Of course, the infarct region also affects the activation sequence and the volume conductor so the outcome is more complicated.) In our search for the needs of ICU monitors and what biosignals should be in our mind to observe we find this research by the Department of Surgery, Division of Vascular Surgery, Loyola University Medical Center The purpose of this study was to develop criteria by which selected patients can be observed.. From this research we find out what biosignals should be observed And they are: ECG, Heart Rate, Temperature, Blood pressure and SPO2. For our parameters that we manage to detect SPO2, Heart Rate, Temperature and Blood pressure in addition to ECG of course The normal ranges of these parameters are (in case of adult male 180 cm tall, 85 kg weight, and 40 to 45 years old): SPO2 Heart Rate Temperature Blood pressure it should be higher than 90 % from 60 to 100 bpm 37 C ideal case normal range from 36 to 38 C normal range of systolic pressure from 100 to 140 mmHG AND normal range of Diastolic pressure from 70 to 90 mmHG

-:Introduction 2.1
Electrocardiography or ECG is a important diagnostic tool for Veterinary.Medicine
10

.ECGs measure the electrical activity of the heartThe heart shoulders the responsibility for pumping blood throughout the entire human circulatory system. The circulatory system delivers much needed oxygen and nutrients to the organs and tissues of the body, and then returns depleted blood to the heart and the lungs for regeneration. This perpetual cycle represents the scientific essence of human life. On an average day, the heart will "beat", i.e. expand and contract, nearly 100,000 times, while pumping about 2000 gallons of .blood. In a 70-year lifetime, a normal heart will beat more than 2.5 billion times Given the arduous physical demands placed on the human heart, it should come as no surprise that heart disease represents one of society's gravest health risks. Essentially, heart disease is present when the pumping and circulatory functions .described above encounter interference Although heart disease comes in myriad forms, its variations can be grouped into two basic categories. "Congenital" heart disease involves organ defects that are inborn or existent at birth. These defects may impede the flow of blood in the heart or in the vessels near it. Furthermore, the defects may cause blood to flow through the heart in abnormal patterns. "Congestive" heart failure, on the other hand, doesn't necessarily involve inborn organ defects. Rather, this condition is present when the heart's pumping function is restricted by an underlying medical condition that has developed over time, such as clogged arteries or high blood .pressure Congenital and congestive forms of heart disease take an enormous toll on society. As noted previously, the heart's pumping action supplies the body with the oxygen and nutrient-rich blood it needs in order to function properly. Persons plagued by early and middle stage heart disease suffer from a shortage of these life-sustaining elements. Thus, such persons often tend to feel weak, fatigued, .and short of breath As the American Heart Association notes, basic daily activities such as walking, climbing stairs, and carrying groceries can begin to feel like insurmountable tasks .for patients suffering within this category While the productivity and lifestyle-related losses that stem from early and middle stage heart disease are quite substantial, the terrifying impact of this health condition is most clearly illustrated by the experiences of those suffering .at the end-stage of the disease

11

Each year, nearly 1,000,000 people die from complications of cardiovascular disease. Indeed, according to some experts, heart disease kills as many persons as nearly all other causes of death combined. Because of the substantial strain that heart disease places on society, physicians, scientists and policy makers have, for decades, devoted significant amounts of time and resources to combating its effects. Furthermore, numerous health organizations have undertaken efforts to better educate the public about demonstrable linkages between heart disease and personal choices regarding diet and lifestyle. Despite these efforts, however, a large segment of the population lives with hearts that have been severely .damaged by heart disease, and thus face imminent death The first known step, in whatever heart-related problems, is to see the patients Electrocardiograph as a non-invasive inspection tool to notice some of the heart problems such as blocks, fibrillationetc, as will be shown on the text. Before getting deep into the equipment itself it is preferably to know a brief overview .about the heart anatomy and physiology

:Medical Overview 2.2


:Location of the heart

12

The heart is located in the chest between the lungs behind the sternum and above the diaphragm. It is surrounded by the pericardium. Its size is about that of a fist, and its weight is about 250-300 g. Located above the heart is the great vessels: the superior and inferior vena cava, the pulmonary artery and vein, as well as the aorta. The aortic arch lies behind the heart. The esophagus and the spine lie .further behind the heart

Anatomy of the heart


The heart is one of the most important organs in the entire human body. It is really nothing more than a pump, composed of muscle which pumps blood throughout the body, beating approximately 72 times per minute of our lives. The heart pumps the blood, which carries all the vital materials which help our bodies function and removes the waste products that we do not need. For example, the brain requires oxygen and glucose, which, if not received continuously, will cause it to loose consciousness. Muscles need oxygen, glucose and amino acids, as well as the proper ratio of sodium, calcium and potassium salts in order to .contract normally

13

The glands need sufficient supplies of raw materials from which to manufacture the specific secretions. If the heart ever ceases to pump blood the body begins to .shut down and after a very short period of time will die Like any other muscle in the human body, it contracts and expands. Unlike skeletal muscles, however, the heart works on the "All -or-Nothing Law". That is, each times the heart contracts it does so with all its force. In skeletal muscles, the principle of "gradation" is present. The pumping of the heart is called the .Cardiac Cycle, which occurs about 72 times per minute

:valves

Heart

the heart are The walls of three layers, made up of while the cavity is divided into four parts. There are two upper chambers, called the right and left atria, and two lower chambers, called the right and left ventricles. The Right Atrium, as it is called, receives blood from the upper and lower body through the superior vena cava and the inferior vena cava, .respectively, and from the heart muscle itself through the coronary sinus The right atrium is the larger of the two atria, having very thin walls. The right atrium opens into the right ventricle through the right atrioventicular valve (tricuspid), which only allows the blood to flow from the atria into the ventricle, but not in the reverse direction. The right ventricle pumps the blood to the lungs .to be reoxygenated The left atrium receives blood from the lungs via the four pulmonary veins. It is smaller than the right atrium, but has thicker walls. The valve between the left atrium and the left ventricle, the left atrioventicular valve (bicuspid), is smaller than the tricuspid. It opens into the left ventricle and again is a one way valve.
14

The left ventricle pumps the blood throughout the body. It is the Aorta, the .largest artery in the body, which originates from the left ventricle

as a pump moving The heart works our bodies to nourish blood around in every cell. Used blood, that is blood that has already been to the cells and has given up its nutrients to them, is drawn from the body by the right half of the .heart, and then sent to the lungs to be reoxygenated Blood that has been reoxygenated by the lungs is drawn into the left side of the heart and then pumped into the blood stream. It is the atria that draw the blood .from the lungs and body, and the ventricles that pump it to the lungs and body The output of each ventricle per beat is about 70 ml. In a trained athlete this amount is about double. With the average heart rate of 72 beats per minute the heart will pump about 5 liters per ventricle, or about 10 liters total per minute. This is called the cardiac output. In a trained athlete the total cardiac output is about 20 liters. If we multiply the normal, non-athlete output by the average age of 70 years, we see that the cardiac output of the average human heart over a life .time would be about 1 million liters

15

Systole
The contraction of the cardiac muscle tissue in the ventricles is called systole. When the ventricles contract, they force the blood from their chambers into the arteries leaving the heart. The left ventricle empties into the aorta and the right ventricle into the pulmonary artery. The increased pressure due to the contraction .of the ventricles is called systolic pressure

Diastole
The relaxation of the cardiac muscle tissue in the ventricles is called diastole. When the ventricles relax, they make room to accept the blood from the atria. The decreased pressure due to the relaxation of the ventricles is called diastolic .pressure

Electrical activity of the heart 2.3


:Cardiac muscle cell
Each mechanical heartbeat is triggered by an action potential which originates from a rhythmic pacemaker within the heart and is conducted rapidly throughout
16

the organ to produce a coordinated contraction. As with other electrically active tissues (e.g., nerves and skeletal muscle), the myocardial cell at rest has a typical transmembrane potential, Vm, of about 80 to 90 mV with respect to .surrounding extracellular fluid The cell membrane controls permeability to a number of ions, including sodium, potassium, calcium, and chloride. These ions pass across the membrane through specific ion channels that can open (become activated) and close (become inactivated). These channels are therefore said to be gated channels and their opening and closing can occur in response to voltage changes (voltage gated .(channels) or through the activation of receptors (receptor gated channels The variation of membrane conductance due to the opening and closing of ion .channels generates changes in the transmembrane (action) potential over time When cardiac cells are depolarized to a threshold voltage of about 70 mV (e.g., by another conducted action potential), there is a rapid depolarization that is .caused by a transient increase in fast sodium channel conductance Then there is an initial repolarization that is caused by the opening of a .potassium channel After that there is an approximate balance between inward-going calcium current and outward-going potassium current, causing a plateau in the action potential .and a delay in repolarization This inward calcium movement is through long-lasting calcium channels that .open up when the membrane potential depolarizes to about 40 mV Repolarization is a complex process and several mechanisms are thought to be important. The potassium conductance increases, tending to repolarize the cell via a potassium-mediated outward current. In addition, there is a time-dependent .decrease in calcium conductivity which also contributes to cellular repolarization Finally, the resting condition is characterized by open potassium channels and the .negative transmembrane potential

17

The Conduction System of the Heart


Located in the right atrium at the superior vena cava is the sinus node (sinoatrial or SA node) which consists of specialized muscle cells. The SA nodal cells are self-excitatory, pacemaker cells. They generate an action potential at the rate of (about 60 to 100 beats per minute), from the sinus node, activation propagates throughout the atria, but cannot propagate directly across the boundary between atria and ventricles . The atrioventricular node (AV node) is located at the boundary between the atria and ventricles; it has an intrinsic frequency of (about 40 to 50 beats per minute). However, if the AV node is triggered with a higher pulse frequency, it follows this higher frequency. In a normal heart, the AV node provides the only conducting path from the atria to the ventricles. Thus, under normal conditions, .the latter can be excited only by pulses that propagate through it Propagation from the AV node to the ventricles is provided by a specialized conduction system. Proximally, this system is composed of a common bundle, called the bundle of His. More distally, it separates into two bundle branches propagating along each side of the septum, constituting the right and left bundle branches. (The left bundle subsequently divides into an anterior and posterior branch.) Even more distally the bundles ramify into Purkinje fibers that diverge .to the inner sides of the ventricular walls Propagation along the conduction system takes place at a relatively high speed once it is within the ventricular region, but prior to this (through the AV node) .the velocity is extremely slow

18

From the inner side of the ventricular wall, the many activation sites cause the formation of a wavefront which propagates through the ventricular mass toward .the outer wall This process results from cell-to-cell activation. After each ventricular muscle region has depolarized, repolarization occurs. Repolarization is not a propagating phenomenon, and because the duration of the action impulse is much shorter at the epicardium (the outer side of the cardiac muscle) than at the endocardium (the inner side of the cardiac muscle), the termination of activity appears as if it .were propagating from epicardium toward the endocardium

Location in the heart

Event

Time [[ms

-ECG Conduction terminology velocity [[m/s

Intrinsic frequency [[1/min

19

SA node atrium, Right Left AV node

impulse generated (* depolarization depolarization arrival of impulse bundle of His departure of bundle impulse branches activated Purkinje fibers activated endocardium activated Septum Left ventricle depolarization depolarization epicardium Left ventricle depolarization Right depolarization ventricle repolarization epicardium repolarization Left ventricle Right repolarization ventricle endocardium Left ventricle

0 5 85 50 125 130 145 150 175 190 225 250 400

P P P-Q interval

0.05 0.8-1.0 0.8-1.0 0.02-0.05 1.0-1.5 1.0-1.5 3.0-3.5 (axial) 0.3 0.8 (transverse)

70-80

20-40

QRS

600 T

0.5

:(Cardiac

Waveform (electrocardiogram 2.4


20

An electrocardiogram abbreviated as EKG or ECG is a test that measures the electrical activity of the heartbeat. With each beat, an electrical impulse (or wave) travels through the heart. This wave causes the muscle to squeeze and pump blood from the heart. A normal heartbeat on ECG will show the timing of .the top and lower chambers The right and left atria or upper chambers make the first wave called a P wave" following a flat line when the electrical impulse goes to the bottom chambers. The right and left bottom chambers or ventricles make the next wave called a QRS complex." The final wave or T wave represents electrical .recovery or return to a resting state for the ventricles

:P Wave
The sinoatrial node initiates atrial depolarization, producing the P wave on the electrocardiogram. Although the atria are anatomically two distinct chambers, electrically they act almost as one. They have relatively little muscle and generate a single, small P wave. P wave amplitude rarely (2.5 mm) (0.25 mV). The .(duration of the P wave should not exceed (0.12 s

21

:PR interval
After the P wave there is a brief return to the isoelectric line, resulting in the PR segment. During this time the electrical impulse is conducted through the atrioventricular node, the bundle of His and bundle branches, and the Purkinje .fibres The PR interval is the time between the onset of atrial depolarization and the onset of ventricular depolarization, and it is measured from the beginning of the P wave to the first deflection of the QRS complex, whether this is a Q wave or an .(R wave. The normal duration of the PR interval is (0.120.20 s

:QRS complex
The QRS complex represents the electrical forces generated by ventricular depolarization. With normal intraventricular conduction, depolarization occurs in an efficient, rapid fashion. The duration of the QRS complex is measured in the .(lead with the widest complex and should not exceed (0.10 s

:ST segment
The isoelectric period (ST segment) It starts at the J point (junction between the .QRS complex and ST segment) and ends at the beginning of the T wave

22

The ST segment is important in the diagnosis of ventricular ischemia or hypoxia because under those conditions, the ST segment can become either depressed or .elevated (It has duration of 0.08 to 0.12 sec (80 to 120 ms .

:T Wave
The T wave represents ventricular repolarization and is longer in duration than .depolarization The T wave should generally be at least 1/8 but less than 2/3 of the amplitude of .the corresponding R wave; T wave amplitude rarely exceeds 10 mm

Interval: T Q
The QT interval is measured from the beginning of the QRS complex to the end of the T wave. A normal QT interval is usually about 0.40 seconds. The QT interval as well as the corrected QT interval is important in the diagnosis of long .QT syndrome and short QT syndrome The Q-T interval represents the time for both ventricular depolarization and repolarization to occur and therefore roughly estimates the duration of an average ventricular action potential The QT interval varies based on the heart rate, and various correction factors .have been developed to correct the QT interval for the heart rate
23

The most commonly used method for correcting the QT interval for rate is the : one formulated by Bazett Bazett's formula is .(QTc): QTc = QT/RR (seconds)

:The U Wave
Another wave -the U wave - is recorded immediately following the T wave and before the P wave. The U wave remains rather mysterious but is thought to represent a final stage of repolarization of unique ventricular cells in the midmyocardium. The U wave will most often orient in the same direction as the T wave with amplitude less than 2 mm

:ECG Electrode 2.5


The basic function of the electrodes is to convert a physical parameter into an electrical output. It is necessary to remember that the metal in the electrodes is not responsible for conducting the electrical changes in the body; hence the .electrodes must have a transducer The function of the transducer is to convert biological information into a quantifiable electrical signal. This transducer interface is provided using an electrode-electrolyte interface. There is also another interface with the skin involved in the acquisition of the bio-potential. The skin has three layer: Epidermis (This is the top layer of the skin which is actually dead cells from the layer below), Dermis and the Subcutaneous Layers. Since the epidermis makes contact with the Electrodes it is the only layer of interest when looking at the .acquisition of Bio-Potentials

24

To understand the underlying problems with Bio-Potential electrodes it is necessary to obtain an electrical model of the contact between the electrodes and the skin.

Having obtained the electrical model of the interface between the skin and the electrode it is possible to see the problems that can occur. If the patient moves and then the electrode moves the charge distribution changes and the ECG signal is messed up. If this happen the measurement gets corrupted and the patient could die.

The silver/silver chloride (Ag/AgCl) electrode is electrochemically stable and is thus most widely used. An electrode is usually constructed by elec-trolyzing a

25

silver plate as an anode in an aqueous solution of sodium chloride to form a film of AgCl on the surface of the silver. The reaction is Ag + Cl AgCl + e. Often a transparent electrolyte gel containing chloride ions as the principle anion is used. The gel also allows for good contact between the skinelectrode interfaces.

.A typical surface electrode used for ECG recording is made of Ag/AgCl (The electrodes are attached to the patients skin and can be easily removed

2.6 ECG leads


The word lead has two meanings in electrocardiography: it refers to either the wire that connects an electrode to the electrocardiograph, or (more commonly) to a combination of electrodes that form an imaginary line in the body along which the electrical signals are measured.. In fact, a 12 lead electrocardiograph usually only uses 10 wires/electrodes.

26

A lead records the electrical signals of the heart from a particular combination of recording electrodes which are placed at specific points on the patient's body. When a depolarization wavefront (or mean electrical vector) moves toward a positive electrode, it creates a positive deflection on the ECG in the corresponding lead.

When a depolarization wavefront (or mean electrical vector) moves away from a positive electrode, it creates a negative deflection on the ECG in the corresponding lead.

When a depolarization wavefront (or mean electrical vector) moves perpendicular to a positive electrode, it creates an equiphasic (or isoelectric) complex on the ECG. It will be positive as the depolarization wavefront (or mean electrical vector) approaches (A), and then become negative as it passes by (B).

There are two types of leadsunipolar and bipolar. The former have an indifferent electrode at the center of the Einthovens triangle at zero potential. The direction of these leads is from the center of the heart radially outward and includes the precordial (chest) leads and limb leads VL, VR, & VF.

27

2.6.1 Limb lead:


Leads I, II and III are the so-called limb leads because at one time, the subjects of electrocardiography had to literally place their arms and legs in buckets of salt water in order to obtain signals for Einthovens string galvanometer. they form the basis of what is known as Einthovens triangle.[3] Eventually, electrodes were invented that could be placed directly on the patients skin. Even though the buckets of salt water are no longer necessary, the electrodes are still placed on the patients arms and legs to approximate the signals obtained with the buckets of salt water. They remain the first three leads of the modern 12 lead ECG.

Lead I is a dipole with the negative (white) electrode on the right arm and the positive (black) electrode on the left arm.

28

Lead II is a dipole with the negative (white) electrode on the right arm and the positive (red) electrode on the left leg.

Lead III is a dipole with the negative (black) electrode on the left arm and the positive (red) electrode on the left leg.

2.6.2 Augmented limb leads:


Leads aVR , aVL, and aVF are augmented limb leads. They are derived from the same three electrodes as leads I, II, and III. However, they view the heart from different angles (or vectors) because the negative electrode for these leads is a modification of Wilson's central terminal, which is derived by adding leads I, II, and III together and plugging them into the negative terminal of the EKG machine.

29

Lead aVR or "augmented vector right" has the positive electrode (white) on the right arm. The negative electrode is a combination of the left arm (black) electrode and the left leg (red) electrode, which "augments" the signal strength of the positive electrode on the right arm.

Lead aVL or "augmented vector left" has the positive (black) electrode on the left arm. The negative electrode is a combination of the right arm (white) electrode and the left leg (red) electrode, which "augments" the signal strength of the positive electrode on the left arm.

Lead aVF or "augmented vector foot" has the positive (red) electrode on the left leg. The negative electrode is a combination of the right arm (white) electrode and the left arm (black) electrode, which "augments" the signal of the positive electrode on the left leg.

30

The augmented limb leads aVR, aVL, and aVF are amplified in this way because the signal is too small to be useful when the negative electrode is Wilson's central terminal. Together with leads I, II, and III, augmented limb leads aVR, aVL, and aVF form the basis of the hexaxial reference system, which is used to calculate the heart's electrical axis in the frontal plane.

2.7 ECG Signal Characteristics:


The amplitude of the ECG signal as measured on the skin ranges from 0.1 mV to 4 mV. The frequency extends from 0.05 Hz to 150 Hz. Physiological signals like the ECG differ from artificial signals in that they are not reproducible from one time segment to another. They are more statistical in nature and have larger variations in signal characteristics than, say, a signal generator output. The human body acts like the midpoint of a capacitive divider between one or more power lines and ground. Thus, common-mode voltages as high as 20V p-p can be superimposed on the body. Eliminating this source of noise is one of the major tasks of an ECG amplifier. Fortunately, the ECG signals are differential signals while the power line voltages are common-mode, so the noise can be reduced with differential amplifiers.

31

In emergencies when the heart stops beating ventricular fibrillation), a commonly used procedure is to apply a voltage pulse of about 5 kV p-p with a 5-ms duration to synchronize the neural stimulus of the heart's muscle mass and bring it back to normal operating conditions. Because of the high voltages needed to defibrillate a patient, the inputs of the ECG circuit must be protected. Other sources of noise are electrosurgery devices, which are used in operating rooms as electronic scalpels. These devices contain high-frequency currents in the megahertz range. The high current density at the tip of the electrode coagulates the protein, thereby stopping bleeding. The ECG module must provide additional filtering against this high-frequency noise.

ECG Application:
The following bandwidths are used for different applications in ECG a. Clinical Bandwidth for standard 12-Lead ECG [0.05-100 Hz] b. Monitoring Application for Intensive Care Unit (ICU) [0.50 - 50 Hz]. It is used to detect rhythm disturbances (i.e. arrhythmias). The restricted bandwidth attenuates higher frequency noise caused by muscle contractions (EMG noise) and the lower frequency noise caused by motion of electrodes (baseline changes). c. Heart Rate Meter it is a band pass filter centered at 17Hz with selectivity (Q) of about 3 to 4. Such filter passes the frequencies of the QRS complex while rejecting noise including non-QRS waves in the ECG signal such as the P and T waves. This bandwidth maximizes the signal-to-noise-ratio (SNR) for detecting the QRS complex. d. Late Potentials Measurement - Bandwidth up to 500 Hz is used to measure late potentials. Late potentials are small higher-frequency events that occur in the ECG following the QRS complex.

2.8 Specification of ECG signal:


Because the electrocardiograph is widely used as a diagnostic tool and there are several manufacturers of this instrument, standardization is necessary. Standard requirements for electrocardiographs have been developed over the years.

32

Specification Input signal dynamic range Dc offset voltage Slew rate Frequency response Input impedance at 10 Hz Dc lead current Return time after lead switch Overload voltage without damage Risk current at 120 V

Value mV 5 mV 300 mV/s 320 to 150 0.05 Hz M 2.5 0.1 s1 V 5000 10

2.9 Hardware Implementation


2.9.1 Block diagram
Analog System Design and Criteria: We will work on Monitoring Application using frequency on the range between 0.05 to 100 Hz and using the three lead Wire ECG system which used in emergency departments, telemetry monitoring, and during medical procedures.
33

General block diagram:

2.9.2 Sensing electrodes:They have the function of sensing the signal from the body to the ECG device. All electrodes can be represented by a battery in series with a parallel resistor and capacitor. The battery represents the polarization voltage produced by active and reference electrode materials being in contact with an electrolyte, the saline solution of body fluid.

Advantages of disk electrode: 1. Painless 2. Nonirritating

34

3. Reliable 4. Reversible

2.9.3 Lead selector:They have the function of select the wanted leads that we want to show there signal. It is made by using analog multiplexer (4052) that has multi input ((x0,x1,x2,x3)(y0,y1,y2,y3)) and one output (X,Y) is selected by selection lines(A,B).

35

2.9.4 High Pass Filter:The implemented high pass filter is passive high pass filter. The corner frequency is calculated at 0.05 Hz from the equation (f =1\2RC.) Substituting the value of C=1 f, then the value of R=3.3 m. We used two high pass filter before the instrumentation for each input signal.

36

2.9.5 Instrumentation Amplifier (Preamplifier Stage):The differential input single1ended output instrumentation amplifier is one of the most versatile signal Processing amplifiers available. It is used for precision amplification of differential dc or ac signals while rejecting large values of common mode noise. By using integrated circuits, a high level of performance is Obtained at minimum cost.

We will use Instrumentation Amplifier AD524 for reject noise and amplify the signal from the sensor electrodes, which typically falls in the 1 mV range, by a factor of 1000. The AD524 is chosen as it is a high precision amplifier commonly used in bioelectronics, featuring a measured CMRR of at least 90dB, a low cost, a max supply current of 1.3 mA and a wide power supply range (2.3V to 18V & -2.3V to 18V). It is also easy to use rather than its higher performance than five Operational Amplifiers IA design.

37

The low power and signal accuracy are also important factors when choosing such an amplifier. This is due to its very low input bias current (1.0 nA) and offset voltage (50 V), respectively.

Common mode rejection ratio (CMRR)


Is the ability of an amplifier to reject noisebymeansof differential pair, the higher the CMRR the best performance the amplifier is acceptable range of CMRR is about 80:100 dB , the CMRR value is Inversely related to the operating frequency the higher the frequency the lower CMRR. Common mode rejection ratio (CMRR) is used as a measure of the quality of a balanced circuit.

38

2.9.6 Low Pass Filter:The passive low pass filter has a corner frequency is calculated to be 100Hz from the equation ( f =1\2RC) Substituting the value of C=100nf then the value of R=18 kohm

39

2.9.7 Notch filter:Notch filter is used to reject the 50Hz noise that comes from the power line around the circuit.

2.9.8 DC shift:After filtering and amplification, the data is ready to be digitized by the ADC. The ADC requires the signal it is sampling to be completely in the positive voltage range. The summing amplifier is used to achieve this and its topology is shown below.

40

2.9.9 Micro-control (with built-in A\D converter):We used micro-control with built in A\D converter to convert the detected analog signal to digital signal that is processed in micro so the signal can be displayed on graphic LCD and can be sent by USB port.

41

2.9.10 PCB Circuit:-

42

43

One lead circuit

3 lead Circuit

44

2.9.11Our Real Board

45

2.10 Signal problems:The following section describes common signal quality problems with suggested solution

46

47

48

2.11 Kinds of noise:


ECG signal may be corrupted by various kind of noise. 1. Power line interference:50HZ from the power main. 2. Electrode contact noise: variable contact between the electrode and the skin 3. Change in the electrode1 skin impedance 4. Electromagnetic interference from other electronic device. 5. Noise coupled from other electronic devices

49

50

3.1 Introduction and Medical background


Vocal definitions:
Pressure is a force exerted over an area. All fluids in a closed container exert a pressure on the walls of the container, called hydrostatic pressure. Blood Pressure: the pressure that the blood exerts on the walls of the arteries in the body. It is a hydrostatic pressure. Systolic Pressure: the maximum pressure on the arteries during contraction of the heart when blood is pumped out. Diastolic Pressure: the lowest pressure on the arteries right before the next ventricular contraction (while the blood is moving out of the arteries). Normal ranges for blood pressure in adult humans are: Systolic between 90 and 135 mm Hg (or 90 and 135 Torr, 12 to 18 kPa) Diastolic between 50 and 90 mm Hg (or 50 and 90 Torr, 7 to 12 kPa)

51

Pulse: a wave of pressure caused by the contraction of the heart, which pumps blood out into an artery. Therefore, there is one pulse for every heart beat. The pressure of this wave is represented by the difference between systolic and diastolic pressure.

How is blood pressure measured?


In humans, blood pressure is measured using a device called a sphygmomanometer. First the cuff is placed over the elbow and pressure is increased until it is greater than the systolic pressure. When this happens, the arteries collapse and no blood can flow out of them. Then the pressure is slowly released until it is equal to systolic pressure. At this point, blood can flow through the arteries once again. This is when a pulse can be heard. The reading on the sphygmomanometer now is the systolic pressure. Pressure is slowly released until the point where the pulse cannot be heard. This reading is the diastolic pressure. This is the most used way in measuring the blood pressure till the 90th where new digital and electronic systems were introduced.

52

Why blood pressure is measured this way?


Blood pressure acts like a wave, with max points and min points. It's measured using systolic and diastolic pressure because it's only way to account for the range of pressure between contraction and relaxation. We use mm Hg because it's more convenient than using mm water. The blood pressure in humans is measured at the elbow because it is basically at the same level as the heart. Therefore, the pressure at the elbow should be the same as the pressure at the heart.

What affects the blood pressure?


For each animal, blood pressure is determined by its height, shape, weight, body structure, age, and amount of activity. The pressure in blood vessels changes as a function of the distance between the heart and the tissue you're concerned with. Tissues pumping blood up have to fight against the force of gravity to push it up.

What affects systolic pressure?


The systolic pressure is determined by the amount of blood (stroke volume) being forced into the aorta and arteries with each contraction of the heart and also by the force of contraction. An increase in either of the two will increase the systolic pressure. Also, if the arterial wall becomes stiffer, the vessels won't be able to distend with the increased blood volume and the systolic pressure is increased.

What affects diastolic pressure?


53

If there is increasing constriction in the arteries, this will impede blood flowing out of the arterial system to the capillaries, and the diastolic pressure will rise. Also, the resistance is reduced, more blood will flow out of the arterial system and so diastolic pressure will fall. The diastolic pressure also depends on the level of the systolic pressure, the elasticity of the arteries and the viscosity of the blood. Changes in the heart rate will also affect diastolic pressure: with a slower heart rate, the diastolic pressure will be lower as there is a greater time for blood to flow out of the arteries, and vice versa.

Why should I monitor my blood pressure at home?


For persons with hypertension, home monitoring allows your physician to monitor how much your blood pressure changes during the day, and from day to day. This may also help your physician determine how effectively your blood pressure medication is working.

3.2 How to measure blood pressure:


Either an aneroid monitor, who has a dial gauge and is read by looking at a pointer, or a digital monitor, in which the blood pressure reading flashes on a small screen can be used to measure blood pressure.

3.2.1 The aneroid monitor:

54

The aneroid monitor is less expensive and easier to manage than the digital monitor. The cuff is inflated by hand by squeezing a rubber bulb. Some units even have a special feature to make it easier to put the cuff on with one hand. However, the unit can be easily damaged and become less accurate. Because the person using it must listen for heartbeats with the stethoscope, it may not be appropriate for the hearing impaired.

3.2.2 The digital Blood pressure monitor

55

The digital monitor is automatic, with the measurements appearing on a small screen. Because the recordings are easy to read, this is the most popular blood pressure measuring device. It is also easier to use than the aneroid unit, and since there is no need to listen to heartbeats through the stethoscope, this is a good device for hearing impaired patients. One disadvantage is that body movements or an irregular heart rate can change the accuracy. These units are also more expensive than the aneroid monitors.

3.2.3 The finger/wrist blood pressure monitors

Tests have shown that finger and/or wrist blood pressure devices are not as accurate in measuring blood pressure as other types of monitors. In addition, they are more expensive than the other monitors.

Before you measure your blood pressure:


56

Rest for three to five minutes without talking before taking a measurement. Sit in a comfortable chair, with your back supported and your legs and ankles uncrossed. Sit still and place your arm, raised level with your heart, on a table or hard surface. Wrap the cuff smoothly and snugly around the upper part of your arm. The cuff should be sized to fit smoothly, while still allowing enough room for one fingertip to slip under it. Be sure the bottom edge of the cuff is at least one inch above the crease in your elbow. It is also important, when taking blood pressure readings, that you record the date and time of day you are taking the reading, as well as the systolic and diastolic measurements. This will be important information for your physician to have. Ask your physician or another healthcare professional to teach you how to use your blood pressure monitor correctly. Have the monitor routinely checked for accuracy by taking it with you to your physician's office. It is also important to make sure the tubing is not twisted when you store it and keep it away from heat, to prevent cracks and leaks. Proper use of your blood pressure monitor will help you and your physician in monitoring your blood pressure.

3.2.4 Using catheters in blood pressure measurement:

The most accurate means for measuring blood pressure is directly within an artery (intra-arterial) using a catheter. But because this method is invasive, it is neither practical nor appropriate for repeated measurements in non-hospital settings, or for large-scale public health screenings. In addition, different methods for measuring blood pressure can produce different readings. The
57

guidelines for diagnosing and treating hypertension are based upon measurements made using the mercury-filled sphygmomanometer, not upon intra-arterial measurement of blood pressure. The usual method of measurement, therefore, is a noninvasive means that uses a sphygmomanometer, which includes either a column of mercury or pressure registering gauge. With this technique, the flow of blood is temporarily stopped by an inflated cuff that is wrapped around the upper arm and that puts pressure on the main artery in the arm. Blood flow is then gradually restarted as the user slowly deflates the cuff. An examiner uses a stethoscope to listen for sounds, called Korotkoff sounds that can be heard when the blood begins flowing again through the artery and that change in tone and volume while the cuff is deflated. Blood pressure is typically measured in units of millimeters of mercury, and represents the force of blood against the blood vessel wall. The first number, called the systolic pressure, represents the highest blood pressure that occurs each time the heart beats. The second number, called the diastolic pressure, is the lowest pressure that occurs when the heart relaxes between two beats. The Korotkoff sounds are used to identify a person's systolic and diastolic blood pressure readings. Both numbers are important because when either is elevated, so is the risk of developing heart and blood problems. According to the National Heart, Lung, and Blood Institute, a blood pressure reading consistently higher than 140/90 is a sign that the blood pressure needs to be brought under control. The typical adult blood pressure is 120/80 or lower, but readings vary depending on age and other factors. The mercury sphygmomanometer is simple, easy to read, and requires no readjustment. It has been validated in many clinical circumstances against the direct method of measurement through the artery.

3.2.5 Why replacing the mercury sphygmomanometers?


The push to replace mercury sphygmomanometers began in June 1998, when the Environmental Protection Agency and the American Hospital Association agreed to limit the amount of mercury waste from hospitals as much as possible by 2005. Other organizations, over time, have joined the effort. Mercury is a silver-colored metallic element that is liquid at room temperature and tends to break into tiny, highly mobile droplets when spilled. These droplets vaporize and can contaminate the atmosphere. Precautions must be taken to limit the inhalation, ingestion or absorption of mercury in case of a

58

spill or breakage. Exposure to mercury from sphygmomanometers used in healthcare settings is extremely rare. Modern mercury sphygmomanometers are available in models that prevent accidental spillage of mercury. And, there have been only a few isolated cases of illness in children from mercury toxicity related to broken glass thermometers. The FDA, which regulates blood pressure devices, requires companies to show that new monitors are substantially equivalent to models already on the market. They also must demonstrate accuracy through a clinical validation study. There are two alternative types of blood pressure measuring instruments being marketed. Aneroid devices, which have no liquid, use metal that acts like a spring to measure blood pressure. These have a round compass-like face that is attached to a cuff and accompanied by a stethoscope, and are commonly used in physicians' offices. Electronic devices measure pressure by converting the readings into measurable electronic waves. Electronic instruments include in-home blood pressure monitoring devices as well as the small stations often seen at drug stores where people place their arms through a mechanical cuff. These use physical measurements and mathematical formulas to calculate pressure. Electronic monitors were originally designed for use during surgery and in emergency room settings. They are not commonly used by physicians to diagnose or to monitor hypertension. The two crucial considerations for substituting aneroid and electronic units for mercury instruments are calibration and validation. Calibration is a way to make sure that measurements begin from zero--much like when a scale is balanced before it is stepped on to measure body weight. If the starting mark is above or below zero, the final measurement will be inaccurate. Validation ensures that the instrument can take accurate measurements over a wide range of blood pressures, ages and clinical conditions. The FDA also is concerned that aneroid and electronic devices may not be regularly calibrated, potentially making these devices prone to erroneous readings. Regardless of the type of device used to measure blood pressure, selecting appropriately sized cuffs is critical. The appropriate cuff width is based on the diameter of the upper arm. Taking blood pressure measurement with a cuff that's too narrow could overestimate blood pressure, while too wide a cuff can underestimate the pressure. Inappropriately low blood pressure, or clinical shock, is a medical emergency. Inappropriately high blood pressure can indicate hypertension.

3.2.6 Oscillometric methods

59

Oscillometric methods are used in long-term measurement as well as in clinical practice. The equipment is functionally the same as for the auscultatory method, but with an electronic pressure sensor (transducer) fitted in the cuff to detect blood flow, instead of using the stethoscope and the expert's ear. In practice, the manometer is a calibrated electronic device with a numerical readout of blood pressure, instead of a mercury tube; calibration must be checked periodically. In most cases the cuff is inflated and released by an electrically operated pump, and it may be fitted on the wrist (elevated to heart height), although the upper arm is preferred. Oscillometric measurement requires less skill than auscultatory, and is suitable for use by non-trained staff and for automated patient monitoring. The cuff is inflated to a pressure in excess of the systolic blood pressure. The pressure is then gradually released over a period of about 30 seconds. When blood flow is nil (cuff pressure exceeding systolic pressure) or unimpeded (cuff pressure below diastolic pressure), cuff pressure will be essentially constant. When blood flow is present, but restricted, the cuff pressure, which is monitored by the pressure sensor, will vary periodically in synchrony with the cyclic expansion and contraction of the brachial artery, i.e., it will oscillate. The cuff pressure at which oscillations start is the systolic pressure; pressure when oscillations cease is diastolic pressure. In practice the different methods do not give identical results; an algorithm and experimentally obtained coefficients are used to adjust the oscillometric results to give readings which match the auscultatory as well as possible. Some equipment uses computer-aided analysis of the instantaneous blood pressure waveform to determine the systolic, mean, and diastolic points. The term NIBP, for Non-Invasive Blood Pressure, is often used to describe oscillometric monitoring equipment.

3.3 Theory of operation of most pressure monitor systems


Measuring a person's blood pressure is a routine part of every physical exam. The results can predict long-term health risks, assess suitability for certain physical activities, help manage many types of medical problems, and determine eligibility for insurance. The procedure is done to screen for high blood pressure (hypertension), a major risk factor for serious conditions, such as stroke and kidney failure. The safety of the current "gold standard" instrument used to
60

measure blood pressure, the mercury-filled sphygmomanometer however is being called into question due to the environmental health risks associated with mercury. At the same time, medical experts fear that the mercury gauges may be replaced by less accurate devices without consideration for the health risks that could follow. Although the environmental concerns are serious, the Food and Drug Administration believes that mercury sphygmomanometers are still useful medical devices.

The Mean arterial pressure (MAP)


It is a term used in medicine to describe a notional average blood pressure in an individual. It is defined as the average arterial pressure during a single cardiac cycle.

, where CO is cardiac output SVR is systemic vascular resistance CVP is central venous pressure CVP is usually small enough to be neglected in this formula.

61

At normal resting heart rates MAP can be approximated using the more easily measured systolic and diastolic pressures, SP and DP: Or equivalently Where PP is the pulse pressure, SP DP At high heart rates MAP is more closely approximated by the arithmetic mean of systolic and diastolic pressures because of the change in shape of the arterial pressure pulse. MAP is considered to be the perfusion pressure seen by organs in the body. It is believed that a MAP of greater than 60 mmHg is enough to sustain the organs of the average person under most conditions. If the MAP falls significantly below this number for an appreciable time, the end organ will not get enough blood flow, and will become ischemic. The MAP will play an important rule in out design as we will demonstrate next .

3.4 Our pressure monitors system:


First we would like to refer to that we have chosen the oscillometric method. This method is employed by the majority of automated noninvasive devices. A limb and its vasculature are compressed by an encircling, inflatable compression cuff. The blood pressure reading for systolic and diastolic blood pressure values are read at the parameter identification point. The simplified measurement principle of the oscillometric method is a measurement of the amplitude of pressure change in the cuff as the cuff is inflated from above the systolic pressure. The amplitude suddenly grows larger as the pulse breaks through the occlusion. This is very close to systolic pressure. As the cuff pressure is further reduced, the pulsation increase in amplitude reaches a maximum and then diminishes rapidly. The index of diastolic pressure is taken where this rapid transition begins. Therefore, the systolic blood pressure (SBP) and diastolic blood pressure (DBP) are obtained by identifying the region where there is a rapid increase then decrease in the amplitude of the pulses respectively. Mean arterial pressure (MAP) is located at the point of maximum oscillation.

62

3.4 Hardware Implementation:


Selecting a blood pressure method:
The oscillometric method can be incorporated into our project design. Because this method is capable of turning pressure readings into a digital signal; we want to build a unit that uses a microcontroller to analyze the information. We want to use a Pulse/oxygen sensor to detect the changes in blood flow through the artery. It is major modification to the oscillometric methods researched. The basic design will consist of a microcontroller, pressure sensor, squeezer, automatic inflation system and associated hardware.

3.4.1 Designing our blood pressure monitor(Block Diagram)


The Microcontroller will receive 2 signals one from the pressure monitor & one from the oscillations amplifier circuit where these two signals will be saved on an EEPROM and then the MAP will be calculated and utilizing it, the systolic and the diastolic pressures will be calculated then the output will be displayed .The digital output will be stored and sent to the main computer for analysis during a blood pressure reading. Now lets take a look at the system in block diagram:

63

Now lets take a look at the important blocks in our design:

3.4.2The pressure sensor MPXV5050GP


We checked several pressure sensors for our project. We wanted to find a sensor that can read pressure from 0 to 180 mmHg (0 to 3.48 lb/in) to be able to calibrate it by the aid of a mercury sphygmomanometer. This pressure range is determined from measurements taken by doctors and clinicians for blood pressure. Our sensor must have a fast response to small pressure changes. It needs to be greater than the average heart rate. The fast response will enable our design better accuracy for the blood pressure and amplitude of the heartbeat. The sensor we decided to use for our design is the integrated pressure sensor by Motorola (MPXV5050).

Advantages of the Motorola (MPXV5050):


It is designed to use with a microcontroller. It is a silicon pressure sensor design to measure pressure from 0 to 7.25psi. It requires a voltage supply of 5Vdc. The sensor needs a supply current of 7mAdc. The full scale output of the sensor is typically 4.7Vdc. The full scale span is around 4.5Vdc. Accurate and contains internal amplification. It is (+/-) 2.5% of the full scale span. The level of sensitivity, which is another advantage, is 90mV/kPa. The response time is 1ms which is very important for blood pressure monitoring.
64

Disadvantages of the MPX5050:


The MPXV5050 is not available in Egypt and is expensive; the part price can be checked on the Freescale official site: Solution to this disadvantage: The MPXV5050 was available as a free sample but not anymore. So we contacted the technical support and made an agreement with a freescale representative who shipped us a package of 5 sensors for free, we only had to pay for the shipping and the taxes fees in return to a copy of our pressure monitor prototype.

MPXV5050GP description:
Its an integrated silicon pressure sensor on chip signal conditioned, temperature compensated and calibrated. The MPX5050 series piezoresistive transducer is a stateoftheart monolithic silicon pressure sensor designed for a wide range of applications, but particularly those employing a microcontroller or microprocessor with A/D inputs. This patented, single element transducer combines advanced micromachining techniques, thinfilm metallization, and bipolar processing to provide an accurate, high level analog output signal that is proportional to the applied pressure.

65

The MPXV5050GP series pressure sensor operating characteristics and internal reliability and qualification tests are based on use of dry air as the pressure media. Media, other than dry air, may have adverse effects on sensor performance and longterm reliability.

LAYOUT OPTIMIZATION
In mixed analog and digital systems, layout is a critical part of the total design. Often, getting a system to work properly depends as much on layout as on the circuit design. The following discussion covers some general layout principles, digital section layout and analog section layout.

3.4.3-Hardware diagram:
Usually when the doctor measures the patients blood pressure, he will pump the air into the cuff and the stethoscope the listen to the sounds of the blood in the artery of the patients arm. At the start, the air is pumped to be above the systolic value. At this point, the doctor will hear nothing through the stethoscope. After the pressure is release gradually, at some point, the doctor will begin to hear the sound of the heart beats. At this point, the pressure in the cuff corresponds to the systolic pressure.
66

After the pressure decreases further, the doctor will contain hearing the sound (with different characteristics). And at some point, the sounds will begin to disappear. At this point, the pressure in the cuff corresponds to the diastolic pressure. To perform a measurement, we use a method called oscillometric .the air will be pumped into the cuff to be around 20mmHg above average systolic pressure (about 120 mmHg for an average). After that the air will be slowly released from the cuff causing the pressure in the cuff decrease. As the cuff is slowly deflated, we will be measuring the tiny oscillation in the air pressure of the arm cuff. The systolic pressure will be the pressure at which the pulsation starts to occur. We will use the MUC to detect the point at which this oscillation happens and then record the pressure in the cuff. Then the pressure in the cuff will decrease further. The diastolic pressure will be taken at the point in which the oscillation starts to disappear.

The diagram above shows how our device is operated. The user will use buttons to control the operations of the whole system. The MCU is the main component that controls all the operations such as motor and valve control, A/D conversion, and calculation, until the measurement is completed. The results then are output through and LCD screen for the user to see. -Analog circuit:

67

The pressure sensor produces the output voltage proportional to the applied differentional input pressure. The output voltage of the pressure sensor ranges from 0.2 to 4.7V. But for our application, we want to pump the arm cuff to only 170mmHg. Then the signal from the DC component will be passed on to the band-pass filter. The filter is designed to have large gain at around 1- 4 Hz and to attenuate any signal that is out of the pass band. The AC component from the band-pass filter is the most important factor to determine when to capture the systolic/diastolic pressures. The final stage is the AC coupling stage. We use two identical resistors to provide a DC bias level at approximately 2.5 volts. The 47 micro farad capacitor is used to coupling only AC component of the signal so that we can provide the DC bias level independently.

3.4.4-Hardware parts:
Pressure sensor:
We use the MPXV5050GP [built in amplifier] pressure sensor to sense the pressure from the arm cuff. The pressure sensor produces the output voltage proportional to the applied differentional input pressure. We connect the tube from the cuff to the input of the sensor. By this way, the output voltage will be proportional to the difference between the pressure in the cuff and the air pressure in the room.

Band-pass filter:
The band-pass filter stage is designed as a cascade of the two active band-pass filters. The reason for using 2 stages is that the overall band-pass stage would provide a large gain and frequency response of the filter will have sharper cut off than using only single stage. This method will improve the signal to noise ratio of the output.

68

Band pass Filter Stage

First Band-pass filter:


The lower frequency cutoff is The higher frequency cutoff is The mid-band gain of the first filter is

Second Band-pass filter:


The lower frequency cutoff is
69

The higher frequency cutoff is The mid-band gain of the first filter is AC coupling stage: The ac coupling stage is used to provide the DC bias level. We want the DC level of the waveform to locate at approximately half Vdd, which is 2.5 volt.

AC coupling stage for DC bias level Given this bias level, it is easier for us to process the AC signal using the on-chip ADC in the microcontroller. The AC output from this stage will be passed on to the analog-to-digital converter in pic16f877A microcontroller. The image from the laboratory bench is shown in this figure. We can see that it is very nice and clean.

AC Waveform
70

But the pressure signal before filtrationas follow:

3.5 Blood pressure Circuits: 3.5.1 Simulation Ciruit:

71

Power supply:
Motor-----------------------------------------5V

Pressure sensor---------------------------5V
72

Micro control -----------------------------5V Valve----------------------------------------5V

Amplifier ------------------------------5V, -5V

So our power supply generate 5v & -5 v

Bush button:
Is used to start the program when connect pin RC0 of the MCU with ground . Pull-up resistor: is used to keep 5V on pin no 15 (RC0) when the push button is not depressed(not open)
5o v lt R 0N B/ T I R1 B R2 B R3 G B/ M P R4 B R5 B R6 G B/ C P R7 G B/ D P R0 1 S / 1 K C/ OO CI T T R 1 1 SC P C/ OI C2 T / R 2 C1 C/ P C R 3 C/ C C/ K L S S R 4 DS A C/ I D S/ R5 D C/ O S R6 X K C/ / TC R7 X T C/ / RD R 0 S0 D/ P P R 1 S1 D/ P P R 2 S2 D/ P P R 3 S3 D/ P P R 4 S4 D/ P P R 5 S5 D/ P P R 6 S6 D/ P P R 7 S7 D/ P P P 1 F7A I 6 87 C 3 3 3 4 3 5 3 6 3 7 3 8 3 9 4 0 1 5 1 6 1 7 1 8 2 3 2 4 2 5 2 6 1 9 2 0 2 1 2 2 2 7 2 8 2 9 3 0

U 1
1 3 1 4 2 3 4 5 6 7 8 9 1 0 1 OC/ L I S1 K C N OC/ L OT S2 K U C R0 N A/ 0 A R1 N A/ 1 A R2 N/ RFCRF A/ 2 E- V E A V / R3 N/ RF A/ 3 E+ A V R4 0 KCOT A/ C I 1 U T / R5 N/ S 2 U A/ 4 / OT A SC R0 N/ D E/ 5 A R R1 N/ R E/ 6 A W R2 N/ S E/ 7 A C ML / p / H CR p V V T

R 1
1k 0

Microcontroller:
It is the brain of the device, we selected PIC16F877A. This type has internal A/D converter. It operates on 5V DC to control each part in the device.

73

Oscillator:
It is used to detect the required time for performing one order by microcontroller.

Oscillator circuit is formed of two 33 PF capacitors and crystal 4MHZ which produces 1 micro second for one order.

Pins no 13, 14 in microcontroller is connected to the o/p of oscillator circuit.

Pressure Sensor:
Type: MPX5050GP, it is operated on 5V. Is used to detect the air pressure inside the cuff in relation with analog voltage.
74

The o/p of the pressure sensor (MPX5050GP) at pin no 3, 4 is connected to the MCU which is the pin of A/D converter.

Valve:
Type: KSVP, it operates on 5V. It is normally opened and when it receives a pulse from micro control, it is closed.. This valve is used to leakage air inside the cuff for small time this lead to decrease pressure. Pin no 20 (RD1) is connected to I/P pin of valve of MCU. Pin no 20 (RD1) of MCU is connected to the base of the transistor (2n2222) which is used as a switch to supply 5V to the motor when O/P of pin no 20 is 5V.

75

Motor:
It is used to pump air inside the cuff thus increasing pressure. Pin no 19 (RD0) of MCU is connected to the base of transistor Q3 (2n2222) which is used as a switch to supply 6v to the motor when O/P of pin no 19 is 5v.

76

7 Segment :

We use two 7 seg above one for displaying systolic blood pressure (ex. 112) and another one for diastolic blood pressure (ex. 80)

Band pass filter:

77

Operational amplifier 2 x 1:

78

3.5.2 PCB Circuit:

79

Microcontroller circuit

80

Motor & Valve Driver Filter circuit 3.5.3 Our circuit board:

81

3.6 Software design:


82

-Design for the operating control: The block diagram for the operating control is consisted of a total of 7 states. We first start at the ON state where the program waits for the user to push the START button of the device. Once the START button has been pushed, the measurement process begins by inflating the hand cuff. While the cuff is being inflated, if the user feels very uncomfortable or painful, he/she can push (hold) the RESET button to stop the motor, quickly deflate the cuff and stop the measurement. This will ensure that the safety of the user is well maintained while using the device. Anyhow, if the cuff-inflating procedure goes smoothly. The air will be pumped into the cuff until the pressure inside the cuff reaches 170mmHg after that the motor will be stopped and the air will be slowly released from the cuff. NOTE: orifice release air all the time Again, at this point, the user can abort the process by pressing RESET button. Once the MCU has obtained the values of systolic, diastolic. The valve will be open to release air from the cuff quickly. Then, it will report the result of the measurement by displaying the obtained data on the LCD screen. After that if the RESET button is pushed the program will return to the RESET state again waiting for the next measurement. -Design for the measuring: Once the motor pumps the air into the cuff until the pressure exceeds 170mmHg, the motor then stops pumping more air and the cuff is deflated through the orifice. The pressure in the cuff starts decreasing approximately linearly in the time. At this point, the program enters the measurement mode. The MCU will looks at the AC signal through the ADC2 pin and determines the systolic, diastolic pressure values of the user respectively. For this project, we perform the measurement using the oscillometric method, in which the program monitors the tiny pulsations of the pressure in the cuff; the state diagram of the measurement is shown in this figure.

3.6.1 Code:
Once the motor pumps the air into the cuff until the pressure exceeds 170 mmHg, the motor then stops pumping more air and the cuff is deflated through the orifice. The pressure in the cuff starts decreasing approximately linearly in time.

83

At this point, the program enters the measurement mode. The MCU will looks at the AC signal through the ADC2 pin and determines the systolic, diastolic pressure values of the user respectively....... For this project, we perform the measurement using the oscillometric method, in which the program monitors the tiny pulsations of the pressure in the cuff.

1-systolic pressure measurement:


After the motor pump the pressure up to 170mmHg which is approximately more than the systolic pressure of normally healthy people, the cuff starts deflating and the program enters SYS_MEASURE state. In this stage, the program will looks at the AC waveform from ADC2 pin. When the pressure in the cuff decreases to a certain value, the blood begins to flow through the arm. At this time if we look at the oscilloscope, we will see the onset of the oscillation. The systolic pressure can be obtained at this point. The way we program this is that we set a threshold voltage of 4V for the AC waveform. At the start, there is no pulse and the voltage at the ADC2 pin is constant at approximately 2.5V. Then when the pressure in the cuff decreases until it reaches the systolic pressure value, the oscillation starts and grows. We then count the number of pulses that has maximum values above the threshold voltage. If the program counts up to 4, the program enters the Sys_cal state. At this state, the program records the DC voltage from pin ADC1. Then it converts this DC voltage value to the pressure in the cuff to determine the systolic pressure of the patient.

2-Diastolic Pressure Measurement:


After the systolic Measure state is determined, the program enters the Dias Measure state. In this state, the program is still sampling the signal at every 40 millisecond. We then define the threshold for the diastolic pressure. While the cuff is deflating, at some point before the pressure reaches diastolic pressure, the amplitude of the oscillation will decrease. To determine the diastolic pressure, we record the DC value at the point when the amplitude of the oscillation decreases to below the threshold voltage. After the program finishes calculating the diastolic pressure, it will display the information acquired from the measurement on the LCD. Then the program
84

will open up the valve and the cuff will deflate quickly. The measurement is now finished.

3.6.2 Flow chart:

85

86

87

3.7 User manual:


Important facts about blood pressure and self-measurement: -blood pressure is the pressure of the blood flowing in the arteries generated by the pumping of the heart. Two values, the systolic value and the diastolic values, are always measured. -permanently high blood pressure values can damage your health and must be treated by your doctor! -always discuss your values with your doctor and tell him/her if you have noticed anything unusual or feel unsure. Never rely on single blood pressure readings. -there are many causes of excessively high blood pressures values. Your doctor will explain them in more detail and offer treatment where appropriate. Besides medication, relaxation techniques, weight loss and exercise can also lower your blood pressure -under no circumstances should you alter the dosages of any drugs prescribed by your doctor! -depending on physical exertion and condition, blood pressure is subject to wide fluctuation as the day progresses. You should therefore take your measurements in the same quiet conditions and when you feel relaxed! Take at least two measurements per day, one in the morning and one in the evening. -it is quite normal for two measurements taken in quick succession to produce significantly different results. -deviations between measurements taken by your doctors or in the pharmacy and those taken at home are quite normal, as these situations are completely different. Several measurements: provide a much clearer picture than just one single measurement. Leave a small break: of at least 15 seconds between two measurements. If you are pregnant, you should monitor your blood pressure very closely as it can change drastically during this time. How do I evaluate my blood pressure?? Table for classifying blood pressure values in adults in accordance with the world health organization (WHO) Data in mmHg:

88

1 2 3 4 5 6

Range Blood pressure too low Blood pressure optimum Blood pressure normal Blood pressure slightly high Blood pressure too high Blood pressure far too high Blood pressure dangerously high

systolic <100 100-120 120-130 130-140 140-160 160-180 >180

Diastolic <60 60-80 80-85 85-90 90-100 100-110 >110

Recommendation Consult your doctor Self-check Self-check Consult your doctor Seek medical advice Seek medical advice Urgently seek medical advice

The higher value is the one that determines the evaluation. Checklist for taking a reliable measurement: 1-avoid activity, eating or smoking immediately before the measurement. 2-sit down for at least 5 minutes before the measurement and relax. 3-always measure on the same arm. 4-remove close-fitting garments from the upper arm. To avoid constriction, shirt sleeves should not be rolled up-they do not interfere with the cuff if they are laid flate. 5-always ensure the cuff is positioned correctly 6-press the on/off button to start the measurement . 7- The cuff will not pump up automatically ,relax don`t move and dont tense your arm muscles until the measurement result is displayed . breathe normally and dont talk.

89

3.9- Safety in design:


Since this is a medical instrumentation device, the safety of the user is the first concern to us. The cuff while driven by a 5 volts motor can squeeze the arm really hard and cause injury if being used improperly. So in our device we have 3 levels of security, making sure that the operation can be aborted by the user at anytime.

The first safety design:


Is to The microcontroller is programmed in the way such that if the pressure in the cuff is greater than 160 mmHg, the motor will stop. For most people, the pressure at 160 mmHg will only cause a little discomfort to the arm. This design makes sure that the pressure inside the cuff will never exceed the maximum limit of 160 mmHg.

The second safety design:


Is to provide an emergency button for the user. While the motor is pumping and the cuff is being inflated, if the user encounters too much discomfort or pain, he/she can press this button to stop the operation immediately. The motor will be stopped and the valve will be opened to release the air out of the cuff. However, we still think that only a pushbutton is not enough for the safety of the user. This is because the emergency button still relies on the operating system of the program in the MCU. Even though we have no bug in our program, if something goes wrong with the MCU or the button connections, there is a possibility that the emergency button becomes unusable. So we agree that we must have another switch that controls the device physically. This switch must be able to disconnect the circuit from the power supply immediately. This way it is certain that the user will be able to stop the operation even when the emergency button does not work. And this switch is the on-off power switch that we have on the device. Other than the cuff and motor concerns, our project is very safe to use because it is very well packaged in a plastic enclosure. The device is run by low-voltage (9 volts) battery which cannot cause any major harm to human body.
90

91

4.1 INTRODUCTION
The oxygenation and deoxygenating of blood is a process rarely considered, but occurs with every breath. When someone breaths air in from the atmosphere, about 20% of what they breathe is oxygen. The oxygen rich air travels down to the lungs where it is exchanged across a membrane into oxygen depleted hemoglobin. The oxygenated hemoglobin then flows through the arterial system to the heart where it is distributed throughout the body to the tissues. In the tissues the oxygen is used up, and the byproduct, or waste, carbon dioxide, is then carried back through the venous system, through the heart, then back to the lungs where the carbon dioxide can be expelled from the body by exhaling. This process occurs with every breath someone takes and is illustrated in Figure 1

92

.When someone lacks sufficient oxygen in their blood supply they are said to

have hypoxia. There are varying degrees of hypoxia based on how low the oxygen levels in the blood are. The symptoms are not easily detected, especially in cases of acute hypoxia. The more subtle effects of hypoxia are poor judgment and loss of motor function. Hypoxia can, however, be deadly since, by definition, not enough oxygen is being transported from the bloodstream to the tissues of the body. The most sensitive tissue to hypoxia in the body is the brain. The condition that occurs when the brain does not receive enough oxygen is called cerebral hypoxia. Five minutes is all it takes for a brain cell to die in the absence of oxygen. If the hypoxia lasts for prolonged periods it can lead to coma, seizures, and even brain death. In brain death, basic life functions such as breathing, blood pressure, and cardiac function arepreserved, but there is no consciousness or response to the world around. The four main variations of hypoxia include stagnant hypoxia, hypemic hypoxia, histotoxic hypoxia, and hypoxic hypoxia. Stagnant hypoxia occurs when the blood flow is restricted to an area of the body cutting off the oxygen supply. An example of this is when someone is cramped for a while and their foot falls asleep. Hypemic hypoxia occurs when the functional hemoglobin count is low, thus not having enough hemoglobin to transport the oxygen throughout the body. Histotoxic hypoxia occurs when tissue cells become poisoned and cant properly use the oxygen. This might occur due to carbon monoxide poisoning. Hypoxic hypoxia occurs due to lack of oxygen available to breathe in. This occurs at high altitudes and is of major concern to pilots. There are physiological causes for hypoxia, one of which is due to complications during anesthesia. During anesthesia there can be many factors that can occur to induce the onset of hypoxia. They include: low cardiac output, pulmonary edema, pulmonary embolism, airway obstruction, and endobroncial intubation among others . There are many times when it would be useful to be able to monitor the blood oxygen levels in a person to catch and treat hypoxia before its effects can harm the individual. These situations include: in the operating room during anesthesia in case something unexpected goes wrong, in the post operating room where the patient will be recovering, in an ambulance while being transported to the hospital after a cardiac or pulmonary episode, and in the neonatal care unit to closely monitor a newborns vital signs. By having a device to monitor the
93

oxygenated hemoglobin levels, the physician is put at an advantage over any possible complications. It is for these reasons that pulse oximetry has become more prominent.

4.2 What does a pulse oximeter measure?


1. The oxygen saturation of haemoglobin in arterial blood - which is a measure of the average amount of oxygen bound to each haemoglobin molecule. The percentage saturation is given as a digital readout together with an audible signal varying in pitch depending on the oxygen saturation. 2. The pulse rate - in beats per minute, averaged over 5 to 20 seconds. Pulse oximetry is accomplished by implementing the Beer-Lambert Law, which, in this case, relates the concentration of oxygen in the blood to the amount of light absorbed when transmitted through the blood. The absorption of the light transmitted through the medium can be calculated using the Beer-Lambert Law as follows:

Where IOUT is the intensity of the light transmitted through the medium, IIN is the intensity of the light going into the medium, and A is the absorption factor. There are different light absorption levels for oxygenated and deoxygenated hemoglobin at different wavelengths as can be seen in Figure 2. Traditionally, pulse oximeters make use of red (=660nm) and infrared light (=940nm) to determine then percentage of oxygenated hemoglobin present in the arterial system. These two wavelengths are chosen because, at 660 nm, deoxygenated hemoglobin has a higher absorption, whereas at 940 nm, oxygenated hemoglobin has a higher absorption. Once the absorption levels are detected, it is possible to determine the ratio of the absorption between the deoxygenated and oxygenated hemoglobin at the different wavelengths.

94

Figure 2. Absorption levels of oxygenated and deoxygenated blood at different wavelengths

The measurements taken by the pulse oximeter demonstrate the shape of a pulsatile waveform as seen in Figure 3. This pulsatile waveform has both AC and DC components in it. The DC components are comprised of the absorption from the nonpulsing arterial blood, the venous and capillary blood, as well as from scattering and absorption due to the tissue and bone. These components are always constant and rest on one another as shown in the figure. The AC component of the figure 3 is the pulsatile waveform that we are interested in. This waveform represents the pulsing of the blood in the arteries and each individual pulse can be seen, representative of the heart rate.

95

This waveform is gathered for both light frequencies, in this case infrared and red light. In order to obtain the pulse oximeter saturation (Sp02), these AC and DC components from each of the wavelengths need to be measured and taken as a ratio as follows:

This ratio is then used in a calibration curve based on studies of healthy individuals to determine the Sp02. This value will end up being a percentage which will tell the physician whether or not everything is as it is supposed to be. A normal saturation level is between 87-97%. [9] This method of measuring the Sp02 has been shown to be accurate to within 2.5%.

4.3 Factors That Affect Pulse Oximetry Readings

4.3.1 Patient Factors:


1- Patients with carbon monoxide poisoning, smoke inhalation, or cigarette smoking may have inaccurately increased SaO2 readings that reflect the sum of oxyhemoglobin and carboxyhemoglobin saturations.Such patients may be suffering from hypoxemia (lack of oxygen in the blood) without producing abnormal readings on pulse oximetry. 2- Conditions such as

96

hypercapnea (is a condition where there is too much carbon dioxide (CO2) in the blood ) decrease oxygen affinity, making oxygen more available to the cells. hypocapnea (is a state of reduced carbon dioxide in the blood and usually results from deep or rapid breathing) increase oxygen affinity 3- oxyhemoglobin is less able to release the oxygen molecules at the tissue level. 4- Anemia (hemoglobin less then 5mg/dL) prevent accurate pulse oximetry measurement. 5- Blood pressure, when the patient's blood pressure is low, the oximeter has difficulty differentiating the light wavelengths of arterial blood.

4.3.2 External Factors :


1- Lighting (e.g., surgical lights, bilirubin lights, infrared radiant warmers). 2- Patient movement/motion artifacts ( including shivering ) . 3- Non-pulsatile substances that absorb light: (e.g., nail polish, false nails, dried blood, heavy skin pigmentation/tattoos). 4- Intravascular compounds that absorb light at the same wavelengths as hemoglobin (e.g., dyes like methylene blue, indocyanine green, or indigo carmine). 5- Finger thickness , Skin pigmentation (dark skin may affect-evidence inconsistent) . Patients who require oxygen based on an O2 saturation measurement : We know that normal range is higher than 93 % , if this ratio is reduced so the patient require oxygen supply .

4.4 Skin Integrity Issues Associated with Pulse Oximetry


Mechanisms of Injury :

Equipment
Sensor overheating can also occur due to short circuits between wires in the sensor lead.14 If insulation over the light-emitting diode (LED) portion of the sensor is damaged or missing, the sensors electrical components may contact the
97

patients skin. An electrochemical burn at the site may result, caused by lowvoltage direct-current tissue electrolysis. Further, the protective cover over the LED may become damaged, allowing the sensor to overheat.

Patient Condition
a - Decreased blood flow to the area where the sensor is applied increases the risk of burn injury. The heat generated by the LED may not be dissipated from the site because of inadequate blood flow. b - The thinness of the patients skin increases the risk of more severe injury. c - Compression of the skin by the sensor may further decrease blood flow, reducing the bodys ability to dissipate sensor-generated heat.

Technique
The duration of skin contact with the sensor increases the risk of skin discoloration and burn injury.

Diagnostic/Treatment Modalities
Severe burns associated with pulse oximetry have occurred in patients undergoing Magnetic Resonance Imaging (MRI), During MRI, electrical currents are induced in all conductive materials exposed to the radio-frequency and gradient magnetic fields used during imaging.The current generated in such conductive materials can produce enough heat to cause a burn.

4.5 How can we calculate Spo2?


The light signal transmit through tissues pulsatile component resulting from the changing volume of arterial blood with each pulse beat AC. This can distinguish by microcontroller from the non pulsatile component from venous and capillary light absorption DC

98

We can distinguish & calculate by microcontroller between variable light absorption (AC) and constant light absorption (DC).this distinguishing process done to Red & IR light absorption .

Calculating:a-ratio of ratios:
Ros = (ACR/DCR) (ACIR/DCIR )

b-oxygen saturation:
Spo 2 = (EHbR - EhbIR * Ros) *100 % [EHbR - EHbo2R + (EHbo2IR - EHbIR) * Ros]

where:EHbR : Extinction (absorptive ) coefficient of hemoglobin with red EHbIR: absorptive coefficient of hemoglobin with infra red EHbo2R: absorptive coefficient of oxyhemoglobin with infra red EHbo2IR:absorptive coefficient of oxyhemoglobin with infra red From the absorptive curve of light wavelength with blood structure absorptive coefficient , we can detect values of hemoglobin and oxyheamoglobin absorptive coefficient from red and infra red which help us to solve oxygen saturation equation

4.6 Pulse Oximeter Sensor : (Adult Spo2 Disposable Sensor

99

We use this sensor cause it was the cheapest one in the market as the reusable spo2 sensor was in range 700 900 pounds The Sensor consists of LEDs. and a photodiode LEDs : An infrared LED (910 nm) and a red LED (660 nm) connected back-to-back. LEDs are chosen because of their small size and narrow bandwidth. Photo diode: The photo detector is a silicon photodiode that produces current (12 A) linearly proportional to the intensity of the light striking it.

SPECIFICATIONS :
- The accuracy of Adult Disposable Sensor during no motion from 70% to 100% SpO2 is 2 digits ( 1 Std. Dev.). - It requires a voltage supply of 5 V dc .
100

INSTRUCTIONS
A)Site Selection : Always choose a site that is well perfused and will completely cover the sensor's detector window, and least restricts a conscious patient's movements. So we can choose the ring or middle finger of the non-dominate hand is preferred.

B) Attaching the sensor to the patient : Orient the sensor so the detector can be placed first (Fig. 1a). Press the detector onto the fleshy part of the finger near the tip of the finger. Press down the T shaped adhesive ends of the sensor onto the finger (Fig. 1b).

Next, wrap the sensor with the emitter (star marking) over the fingernail and secure the wings down one at a time around finger (Fig. 1c). When properly applied, the emitter and the detector should be vertically aligned as shown (Fig. 1d).

101

Sensor pin Configuration:


Finding the pin configuration of the sensor was the big problem we faced . we solve it by searching and testing .

DB9 female connector

Notes :
Connect 1,6 (for calibration),7 (shielding) and 8 into Ground , Connect Anode of sensor photodiode into ground and Cathode of sensor photodiode into current to voltage converter .

4.7 Hardware Implementation:


102

4.7.1.Block Diagram :
RD& IR LED Driving Circuit LCD

Finger Photodiode Microcontroller PC

Current to Voltage Converter

Bandpass Filter (0.5-5 Hz)

A/D Converter

EEPROM

103

4.7.2 Simulation Circuit :

104

4.7.3 LED Driving Circuit :


we use two transistor N5551 NPN to complement the turning on and off red &IR LEDS with constant current to maintain stable operation .
105

by complement receiving current from 2 pin of micro control so transistor work as switch. - We control it by connect the two base of transistors by two pins of microcontroller when the base equal zero then the transistor will produce 5 v on the collector which connect with series resistor (0.5k ) to produce small current where V=IR I = 5 v / .5 k = 10 mA For Exampe ( when the base of Red equal Zero & the base of IR edual 1 => so the Red LED will be On and IR Off )

4.7.4 Current To Voltage Converter :


This circuit converts the current produced from the photodiode corresponding to light intensity into voltage. Its Governing Equation : V = I R V = I * 2.4 M - we use large feedback resistance as the current produced from Photodiode in the range microamplifier - The output voltage produced was in range 1-3 V

4.7.5 Filtering :
106

Pulse oximeter have a frequency range from 0.5 to 5 Hz

Method of filering:
1-Software filtering
We can distinguish & calculate by microcontroller between variable light absorption (AC) and constant light absorption (DC).this distinguishing process done to Red & IR light absorption . This signal happen two times , one for red signal and one for infra red signal. By separating it into Ac signal and DC signal from maximum and minimum value for each LED , we can get the equation value.

Signal for Red


Received intensity from photodiode

Signal for Infrared

IP( IR) IP ( R ) IB ( R )
Time

IB( IR)
Time

I P (R ) I B (R ) I P (IR ) I B (IR )

Is Max. value of received signal from red LED Is Min. value of received signal from red LED Is Max. value of received signal from infra red LED Is Max. value of received signal from infra red LED

107

2-Hardware filtering
Pulse oximeter have a frequency range from 0.5 to 5 Hz so we use Butterworth Bandpass filter (0.5 5 Hz) it is consistes of 2nd order High pass Filter followed by 4th order Low Pass Filter a ) High Pass Filter It is used to eliminate the DC component of the signal so that only the timevariant portion remains.

2nd Order Butterworth High-Pass Filter with fc = 0.5 Hz a1= 1.4142 ,b1= 1 are Butterworth 2nd order coefficient C1=C2=C R1C = a1/ 4 *fc*b1 R1C = 0.225079 R2C = 1/ *fc*a1 R2C = 0.450158 So we choose this Values C = 680 nF R1 = 330 k
108

R2 = 680 k b) Low Pass Filter It is used to eliminate all higher frequencies, which add noise to the signal due to motion of the person wearing the sensor.

4th Order Butterworth Low-Pass Filter(two 2nd Order Low Pass Filter) with fc = 5 Hz a1= 1.4142 ,b1= 1 are Butterworth 2nd order coefficient R1=R2=R RC2 = 0.022508 RC1 = 0.045016 So we choose this Values R = 68 K C1 = 680 nF C2 = 330 nF

109

4.7.6 PCB circuit :

110

Microcontroller circuit

111

Spo2 sensor driver 4.7.7 Our real circuit :

112

4.8 software design


113

4.8.1The Microcontroller
- We choose PIC16F877A as it is available on the market , cheap and easy to program and have internal analog to digital converter(A/D) . - we used embedded basic programming language compiled by IDE proton . We use The Microcontroller to control all the system components giving the order to each component telling it what to do and when . we use it to control : 1- Driving Circuit on leds (R&IR) 2- convert input analog volt to digital 3- EPROM 4- LCD 5- Transfer data serially to PC

4.8.2 The Code


Our microcontroller code is required to do the next procedures : a- Control LED Driving Circuit : connect 2 pins of microcontroller with the two transistor base pins to select which leds on or off (RED & IR ) b- Control ADC : connect one pin of microcontroller with WR pin to control start of conversion and hold the data . c- Control EEPROM :connect 2 pin of microcontroller with SCL & SDA pin to store the hold data to eeprom and retrieve it d- perform calculation on the data retrieved from eeprom e- Control LCD : display the result f- Transfer the final result serially to display on PC

114

4.8.3 Flow chart:-

115

116

5.1 Introduction:
Body temperature is a measure of the body's ability to generate and get rid of heat. The body is very good at keeping its temperature within a narrow, safe range in spite of large variations in temperatures outside the body. When you are too hot, the blood vessels in your skin expand (dilate) to carry the excess heat to your skin's surface. You may begin to sweat, and as the sweat evaporates, it helps cool your body. When you are too cold, your blood vessels narrow (contract) so that blood flow to your skin is reduced to conserve body heat. You may start shivering, which is an involuntary, rapid contraction of the muscles. This extra muscle activity helps generate more heat. Under normal conditions, this keeps your body temperature within a narrow, safe range Body temperature is checked to: - Detect fever. - Detect abnormally low body temperature (hypothermia) in people - Who have been exposed to cold. - Detect abnormally high body temperature (hyperthermia) in people - Who have been exposed to heat. - Help monitor the effectiveness of a fever-reducing medication. - Help plan for pregnancy by determining if a woman is ovulating.

5.2 Normal body temperature


The normal core body temperature of a healthy, resting adult human being is stated to be at 98.6 degrees fahrenheit or 37.0 degrees celsius. Though the body temperature measured on an individual can vary, a healthy human body can maintain a fairly consistent body temperature that is around the mark of 37.0 degrees celsius. The normal range of human body temperature varies due to an individuals metabolism rate, the higher (faster) it is the higher the normal body temperature or the slower the metabolic rate the lower the normal body temperature.
117

Other factors that might affect the body temperature of an individual may be the time of day or the part of the body in which the temperature is measured at. The body temperature is lower in the morning, due to the rest the body received, and higher at night after a day of muscular activity and after food intake. Body temperature also varies at different parts of the body. Oral temperatures, which are the most convenient type of temperature measurement, is at 37.0 C. This is the accepted standard temperature for the normal core body temperature. Axillary temperatures are an external measurement taken in the armpit or between two folds of skin on the body. This is the longest and most inaccurate way of measuring body temperature, the normal temperature falls at 97.6 F or 36.4 C. Rectal temperatures are an internal measurement taken in the rectum, which fall at 99.6 F or 37.6 C. It is the least time consuming and most accurate type of body temperature measurement, being an internal measurement. But it is definitely, by far, not the most comfortable method to measure the body temperature of an individual. Most people think of a "normal" body temperature as an oral temperature of 98.6 F(37 C). This is an average of normal body temperatures. Your temperature may actually be 1F (0.6C) or more above or below 98.6 F (37 C). Also, your normal body temperature changes by as much as 1F (0.6C) throughout the day, depending on how active you are and the time of day. Body temperature is very sensitive to hormone levels and may be higher or lower when a woman is ovulating or having her menstrual period.

5.3 Location of body temperature measurement


Your body temperature can be measured in many locations on your body. The mouth, ear, armpit, or rectum is the most commonly used places. Temperature can also be measured on your forehead.

5.3.1 How to take an oral temperature

118

Oral is the most common method of taking a temperature. To get an accurate temperature, the person must be able to breathe through the nose. If this is impossible because of a stuffy nose or lack of cooperation, use the rectum or armpit. 1. Place the digital or disposable thermometer under the tongue, just to one side of the center, and close the lips tightly around it. 2. Leave the thermometer in place for the required amount of time. Time yourself with a clock or watch. Some digital thermometers give a series of short beeps when the reading is done. 3. Remove the thermometer and read it. 4. Clean a digital thermometer with cool soapy water and rinse it off before putting it away.

5.3.2 How to take a rectal temperature


This is the location to measure body temperature most accurately. It is recommended for babies, small children, and people who cannot hold a thermometer safely in their mouths. It is also used when getting the most accurate measurement is essential. 1. Apply a lubricant jelly or petroleum jelly, such as Vaseline, on the bulb of the thermometer so that you can insert it easily. 2. When measuring the temperature of babies or small children, turn the child face down on your lap or on a flat covered or padded surface, such as a bed. Choose a quiet place so that the child won't be distracted or move around too much. 3. Spread the child's buttocks with one hand and gently insert the bulb end of the rectal thermometer about 0.5 in. to 1 in. into the anal canal with your other hand. Don't force it into the rectum. Hold the thermometer in place with two fingers
119

close to the anal opening (not near the end of the thermometer). Pressing the child's buttocks together will help keep the thermometer in place. 4. Leave the thermometer in place for the required amount of time. Some digital thermometers give a series of short beeps when the reading is done. Time yourself with a watch or clock.. 5. Remove the thermometer and read it. A rectal temperature reading may be as much as 1F (0.6C) higher than an oral temperature reading. 6. Clean a digital thermometer with cool soapy water and rinse it off before putting it away. 7. Do not use a thermometer to take an oral temperature after it has been used to take a rectal temperature.

5.3.3 How to take an armpit (axillarys) temperature


Taking a temperature in the armpit may not be as accurate as taking an oral or rectal temperature. 1. Place the thermometer under the arm with the bulb in the center of the armpit. 2. Press the arm against the body and leave the thermometer in place for the required amount of time. Time yourself with a watch or clock. 3. Remove the thermometer and read it. An armpit temperature reading may be as much as 1F (0.6C) lower than an oral temperature reading. 4. Clean a digital thermometer with cool soapy water and rinse it off before putting it away.

5.3.4 How to take an ear temperature


Ear thermometers may need to be cleaned and prepared for use. These steps can be followed when using a ear thermometer 1. Check that the probe is clean and free of debris. If dirty, wipe the it gently with a clean cloth. Do not immerse the thermometer in water. 2. To keep the probe clean, a disposable probe cover should be used. Use a new probe cover each time you take an ear temperature. Attach the disposable cover to the probe. 3. Turn the thermometer on. 4. For babies younger than 12 months, pull the earlobe down and back. This will help place the probe in the ear canal. Center the probe tip in the ear and push gently inward toward the eardrum. 5. For children older than 12 months and for adults, pull the earlobe up and back. Center the probe tip in the ear and push gently inward toward the eardrum.
120

6. Press the "on" button to display the temperature reading. 7. Remove the thermometer and throw away the used probe cover.

5.4 Abnormalities in body temperature 5.4.1 Hypothermia


Hypothermia refers to any condition in which the temperature of a body drops below the level required for normal metabolism and/or bodily function to take place. In Humans, core body temperature is maintained at or near a constant level through biologic homeostasis. When the body is exposed to colder temperatures, however, its internal mechanisms may be unable to replenish the heat that is being lost to the body's surroundings. Hypothermia is the opposite of hyperthermia. Because the words sound alike, they are easily confused. Stages of hypothermia in humans Stage 1 Body temperature drops by 1C - 2C below normal temperature C (1.8-3.6F, or between 96.8F - 95F). Mild to strong shivering occurs. Unable to perform complex tasks with the hands; the hands become numb. Blood vessels in the outer extremities contract, lessening heat loss to the outside air. Breathing becomes quick and shallow. Goose bumps form, raising body hair on end in an attempt to create an insulating layer of air around the body (limited use in humans due to lack of sufficient hair, but useful in other species). Often times, a person will expierence a warm sensation, as if they have recovered, but they are in fact heading into Stage 2. Stage 2 Body temperature drops by 2C - 4C (3.6F - 7.2F, or between 95F - 91.4F). Shivering becomes more violent. Muscle miscoordination becomes apparent. Movements are slow and labored, accompanied by a stumbling pace and mild confusion, although the victim may appear alert. Surface blood vessels contract further as the body focuses its remaining resources on keeping the vital organs warm. Victim becomes pale. Lips, ears, fingers and toes may become blue. Stage 3
121

Body temperature drops below approximately 32C or 90F (normal is 37C or 98.6 F). Shivering usually stops below 32C; difficulty speaking, sluggish thinking, and amnesia start to appear; inability to use hands and stumbling are also usually present. Cellular metabolic processes shut down. Below 86F (30C) the exposed skin becomes blue and puffy, muscle coordination very poor, walking nearly impossible, and the victim exhibits incoherent/irrational behavior including terminal burrowing behavior or even a stupor. Pulse and respiration rates decrease significantly but fast heart rates (ventricular tachycardia, atrial fibrillation) can occur. Major organs fail. Clinical death occurs. Because of decreased cellular activity in stage 3 hypothermia, the body will actually take longer to undergo brain death. Prevention In air, most heat is lost through the head;[2] hypothermia can thus be most effectively prevented by covering the head. Having appropriate clothing for the environment is another important prevention. Fluid-retaining materials like cotton can be a hypothermia risk; if the wearer gets sweaty on a cold day, then cools down, they will have sweat-soaked clothing in the cold air. For outdoor exercise on a cold day, it is advisable to wear fabrics which can "wick" away sweat moisture. These include wool or synthetic fabrics designed specifically for rapid drying. Heat is lost much more quickly in water. Children can die of hypothermia in as little as two hours in water as warm as 16C (61F, 289 K), typical of sea surface temperatures in temperate countries such as Great Britain in early summer. Many seaside safety information sources fail to quote survival times in water, as well as the consequent importance of diving suits. This is possibly because the original research into hypothermia mortality in water was carried out in wartime Germany on unwilling subjects. There is an ongoing debate as to the ethical basis of using the data thus acquired. There is considerable evidence, however, that children who suffer near-drowning accidents in water near 0C (32F, 273 K) can be revived up to two hours after losing consciousness. The cold water considerably lowers metabolism, allowing the brain to withstand a much longer period of hypoxia.

5.4.2 Hyperthermia
Hyperthermia (hyperpyrexia), in its advanced state referred to as heat stroke or sunstroke, is an acute condition which occurs when the body produces or absorbs more heat than it can dissipate. It is usually due to excessive exposure to heat. The heat regulating mechanisms of the body eventually become overwhelmed and unable to effectively deal with the heat, and body temperature climbs uncontrollably. This is a serious medical emergency that requires immediate medical attention.
122

Hyperthermia can be created artificially by drugs or medical devices. In these instances it may be used to treat cancer and other conditions. Malignant hyperthermia is a rare complication of some types of general anesthesia. Body temperatures above 40C (104 F) are life-threatening. At 41C (106 F), brain death begins, and at 45C (113F) death is - 35 - nearly certain. Internal temperatures above 50C (122F) will cause rigidity in the muscles and certain, immediate death. Heat stroke may come on suddenly, but usually follows a less threatening condition commonly referred to as heat exhaustion or heat prostration.

Preparation:
Take your temperature several times when you are feeling well to find out what is normal for you. Check your temperature in both the morning and evening, since body temperature can vary by as much as 1F (0.6C) throughout the day. Wait at least 20 to 30 minutes after smoking, eating, or drinking a hot or cold liquid before taking your temperature. Also wait at least an hour after vigorous exercise or a hot bath.

Results:

123

5.5 Our circuit design :

124

125

Components Used:
5.5.1 Temperature Sensor (LM35DZ):
1. The Lm35 Precision Semiconductor Temperature Sensor Giving An Output Of 10mv Per Degree Centigrade. 2. Unlike Devices With Outputs Proportional To The Absolute Temperature ( In Degree Kelvin) There Is No Large Offset Voltage Which, In Most Applications Will Have To Be Removed. 3. Accuracies of 1/4C At Room Temperature Or 3/4C Over The Full Temperature Range Are Typical

126

Features:
1. Output proportional to C 2. Wide temperature range (-40C to +110C)CZ version 3. Accurate 1/ 4C at room temperature typical 4. Linear output 0.2C typical 5. Low current drain (60A typical) 6. Low self heating (0.08C typical)

5.5.2 Pic16f877a:

Its Features:
-High-Performance RISC CPU:
Only 35 single-word instructions to learn All single-cycle instructions except for program branches, which are two-cycle Operating speed: DC 20 MHz clock input DC 200 ns instruction cycle Up to 8K x 14 words of Flash Program Memory, Up to 368 x 8 bytes of Data Memory (RAM), Up to 256 x 8 bytes of EEPROM Data Memory Pin out compatible to other 28-pin or 40/44-pin PIC16CXXX and PIC16FXXX microcontrollers

-Peripheral Features:
Timer0: 8-bit timer/counter with 8-bit prescaler Timer1: 16-bit timer/counter with prescaler, can be incremented during Sleep via external crystal/clock Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler Two Capture, Compare, PWM modules - Capture is 16-bit, max. resolution is 12.5 ns - Compare is 16-bit, max. resolution is 200 ns - PWM max. resolution is 10-bit
127

Synchronous Serial Port (SSP) with SPI (Master mode) and I2C (Master/Slave) Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) with 9-bit address detection Parallel Slave Port (PSP) 8 bits wide with external RD, WR and CS controls (40/44-pin only) Brown-out detection circuitry for Brown-out Reset (BOR)

Analog Features:
10-bit, up to 8-channel Analog-to-Digital Converter (A/D) Brown-out Reset (BOR) Analog Comparator module with: - Two analog comparators - Programmable on-chip voltage reference (VREF) module - Programmable input multiplexing from device inputs and internal voltage reference - Comparator outputs are externally accessible

-Special Microcontroller Features:


100,000 erase/write cycle Enhanced Flash program memory typical 1,000,000 erase/write cycle Data EEPROM memory typical Data EEPROM Retention > 40 years Self-reprogrammable under software control In-Circuit Serial Programming (ICSP) via two pins Single-supply 5V In-Circuit Serial Programming Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation Programmable code protection Power saving Sleep mode Selectable oscillator options In-Circuit Debug (ICD) via two pins

CMOS Technology:
Low-power, high-speed Flash/EEPROM technology Fully static design Wide operating voltage range (2.0V to 5.5V) Commercial and Industrial temperature ranges Low-power consumption

5.5.3 7-segment (a-563e) THREE DIGITS DISPLAY

128

129

6.1 Displaying data:


Magic monitor used common anode 7 segments to display data measured as : * Blood pressure * Pulse oximeter * Temperature

6.1.1 Design of
of electronic display numeral

7-Segments: is a form
device for displaying decimal

Figure1: 7segments in front view

Lab al in 7 A B C D E F G Dp Dig1 Dig2 Dig3

No.b in 7 6 3 2 1 5 4 11 8 9 12

dig1

dig2

dig3

130

Figure2 : Shape of 7segment

Table 1

Figure3 :

Connection of three of 7segment

6.1.2 Concept and visual structure:


A seven segment display, as its name indicates, is composed of seven elements. Individually on or off, they can be combined to produce simplified representations of the numerals. the seven segments are of nearly uniform shape and size. Using multiplexer in(3x1) it to reduce pine of seven segment and control in 3 digs

Note : Each label of led have pine as indicate in table1 and figure 2

6.1.3 Programmed 7segment:


7segment have 8 leds (A-B-S-D-E-F-G-DP) each led connected with pin of port in micro which default as output port and control pines to choose which dig display in 7segment . Numbers to 7-segment-code: A single byte can encode the full state of a 7-segmentdisplay. The most popular bit encodings are gfedcba and abcdefg - both usually assume 0 is off and 1 is on table2 gives the hexadecimal encodings for displaying the digits 0 to 9. Dig1, Dig2 and Dig3 used to control in multiblexer used in device of seven segment to connect the pins of led (A,B,C,D,E,F,G,DP) as shown in figure 3

Program of display data on 7segment by using pic16f877A:


Output PORTB Output PORTD ; control in (A,B,C,D,E,F,G,DP) pins of 7segment ; control in (Dig1,Dig2,Dig3)pins of 7segment

Number1=Number Dig 0 Number2=Number Dig 1 Number3=Number Dig 2

; detect value of digit 1 on in 7segment ; detect value of digit 2 on in 7segment ; detect value of digit 3 on in 7segment

131

PORTD.5=1 PORTD.6=0 PORTD.4=0 If Number3=0 Then PORTB ElseIf Number3=1 Then PORTB ElseIf Number3=2 Then PORTB ElseIf Number3=3 Then PORTB ElseIf Number3=4 Then PORTB ElseIf Number3=5 Then PORTB ElseIf Number3=6 Then PORTB ElseIf Number3=7 Then PORTB ElseIf Number3=8 Then PORTB ElseIf Number3=9 Then PORTB EndIf DelayMS 5 PORTD.5=0 PORTD.6=1 PORTD.4=0 If Number2=0 Then PORTB ElseIf Number2=1 Then PORTB ElseIf Number2=2 Then PORTB ElseIf Number2=3 Then PORTB ElseIf Number2=4 Then PORTB ElseIf Number2=5 Then PORTB ElseIf Number2=6 Then PORTB ElseIf Number2=7 Then PORTB ElseIf Number2=8 Then PORTB ElseIf Number2=9 Then PORTB EndIf DelayMS 5 PORTD.5=0 PORTD.6=0 PORTD.4=1 If Number3=0 Then PORTB ElseIf Number1=1 Then PORTB ElseIf Number1=2 Then PORTB ElseIf Number1=3 Then PORTB ElseIf Number1=4 Then

; enable only Dig2 ; diesaple only Dig1 ; diesaple only Dig0 = %11000000 = %11111001 = %10100100 = %10110000 = %10011001 = %10010010 = %10000010 = %11111000 = %10000000 = %10010000 ; display in portB no 0 ; display in portB no 1 ; display in portB no 2 ; display in portB no 3 ; display in portB no 4 ; display in portB no 5 ; display in portB no 6 ; display in portB no 7 ; display in portB no 8 ; display in portB no 9

; diesaple only Dig1 ; enable only Dig2 ; diesaple only Dig1 = %01000000 = %01111001 = %00100100 = %00110000 = %00011001 = %00010010 = %00000010 = %01111000 = %00000000 = %00010000

; diesaple only Dig1 ; diesaple only Dig1 ; enable only Dig2 = %11000000 = %11111001 = %10100100 = %10110000

132

PORTB ElseIf Number1=5 Then PORTB ElseIf Number1=6 Then PORTB ElseIf Number1=7 Then PORTB ElseIf Number1=8 Then PORTB ElseIf Number1=9 Then PORTB EndIf DelayMS 5

= %10011001 = %10010010 = %10000010 = %11111000 = %10000000 = %10010000

6.1.4 Display data on each module :


At temperature and pulse oximeter Use only one 7segment to display temperature and pulse oximeter as shown in figure 5

Fig 5: layout of data via 7segment

Fig 6: circuit of pulse or temp Magic monitor use two 7segment to display systolic and diastolic as showen in figure7

133

Fig 7: layout of data via 7segment

Fig 8: circuit of pressure

6.2 Plotting signal:


Magic monitor use graphic lcd (LM12862LFW) to plot ECG signal as showen in fig 9 . Graphic lcd contain 20 pins the usage of them as showen in table 3 . Graphic lcd used to display data and plot signal as showem in fig 10

Fig 10: graphic lcd display data and plot signal

134

6.2.1 How is plotting signal on graphic lcd: Using microcontroller (pic16F877A) in analog to digital converter pin to inter signal of ECG (in pin A0) which is converted analog volt to digital value , applying digital value in equation to be corresponding to x axis which start from (0 63). Signal appear in graphic lcd as : - Vertical axis volt, - Horizontal axis as time.

Sig_process: VAR2 =(VAR1/5) - 51 ; converting the digitalized value to another corresponding to X axis VAR3=Abs VAR2 ;invert signal to drowen from bottom to top If PORTC.3 == 0 Then i=i+1 EndIf VAR4=VAR3 + i ;control in shift signal(as shown in fig 14) Return

Fig 11: signal shifted by push

botton in portc.3

135

By taking the digital values with delay beween them 500 microsecond and put the signal as dot in graphic lcd as shwon in fig 12.

Fig 12:sine signal plotting as dot

only

Then use instruction line to contact between the dots in line as shown in fig 13 Not plotting between end and start of signal appear in graphic as shown in fig 14.
If Y=17 Then GoTo NN Line 1 ,X1 ,Y1 ,Y ,VAR4

; Not to draw line between end and start point

Fig 13:sine signal plotting final shape of signal

Fig 14: signal draw line between end and start point To avoid plot on the clear the last signal before plot the current signal use the following instruction. (as shown in fig 15

136

For Y = 17 To 125 ; width of graph from 17 to 125 If Y=17 Then GoTo ll ; not to clear after the graph width Line 0 , Y+1 , 10 , Y+1 , 63 ; clearing line

Fig 15: signal not clearing

6.2.2 The circuit of graphic lcd:

137

138

139

Serial Communication
Communication with other devices is an important task in the embedded world. Most devices need to communicate with other devices, which may be present on the same board; same device or they may be separate individual devices. The other device may not be based upon the same microcontroller as you are using. Indeed it may be your personal computer, an industrial device which is based upon some other processor. Thus this communication has to be hardware independent. It should not matter, as to what is inside the device, there has to be a protocol for communication. Ideally a communication system must synchronize its data transmission and receiving with a clock signal. In certain situations like in radio controlled wireless applications it is difficult or sometimes impossible to establish a separate channel for data and clock. In these situations single wire transmission is more effective. A large number of communication protocols exist; these are implemented one way or other in many devices. Here one of the oldest and time tested serial protocols, called USART will be discussed. This stands for Universal Asynchronous Receiver and Transmitter protocol. This system uses two I/O lines one fro receiving data and other for transmitting. The data is sent and received without any clock synchronization, therefore its called Asynchronous. The serial port on your PC uses the same protocol to communicate with various devices. The USART protocol is very simple, its data consists of either 8 bits or 9 bits, and every start of byte has a start bit and an end bit.

140

Briefly, each data is transferred in the following way: In idle state, data line has high logic level (1). Each data transmission starts with START bit which is always a zero (0). Each data is 8- or 9-bit wide (LSB bit is first transferred) Each data transmission ends with STOP bit which always has logic level which is always a one (1).

7.1 Protocol :
Protocol is a set of rule that governs the communication between two intelligent device

Baud Rate
Baud Rate is the speed at which data is transmitted. It is represented by a number indicating bits per second. In order to properly communicate it is very important that the communicating devices should have the same Baud rate. The Baud rate is controlled independently by the Baud rate generator module in the chip. There is a complex calculation to determine exact values to be written in SPBRG register to produce the desired Baud Rate. This process has been simplified by BASIC compiler, using a declare to specify the Baud Rate. HSERIAL_BAUD 9600

Byte size :
141

Data is 8 or 9 bit wide (LSB bit is first tranferred) Parity bit : -Check the data (if the data correctly sent or have an error) -the data which sent by microcontroller may be have error by the connecting wire. -the connecting wire (transmission line) act as low pass filter. -Any signal contain for (fundamental signal + harmonic signals). -when signal applied to low pass filter the filter can remove harmonic signals. The hardware module of PIC16F877A has external pins on RC6 and RC7. Therefore a device which needs to implement the USART using internal hardware must use these two lines, one for Tx and other for Rx. However using software techniques you can implement connectivity through any digital I/O line.

7.2 RS232 Level Conversion


Although devices can communicate directly if their Rx and Tx pins are connected with each other. However to reduce noise interference and increase transmission distance over wire the voltage levels of logical 0 and 1 are changed. This is usually implemented using a TTL level conversion chip, called Max-232. this chip accepts the converted high voltage values and convert them to TTL logical values and present them to microcontroller, it also accepts the logical value from microcontroller and converts it to high voltage levels for transmission.

142

RCSTA and TXSTA registers


Since RC6 and RC7 pins are also general purpose digital I/O lines as well, in order to connect and enable them as USART pins, we have to configure appropriate registers. RC6 is the Tx pin whereas RC7 is Rx pin. The Tx pin will transmit data out of microcontroller and Rx pin will receive data into the microcontroller. The pins will be connected reciprocally to the other device. That is the Tx pin of one device is connected to Rx of other and so on. RCSTA register configures the receiving characteristics of hardware module whereas TXSTA register will configure the transmitting characteristics of the module. As you can see various bits assigned various settings to control the behavior of transmission. For our purpose the most important bit to start with is bit 5. The TXEN bit. Setting this bit to 1 will enable serial transmission through Tx pin which is RC6. TXSTA.5=1 The same thing can also be declared as: HSERIAL_TXSTA %00100000

TXSTA registers

- Bit 5 (TEXN) is a transmit enable bit. If ( TEXTA.5 = 1 ) enable transmit If ( TEXTA.5 = 0 ) disable transmit

143

7.3 PCB Circuit :

144

145

8.1 Display Monitor Data on PC


We used MATLAB program to display the data from device by two ways:8.1.1 Read and Display input data serially

To read data from serial we used the following instructions: s = serial('COM7'); create a port object(s) like com7 to

146

set(s,'BaudRate', 4800, 'DataBits', 8, 'Parity', 'none','StopBits', 1, 'FlowControl', 'none'); To adjust the port object properties to be ready to receive data from the microcontrol circuit. The properties was BaudRate ---------- 4800 DataBits ---------- 8 Parity -----------none StopBits -----------1 FlowControl ----------none fopen(s); fprintf(s,'*IDN?') idn = fscanf(s) fclose(s) The above instructions were used to receive the data from the serial port with name IDN fopen(s) ------------open reading data session fprintf(s,'*IDN?') ------------take data from serial and story it in variable IDN fclose(s) ------------close reading data session save idn; load idn; The above instructions used to save and loading the variable idn that has the received data in machine language dlmwrite('c:\medical.txt',idn,'',1,4); The above instruction is used to save the variable idn in the path c:\ with name medical with text format in ASCLL language.

147

8.1.2 Plot ECG signal To read data from input audio port (microphone) we used the following instructions: ecg=wavrecord(2*Fs,Fs) Record signal using PC-based audio input device save ('ecg') The above instruction is used to save the variable ecg that has the received data in machine language y=plot(ecg); The above instruction is used to plot the curve of the input signal on a figure window. saveas(y,'c:\ecg','png') The above instruction is used to save the signal as image with extension png (Portable Network Graphics) 8.2 Send data to E-Mail To send the received data in E-Mail by MATLAB we used the following instructions:mail = 'agg123agg@gmail.com'; password = '0107707154'; The above instructions are used to configure the sender mail setpref('Internet','E_mail',mail);
148

setpref('Internet','SMTP_Server','smtp.gmail.com'); setpref('Internet','SMTP_Username',mail); setpref('Internet','SMTP_Password',password); The above instruction is used to configure the server to be ready to accept the data and send them to the selected E-MAIL. sendmail('rwash_rwash@yahoo.com','EL-MAGIC','EL-MAGIC','c:\ECG.png') This instruction is to send the data to mail with subject El-magic with attached file with path (c:\)

8.3. GUI

149

150

151

152

When press on Display ECG Signal will display Shape of signal

153

154

9.1. System data flow:

155

1-Each module send its result data serially by max232 to pc 2-Pc upload data to servers using : -client server protocol -HTTP protocol 3-Mobile download data thats want to handle in application options

9.1.1 Client server protocol :


In computing, a client-server protocol is a protocol in which there is a single server which listens for connections, usually on a specific port (if this is TCP, UDP, or a similar protocol), and one or more clients which connect to it. Client-Server Protocol is one of three basic groups of NOSs' (Network Operating System). The Protocol enables one machine to be dedicated to resources. The machine had a dedicated NOS optimized for sharing files. The highly specialized OS has an extensive powerful cache to enable high-speed file access. There is an extremely high level of protection and organization that permits extensive control of data. This machine is called a dedicated server. All of the machines that access the server are called clients or workstations. The most current NOS available that most closely adheres to the definition of Client/Server Networks is Novell Netware

9.1.2 HTTP protocol :


The Hypertext Transfer Protocol (HTTP) is an Application Layer protocol for distributed, collaborative, hypermedia information systems.[1] HTTP is a request-response protocol standard for client-server computing. In HTTP, a web browser, for example, acts as a client, while an application running on a computer hosting the web site acts as a server. The client submits HTTP requests to the responding server by sending messages to it. The server, which
156

stores content (or resources) such as HTML files and images, or generates such content on the fly, sends messages back to the client in response. These returned messages may contain the content requested by the client or may contain other kinds of response indications. A client is also referred to as a user agent (or 'UA' for short). A web crawler (or 'spider') is another example of a common type of client or user agent. In between the client and server there may be several intermediaries, such as proxies, web caches or gateways. In such a case, the client communicates with the server indirectly, and only converses directly with the first intermediary in the chain. A server may be called the origin server to reflect the fact that this is where content ultimately originates from.

HTTP is not constrained in principle to using TCP/IP, although this is its most popular implementation platform. Indeed HTTP can be "implemented on top of any other protocol on the Internet, or on other networks." HTTP only presumes a reliable transport; any protocol that provides such guarantees can be used.[2] Resources to be accessed by HTTP are identified using Uniform Resource Identifiers (URIs)or, more specifically, Uniform Resource Locators (URLs) using the http or https URI schemes. Its use for retrieving inter-linked resources, called hypertext documents, led to the establishment of the World Wide Web in 1990 by English physicist Tim BernersLee.

9.2. Java Platform, Micro Edition:


Java Platform, Micro Edition, or Java ME, is a Java platform designed for mobile devices and embedded systems. Target devices range from industrial controls to mobile phones (especially feature phones) and set-top boxes. Java ME was formerly known as Java 2 Platform, Micro Edition (J2ME). Java ME was designed by Sun Microsystems, now a subsidiary of Oracle Corporation; the platform replaced a similar technology, PersonalJava. Originally developed under the Java Community Process as JSR 68, the different flavors of Java ME have evolved in separate JSRs. Sun provides a reference implementation of the specification, but has tended not to provide free binary
157

implementations of its Java ME runtime environment for mobile devices, rather relying on third parties to provide their own. Java ME devices implement a profile. The most common of these are the Mobile Information Device Profile aimed at mobile devices, such as cell phones, and the Personal Profile aimed at consumer products and embedded devices like set-top boxes and PDAs. Profiles are subsets of configurations, of which there are currently two: the Connected Limited Device Configuration (CLDC) and the Connected Device Configuration (CDC).[1] There are more than 2 billion Java ME enabled mobile phones and PDAs[2].

9.2.1. Mobile devices:


Java ME has become popular in mobile devices, where it competes with Symbian, BREW, and the .NET Compact Framework. The diversity of mobile phone manufacturers has led to a need for new unified standards so programs can run on phones from different suppliers - MIDP. The first standard was MIDP 1, which assumed a small screen size, no access to audio, and a 32kB program limit. The more recent MIDP 2 allows access to audio, and up to 64kB for the program size. With handset designs improving more rapidly than the standards, some manufacturers relax some limitations in the standards, for example, maximum program size

9.3. Software Requirements Specification:


A Software Requirements Specification (SRS) is a complete description of the behavior of the system to be developed. It includes a set of use cases that describe all the interactions the users will have with the software. Use cases are also known as functional requirements. In addition to use cases, the SRS also contains non-functional (or supplementary) requirements. Non-functional requirements are requirements which impose constraints on the design or implementation (such as performance engineering requirements, quality standards, or design constraints).
158

-The system will store, protect and maintain records in physical (paper) and in electronic (machine readable) format.

9.4. Domain Requirements:


1- Authentication constraint: Each connection must have a special kind of security to connect to the server 2- It must have a high bandwidth to support too many connections because there are a lot of students 3- we must distribute the database containing the information on many machines so that it would be fast and also don't put all the information in single database (multiple database) because any database support a limited number of requests when it exceed this number the system will be down 4- The software version on the host Example: If I did it using asp.net then the host OS must be windows because it must have the .net framework 5- The protocols supported by the server Example: The server can give the ftp protocol but not the http protocol.

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

List of References:
Textbooks
- Medical Instrumentation ; Application and design by John G. Webster - Encyclopedia of Medical Devices and Instrumentatio by John G. Webster - Electronic Devices By Thomas .L.Floyed

-[IEEE] The applicable IEEE standards are published in IEEE Standards Collection, 2001 edition. -[Bruade] The principal source of textbook material is Software Engineering: An Object-Oriented Perspective by Eric J. Bruade (Wiley 2001). - Freescale Semiconductors Application Note 1571 (Rev 1, 5/2005) By: C.S. Chua and Siew Mun Hin, Sensor Application Engineering Singapore, A/P - Digital Systems (Eighth Edition) Principles and By: Ronald J. Tocci and Neal S. Widmer Applications

177

Internet Links
o Microchip Website www.microchip.com o CISCO Website www.sisco.com o Freescale Website www.freescale.com o Descriptions for the Bio-Sensors www.bioapc.com

178

You might also like