ecg

76
12 CHAPTER 1 INTRODUCTION 1.1 About the project The aim of the project is to create the framework needed for building a low cost and simple PC based ECG monitoring system. We first started by researching on the basics of ECG and its theory. We then explore how to obtain and process the signal from the human body. We also looked at how to digitize the signal so that it can be fed to the computer. Various ways of integrating the system with a computer and how the host computer can play a part in the system are also explored. 1.2 Problem to Be Studied PC-Based Patient Monitoring System provides essential information of person heart in order to detect various heart related decease. However, most of commercial ECG monitoring system has complicated function. Therefore, the problem to be studied is to design and implement the user -friendly system,

Upload: abhinav-kumar

Post on 26-Nov-2014

441 views

Category:

Documents


1 download

DESCRIPTION

ELECTROCARDIOGRAM REPORT

TRANSCRIPT

Page 1: ECG

12

CHAPTER 1

INTRODUCTION

1.1 About the project

The aim of the project is to create the framework needed for building a low cost and simple

PC based ECG monitoring system. We first started by researching on the basics of ECG and

its theory. We then explore how to obtain and process the signal from the human body. We

also looked at how to digitize the signal so that it can be fed to the computer. Various ways of

integrating the system with a computer and how the host computer can play a part in the

system are also explored.

1.2 Problem to Be Studied

PC-Based Patient Monitoring System provides essential information of person heart in order

to detect various heart related decease. However, most of commercial ECG monitoring

system has complicated function. Therefore, the problem to be studied is to design and

implement the user -friendly system, attractive and can save time. Other problem is patient's

vital signal measurement and data acquisition module. Besides that, the problem to be studied

is the setup for interfacing ECG circuit to PC by using specific software.

Other than that, is to prepare the coding that can be calculated the heartbeat rate. The patient

monitoring system is developed especially for hospital usage, so the system needs to have a

database for patient's data and confidentiality.

Page 2: ECG

13

1.3 Objective of Project

The objective of this project is to develop ECG data acquisition module. Thus this device will

available for monitoring heart signal in hospital or by individuals outside hospital. So patient

can continue monitoring heart at home when patients are dismissed from hospital. Besides

that, to study basic knowledge about diagnosis and to make comparison between normal and

abnormal signal producing by human body. Otherwise, is to develop a Patient Monitoring

System that is user friendly. This is very important because without this element, user cannot

understand and then they cannot interact with this project successfully.

1.4 Scope of Project

The scope of this project is to design and implement a PC-Based Patient Monitoring System.

The system can acquires signals and displays ECG signal on the PC screen. Besides that, it

also has a function to calculate the number of heart beats per minute based on ECG waveform

obtained. Otherwise this project also has a database to save the information. The major

concentration in this project is Software Development.

Page 3: ECG

14

CHAPTER 2

LITERATURE REVIEW

2.1 Theory of project

Basically, this project divided into two main parts, hardware design and software design.

There are three electrodes are placed on human body to capture small electrical voltage

produced by contracting muscle due to each heartbeat. Two electrodes are placed each on the

left and right wrist, while the third electrodes is placed on the ankle of the leg as ground. The

output from ECG is fed into the next stage for signal amplification and filtering purposes.

Then, analog output from this stage is fed into the next stage for analog to digital conversion.

Finally the digital output from ADC is sent to PC via serial port interface.

Figure 2.1: Block Diagram of PC-Based Patient Monitoring System

2.2 ECG Background

An electrocardiogram is a measurement of the electrical activity of the heart (cardiac) muscle

as obtained from the surface of the skin. As the heart performs its function of pumping blood

Page 4: ECG

15

through the circulatory system, a result of the action potentials responsible for the

mechanical events within the heart is a certain sequence of electrical events.

The electrical activity of the heart can be recorded to monitor cardiac changes or diagnose

potential cardiac problems. The principle involved is simple: body fluids are good electrical

conductors. Electrical impulses generated in the heart are conducted through body fluids to

the skin, where they can be detected and printed out by a sensitive machine called an

electrocardiograph. This printout is called an electrocardiogram, or ECG.

2.2.1 Heart

The heart is the organ responsible for pumping blood through the circulatory system. The

heart is made of a special kind of muscle, so that it can beat automatically without having to

be told to do so by the brain. The left side of the heart drives oxygen rich blood out of the

aortic semi-lunar outlet valve into circulation where it is delivered to all parts of the body.

Blood returns to the right side of the heart low in oxygen and high in carbon dioxide and

is then pumped through the pulmonary semi-lunar pulmonic valve to the lungs to have its

oxygen supply replenished before returning to the left side of the heart to begin the cycle

again.

Page 5: ECG

16

2.2.2 ECG Waveform

Typically, an ECG is comprised of a series of three distinguishable waves or components

(known as deflection waves), each representing an important aspect of cardiac function. The

first wave, known as the P wave, represents atrial depolarisation, and is a result of the

depolarization wave from the Sinoatrial node (SA node) through the atria. This action

precedes and is the cause of atrial contraction. The QRS complex is the result of ventricular

depolarisation. It is caused by the electrical activity spreading from the Atrioventricular

node (AV node), through the ventricles via the Purkinje fibres, and precedes ventricle

contraction. During this time, atrial repolarisation is also occurring however its occurrence is

usually masked by the large QRS complex being detected. Finally, the T wave occurs when

the ventricles repolarise. Repolarisation, is slower than depolarisation, hence the T wave is

usually wider than the P wave and the QRS complex . A Typical ECG Signal can be shown

as Figure 2.3.

Figure 2.3 ECG Waveform

Page 6: ECG

17

2.2.3 Standard ECG Measurement

To perform a clinical electrocardiograph, it is important that more than one lead (also known

as a channel) be recorded in order to accurately describe the heart's electrical activity. There

are two planes in which these leads may lie, which is the frontal plane (the plane of the body

that is parallel to the ground when one is lying on one's back) and the transverse plane (the

plane of the body that is parallel to the ground when one is standing erect). For two or

three channel ECG, only the leads in the frontal plane are required.

The frontal plane of an ECG consists of three basic leads, as can be seen in Figure 2.4.

These leads are the result of the various combinations of pairs of electrodes located on the

right arm @A), the left arm (LA) and the right leg (LL) of the patient. The resulting leads

are: lead I, LA to RA; lead 11, LA to RA; and lead 3 LL to LA.

Figure 2.4 Position and Orientation of 3 Bipolar Limb Leads

Page 7: ECG

18

2.3 Types of ECG Recording

Bipolar Leads record voltage between electrodes placed on wrists & legs (right leg is ground).

• Lead I records between right arm & left arm.

• Lead II: right arm & left leg.

• Lead III: left arm & left leg.

Figure 2.5 3 Lead Method of Recording

2.4 Waves in ECG

3 distinct waves are produced during cardiac cycle

• P wave caused by atrial depolarization.

• QRS complex caused by ventricular depolarization.

• T wave results from ventricular repolarization.

Page 8: ECG

19

Figure 2.6 Waves in ECG

2.5 Explanation of Einthoven’s Triangle

Page 9: ECG

20

Leads used:

Limb leads are I, II, II. So called because at one time subjects had to literally

place arms and legs in buckets of salt water.

Each of the leads are bipolar; i.e., it requires two sensors on the skin to make a

lead.

If one connects a line between two sensors, one has a vector.

There will be a positive end at one electrode and negative at the other.

The positioning for leads I, II, and III were first given by Einthoven. Form the

basis of Einthoven’s triangle.

Figure 2.7 Einthoven’s Triangle

2.6 Elements of the ECG

a) P Wave: It is the depolarization of both atria and the shape and duration of P may indicate atrial enlargement.

Page 10: ECG

21

b) PR Interval: It starts from onset of P wave to onset of QRS and range of Normal

duration varies from 0.12-2.0 sec (120-200 ms).A prolonged PR interval may indicate

a 1st degree Heart block.

c) QRS Complex: It is the ventricular depolarization of the heart. It is larger than P wave

because of greater muscle mass of ventricle.

Normal duration = 0.08-0.12 seconds.

Q wave greater than 1/3 the height of the R wave, greater than 0.04 sec are abnormal.

d) ST Segment: It connects the QRS complex and T wave and its duration fall in the

range of 0.08-0.12 sec (80-120 m sec).

e) T Wave: It represents re-polarization or recovery of ventricles in the heart and its

interval starts from the beginning of QRS to apex of T and is referred to as the

absolute refractory period.

f) QT Interval: It is usually measured from beginning of the QRS complex to the end of

the T wave. A normal QT is usually about 0.40 sec QT interval varies based on the

heart rate.

2.7 Literature Review

This project is to design a PC-Based Monitoring System of ECG Signal. The system can

operate in real time and real mode. It also used a serial port programming to display the ECG

signal to PC. The digitized signal will be channeled through RS232 to the serial port of the

computer. This project divided into 2 parts: Hardware and Software as can be shown in

figure 2.8. The software methodology has been developed using Visual Basic 6.0.

Page 11: ECG

22

Figure 2.8 The Structure of PC-Based Heart Diagnosing System.

Page 12: ECG

23

CHAPTER 3

Project Methodology

3.1 Overview

This chapter will discuss briefly about the software methodology used to develop the data

acquisition system. Basically, this project divided into two main parts as can be shown in

Figure 3.1.

1. Part A: hardware design

2. Part B: software design

The major concentration in this project is the development of the PC interface programming

and waveform display program. Generally the system has two main functions that are

allowing user to monitor ECG signal waveform and also have function to save the patient's

information include heartbeat rate and health info to the database.

Page 13: ECG

24

3.2 Software Setup

Hardware, software, database and network technologies all contribute to distributed and

cooperative computer architectures. It's most general form, distributed and cooperative

computer architecture.

3.2.1 Software Requirement

a) Microsoft Visual Basic 6.0

The Microsoft Visual Basic 6.0 is the best chosen for Patient Monitoring System due to its

ability in controlling and monitoring the hardware operation effectively. Besides that, this

application also easy to understanding and it's surely support application that run on Windows

XP platform.

b) Microsoft Windows XP Professional

Microsoft Windows XP Professional was selected as the operating system for personal

computer and network computer. Windows XP Professional had been chosen as the

operating system in order to complete the entire development for the project. It is depend on

several advantages after compared to other operating system. One of the main reasons is

because Microsoft currently holds the largest market for operating system and Microsoft

Window XP with Service Pack I was one of the bestseller operating system. Microsoft

Window XP is very reliable and user-friendly, it is a combination of others Microsoft

operating system.

Microsoft XP is design to use resources efficiently and manage file in systematic ways. In

conclusion, Microsoft Windows XP Professional with Services Pack 1 is the best platform

Page 14: ECG

25

available to run the Patient Monitoring System smoothly without any problems. Beside that

this operating also suitable for this project and platform for ECG device supports.

3.3 DESIGN Technical Background

3.3.1 ECG Sensor Requirements

The front end of an ECG sensor must be able to deal with the extremely weak nature of the

signal it is measuring. Even the strongest ECG signal has a magnitude of less than 10mV, and

furthermore the ECG signals have very low drive (very high output impedance). The

requirements for a typical ECG sensor are as follow:

- Capability to sense low amplitude signals in the range of 0.05 -10mV.

- Very high input impedance, > 5 MQ.

- Very low input leakage current, < 1 pA.

- Flat frequency response of 0.05 - 100 Hz.

- High Common Mode Rejection Ratio (CMRR).

3.3.2 Electrodes

Electrodes are used for sensing bioelectric potentials that are 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 ECG 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.

Page 15: ECG

26

Figure 3.2 Electrodes

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:

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.3 Dry Electrode Structure

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

Page 16: ECG

27

measured will be considerably less than that obtained with an electrode utilizing an

electrolyte.

3.3.3 Differential Amplifier

A normal differential amplifier in an ECG system works as shown in Figure1.6. A lead of

data is formed by the differential amplification of the voltage picked up from two electrodes

on both wrists- A common ground exists between the two points when the third electrode is

connected to the left ankle. The advantage offered by this topology is that of the high CMRR

afforded by a differential amplifier- The differential amplifier used in the system has a CMRR

of 90 which means noise common to both input channels is attenuated to less than 0.0001% of

its input amplitude at the amplifiers output.

Figure 3.4 Differential Amplifier

3.3.4 Signal Filtering

Removal of the undesirable noise requires filtering. Noise can be filtered through the use of

analog circuitry or digital signal processing. The weak nature of the ECG signal and the noise

affecting it requires that a range of filters to be implemented. A filter is a device that passes

electric signals at certain frequencies or frequency ranges while preventing the passage of

Page 17: ECG

28

others. Filters are often used in electronic systems to emphasize signals in certain frequency

ranges and reject signals in other frequency ranges. Bandpass, notch, low-pass, high-pass and

all-pass are the five basic filter types.

The three approaches to implementing analog filters using circuitry are Active, Passive and

Switched-Capacitor. The order of a filter is usually equal to the total number of capacitors and

inductors in the circuit and represents the severity with which signals outside of the filter's

pass-band will be attenuated. A higher order filter is desirable due to its greater ability to

discriminate between signals at different frequencies, but does require an increased number of

components and consequently an increase in cost and size.

Active filters are circuits that make use of amplifying units, especially operational amplifiers

(op amps), as the active device in combination with some resistors and capacitors to provide

an LRC-like filter performance at low frequencies.

Active filters have high input impedances, low output impedances and are able to provide

gain. They don't require inductors and as such are not hampered by the high tolerance and

gain spacing of these devices. Through the use of low tolerance capacitors and resistors, good

accuracy can be obtained. Disadvantages include the limited bandwidth of the amplifying

units and noise produced by these units. Active filter is chosen to be implemented to the

circuitry because passive filter is more cumbersome to be configured compared to the active

filter.

Figure 3.5 2nd Order Active Filter

Page 18: ECG

29

Figure 3.6 2nd Order Passive Filter.

3.3.5 Bio-Electricity

Ionic potentials are formed in certain cells of the body due to differences in the concentrations

of certain chemical ions, notably sodium ( Na + ) chloride (Cl-), and potassium (k+) ions. The

cell wall is a semi permeable membrane. Permeability is a measure of the ability of the

membrane to pass certain ions, In the case of a semi permeable membrane, a selective process

allows some ions to pass while restricting or rejecting others. Such a membrane will not allow

the free diffusion of all ions but only a limited few. It is thought that this selective

phenomenon is due to on size differences, their respective electrical charges, and certain other

factors. The end result, however, is that cell membranes at rest tend to be more permeable to

some ions (e.g., potassium and chloride) than to others (e.g.-sodium). As a result, the

concentration of positive sodium ions inside a cell (see Figure Below) is less than the

concentration of sodium ions in the intracellular fluid outside the cell. A phenomenon known

as the sodium-potassium pump keeps the sodium largely outside the cell and potassium ions

inside.

Potassium is thus pumped into the cell while sodium is pumped out but the rate of sodium

pumping is roughly two to live times that of potassium. These rates result in a difference of

ion concentration, creating an electrical potential. And this causes the cell to be polarized. The

inside of the cell is less positive than the outside, so the cell is said to tie negative with respect

to its outside. Various authorities give slightly different figures for the value of this resting

potential, but fall within the 70- to 90-millivolt (mV) range.

Page 19: ECG

30

Figure 3.7 Cell polarization at Rest and during Stimulation

a) Resting (Diffusion Potential); Polarized Cell

b) Action Potential (Depolarized Cell).

3.3.6 AD 620 Instrumentation Amplifier

The AD620 is a low cost, high accuracy instrumentation amplifier that requires only one

external resistor to set gains of 1 to 1000. Furthermore, the AD620 features 8-lead SOIC and

DIP packaging that is smaller than discrete designs, and offers lower power (only 1.3 mA max

supply current), making it a good fit for battery powered, portable (or remote) applications.

The AD620, with its high accuracy of 40 ppm maximum non-linearity, low offset voltage of

50 µV max and offset drift of 0.6 µV/°C max, is ideal for use in precision data acquisition

systems, such as weigh scales and transducer interfaces. Furthermore, the low noise, low input

bias current, and low power of the AD620 make it well suited for medical applications such

as ECG and noninvasive blood pressure monitors. The low input bias current of 1.0 nA max is

made possible with the use of Super beta processing in the input stage. The AD620 works

Page 20: ECG

31

well as a preamplifier due to its low input voltage noise of 9 nV/√Hz at 1 kHz, 0.28 µV p-p

in the 0.1 Hz to 10 Hz band, 0.1 pA/√Hz input current noise. Also, the AD620 is well suited

for multiplexed applications with its settling time of 15 µs to 0.01% and its cost is low enough

to enable designs with one in op-amp per channel.

3.3.6.1 Features of AD620

The AD620 is a low cost, high accuracy instrumentation amplifier that requires only one

external resistor to set gains of 1 to 1000. Its key features are:

a) Gain Set with One External Resistor (Gain Range 1 to 1000).

b) Wide Power Supply Range (62.3 V to 618 V).

c) Higher Performance than Three Op Amp IA Designs.

d) Available in 8-Lead DIP and SOIC Packaging.

e) Low Power, 1.3 mA max Supply Current.

f) Low Noise 9 nV/√Hz, @ 1 kHz, Input Voltage Noise.

g) Excellent AC Specification 120 kHz Bandwidth (G = 100) 15 ms Settling Time to

0.01%.

h) High accuracy.

i) Low Cost.

j) Low input bias current.

Page 21: ECG

32

3.3.6.2 Applications

It is used in Weigh Scales, ECG and Medical Instrumentation, Transducer Interface and Data

Acquisition Systems.

3.3.7 LM358 Operational Amplifier

The LM358 series consists of two independent, high gain, internally frequency compensated

operational amplifiers which were designed specifically to operate from a single power supply

over a wide range of voltages. Operation from split power supplies is also possible and the

low power supply current drain is independent of the magnitude of the power supply voltage.

Application areas include transducer amplifiers, dc gain blocks and all the conventional op

amp circuits which now can be more easily implemented in single power supply systems. For

example, the LM358 series can be directly operated off of the standard +5V power supply

voltage which is used in digital systems and will easily provide the required interface

electronics without requiring the additional ±15V power supplies.

The LM358 are available in a chip sized package (8-Bump micro SMD) using National’s

micro SMD package technology.

Page 22: ECG

33

Figure 3.8

Figure 3.9 Implemention of AD 620 in ECG circuit

Page 23: ECG

34

3.3.7.1 Unique Characteristics

In the linear mode the input common-mode voltage range includes ground and the output voltage can also swing to ground, even though operated from only a single power supply voltage.

The unity gain cross frequency is temperature compensated and the input bias current is also

temperature compensated.

3.3.7.2 Advantages

Two internally compensated op amps and also eliminates need for dual supplies.

Compatible with all forms of logic and power drain suitable for battery operation.

3.3.8 LM 324,124 IC’s

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. Operation from split supplies also is possible if the difference between the two

supplies is 3 V to 32 V (3 V to 26 V) and VCC is at least 1.5 V more positive than the input

common-mode voltage. The low supply-current drain is independent of the magnitude of the

supply voltage.

Applications include transducer amplifiers, dc amplification blocks, and all the conventional

operational-amplifier circuits that now can be more easily implemented in single-supply-

voltage systems. For example, the LM124 can be operated directly from the standard 5-V

supply that is used in digital systems and easily provides the required interface electronics

without requiring additional 15-V supplies. The figure below shows the pin configuration of

IC.

Page 24: ECG

35

3.3.8.1 Active Notch Filters

Operational amplifiers can be used to make notch filter circuits. Here we show two, a standard

notch filter circuit, and another for a twin T notch filter circuit. A notch filter is used to

remove a particular frequency, having a notch where signals are rejected. Often they are fixed

frequency, but some are able to tune the notch frequency. Having a fixed frequency, this

operational amplifier, op amp, notch filter circuit may find applications such as removing

fixed frequency interference like mains hum, from audio circuits.

The diagram below shows a notch filter circuit using a single op amp. The notch filter circuit

is quite straightforward and the calculations for the component values are also easy.

Figure 3.10 Notch Filter Circuit

The circuit is quite straightforward to build. It employs both negative and positive feedback

around the operational amplifier chip and in this way it is able to provide a high degree of

performance.

Calculation of the value for the circuit is very straightforward. The formula to calculate the

resistor and capacitor values for the notch filter circuit is:

F notch = 1 / (2 π R C)

Page 25: ECG

36

R = R3 = R4

C = C1 = C2

Wheref notch = centre frequency of the notch in Hertz.π = 3.142

R and C are the values of the resistors and capacitors in Ohms and Farads.

When building the circuit, high tolerance components must be used to obtain the best

performance. Typically they should be 1% or better. A notch depth of 45 dB can be obtained

using 1% components, although in theory it is possible for the notch to be of the order of 60

dB using ideal components. R1 and R2 should be matched to within 0.5% or they may be

trimmed using parallel resistors.

A further item to ensure the optimum operation of the circuit is to ensure that the source

impedance is less than about 100 ohms. Additionally the load impedance should be greater

than about 2 M Ohms.

The circuit is often used to remove unwanted hum from circuits. Values for a 50 Hz notch

would be: C1, C2 = 47 nF, R1, R2 = 10 k, R3, R4 = 68 k.

3.3.8.2 Applications of Active Notch Filters

The notch filter is an advanced tuning technique that acts much like a band-reject filter in an

electronic circuit. Certain frequencies are rejected while others are allowed to pass through.

This is particularly helpful when trying to eliminate a resonance that always occurs at a single

frequency.

3.3.9 RS232 Serial Port

Communication as defined for RS 232 is an asynchronous serial communication method. The

word serial means, that the information is sent one bit at a time. Asynchronous tells us that the

Page 26: ECG

37

information is not sent in predefined time slots. Data transfer can start at any given time and it

is the task of the receiver to detect when a message starts and ends.

3.3.9.1 RS 232 Bit Streams

The RS 232 standard describes a communication method where information is sent bit by bit

on a physical channel. The information must be broken up in data words. The length of a data

word is variable. On PC's a length between 5 and 8 bits can be selected. This length is the

information length of each word. For proper transfer additional bits are added for

synchronisation and error checking purposes. It is important, that the transmitter and receiver

use the same number of bits. Otherwise, the data word may be misinterpreted, or not

recognized at all.

With synchronous communication, a clock or trigger signal must be present which indicates

the beginning of each transfer. The absence of a clock signal makes an asynchronous

communication channel cheaper to operate. A disadvantage is that the receiver can start at the

wrong moment receiving the information. All data received in the resynchronization period is

lost. Another disadvantage is that extra bits are needed in the data stream to indicate the start

and end of useful information. These extra bits take up bandwidth which leads to reduction in

useful bandwidth.

Data bits are sent with a predefined frequency, the baud rate. Both the transmitter and receiver

must be programmed to use the same bit frequency. After the first bit is received, the receiver

calculates at which moments the other data bits will be received. It will check the line voltage

levels at those moments. With RS232, the line voltage level can have two states. The on state

is also known as mark, the off state as space. No other line states are possible. When the line

is idle, it is kept in the mark state. The figure shows the specifications of RS232 serial port

and actual RS232 serial port used in major applications for interfacing of the hardware with

the system.

Page 27: ECG

38

Figure 3.11

Figure 3.12 Actual RS 232 Serial Port

3.3.9.2 Atmega 8 Controller

On the AVR RISC architecture. It executes powerful instructions in a single clock cycle,

theATmega8achieves throughputs approaching 1 MIPS per MHz, allowing the system

designer to optimize power consumption versus processing speed.

Page 28: ECG

39

The AVR core combines a rich instruction set with 32 general purpose working registers. All

the 32 registers are directly connected to the Arithmetic Logic Unit (ALU), allowing two

independent registers to be accessed in one single instruction executed in one clock cycle. The

resulting architecture is more code efficient while achieving throughputs up to ten times faster

than conventional CISC microcontrollers.

The ATmega8 provides the following features: 8 Kbytes of In-System Programmable Flash

with Read-While-Write capabilities, 512 bytes of EEPROM, 1 Kbyte of SRAM, 23 general

purpose I/O lines, 32 general purpose working registers, three flexible Timer/Counters with

compare modes, internal and external interrupts, a serial programmable USART, a byte

oriented Two wire Serial Interface, a 6-channel ADC (eight channels in TQFP and QFN/MLF

packages) with 10-bit accuracy, a programmable Watchdog Timer with Internal Oscillator, an

SPI serial port, and five software selectable power saving modes. The Idle mode stops the

CPU while allowing the SRAM, Timer/Counters, SPI port, and interrupt system to continue

functioning.

The Power down mode saves the register contents but freezes the Oscillator, disabling all

other chip functions until the next Interrupt or Hardware Reset. In Power-save mode, the

asynchronous timer continues to run, allowing the user to maintain a timer base while the rest

of the device is sleeping.

The ADC Noise Reduction mode stops the CPU and all I/O modules except asynchronous

timer and ADC, to minimize switching noise during ADC conversions. In Standby mode, the

crystal/resonator Oscillator is running while the rest of the device is sleeping. This allows

very fast start-up combined with low-power consumption.

The device is manufactured using Atmel’s high density non-volatile memory technology. The

Flash Program memory can be reprogrammed In-System through an SPI serial interface, by a

conventional non-volatile memory programmer, or by an On-chip boot program running on

the AVR core. The ATmega8 AVR is supported with a full suite of program and system

development tools, including Visual Basic, debugger/simulators, In-Circuit Emulators, and

evaluation kits. The Figure below shows the pin configuration of ATmega 8 Controller.

Page 29: ECG

40

3.3.10 Implementation of the Project

a) Pre-Amplifier Low Pass Filter

It has been used to exclude the 50 Hz signal predominantly available from the main line

power. For two Inputs two passive RC low pass filter with cut off frequency of 28 Hz has

been used.

b) Main Amplifier

The Main Amplifier consist AD620 Amplifier. The AD620 is a low cost, high accuracy

instrumentation amplifier that requires only one external resistor to set gains of 1 to 1000.

Figure 3.13 Connection 2, 3 to the Right and Left Electrodes Respectively.

Page 30: ECG

41

c) Post Amplifier two stage Butterworth Low Pass Filter

Two -40dB/decade Butterworth filter with cutoff frequency of 31Hz is added to get a -80

dB/decade LPF operation. It removes the noise from line power and amplifier operation.

d) Amplifier for gain recovery

Since the two Butterworth filter reduces the signal amplitude, so a post filter amplifier is used

with LM358 and a gain of 11.

e) Real Time Data Acquisition

The data acquisition was done with the sound card which takes analog signals as input.

Initially the data is sampled at 22 KHz. Since this much sampling is sufficient to capture the

analog signal it is re-sampled so that the code does not become slow when processing the

data.

Real-time data acquisition supports tactical decision-making. It also supports operational

reporting by allowing you to send data to the delta queue or PSA table in real-time. You then

use a daemon to transfer Data Store objects to the operational Data Store layer at frequent

regular intervals. The data is stored persistently in BI.  The Data Source has to support real-

time data acquisition.

The above given components are arranged in an timely fashion. Therefore, the complete

circuit diagram is shown as follows to display the standard ECG graph as shown below with

the standard intervals and amplitudes.

Page 31: ECG

42

Figure 3.14 Shows Standard ECG graph

Page 32: ECG

43

Figure 3.15 Complete Diagram of Complete ECG Circuit.

Page 33: ECG

44

3.3.11 Interfacing with Visual Basic 6.0

A simple intuitive GUI is implemented for the display of the ECG data. The GUI is

implemented using visual basic 6.0 Enterprise Edition.

3.3.11.1 Amplitude Settings

Typical ECG display software measures the signal in terms of mV. However the signal being

transmitted is in the Volt range (amplified) and has been offset to accommodate the

requirements. The signal is hence categorized manually by simultaneously displaying the raw

ECG signal on an oscilloscope (output of differential amplifier) and plotting the filtered data

on the GUI. The peak to peak voltage of the differential amplifier was measured (As the

signal resembled that of figure 16). It is then divided by ten as the gain of the differential

amplifier is set to ten. This value represented the peak to peak value of the ECG wave. The

peak to peak value on the GUI in terms of milli volts is then set to be equal to the result on the

scope. 3 different people were tested to verify and calibrate the result.

3.3.11.2 Time Scale Settings

A similar method is utilized in categorizing the time scale. The output of the DAC is

connected to the oscilloscope while simultaneously viewing the Data on the GUI. A single

division on the PC was measured. The time/division was varied while measuring the time

between successive peaks measured and calculating the mm/sec value. The distance between

peaks was simultaneously measured on screen and the resultant time scale was calibrated.

Page 34: ECG

45

Figure 3.17 Shows the Comparison of Standard ECG with Patient’s one

Page 35: ECG

46

CHAPTER 4

ANALYSIS OF PROJECT

4.1 Analysis of the waveform

4.1.1 Heart rate

The quickest way to calculate the heart rate is to count the number of large squares between

QRS complexes and divide into 300, e.g. if there are three large squares, the heart rate is 100

beats/min.

A heart rate of > 100 bpm is a tachycardia and < 60 bpm is a bradycardia.

Figure 4.1 Sinus Tachycardia

Figure 4.2 Sinus Bradycardia

Page 36: ECG

47

4.1.2 Heart rythms

a) Regular rythms

P wave precedes every QRS complex with consistent PR interval is sinus rhythm.

No discernable P wave preceding each QRS but narrow regular QRS complexes is a

nodal or junctional rhythm.

b) Irregular rythms

No discernable P waves preceding each QRS complex with an irregular rate is atrial

fibrillation.

P wave preceding each QRS with consistent PR interval, the rhythm is sinus

arrhythmia.

If P waves are present but there is progressive lengthening of the PR interval ending

with non-conducted P wave (‘dropped beat’) followed by a normally conducted P

wave with a shorter PR interval, the patient is in Wenckebach’s (or Mobitz type I) 2nd

degree AV block.

4.1.2 Cardiac axis

There is nothing mysterious about working out the cardiac (or QRS) axis. It represents the net

depolarization through the myocardium and is worked out using the limb leads, in particular

leads I and AVF. The directions of each of these leads (the cardiac vector) are summarized in

Fig. 4.3. By convention, the direction of lead I is 0_; and aVF points down (V‘FEET’).

Page 37: ECG

48

Figure 4.3 Normal QRS or Cardiac axis

4.1.3 P wave

Look at the P wave shape.

Peaked P waves (P pulmonale) suggest right atrial hypertrophy – e.g. pulmonary

hypertension or tricuspid stenosis.

Figure 4.4 Tall P wave

Bifid broad P waves (P mitrale) suggests left atrial hypertrophy – e.g. mitral

stenosis

Page 38: ECG

49

Figure 4.5 Bifid P wave

4.1.4 PR Interval

The PR interval is measured from the beginning of the P wave to the R wave and is usually 1

large square in duration (0.2 s). A short PR interval represents rapid conduction across the AV

node, usually through an accessory pathway (e.g. Wolff–Parkinson–White syndrome).

Figure 4.6 Short PR interval

A long PR interval (>1 large square) but preceding every QRS complex by the same distance

is first degree AV block (Fig. 4.7). This is usually not significant, though it is worth checking

the patient’s drug history for beta-blockers or ratelimiting calcium antagonists, e.g. verapamil

and diltiazem.

Page 39: ECG

50

Figure 4.7 First degree AV block

A PR interval that lengthens with each consecutive QRS complex, followed by a P wave

which has no QRS complex and then by a P wave with a short PR interval, is Wenckebach’s

(or Mobitz type I) 2nd degree AV block (Fig. 4.8)

Figure 4.8 Second degree AV block, MOBITZ 1

If the P waves that are followed by a QRS complex have a normal PR interval, with the

occasional non-conducted P wave – i.e. a P wave with no subsequent QRS complex (a

‘dropped beat’), the rhythm is said to be Mobitz type II 2nd degree AV block (Fig. 4.9).

Figure 4.9 Second degree AV block, MOBITZ 2

Page 40: ECG

51

If the P waves regularly fail to conduct, say every 2 or 3 beats, the patient is said to be in 2:1

(or 3:1 etc.) heart block.

If the P waves are regular (usually at a rate of about 90) and the QRS complexes are regular

(heart rate about 40 bpm), but there is no association between the two, then the rhythm is

complete (or 3rd degree) AV block (Fig. 4.10). This rhythm will need to be discussed with

your seniors as will usually require cardiac pacing, and if the patient is compromised, e.g.

hypotensive, will need insertion of a temporary pacing wire.

Figure 4.10 Third degree AV block

4.1.5 QRS complex

First, look at the width of the QRS, then the morphology.

Normal QRS duration is less than three small squares (0.12 s) and represents normal

conduction through the AV node and the bundle of His.

A broad QRS complex signifies either:

1. The beat is ventricular in origin, e.g. an ectopic beat, or

2. There is a bundle branch block.

A broad QRS complex with an RSR pattern in V1 represents right bundle branch block.

A broad QRS with an ‘M’ pattern in lead I represents left bundle branch block (Fig. 4.11).

Page 41: ECG

52

Figure 4.11 Wide QRS

The first negative deflection of a QRS complex is the Q wave. If the Q wave is > 2 mm (two

small squares), it is considered pathological (Fig. 4.12).

Figure 4.12 Deep Q wave

4.1.6 ST segments

There are basically three abnormalities seen in the ST segement:

1.ST depression – could signify cardiac ischaemia (Fig. 4.13).

Page 42: ECG

53

Figure 4.13 ST depression

2. ST elevation – highly suggestive of infarction (Fig. 4.14)

Figure 4.14 ST elevation

3. Saddle shaped’ – concave ST segments usually seen across all the ECG, suggesting a

diagnosis of pericarditis.

If there is any evidence of ST segment abnormality, particularly in the context of a patient

with chest pain, seek senior advice at once. It is important to note that ST segments are

abnormal and cannot be interpreted in patients with bundle branch block, especially LBBB.

Page 43: ECG

54

4.1.7 QT interval

The QT interval is usually about 0.4 s (two large squares) and is important as prolongation

can lead to serious ventricular arrhythmias such as torsades de pointes. It can be prolonged for

several reasons – including drugs such as amiodarone, sotalol and some anti-histamines – so a

drug history is crucial if this abnormality is seen. A family history of sudden cardiac death is

also important as a congenital long QT syndromemay be present.

4.1.8 T waves

T waves should be upright in all leads other than leads III and V1 where an inverted T wave

can be a normal variant.

Tall tented T waves could represent hyperkalaemia (Fig. 4.15).

Figure 4.15 Tall T wave

T wave inversion can represent coronary ischaemia, previous infarction or electrolyte

abnormality such as hypokalaemia (Fig. 4.16).

Figure 4.16 T wave inversion

Page 44: ECG

55

RESULT AND CONCLUSION

a) GRAPH OBTAINED :

b) STANDARD ECG GRAPH :

Page 45: ECG

56

CONCLUSION :

With technology advances being seen all around us in our everyday life, it is extremely

important to use such technology for the benefit of the community at large. Monitoring of a

patient’s heart condition is presently being achieved by a system using several cables wired to

specific points on the patient’s body to produce an ECG signal.

This thesis provides the documentation of the design and implementation which was

necessary to create the Heart Diagnosing System. The design can decrease the load of a

medical practitioner. The patient can himself/herself analyze the ECG by using this design.

We have developed a system which is capable to capture the ECG of a patient on a PC. But

the final model that has been created can be improved by increasing the accuracy of the graph

obtained.

The current state of the project should not be looked at, as a final product, but merely as a

promising platform by which to maintain enhancements within the design. With a

continuation of the current design, the proposed end product is very realistic and attainable.

Page 46: ECG

57

Page 47: ECG

58

.

Page 48: ECG

59

Page 49: ECG

60

Page 50: ECG

61

Page 51: ECG

62

• .

Page 52: ECG

63

Page 53: ECG

64

Page 54: ECG

65

Page 55: ECG

66

Page 56: ECG

67

.

Page 57: ECG

68

Page 58: ECG

69