Bachelorthesis.compressed

91
Biomedical Wireless Sensor Network DDU (Faculty of Tech., Dept. of IT) Page 1 Biomedical Wireless Sensor Network BE-Sem- VIII Prepared at Prepared by Shah Dhara M. ID No. 056079 Viroja Pooja S. ID No. 051118 Shah Ishan D. ID No. 13821 Guided By Prof. Dr. Prabhat Ranjan Prof. R.S.Chhajed Dept. of Wireless Communication Head of Dept. of Information Technology Technology DA-IICT, Gandhinagar DDU, Nadiad Department of Information Technology Faculty of Technology, Dharamsinh Desai University College Road, Nadiad-387001 March-April 2009

Transcript of Bachelorthesis.compressed

Page 1: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 1

Biomedical Wireless Sensor Network BE-Sem- VIII

Prepared at

Prepared by

Shah Dhara M. ID No. 056079

Viroja Pooja S. ID No. 051118

Shah Ishan D. ID No. 13821

Guided By

Prof. Dr. Prabhat Ranjan Prof. R.S.Chhajed

Dept. of Wireless Communication Head of Dept. of Information

Technology Technology

DA-IICT, Gandhinagar DDU, Nadiad

Department of Information Technology

Faculty of Technology, Dharamsinh Desai University

College Road, Nadiad-387001

March-April 2009

Page 2: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 2

TABLE OF CONTENTS

Title Page No ABSTRACT…………………………………………………………………..5 1.0 Introduction…………………………………………………….............8

1.1 Project Details 1.2 Purpose 1.3 Scope 1.4 Objective 1.5 Technology and Literature Review

1.5.1 ECG Signal 1.5.2 Electrodes 1.5.3 Amplifiers and Filters 1.5.4 QRS Detector 1.5.5 STK_500 Kit 1.5.6 Microcontroller IC-ATMEGA32 1.5.7 XBee

2.0 Project Management………………………………………………….54 2.1 Feasibility Study 2.1.1 Technical feasibility 2.1.2 Time schedule feasibility 2.1.3 Operational feasibility 2.1.4 Implementation feasibility 2.2 Project Planning 2.2.1 Project Development Approach and justification 2.2.2 Project Plan 2.2.3 Milestones and Deliverables 2.2.4 Roles and Responsibilities 2.2.5 Group Dependencies 2.3 Project Scheduling Project scheduling chart 3.0 System Requirements Study………………………………………….57 3.1 History of ECG

3.2 Study of Current System 3.3 Problems and Weaknesses of Current System 3.4 System User Characteristics

Page 3: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 3

3.5 Hardware and Software requirements 3.6 Constraints

3.6.1 Regulatory Policies 3.6.2 Hardware Limitations 3.6.3 Interfaces to Other Applications 3.6.4 Parallel Operations 3.6.5 Higher Order Language Requirements 3.6.6 Reliability Requirements 3.6.7 Criticality of the Application 3.6.8 Safety and Security Consideration

3.7 Assumptions and Dependencies 4.0 System Analysis………………………………………………………..62

4.1 Requirements of New System (SRS) 4.1.1 User Requirements 4.1.2 System Requirements

4.2 Features of New System 4.3 Navigation Chart 4.4 Class Diagram (Analysis level, without considering impl. environment) 4.5 System Activity(Use case and/or scenario diagram) 4.6 Sequence Diagram (Analysis level, without considering impl.

Environment) 4.7 Data Modeling

4.7.1 Data Dictionary 4.7.2 ER Diagram

5.0 System Architecture Design………………………………………….65 5.1 Pre-Amplifier Circuit 5.2 Post-Amplifier Circuit 5.3 QRS Detector Circuit 5.4 Controller Circuit 5.5 Hardware Module 6.0 Implementation Planning…………………………………………….74 6.1 Implementation Environment 6.2 Program Specification 6.3 Coding Standards

Page 4: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 4

7.0 Testing…………………………………………………………………83

7.1 Testing Plan 7.2 Testing Strategy 7.3 Testing Methods 7.4 Test Cases 7.4.1 Purpose 7.4.2 Required Input 7.4.3 Expected Results 8.0 Limitation and Future Enhancements……………………………..84 9.0 Conclusion and Discussion …………………………………………86 9.1 Conclusions and Future Enhancement

9.2 Discussion 9.2.1 Self Analysis of Project Viabilities 9.2.2 Problem Encountered and Possible Solutions 9.2.3 Summary of Project work EXPERIENCE…………………………………………………………….87 REFERENCES……………………………………………………………89

Page 5: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 5

Abstract The object of our project is acquisition of Electro cardiogram signal from patient‟s body through wearable system, analyze whether it is normal or abnormal at patient‟s end, then transmit the wireless signal if found that it is abnormal. Transmission is to be done wirelessly through XBEE Technology and then higher level analysis is to be done on computer which is situated at base -station. To achieve our objective we have used microcontroller AT Mega 32 and for its programming we have used dynamic C with AVR Studio base. For higher level analysis we have made software using Java J2EE, Java Script and PHP.

Page 6: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 6

Page 7: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 7

Page 8: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 8

Chapter 1 INTRODUCTION

1.1 PROJECT DETAILS

This document aims to define the overall hardware and software requirements for “Biomedical

Wireless Sensor Network” project. Efforts were exhaustively accurate to fulfill the requirements.

The final system will be having only features mentioned in this document and assumptions for any

additional functionality should not be made by any of the parties’ moves in developing this system.

This system will be working to take an ECG Signal from the patient and analysis it. If any abnormality

is present, transmit it and inform the Doctor through wireless device.

1.2 PURPOSE

This specification document describes the capabilities that will be provided by the hardware as well

as software application. It also states the various required constraints by which the system will

abide. The intended evidence for this document is the Development Team, Testing Team and users

of this document.

This system is designed basically for old age people. We know that in Old Age Home people move

freely in the surrounding area and for their heart care, we make wearable ECG monitor which is rang

a buzzer if any abnormality happened with patient heart and send this abnormal signal to the Doctor

through wireless then corresponding, immediately Doctor service can be provided.

1.3 SCOPE

According to project aim the heart patient can consult Doctor if any abnormal thing happened with

his or her heart. And for that this wearable ECG monitor is helpful. Like for Old Age Home people,

they wear it and move freely in campus. Another scope is that we can use it in hospitals for heart

patients and in resident society, mall, office building. The coverage area can change according the

range of the wireless device.

Page 9: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 9

1.4 OBJECTIVE

Estimation was made that about 17.5 million people were died from cardiovascular disease in 2005,

representing 30 % of all global deaths. Out of these deaths, 7.6 million were due to heart attacks and

5.7 million were due to stroke. If current trends are allowed to continue, by 2015 an estimated 20

million people will die from cardiovascular disease, mainly from heart attacks and strokes.

Unfortunately, out of these heart attacks, 250,000 are sudden, causing the patient to die within an

hour. And it is estimated that about 47% of cardiac deaths occur before emergency services or

transport to a hospital.

This wearable ECG sensor can provide emergency services and may reduce the death rate, occur

before emergency services.

1.5 TECNOLOGY AND LITERATURE REVIEW

1.5.1 ECG Signal

Blood Circulation Through 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.

Page 10: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 10

Figure 1.1 Anatomy of the Heart Figure 1.2 Blood circulation in the Heart

Figure 5.1.2 shows the circulation of blood through the heart. The blood enters the right atrium of the heart through the superior vena cava. The right atrium contracts and pushes the blood cells through the tricuspid valve into the right ventricle. The right ventricle then contracts and pushes the blood through the pulmonary valve into the pulmonary artery, which brings it to the lungs. In the lungs, the blood cells exchange carbon dioxide for oxygen. This oxygenated blood returns to the heart by way of the pulmonary vein and enters the left atrium. The left atrium contracts and pumps the blood through the mitral valve into the left ventricle. Then, the left ventricle contracts and pushes the blood into the aorta. The aorta branches off into several different arteries that pump the oxygenated blood to various parts of the body. So the flow is…

Anterior and posterior vena cava -> right atrium -> tricuspid valve -> right ventricle -> pulmonary semi lunar valve -> pulmonary artery -> lungs -> pulmonary veins -> left atrium -> bicuspid valve -> left ventricle -> aortic semi lunar valve -> aorta -> arteries -> body.

Page 11: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 11

Heart is having its own source of oxygenated blood. The heart is supplied by its own set of blood vessels. These are the coronary arteries. There are two main ones with two major branches each. They arise from the aorta right after it leaves the heart. The coronary arteries eventually branch into capillary beds that course throughout the heart walls and supply the heart muscle with oxygenated blood. The coronary veins return blood from the heart muscle, but instead of emptying into another larger vein, they empty directly into the right atrium.

Electrical Activity Of The Heart

The heart has a natural pacemaker that regulates the pace or rate of the heart. It sits in

the upper portion of the right atrium (RA) and is a collection of specializes electrical cells known as

the SINUS or SINO-ATRIAL (SA) node.

Figure 1.3 Sequence of electrical activity within the Heart

The sequence of electrical activity within the heart is displayed in the diagrams above and occurs as

follows:

As the SA node fires, each electrical impulse travels through the right and left atrium.

This electrical activity causes the two upper chambers of the heart to contract. This electrical activity

and can be recorded from the surface of the body as a "P" wave" on the patient's EKG or ECG

(electrocardiogram).

The electrical impulse then moves to an area known as the AV (atrium-ventricular) node.

This node sits just above the ventricles. Here, the electrical impulse is held up for a brief period. This

delay allows the right and left atrium to continue emptying its blood contents into the two

ventricles. This delay is recorded as a "PR interval." The AV node thus acts as a "relay station"

delaying stimulation of the ventricles long enough to allow the two atria to finish emptying.

Following the delay, the electrical impulse travels through both ventricles. The electrically

stimulated ventricles contract and blood is pumped into the pulmonary artery and aorta. This

electrical activity is recorded from the surface of the body as a "QRS complex". The ventricles then

recover from this electrical stimulation and generate an "ST segment" and T wave on the EKG.

Page 12: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 12

In case of the heart, adrenaline plays the role to increase the number of impulses per

minute, which in turn increases the heart rate. The release of adrenaline is controlled by the nervous

system. The heart normally beats at around 72 times per minute and the sinus node speeds up

during exertion, emotional stress, fever, etc., or whenever our body needs an extra boost of blood

supply. In contrast, it and slows down during rest or under the influence of certain medications. Well

trained athletes also tend to have a slower heart beat.

Figure 1.4 Graphical Representation of ECG Signal

The different waves that comprise the ECG represent the sequence of depolarization and repolarization of the atria and ventricles. The ECG is recorded at a speed of 25 mm/sec, and the voltages are calibrated so that 1 mV = 10 mm in the vertical direction. Therefore, each small 1-mm square represents 0.04 sec (40 msec) in time and 0.1 mV in voltage.

1.5.2 Electrodes

Limbs Electrodes

There are different types of electrodes like Augmented Electrodes, Limbs Electrodes and Chest

Electrodes. In which limbs electrodes are mostly used. Bipolar recordings utilize standard limb lead

configurations depicted at the right. By convention, lead I have the positive electrode on the left

Page 13: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 13

arm, and the negative electrode on the right arm, and therefore measure the potential difference

between the two arms. In this and the other two limb leads, an electrode on the right leg serves as a

reference electrode for recording purposes. In the lead II configuration, the positive electrode is on

the left leg and the negative electrode is on the right arm. Lead III has the positive electrode on the

left leg and the negative electrode on the left arm. Whether the limb leads are attached to the end

of the limb or at the origin of the limb makes no difference in the recording because the limb can

simply be viewed as a long wire conductor originating from a point on the trunk of the body.

Figure 1.5 Leads Configuration

Based upon universally accepted ECG rules, a wave a depolarization heading toward the left arm

gives a positive deflection in lead I because the positive electrode is on the left arm. Maximal

positive ECG deflection occurs in lead I when a wave of depolarization travels parallel to the axis

between the right and left arms. If a wave of depolarization heads away from the left arm, the

deflection is negative. Also by these rules, a wave of repolarization moving away from the left arm is

recorded as a positive deflection. Similar statements can be made for leads II and III in which the

positive electrode is located on the left leg. For example, a wave of depolarization traveling toward

the left leg produces a positive deflection in both leads II and III because the positive electrode for

both leads is on the left leg. A maximal positive deflection is recorded in lead II when the

depolarization wave travels parallel to the axis between the right arm and left leg. Similarly, a

maximal positive deflection is obtained in lead III when the depolarization wave travels parallel to

the axis between the left arm and left leg.

Page 14: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 14

1.5.3 AMPLIFIER AND FILTERS Low Pass Filter

Figure 1.9 – Implemented Low Pass Filter

Since the ECG signal is contained in the relatively narrow frequency spectrum below 100Hz, a low

pass filter can remove a large amount of ambient noise. With microprocessors and an RF transmitter

in close proximity to the analogue circuitry, the low pass filter is responsible for ensuring these do

not detrimentally affect the ECG obtained. The low pass filter implemented is shown in Figure above.

It is a first order active filter. The corner frequency is calculated to be 105Hz. An active filter was

used as it also provides gain. The gain of the filter is given by the ratio of R9 to R8; in this

implementation it is 13.6. Figure below shows the frequency response of the filter as generated by

PSPICE.

Page 15: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 15

Figure 1.10 – Frequency Response of Low Pass Filter

A first order filter was deemed to be adequate since little noise is contained in the frequency band

immediately above 100Hz and the 20dB/decade attenuation roll-off is effective in removing the

microprocessor and RF circuitry noise contained in the megahertz.

Page 16: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 16

50Hz Notch Filter

Figure 1.11 – Implemented Notch Filter

Mains power noise is the biggest problem for normal ECG measurement, and especially so in this

system due to the unsuitability of right leg driver circuitry. In order to combat this, a notch filter is

implemented. Numerous filter topologies were tried in PSPICE such as the Fliege and Sallen-Key,

before it was decided that the Twin T provided the best result. The implemented filter is shown in

Figure above, with the frequency response to a 1V AC signal shown in Figure below.

Page 17: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 17

Figure 1.12 – PSPICE Simulation of Notch Filter Response

Page 18: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 18

Difficulties arise in the physical construction of the filter due to the large tolerances of capacitors.

The depth of the notch depends greatly on accurate components and much effort is required to

identify capacitors which give good attenuation at the correct frequency. In the final product,

capacitors C7, C8 and C9 are implemented as a couple of capacitors in parallel after having been

tested and proven to work together to give a good result. The rejection quality could be easily

improved by decreasing R3, but is not easy to implement because a narrower filtering bandwidth

requires more accurate components determining the bandwidth.

Summing Amplifier

Figure 1.12 – Implemented Summing Amplifier

After filtering and amplification, the data is ready to be digitised by the ADC. The ADC requires the

signal it is sampling to be contained completely in the positive voltage domain. The summing

amplifier is used to achieve this and its topology is shown in Figure above. The DC voltage that the

Page 19: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 19

signal will be added to is supplied by the voltage divider formed with two 2.2kΩ resistors. The other

resistors set the gain of the amplifier to be one, and are much larger than the resistors in the voltage

divider so they don't influence the voltage division. In this way the output of the summing amplifier

is the ECG signal transposed up by 2.5V.

Instrumentation Amplifier

An instrumentation amplifier is a type of differential amplifier that has been outfitted with input

buffers, which eliminate the need for input impedance matching and thus make the amplifier

particularly suitable for use in measurement and test equipment. Additional characteristics include

very low DC offset, low drift, low noise, very high open-loop gain, very high common-mode rejection

ratio, and very high input impedances. They are used where great accuracy and stability of the

circuit both short- and long-term are required. The Analogue Devices LM324 was chosen for

implementation in the system. These devices consist of four independent high-gain frequency-

compensated operational amplifiers that are designed specifically to operate from a single supply

over a wide range of voltages.

Design and Construction

The circuitry for capturing ECG signals was built in our laboratory using traditional components and

techniques. Fig.3 shows the actual breadboard circuit. The following sections elaborate on the

details of the design and circuitry layout of each stage or component.

Page 20: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 20

Fig. 1.13 Signal Acquisition Board - Developed In-lab

The ECG signals were amplified by the instrumentation amplifier and fed into the noise filtering

circuits in different stages. To get required output we split Instrumentation amplifier in two parts,

one of them is Pre-amplifier and second one is Post-amplifier. They include simple amplifier, notch

filter and buffer amplifier.

Pre-amplifier and Post-amplifier

A voltage buffer amplifier is used to transfer a voltage from a first circuit, having a low output impedance level, to a second circuit with a high input impedance level. The interposed buffer amplifier prevents the second circuit from loading the first circuit unacceptably and interfering with its desired operation. In the ideal voltage buffer, the input resistance is infinite, the output resistance zero.

Page 21: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 21

Notch filters used for eliminating 50Hz noise signal. It is must for clear appearance. The object is to get the signal between the lower and upper cutoff frequencies (f1 and f2, respectively). This will cause the signal to be reduced by at least 3 decibels, or effectively half the power of the desired signal.

Butterworth filter has a more linear phase response. And its frequency response is maximally flat (has no ripples) in the pass band, and rolls off towards zero in the stop band. It has a monotonically changing magnitude function with ω. The Butterworth is the only filter

that maintains this same shape for higher orders compared with other filters, the Butterworth filter has a slower roll-off, and thus will require a higher order to implement a particular stop band specification. Here we are using 3rd order Butterworth filter.

Figure 1.14– QRS Detector

1.5.4 QRS DETECTOR

Page 22: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 22

The QRS complex represents ventricular depolarization. The duration of the QRS complex is normally

0.06 to 0.1 seconds. It has high amplitude among one heart signal. So, using R wave detector

detection and analysis become easy to decided coming signal is normal or abnormal. Fig.3 shows the

actual breadboard circuit. The following sections elaborate on the details of the design and circuitry

layout of each stage or component.

Page 23: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 23

Figure 1.16 QRS Detector circuit on bread board

Design and Construction

The output of ECG amplifier is given as an input to the QRS Detector circuit. The first stage of it is

notch filter of 50 Hz. It has same functionality as describe in filter section.

Page 24: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 24

Primary Results

Figure QRS Detector Output

Page 25: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 25

Figure Test point 4 output

Page 26: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 26

Figure 1st ECG Signal

Page 27: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 27

Figure work place circuit implementation

Page 28: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 28

Figure Work place part 2

Page 29: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 29

Circuit

Page 30: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 30

Page 31: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 31

Page 32: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 32

Page 33: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 33

Page 34: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 34

Page 35: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 35

Page 36: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 36

Page 37: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 37

Then filter is come. It is sometimes convenient to design a simple active high pass filter using

transistors. Using transistors, this filter is convenient to place in a larger circuit because it contains

few components and does not occupy too much space. The active high pass transistor circuit is quite

straightforward, using just a total of three resistors, three capacitors and two transistors. The

operating conditions for the transistor are set up in the normal way. The resistor Re is the emitter

resistor and sets the current for the transistor.

A rectifier is an electrical device that converts alternating current (AC) to direct current (DC). Rectifiers may be made of opamp, diodes, resistors and capacitors. Here we are used full wave rectifier. When only one diode is used to rectify AC (by blocking the negative or positive portion of the waveform), the difference between the term diode and the term rectifier is merely one of usage, Almost all rectifiers comprise a number of diodes in a specific arrangement for more efficiently converting AC to DC than is possible with only one diode.

For R wave detector, we use transistor and few passive components; you can build a fairly sensitive

peak detector circuit. You can find a peak signal although you only detect the peak of positive cycle.

Here we use pnp transistor as well as npn. The input stage is biased so that the supply voltage is

divided equally across the two complimentary output transistors which are slightly biased in

conduction by the diodes between the bases. The resistors are used in series with the emitters of

the output transistors to stabilize the bias current so it doesn't change much with temperature or

with different transistors and diodes. Here is the actual circuit’s schematic diagram is shown below.

1.5.5 STK_500 Kit

STK_500 Kit is designed to give designers a quick start to develop code on the AVR and for

prototyping and testing of new designs. Its features are given below

AVR Studio Compatible RS-232 Interface to PC for Programming and Control Regulated Power Supply for 10 - 15V DC Power Sockets for 8-pin, 20-pin, 28-pin, and 40-pin AVR Devices Parallel and Serial High-voltage Programming of AVR Devices Serial In-System Programming (ISP) of AVR Devices In-System Programmer for Programming AVR Devices in External Target System Reprogramming of AVR Devices All AVR I/O Ports Easily Accessible through Pin Header Connectors 8 Push Buttons , 8 LEDs and RS-232 Port are for General Use On-board 2-Mbit Data Flash for Nonvolatile Data Storage

Page 38: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 38

Figure 5.1 STK_500 Kit Components

Turn on the kit

First of all connect the power cable between a power supply and the STK_500 and

apply 10 - 15V DC to the power connector. The input circuit is a full bridge rectifier and the

STK_500 automatically handles both positive and negative center connectors. The red LED is lit

when power is on, and the status LEDs will go from red, via yellow, to green that indicates the

target VCC is present.

Description

o LEDs and Switches: The STK500 starter kit includes 8 yellow LEDs and 8 push-button switches. The

LEDs and switches are connected to debug headers that are separated from the rest of the Board.

The cables should be connected directly from the port header to the LED or switch header. Valid

target voltage range is 1.8V < VTG < 6.0V.

Page 39: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 39

Figure 5.2 Ports of LEDs and Switches

Figure 5.3 Connection of LEDs and Switches on kit

o Description of Ports: The pin out for the I/O port headers is explained in Figure where x is stand for

A, C, D. The supplied cables can be used if the Data Flash is connected to the hardware SPI

interface on PORTB of the AVR microcontroller. The connection of the I/O pins is shown in

Figure. The PORTE/AUX header has some special signals and functions in addition to the PORTE

pins.

Page 40: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 40

Figure 5.4 Various types of Ports

o Jumper Setting: A master microcontroller and the eight jumpers control the hardware settings of the

starter kit. During normal operation these jumpers should be mounted in the default position.

To configure the starter kit for advanced use, the jumpers can be removed or set to new

positions.

Default Setting VTARGET : On-board VTARGET supply connected AREF : On-board Analog Voltage Reference connected RESET : On-board Reset System connected XTAL1 : On-board Clock System connected OSCSEL : On-board Oscillator selected

Jumper mounted on pins 1-2: On-board software clock signal connected (default).

Jumper mounted on pins 2-3: On-board crystal signal connected.

Jumper not mounted : On-board XTAL1 signal disconnected.

BSEL2 : Uncounted. Used for High-voltage Programming of various types of AT mega Chips

PJUMP : Unmounted. Used for High-voltage Programming of AT90S2333,AT90S4433, and ATmega8

Work on the kit

Page 41: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 41

Connect a serial cable to the connector marked RS232 CTRL on the evaluation board to a COM

port on the PC. When AVR Studio is started, the program will automatically detect to which COM

port the STK_500 is connected. The STK_500 is controlled from AVR Studio, version 3.2 and

higher. AVR Studio is an integrated development environment (IDE) for developing and

debugging AVR applications.AVR Studio provides a project management tool, source file editor,

simulator, in circuit emulator interface and programming interface for STK500.

To program a hex file into the target AVR device, select STK500 from the Tools menu in AVR

Studio. Select the AVR target device from the pull-down menu on the Program tab and locate

the Intel-hex file to download. Press the Erase button, followed by the Program button. The

status LED will now turn yellow while the part is programmed, and when programming succeeds,

the LED will turn green. If programming fails, the LED will turn red after programming.

o Program Settings It is divided into four different subgroups and includes an erase button on the

selected device, erasing Flash and EEPROM memories. For devices only supporting High-voltage

Programming, the ISP option will be grayed out. If both modes are available, select a mode by

clicking on the correct method. Erase Device before Programming will force STK500 to perform

a chip erase before programming code to the program memory (Flash). Verify Device after

Programming will force STK500 to perform a verification of the memory after programming it

(both Flash and EEPROM) select the “Input HEX File” option.

Page 42: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 42

Figure 5.5 Program Modes

o Board Settings:

VTAR controls the operating voltage for the target board. This voltage can be

regulated between 0 and 6.0V in 0.1V increments. AREF controls the analog reference voltage

for the ADC converter. This setting only applies to devices with AD converter. Both voltages are

read by pressing the “Read Voltages” button, and written by pressing the “Write Voltages”

button. The board uses a programmable oscillator circuit that offers a wide range of frequencies

for the target device.

Figure 5.6 Board Modes

o Auto Settings:

When programming multiple devices with the same code, the “Auto” tab offers a

powerful method of automatically going through a user-defined sequence of commands. They

are executed, if selected. To enable a command, the appropriate check box should be checked.

Page 43: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 43

For example, if only “Program FLASH” is checked when the “Start” button is pressed, the Flash

memory will be programmed with the hex file specified in the “Program” settings.

Figure 5.7 Auto Modes

Page 44: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 44

1.5.7 Xbee or Xbee-PRO

Introduction

If you are looking for wireless monitoring and remote control solutions, XBee may be the

answer. Xbee nodes can tie up a home, office or factory building for nodes safety, security and

control.

The modules have high performance at a low-cost and low-power wireless sensor networks.

The modules require minimal power and provide reliable delivery of critical data between

devices. The modules operate within the ISM (Industrial Scientific Medical) 2.4 GHz frequency

band .RF Data Rate is 250kbps .They are pin-for-pin compatible with each other.

We can easily use them.

Xbee RF Module

Communication range of it in Urban is up to 100 m and line-of-sight is up to 300 m with 100mW

power. Its TX current is 270mA, 3.3v and RX current is 55mA, 3.3v. And its receiver sensitivity is -

100dBm.

Pin Configuration

XBee has 20 pins. Minimum connections are VCC, GND, DOUT and DIN. Unused pins should be

left disconnected. Signal. And direction is specified with respect to the module.

Figure 7.1 XBee or XBee-PRO

Page 45: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 45

Procedure

Data enters the XBee Module UART through the DI pin (pin 3) as an asynchronous serial signal.

The signal should idle high when no data is being transmitted. Each data byte consists of a start

bit (low), 8 data bits (LSB first) and a stop bit (high). The XBee UART performs tasks, such as

timing and parity checking, that are needed for data communications. Serial communication

consists of two UARTs configured with compatible settings (baud rate, parity, start bits, stop bits,

data bits). One illustration is given below

Figure 7.2 UART data packet 0x1F transmitted through the RF module

Flow Control

When physical connection is established, at the transmitter site the data is transmitted from microcontroller to XBee through buffer and vice versa procedure at the receiver. Here we have to mention in software program that which connected XBee is worked as a transmitter or as a receiver. The internal diagram and flow of communication is shown in figure.

•DI Buffer, Hardware Flow Control (CTS). •DO Buffer, Hardware Flow Control (RTS).

Page 46: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 46

Figure 7.3 External and Internal flow of data

o DI Buffer may become full and possibly overflow: If the module is receiving a continuous stream of RF data, any serial data

that arrives on the DI pin is placed in the DI Buffer. The data in the DI buffer will be transmitted over-the-air when the module is no longer receiving RF data in the network.

o DO Buffer may become full and possibly overflow: 1. If the RF data rate is set higher than the interface data rate of the module,

the module will receive data from the transmitting module faster than it can send the data to the host.

2. If the host does not allow the module to transmit data out from the DO buffer because of being held off by hardware or software flow control.

Solution 1. Send messages that are smaller than the DI buffer size. 2. Interface at a lower baud rate (BD parameter, p16) than the fixed RF data

rate.

Modes

Page 47: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 47

XBee is operated in five modes. It operates in one mode at a time.

Serial data is received in the DI Buffer : Transitions to Transmit Mode • Valid RF data is received through the antenna : Transitions to Receive Mode • Sleep Mode condition is met : Transitions to Sleep Mode • Command Mode Sequence is issued : Transitions to Command Mode

Programming the RF module

In the Command Mode section entering Command Mode, sending AT commands and exiting

Command Mode.

Send AT Command: System Response

+++ : Enter into command mode ATCH : Channel command ATMY : 16-bit source address ATDH : Read current Destination Address High ATDL : Read current Destination Address Low ATWR : Write to non-volatile memory

ATGT : Guard Timer , prevent inadvertent entrance into AT command mode

ATRE : Restore Defaults ATSM : Sleep mode ATBD : Interface data rate , 9600bps is default value ATCN : Exit AT command mode

Page 48: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 48

There are also many other AT Commands are presents, these are mostly using. All these

commands are written in minicom software which has Fedora9 platform.

Following are its screenshots

Page 49: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 49

Page 50: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 50

Page 51: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 51

Page 52: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 52

Page 53: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 53

Page 54: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 54

Chapter 2 Project Management

2.1 Feasibility Study

2.1.1 Technical feasibility Project aim required both Hardware and Software competencies as we were required to build wearable system and robust software to support it. To check whether it was possible or not we read lot of books to understand basics of ECG and implemented a simple circuitry shown below from the book called “Biomedical

Instrumentation”. As per our expectations Signal wasn‟t clear as it was theoretical circuit and

not practical but it was clear that project was technically feasible.

2.1.2 Time schedule feasibility As the Technologies to build the project was Analog Electronics, XBEE, Java Script, and STK 500 which were completely new to us. We were quite apprehensive regarding tight Time Schedule within which time frame project needed to be submitted. But detailed Time Analysis and Disciplined work help us to complete project in determined time schedule.

2.1.3 Operational feasibility To acquire operational feasibility we choose java language as our coding language in software part. Because of that all major features of Java language are imbibed in our project also. Like reusability inheritance and portability. So this way we achieved Operational Feasibility.

2.1.4 Implementation feasibility As we implemented our project‟s software part as Web

Application on J2EE Platform our project can be implemented on any machine and can be access by any machine. Hence it‟s feasible in Implementation side.

2.2 Project Planning

2.2.1 Project Development Approach and justification Our project development plan was continuously monitored by both our External guide and internal guide. Every 15 days we submitted our report and seminar to our internal guide at our Institution. And almost every week we had discussion with our External guide regarding our proceedings. On day of our seminar with our internal guide we had to report our next 15 days goal and decide deadline for the next work. Our Schedule of project worked smoothly.

2.2.2 Project Plan Table below shows our schedule.

Page 55: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 55

Date Goal To Be Achieved 15/12/2008 To 28/12/2008 Feasibility Study 29/12/2009 To 03/01/2009 Time Schedule and Analysis 04/01/2009 To 25/01/2009 Requirement Analysis 26/01/2009 To 08/02/2009 Design of Hardware Module 09/02/2009 To 22/02/2009 Implementation of Hardware

Module 23/02/2009 To 01/03 /2009 Design and Implementation of

Wireless Module 02/03/2009 To 08/03/2009 Design and Implementation of

Software Module 09/03/2009 To 22/03/2009 Integration of modules 23/03/2009 To 29/03/2009 Testing and Modifications 30/03/2009 To 04/04/2009 Documentation Finalization 2.2.3 Milestones and Deliverables Our set goals had been achieved on time hence all the sub goals had been our milestones which were delivered on time.

2.2.4 Roles and Responsibilities In our project following Roles were required

1. Requirement Engineer In our project exhaustive requirement analysis and detailed study of the subject was required.

2. Design Engineer As our project was both hardware and software designing of PCB required a Design Engineer from the Background of Hardware and Web Application required Software Design Engineer.

3. Programmer As mentioned above we required programmer with knowledge of Dynamic C and JavaScript both, which is rare combination. But we learnt the entire requisite to fulfill all requirements.

2.2.5 Group Dependencies As it was combined effort, the group never felt that they had lot of dependencies.

Page 56: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 56

2.3 Project Scheduling Practical Implementation of Schedule in form of Gantt Chart Phases 1-

10 11-20

21-30

31-40

41-50

51-60

61-70

71-80

81-90

91-100

101-110

111-112

Feasibility Study Time Schedule and Analysis

Requirement Analysis

Design of Hardware Module

Implementation of Hardware Module

Design and Implementation of Wireless Module

Design and Implementation of Software Module

Integration of modules

Testing and Modifications

Documentation Finalization

Page 57: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 57

Chapter 3 System Requirements Study

3.1 History of Electrocardiogram The electrical activity accompanying a heart-beat was first discovered by Collier and Mueller in 1856. After placing a nerve over a beating frog's heart they noticed that the muscle associated with the nerve twitched once and sometimes twice. Stimulation of the nerve was obviously caused by depolarization and repolarization of the ventricles. At that time there were no galvanometers that could respond quick enough to measure the signal, so Dodders (1872) recorded the twitches of the muscle to provide a graphic representation of the electrocardiographic signal. In 1876, Mary made use of a capillary electrometer to describe a crude electrocardiogram of a tortoise using electrodes placed on the tortoise's exposed heart. The news of this led many investigators to create their own instruments and the ECG of mammals including humans was taken and different types of electrodes and their positioning was investigated. One such investigator was Waller, who recorded the ECG of a patient called Jimmy. Waller later revealed the identity of Jimmy to be his pet bulldog. Jimmy's ECG was recorded by having a forepaw and hind paw in glass containers containing saline and metal electrodes as shown in Figure.

Figure 3.1. – Jimmy the Bulldog The fidelity of ECG obtained using a capillary electrometer was poor and Einthoven (1903) wanted to create a better system using Adder‟s string telegraphic galvanometer. Einthoven's system proved to be a great success and soon string galvanometer based ECG systems were in clinical practice worldwide. Einthoven also came up with his theory regarding the Einthoven triangle and the lead positions based on this are still in use today and is responsible for the labeling of the various waves forming an ECG signal. Figure shows Einthoven's string galvanometer and a patient having his ECG recorded.

Page 58: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 58

Figure 3.2 – William Einthoven’s ECG System [2] Since the early 1900s advances have come through the use of a greater number of leads such as in the augmented lead system or through body surface mapping (>64 recording sites used). As technology has advanced, so has the measuring system, making use of vacuum tubes, transistors, integrated chips and microprocessor technology as time has passed. The use of the electrocardiogram has also spread out from the hospital with ambulatory egg, home electrocardiography and electrocardiograph telemetry systems in wide use. 3.2 Study of Current System

The electrical impulses within the heart act as a source of voltage, which generates a current flow in the torso and corresponding potentials on the skin. The potential distribution can be modeled as if the heart were a time-varying electric dipole. If two leads are connected between two points on the body (forming a vector between them), electrical voltage observed between the two electrodes is given by the dot product of the two vectors [9]. Thus, to get a complete picture of the cardiac vector, multiple reference lead points and simultaneous measurements are required. An accurate indication of the frontal projection of the cardiac vector can be provided by three electrodes, one connected at each of the three vertices of the Einthoven triangle. The 60 degree projection concept allows the connection points of the three electrodes to be the limbs

Page 59: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 59

Figure 3.3 – Lead Positioning [2] Modern standard ECG measurement makes use of further electrode connection points. The 12-lead ECG is made up of the three bipolar limb leads, the three augmented referenced limb leads and the six Wilson terminals (Vow) referenced chest leads. The augmented lead system provides another look at the cardiac vector projected onto the frontal plane but rotated 30 degrees from that of the Einthoven triangle configuration (Figure 2.6b). The connection of six electrodes put onto specific positions on the chest and the use of an indifferent electrode (Vow) formed by summing the three limb leads allows for observation of the cardiac vector on the transverse plane [3] (Figure2.6c). Other subsets of the 12-lead ECG are used in situations which don't require as much data recording such as ambulatory ECG (usually 2 leads), intensive care at the bedside (usually 1 or 2 leads) or in telemetry systems (usually 1lead). The modern ECG machine has an analogue front-end leading to a 12- to 16bit analog-to-digital (A/D) converter, a computational microprocessor, and dedicated input-output (I/O) processors.

Page 60: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 60

3.3 Electrodes used in Electrocardiogram Electrodes are used for sensing bio-electric potentials as caused by muscle and nerve cells. ECG electrodes are generally of the direct-contact type. They work as transducers converting ionic flow from the body through an electrolyte into electron current and consequentially an electric potential able to be measured by the front end of the egg system. These transducers, known as bare-metal or recessed electrodes, generally consist of a metal such as silver or stainless steel, with a jelly electrolyte that contains chloride and other ions (Figure 3.1).

Figure 3.4 – Recessed Electrode Structure [4] On the skin side of the electrode interface, conduction is from the drift of ions as the ECG waveform spreads throughout the body. On the metal side of the electrode, conduction results from metal ions dissolving or solidifying to maintain a chemical equilibrium using this or a similar chemical reaction:

Ag ↔ Ag+ + e- The result is a voltage drop across the electrode-electrolyte interface that varies depending on the electrical activity on the skin. The voltage between two electrodes is then the difference in the two half-cell potentials.

Figure 3.5 – Dry Electrode Structure [2]

Page 61: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 61

Plain metal electrodes like stainless steel disks can be applied without a paste. The theory of operation is the same but the resistivity of the skin electrode interface is much greater. They are useable when proper electrostatic shielding against interference is applied and the electrode is connected to an amplifier with very high input impedance, but the voltage measured will be considerably less than that obtained with an electrode utilizing an electrolyte. 3.4 Problems and Weaknesses of Current System Main problem with the current system which is most commonly used in the hospitals is that it is not compact. It requires 12 leads to cover the view of whole heart. Due to these reasons patient can not move freely during test. Also long duration of test can cause irritation to patient. Patients who are suffering from heart diesis must themselves come to know about emergency, means every time they can not be in hospitals. So any problem comes without they are admitted to the hospitals can cause fatal. 3.5 System User Characteristics System is designed especially for old age people. So the characteristics are:

Mobility Constant monitoring of patient Immediate action during emergency condition

3.5 Hardware and Software requirements

Hardware Requirements:

Electrodes ECG monitor Microcontroller IC ATMEGA32 Transmission part Computer System for Doctor Internet Explorer

Software Requirements: AVR Studio PSpice Minicom Google API mode

Page 62: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 62

Chapter 4 SYSTEM ARCHITECTURE DESIGN

4.1 Pre Amplifier Circuit

Figure 4.1 Pre-Amplifier Circuit 4.2 Post-Amplifier Circuit Diagram

Page 63: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 63

Figure 4.2 Post-Amplifier Circuit

4.3 QRS Detector Circuit Diagram

Page 64: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 64

Figure 4.2 Filter and Rectifier portion of QRS Detector Circuit

Figure 4.3 R-Wave Detector portion of QRS Detector Circuit

Page 65: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 65

Chapter 5 Implementation Planning

5.1 Implementation Environment We implemented our hardware program that is program in

Microcontroller using AVR Studio and Language used is Dynamic C. Following are the Details of Special Registers.

Page 66: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 66

Page 67: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 67

Page 68: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 68

5.2 Program Specification Program Details are as Follows:-

Page 69: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 69

Page 70: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 70

Page 71: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 71

Page 72: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 72

Page 73: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 73

5.3 Coding Standards

J2EE 1.4 java version is used for making display software NET Beans IDE Java enabled Web Browser JDK for windows is installed We have used standard JAVA Naming convention like

1. displayEcg.java 2. showAnnotation.java

Page 74: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 74

Chapter 6 Testing

6.1 Testing Plan We planned to test our project using unit testing and Integration testing strategy. Hence Regression Testing method was applied. We implemented at each and every stage modules and tested their required outputs. Some of the test results are as follows:-

Figure 6.1 QRS Detector Output

Page 75: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 75

Figure 6.2 1st ECG Signal

Figure 6.3 Work place circuit implementation

Page 76: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 76

Figure 6.4 Work place part 2

Page 77: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 77

Figure 6.5 Circuit

Page 78: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 78

Figure 6.6 Test Point 1

Figure 6.7 Test Point 2

Page 79: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 79

Figure 6.8 Test point 3

Page 80: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 80

Figure 6.9 Test point 4

Page 81: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 81

Figure 6.10 Test point 5

Figure 6.11 Test point 6

6.2 Testing Strategy As mentioned above and results shown above we have strictly followed regression testing completely.

Page 82: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 82

6.3 Testing Methods Testing methods applied are Unit Testing and Integration Testing.

6.4 Test Cases 6.4.1 Purpose: - To test whether ECG Module was working or not.

6.4.2 Required Input: - Heart Signal from Patient

6.4.3 Expected Results: - ECG to displayed on Digital Oscilloscope. Use Case Test Case Expected

Output Actual Output Test Case

Status 50 Hz Notch Filter

Frequency higher than 50hz

Pass only till 49 Hz

Passed only till 45 Hz

Pass

ECG Module Heart Signal of 50 mille volt

Heart Signal of 2 Volt

Heart Signal of 1.8 Volt

Pass

Hardware program to detect Abnormality

Give Heart pulse between 60 to 70

Detect it Normal Detected it Normal

Pass

Give Heart pulse less than 60

Detect it Abnormal and transmit it.

Detected it Abnormal and transmit it.

Pass

Software to Display Heart Signal

Samples at 1.6 Kilo Hertz

Show it properly.

Showed it properly

Pass

Page 83: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 83

Chapter 7 Limitations and Future Enhancements

7.1 Limitations Following are the limitations of the System.

The System is not multiparameter. It is including only electrical signal from heart

Range of XBEE Pro differs according to medium. In closed room range is decreased a lot.

Constant wear of electrodes can cause irritation to patient. Due to memory constraint and battery ECG signal can‟t transmitted for long period.

7.2 Future Enhancements Following are the future enhancements intended for the System.

More features can be added to monitor like SPO2, Blood Pressure and Blood Sugar

level. This way it ensures proper monitoring of patient. Range can be improved. More powerful power source can be devised so that for longer time ECG can be

transmitted to base station and patient can be diagnosed more precisely. GPS System can be added to provide alarm signal to doctor with exact location of

patient so that immediate assistance can be provided.

Page 84: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 84

Chapter 8 Conclusion and Discussion 8.1 Conclusions and Future Enhancement

We are successful in getting accurate ECG signal and Transmitting it to base station successfully which was our aim. Overall Experience of building this project was enthralling and unique. So overall it can be concluded that we were successful in making a wearable ECG system which transmits signal when it detects abnormality.

8.2 Discussion

8.2.1 Self Analysis of Project Viabilities We did self analysis and project viabilities by meeting few Doctors and old age home people. This device will be very much useful to both old age homes and old age people. We goggled lot of topics and found out heart ailments are the major problems for people of all age. So we concluded that project is most viable both commercially and for society. Future Enhancements in this project will help technology serve better to mankind. Portable ECG system is the demand of the day. And its miniaturization will help mankind a lot.

8.2.2 Problem Encountered and Possible Solutions Following were the problems encountered and their solutions

ECG has amplitude of only about 1 mV, so to detect it an amplifier is needed. There is a problem, though - electrical noise, or electromagnetic interference (EMI). EMI is generated by many common appliances, such as power lines, fluorescent lights, car ignitions, motors and fans, computers, monitors, printers, TVs and cell phones.

When the ECG is amplified, the noise is amplified too, and often swamps the ECG signal. And the noise is usually of a higher frequency than the ECG.

In the beginning we implemented amplifier and QRS detector circuits from textbook which is not give proper output. Then we asked senior students, research engineers, professors and searched in medical-instrumentation books, reference books, on Internet Explorer etc.

Finally we get one circuit of amplifier and QRS detector and implemented them on PCB board. We changed or added or removed some components in those circuits. In that we break instrumentation amplifier circuit into Pre-amplifier circuit and Post-amplifier circuit and also include notch filter and simple amplifier.

We are using RL configuration in Pre-amplifier which gives better output than RC configuration.

Page 85: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 85

Moreover we modify the ECG electrodes and probes from where we take an ECG signal. In the beginning we used clamp electrodes with long wired probes. Due to those we faced much noise in signal. Then after we switch over to chest electrodes with short and shielded probes but we can‟t get sufficient input from them.

So we use combination of them, we use aluminum plate, good conductor under chest electrodes so that we increase the surface area and take proper ECG signal. But it took much time in arrangement like to stick them on chest. So, finally we use limb electrodes which fulfill our requirements. To solve the problem of DC offset we put RC circuit at those pins where we give

supply voltage to ICs. Another problem is motor driving effect which is due to distribution of supply voltage

from one source to all the ICs. Because of this the internal noise will generate and it affects the incoming signal that has low amplitude. For its solution we give individual supply the all the ICs according to their requirement.

Earthen is one of the problems in our bred board circuit and PCB circuit in lab. For it we make our module with proper earthen and shielding,

After solving all these problems on board to get better and appropriate output, we design ECG signal amplifier module with assembly components on GREEN PCB.

8.2.3 Summary of Project work Our main aim behind this project is to show a way by which old age homes can monitor their old age people. It is a relief for old age people also they roam about freely without any assistance. Also they get immediate help from doctors whenever they are in trouble or in need. We have made it in such a way that even young ones can have it. This project has huge commercial viability if produced in masses.

Page 86: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 86

Experience

We are going to share an experience we had at DA-IICT Dhirubhai Ambani Institute of Information and Communication Technology during our project work.

DA-IICT being one of the premier institute of India our expectations was high. After reaching their the kind of Ambience and Hospitability we received was beyond our expectation. DA-IICT has very fine architecture with great facilities and above all very experienced faculty. We were given separate lab to work in with personal computers issued to us. Also if we needed anything like Resistors, Capacitors, Breadboard etc anything of that sort it could be issued. Not only small things like that even we were given personal CRO, DSO and Function generator in our very own lab. We were free to access lab anytime any day. DA-IICT has one of the most resourceful libraries which we utilize maximum. Whenever we had some difficulties we got answers from there. Not only that entire lab building of DA-IICT is Wi-Fi connected we had free access to internet in Lab and also at our Hostel Rooms. We had very good staying and food facility which made us work more cheerfully. We also had help of three research engineers who eventually became our very good friends. They are Mr. Vishwas, Mr. Aman and Mr. Ravi Bagree and we owe special thanks to them for their support and special attention. Without them project wouldn‟t have

been successful.

Our very sincere thanks to Professor Prabhat Ranjan because it was because of them we were in DA-IICT. We had very good time and learning time with Sir. We can never ever pay our thanks to him for what he has given to us and taught us. His dedication in work inspired us to work more and more. Very sincere thanks to Professor Prabhat Ranjan and we mean it from our bottom of our heart.

Overall complete experience of DA-IICT was mystic and we shall remember it for our life time.

Page 87: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 87

References

Aquino, et al. “Capacitive Sensing of Electrocardiographic Potential Through Cloth From the Dorsal Surface of the Body in a Supine Position: A Preliminary Study,”

IEEE Transactions on Biomedical Engineering, Vol. 54, No. 4. April 2007

A. Leonhard, S.: Personal Healthcare Devices. In S.Mukherjee et al. (eds.), AmIware: Hardware Technology Drivers of Ambient Intelligence. Chapter 6.1, Springer Verlag, Dordrecht, NL, 2006, p. 349–370.

Arhus Richardson, P. C.: The Insulated Electrode. In Proceedings of the 20th Annual Conference on Engineering in Medicine and Biology. Boston, MA (USA), 1967, p. 157.

Ashijima, M.: Monitoring of Electrocardiograms in Bed without Utilizing Body Surface Electrodes. IEEE Transactions on Biomedical Engineering, Vol. 40 (1993), No. 6, p. 593–594.

Aim, K. K., Lim, Y.K., Park. S.: CommonModeNoise Cancellation for Electrically Non-Contact ECG Measurement System on a Chair. In Proceedings of the 27th Annual Conference of the IEEE EMBS. Shanghai (China), Sept. 2005, p. 5881–5883.

Aim, Y. G., Kim, K. K., Park, K. S.: ECG Measurement on a Chair without Conductive Contact. IEEE Transaction on Biomedical Engineering, Vol. 53 (2006), No. 5, p. 956–959.

Aare, A., Kirk up, L.: A direct Comparison of Wet, Dry and Insulating Bioelectric Recording Electrodes. Physiological Measurement, Vol. 21 (2000), p. 271–283.

B. B., Webster, J. G.: Reduction of Interference Due to Common Mode Voltage in Bio potential Amplifiers. IEEE Transactions on Biomedical Engineering, Vol. 30 (1983), No. 1, p. 58–61.

Birney, K, ET. Al.., “Quantification of Motion Artefact in ECG Electrode Design,”

Engineering in Medicine and Biology Society, 2007. EMBS 2007. 29th Annual International Conference of the IEEE, pp.1533-1536, 22-26 Aug. 2007

C. Park and P.H. Chou, Y. Bay, R. Matthews, and A Hobbs. “An Ultra-Wearable, Wireless, Low Power ECG Monitoring System,” in Proc. IEEE Biogas, Nov 29 - Dec 1, 2006.

Enzi, T., et al, “Fully Integrated EKG Shirt based on Embroidered Electrical Interconnections with Conductive Yarn and Miniaturized Flexible Electronics,”

Proceeding of the International Workshop on Wearable and Implantable Body Sensor Networks, 2006.

E. Borrowed, et al. “A Reconfigurable, Wearable, Wireless ECG System,”

Proceedings of the 29th Annual International Conference of the IEEE EMBS. Aug. 23-26, 2007.

F. Axis, A. Dittmer, and G. Delhomme. “Smart Clothes for the Monitoring in Real Time and Conditions of Physiological, Emotional, and Sensorial Reactions of

Page 88: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 88

Human,” Proceedings of the 25th Annual International Conference of the IEEE EMBS. Sept. 17-21, 2003.

G. Lim, K.K. Kim, and K.S. Park. “ECG Recording on a Bed during Sleep without Direct Skin-Contact,” IEEE Transactions on Biomedical Engineering, Vol. 54, No. 4. April 2007.

J. Ishijima. “Monitoring of Electrocardiograms in Bed Without Utilizing Body Surface Electrodes,” IEEE Transactions on Biomedical Engineering, Vol. 40, No. 6. June 1993.

Kerb, T; “A Circuit for Contact Monitoring in Electrocardiography”, IEEE Transactions on Biomedical Engineering, Volume BME-29, May 1982 Page(s):361 - 364

Kohler, B.-U.; Henning, C.; Orglmeister, R. “The principles of software QRS detection”, Engineering in Medicine and Biology Magazine, IEEE Volume 21, Issue 1, Jan.-Feb. 2002 Page(s):42 – 57

Liege U and Schenk Ch: Measurement circuits. In Electronic Circuits Design and Application.1990; 767-778.

Neumann MR: Bio potential amplifiers. In Webster JG, editor. Medical instrumentation application and design. John Wiley & Sons: New York, 1998; 233- 286.

Nastier GH, Peter A and Grimbergen CA: Low power, low-noise instrumentation amplifier for physiological signals. Med Boil Eng Compute, 1984; 22: 272-274.

Mora D: Two-electrode low supply voltage electrocardiogram signal amplifier. Med Boil Eng Compute, 2004; 42: 272-276.

Mir MB: A design study of a bioelectric amplifier and improvement of its parameters. J Med Eng Techno, 1999; 23: 15-19.

Spinally EM, Martinez NH and Mayo sky MA: A single supply bio potential amplifier. Med Eng Phys, 2001; 23: 235-238.

Jefferson CB: Special-purpose OP amps. In Operational amplifiers for Technicians. Breton publishers: 1983; 281-285.

PURKE, M. J., and GLEESON, D. T. (2000): „A micro power dry electrode ECG preamplifier‟, IEEE Trans. Biomed. Eng., 47, pp. 155–162

SHEE, J. (2002): „Low-frequency high gain amplifier with high Doffed Voltage tolerance‟. US patent, US6396343 B2

T. Khorovets, What Is An Electrocardiogram?, 2000 www.ispub.com/journals/IJANP/Vol4N2/ekg.html

Tromping, Joseph D., The Biomedical Engineering Handbook, IEEE Press, 2000

www.google.com www.datasheet4u.com

www.yahoo.com

Page 89: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 89

www.wikipedia.com www.medi-line.com www.allcircuits.com

www.ieee.org Y. Edward Profit, Biomedical Engineering, 1993 Chapter 3

Y. Lu, The Design and Construction of an ECG Telemetry System, University of Queensland Thesis, 1994 National Heart Foundation of Australia, Cardiovascular Disease –Australia’s Major Health Problem, Nov 2001 http://www.heartfoundation.com.au/heart/index_fr.html

Weinberg, B.N., Applied Clinical Engineering, McGraw-Hill, 1986 Yorture, G.L., Principles of Human Anatomy, Harper Collins, 1989

Z‟Souza M., Wireless Biomedical Sensor Project Outline, School of Information Technology and Electrical Engineering, 2002

ZE304 Laboratory Notes, Michigan Technological University www.biomed.mtu.edu.au/osoykan/classes/be304/week3/week3.htm

Zide J., Field Wiring and Noise Considerations for Analogy Signals, National Instruments Application Note 025 References William Brims 61

Zerry Lafayette, A Basic Introduction to Filters – Active, Passive, and Switched Capacitor, National Semiconductor Application note 779, April 1991

Page 90: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 90

Bibliography / Literature Review

1. Barry N. Feinberg, Applied Clinical Engineering, 1996 Chapters 4 & 5 Chapter four of this book contains a fairly detailed explanation of the electrical Activity of the heart and what the ECG waveform represents. It goes on to give lead Locations for standard, augmented and primordial lead systems. Chapter five details Noise sources and solutions, electrode information including skin/electrode equivalent Circuits and explanations of performance measures.

2. A. Edward Profit, Biomedical Engineering, 1993 Chapter 3 This book contains similar information to that provided in [1], but provides Less in-depth explanations. Contains an informative page on microelectrodes.

3. A. Khorovets, What Is An Electrocardiogram?, 2000 www.ispub.com/journals/IJANP/Vol4N2/ekg.html This article taken from the „Internet Journal of Health‟, contains information On exactly what activity in the heart the electrocardiogram represents. It includes Information on what common abnormalities in ECG signals mean in terms of cardiac Disease or misplaced connection points.

4. S. Choir, J. Nyberg, K. Fudged, E. Kael, Telemedicine ECG – Telemetry with Bluetooth Technology, Computers in Cardiology 2001, 28:585-588 This journal entry deals with the use of a Bluetooth system to transmit Digitized ECG data to a Web server via GSM phone modem. The cardiologist then Can access the ECG data over the web and is also able to make use of the on-line Knowledge base. The article talked mostly about the results of trials of their system.

5. A. Praetor, C. Malines, Multichannel ECG Data Compression Method Based on a New Modelling Method, Computers in Cardiology 2001, 28:261-264 The work described in this article concerns a new method of multichannel ECG data compression based on the identification of a FIR system. The compression Method achieved is in development but achieved a compression ratio of 8 with a Signal-to-Reconstruction Noise Ratio of 25dB.

6. Sate M. S. Jalaleddine, Chris well G. Hutchens, William A. Soberly, Robert D. Stratton, Compression of Halter ECG Data, ISA 1988 – Paper #88-0205 This paper described many compression schemes utilised in compression of Halter ECG data including problems such as distortion inherent in them. Nine data Compression techniques are detailed with two more proposed.

7. Robert S. H. Istepanian, Arthur A. Petrofina, Optimal Ronal Wavelet-Based ECG Data Compression for a Mobile Telecardiology System, IEEE Transactions on

Page 91: Bachelorthesis.compressed

Biomedical Wireless Sensor Network

DDU (Faculty of Tech., Dept. of IT) Page 91

Information Technology in Biomedicine, Vol. 4 No. 3, September 2000 This paper details a new approach for ECG data compression for use in mobile Telecardiology. The compression achieved a maximum compression ratio of 18:1 and Was able to reproduce clinically acceptable signals with a 73% reduction in Transmission time. This compression method is rather complicated and is probably not Practical for implementation on our slave nodes and also requires a block size for Compression that is larger than that which is suited for our purposes.

8. Li Gang, Ye Winy, Lin Ling, Yu Qilian, Yu Xiamen, An Artificial-Intelligence Approach to ECG Analysis, IEEE Engineering in Medicine and Biology, March/April 2000. Within this paper is contained information on the use of Neural Networks to Identify QRS complexes in a measured ECG signal. It includes some information on Compression methods of ECG, which is of some relevance but otherwise is not very Useful.

9. D. Marr, ECG Application Featuring Data Transmission by Bluetooth, University Of Queensland Thesis, 2001 The thesis deals with the design of an ECG system which measures and filters An ECG signal with analogue circuitry before A/D converting it and sending it using Bluetooth elsewhere. The analogue circuitry detailed is a bit dodgy, and the results Section is useless.