SlideShare a Scribd company logo
1 of 101
Download to read offline
Reconfigurable Framework for
Abnormality Aware ECG Monitoring
Device - Programmable SoC Approach
UNIVERSITY OF TURKU
Faculty of Mathematics and Natural Science
Department of Information Technology
June 2015
Antti Siirilä
Supervisors
PhD (Tech), Tomi Westerlund
PhD (Tech), Pasi Liljeberg
The originality of this thesis has been checked in accordance with the University of Turku quality assurance
system using the Turnitin OriginalityCheck service.
i
UNIVERSITY OF TURKU
Department of Information Technology
ANTTI SIIRILÄ
Reconfigurable Framework for Abnormality Aware ECG Monitoring Device –
Programmable SoC Approach
Master Thesis, 90 pages, 3 Appendices
Embedded Computing
June 2015
In the field of public healthcare, there is an increasing need for financially and structurally
more efficient health services. This has initiated a new area of research and development
named eHealth. The research on this area targets to alleviate and automate common
procedures and techniques of healthcare by exploiting novel Information and
Communication Technology innovations. One of the best-known and most used
healthcare tool is Electrocardiography (ECG). Ever since its invention by William
Einthoven at the onset of the 20th century, ECG has provided an indispensable means for
monitoring heart functions. For this reason, various eHealth research projects have strived
to develop ECG based automated systems for telemedicine purposes.
This thesis defines a reconfigurable framework for ECG based patient monitoring
systems, targeting implementation on recently introduced Programmable System-on-
Chip (PSoC) technology. A procedure for abnormal ECG signal detection was introduced
as part of this framework. The feasibility of the proposed ECG Detection Framework was
demonstrated in a case study. For this, based on the defined framework, an ECG
monitoring system was implemented on a PSoC chip. Furthermore, a customisable
Intellectual Property block was developed as part of the implementation process. This
block, including required datapath interfaces and drivers, provides an implementation
base for the ECG Detection Framework. The results of the case study demonstrate that
PSoC technology, together with the proposed ECG Detection Framework, enables fast
and flexible development of an ECG monitoring system. Furthermore, detection of an
abnormal ECG signal close to the signal source implies reduced data transfer between
patient’s device and a healthcare centre, and thus the power consumption of the patient’s
device can be optimised.
Key words: ECG, Programmable System-on-Chip, Reconfigurable computing
ii
TURUN YLIOPISTO
Informaatioteknologian laitos
ANTTI SIIRILÄ
Reconfigurable Framework for Abnormality Aware ECG Monitoring Device –
Programmable SoC Approach
Diplomityö, 90 sivua, 3 Liitesivua
Embedded Computing
Kesäkuu 2015
Viime vuosikymmenen aikana on tutkittu keinoja tehostaa terveydenhuollon palveluita
mm. informaatio- ja kommunikaatioteknologiassa kehitettyjä innovaatiota
hyödyntämällä. Yhtenä osana tätä tutkimusta on ollut potilaan etäseurantajärjestelmät.
Näistä tärkeimpinä erottuvat Elektrokardiogrammiin pohjautuvat järjestelmät, mihin
myös tämän diplomityön aihe sijoittuu.
Diplomityössä määritettiin muokattava järjestelmä, joka käyttää ohjelmoitavaa
järjestelmäpiiriä Elektrokardiogrammi-pohjaisten potilaan seurantalaitteiden
toteutukseen. Yhtenä osana määritettyä järjestelmää on normaalista poikkeavan
Elektrokardiogrammin tunnistamismekanismin kuvaaminen, sekä tästä saatavan tiedon
hyödyntäminen etälaitteen tiedonsiirron ja siitä mahdollisesti seuraavan energian
kulutuksen pienentämisessä. Lisäksi diplomityössä toteutettiin määritettyyn
järjestelmään pohjautuva toteutus ohjelmoitavalla järjestelmäpiirillä. Toteutuksesta
saadut tulokset osoittavat, että ohjelmoitavaa järjestelmäpiiriä voidaan pitää
varteenotettavana teknologiana, kun toteutetaan laitetta, joka tunnistaa normaalista
poikkeavia Elektrokardiogrammisignaaleja.
Avainsanat: EKG, Ohjelmoitava järjestelmäpiiri
iii
ACKNOWLEDGEMENT
I gratefully acknowledge my supervisors PhD (Tech) Tomi Westerlund and PhD (Tech)
Pasi Liljeberg for their valuable guidance and worthy comments during this stimulating
project. I also want to thank Pasi for providing me work facilities at the University of
Turku.
Big thanks to Mikko Koskinen, Janne Rantasalo and Markku Saarinen in KONE for their
flexible and helpful attitude towards my studies. Jarno Laiho, Jani Järvinen, and Jarmo
Rantanen also get my appreciations for their readiness to arrange work for me whenever
I so desired. A special thanks also to all my workmates at KONE Turku for their support.
My deepest appreciation goes to my language consultant and beloved friend Andrew
Stevenson for his priceless support during the writing process. Merci infiniment mon
vieux!
I sincerely thank my dear wife Noora for valuable and well-timed pokes she gave me
when I needed to move forward. My sons Pessi and Pieti get a big hug for many pleasing
and relaxing Lego building sessions we had together. Our dog Rontti gets a big belly rub
for taking me out into fresh air in a daily basis. I love you all!
A warm thanks to my mother-in-law Kaisa for smoothening our daily routines by looking
after the boys and cooking the dinners. That really helped a lot, thank you! I also want to
thank Lotta for her medical commentary.
I am also deeply grateful to my dad Jouko and my mom Merja for their strong example
of never giving up.
In Turku 4.6.2015
Antti Siirilä
iv
CONTENTS
1 INTRODUCTION 1
1.1 Motivation 2
1.2 Problem Statement 4
1.3 Thesis Structure 4
2 HEART 6
2.1 Anatomy of the Human Heart 6
2.2 Electrophysiology 8
2.3 Cardio Electrophysiology 9
2.4 Sinus Rhythms 12
3 ELECTROCARDIOGRAM 13
3.1 ECG Signal Acquisition 14
3.2 Interpreting ECG Response 19
3.3 Discussion 22
4 ECG FILTERING 24
4.1 Basic Concepts of the Filtering 25
4.2 Fourier Series of the ECG Signal 28
4.3 De-noising ECG Signal 30
4.4 Automated ECG Signal Detection 33
5 TECHNOLOGIES AND MATERIALS 37
5.1 Zynq - All Programmable SoC by Xilinx 38
2.1.1 Cardiac Cycle 6
2.1.2 Chambers 7
2.1.3 Valves 7
2.2.1 ION Current and Membrane 8
2.2.2 Membrane Potentials 8
2.3.1 Cardio Myocytes 10
2.3.2 Cardio Conduction System 10
2.3.3 Action Potential in Cardio Myocytes 11
3.2.1 ECG Waves and Cardiac Cycle 19
3.2.2 ECG Intervals and Segments 20
4.3.1 Filtering systems 31
4.3.2 ECG De-noising Techniques 32
4.4.1 QRS-complex detection 34
v
5.2 Development Boards 50
6 ECG DETECTION FRAMEWORK 53
6.1 Data Flow 54
6.2 Filtering 55
6.3 Parameters 55
6.4 Analysis and Detection of ECG signal 60
6.5 Multi-Lead ECG Detection System 63
6.6 Summary 64
7 CASE STUDY 65
7.1 ECG Signal Acquisition 66
7.2 ECG Detection Application 68
7.3 Results and Discussion 77
8 CONCLUSION 82
REFERENCES 84
APPENDIX I: SCHEMATICS A
APPENDIX II: BLOCK DESIGN, PART I B
APPENDIX III: BLOCK DESIGN, PART II C
5.1.1 Architecture 38
5.1.2 Embedded System Design for Zynq Devices 44
5.2.1 ZedBoard Evaluation and Development Kit 50
5.2.2 Arduino Uno/e-Health Sensor Platform 51
6.3.1 Generics 56
6.3.2 Registers 57
7.2.1 Hardware Implementation 68
7.2.2 Filters 69
7.2.3 ECG Detector 70
7.2.4 Control Unit Software 76
7.3.1 Feature Signal 78
7.3.2 R-wave Detection 78
7.3.3 Abnormality Detection 79
7.3.4 Statistical Calculations 80
vi
FIGURES
Figure 2.1 Human heart in diastole and systole states..................................................................................7
Figure 2.2 Location of the SA and AV nodes, AV bundles, and Purkinje Fibres ......................................10
Figure 3.1 The placement of the ECG electrodes on human body............................................................. 15
Figure 3.2 The axial reference system defines the viewing angle for each Lead in relation to the heart ...16
Figure 3.3. The ECG deflections acquired with the four electrodes .......................................................... 17
Figure 3.4 Wiggers Diagram maps the ECG signal to the cardiac cycle....................................................19
Figure 3.5 The points of interests in the ECG signal are PR-, QT-, QRS intervals and ST segment.........21
Figure 4.1 Graphical illustration of a waveform and its Fourier Series .....................................................27
Figure 4.2. A typical set up for a hardware based de-noising of ECG signal.............................................30
Figure 5.1 Architecture of the Zynq AP SoC by Xilinx.............................................................................38
Figure 5.2 The architecture of the programmable logic in the Zync-7000.................................................40
Figure 5.3 The architecture of the DSP48E1 slice .....................................................................................42
Figure 5.4 The embedded system design flow for the Zynq. .....................................................................45
Figure 5.5 The layered software stack of SDK .......................................................................................... 49
Figure 5.6 Arduino Uno and e-Health sensor platform v 1.0 boards ......................................................... 51
Figure 6.1 Architecture of the ECG Detection system...............................................................................54
Figure 6.2 Architecture of the ECG Detector unit .....................................................................................60
Figure 6.3 High-level FSM for the peak detection sequence of the Peak detector.....................................61
Figure 6.4 The queue structure of the extracted peak and interval values of ECG ....................................62
Figure 6.5. Multi-Lead framework for an ECG Detection system with three Leads..................................63
Figure 7.1 ZedBoard and Arduino/e-Health-Shield boards used in the case study....................................65
Figure 7.2 High-level system architecture of the case study application ...................................................66
Figure 7.3 Behavioural state machine of the ECG acquisition program run on Arduino Uno...................67
Figure 7.4 The magnitude response of the de-noising filter.......................................................................69
Figure 7.5 The magnitude response of the difference filter .......................................................................70
Figure 7.6 Re-customise IP window of the ECG Detector.........................................................................71
Figure 7.7 The hierarchy of the ECG Detector IP modules .......................................................................72
Figure 7.8 Behavioural state machine of the CU software.........................................................................76
Figure 7.9 Placement of the electrodes during the ECG acquisition .......................................................... 77
Figure 7.10 The de-noised ECG signal (above) in relation to the feature signal (below) .......................... 78
Figure 7.11 The detection window for the R-wave (above) in relation to the feature signal .....................78
Figure 7.12 ECG Abnormality signal actives ECG signal streaming in CU..............................................79
Figure 7.13 The min, max and mean values of detected R-wave peaks.....................................................80
Figure 7.14 The mean value of detected RR-intervals ...............................................................................81
vii
TABLES
Table 3.1 The list of ECG electrodes and their placement on the body. ....................................................18
Table 4.1 The key frequency bands of the ECG signal ..............................................................................28
Table 4.2 Typical noise components that interfere with the ECG signal ...................................................29
Table 6.1 The generic parameters for the PL side components and the data busses connecting them.......56
Table 6.2 The threshold registers ...............................................................................................................57
Table 6.3 The statistics registers ................................................................................................................58
Table 6.4 The definition of the signals in ECG_STATUS register............................................................ 59
1
1 INTRODUCTION
The field of public healthcare around the world is facing new financial and social
challenges, as it needs to provide medical care for increasing number of senior citizens.
In about 40 years’ time, the amount of people in the group older than 65 years is forecasted
to be three times larger than today [1]. Within the near future, for the first time in its
statistical history, this age group is estimated to exceed the age group of children under 5
years old. The reasons for this change are twofold. Firstly, vaccinations and other
successful public health projects throughout the 20th
century led to a drastic decline in
communicable diseases, allowing for younger age groups to avoid premature death.
Secondly, the average life expectancy in the overall population has grown dramatically
and will continue to do so, resulting in a wider age span in the over 65 age group.
Consequently, this change in the age range, together with the improved global control
over communicable diseases, has led to a shift in disease patterns. The non-communicable
diseases and chronical conditions will now cause more deaths and disability than the
communicable diseases. Moreover, the non-communicable diseases such as heart disease,
cancer, and diabetes will not only be the scourge of the average or high-income countries,
but will also be prevalent in lower income countries. Hence, the amount of people
globally suffering hearth disease or other non-communicable diseases will significantly
increase within the coming decades and this will stress the public health care systems
economically and socially worldwide [2].
2
As the pressure on the field of public healthcare increases, many nations have initiated
projects targeting novel solutions for the healthcare systems [3]. These initiatives along
with the rapid development of information and communication technologies (ICT) has
given birth to a new field of research called eHealth. The eHealth concept combines
medical science focused on development of new applications in healthcare with ICT.
These eHealth applications include, among many others, telemedicine, patients’ data
sharing, and intelligent home care.
Heart diseases, described in medical terms as Cardio Vascular Diseases (CVD), are the
largest group in the family of non-communicable diseases. CVD kills globally more than
17 million people every year, particularly in low and middle income countries [4]. In
2010, the global expenditures resulting from CVD were estimated to be more than 850
billion dollars and this trend is continuing.
Early diagnosis of a latent heart problem is the key to the successful treatment in any
abnormalities in the heart [5]. The key method for early diagnosis is Electrocardiography
(ECG). It captures the heart’s electrical activity expressed in waveform. This waveform
provides doctors with visually expressed evidence of a wide variety of heart conditions.
As a consequence, the study of ECG based monitoring systems has been one of the
leading research topics in the eHealth field [6].
1.1 Motivation
Architectural model for a remote ECG monitoring system is generally divided into several
communication domains [6]. Firstly, the ECG signal is collected from sensors placed on
the patient’s body and transferred to a gateway device. Communication between sensors
and gateway is normally made over a short-range wireless connection commonly referred
to as Body Area Network (BAN). The gateway device can be either portable (a
smartphone carried on the patient) or stationary (a dedicated device located near the
patient). Before the gateway device relays the ECG signal to the next communication
domain, it typically performs some de-noising on the signal. The middle ware device at
the border with the next communication domain is typically situated at the patient’s home.
Desktop, laptop, or similar computers are common examples of this middle ware device.
Transfer of the ECG signal from the gateway device to the middle ware device generally
occurs over wireless connection such as Wi-Fi, Bluetooth, or similar. In addition, the
3
middle ware device provides some signal processing and storage services as well as
further connectivity to a health care centre. Likewise, the middle ware device is capable
of analysing the signal and, based on its analysis it can generate alarms or provide
statistical information to the health care centre. Alternatively, the signal can be relayed
directly to the health care centre for further analysis. The health care centre builds a real-
time view of the patient’s health condition using the data received from the middle ware
device. Based on the built view, the health professionals are then able to take any required
actions concerning the patient’s health. Finally, the physical distance between health care
centre and middle ware can be vast, thus the communication between them typically relies
on internet protocols.
For the gateway device to maintain an adequately long battery life, low power
consumption is crucial. As is commonly known, long battery life is clearly an advantage
to the user, since recharging or battery replacements occur less frequently. For this reason,
in order to reduce computational burden on the gateway device and hence power
consumption, the ECG signal is commonly relayed directly to the middle ware device.
For this reason all signal data, even that containing normal sinus rhythm, is constantly
transferred to the middle ware. However, the communication task is also known to be a
large-scale power consumer which again stresses the battery life of the gateway [6]. On
the other hand, if pre-analysis of the ECG signal in the gateway device already detects
normal sinus rhythm, the communication cost could be reduced. Thus, only the samples
containing data of an abnormal ECG signal would be transferred to the middle ware and
the normal ECG signals could be ignored. For this scenario, the ECG signal analysis
should be robust enough so that misinterpretations could be avoided. Therefore, the rules
for detecting a normal ECG signal should be extremely strict. That is to say, no
compromise can be allowed for the ECG detector. Any suspicious ECG signal, which by
human interpretation could be analysed as normal, would get the status of abnormal in
the machine interpretation. Even in this case, the decline of the communication cost could
be significant. Additionally, statistical data could be extracted from the ECG signal during
normal sinus rhythm. The results could then be sent to the middle ware, if so desired.
A novel Programmable System-on-Chip (PSoC) technology has recently been introduced
which offers a tempting platform for the applications performing Digital Signal
Processing (DSP) or other computationally intensive tasks. It is tempting in the sense that
4
PSoC is a single chip device allowing for high computational tasks of the application to
be accelerated in the reconfigurable hardware side of the chip while the actual application
can reside on the traditional processor side as software. Moreover, tasks prone to
parallelism can easily be executed concurrently on the reconfigurable fabric, thus
achieving better performance with lower power consumption. The communication within
the chip is based on programmable interconnects providing standardized bus interfaces
and protocols. In addition, the development process of PSoC combines hardware and
software development tools in a single kit enabling a straightforward and fast way for
system implementation and testing. In the IT device markets PSoC, falls between full
hardware and software systems by combining the features of both. All in all, PSoC
promises selectively faster development times, better performance on reduced physical
area, lower device and design cost with lower risks, and lower power consumption than
the adjacent technologies. In conclusion, an ECG detection system is a model example of
an application that could benefit from the PSoC platform.
1.2 Problem Statement
The aim of this thesis study is to investigate the possibilities of using the recently
introduced PSoC technology as a platform for an abnormality aware ECG detection
system. More precisely, the goal is to propose a framework that provides a high-level
description of the ECG detection system. The framework should allow a flexible selection
of different digital signal processing techniques used in the abnormality detection process.
Furthermore, the framework should describe how the abnormality awareness could be
used to reduce the communication cost between the detector and the middle ware device.
Finally, the feasibility of the proposed framework should be demonstrated in a case study.
The goal of the case study is to produce an IP based block design that could be used as a
base implementation for future studies on the ECG detector.
1.3 Thesis Structure
The contents of this thesis is organised as follows: Firstly, Chapter 2 briefly discusses the
anatomy and electrophysiology of the human heart. Secondly, Chapter 3 introduces ECG,
focusing on the ECG signal acquisition and interpretation. Subsequently, Chapter 4
describes the basics of filtering, followed by a deeper analysis of the ECG signal
5
components. In addition, Chapter 4 introduces some de-noising techniques for the ECG
signal and provides information on automated ECG signal detection methods. Next,
Chapter 5 deals with the technologies and materials that were used in this thesis work. At
this point, the ECG Detection Framework is defined in Chapter 6. Proceeding chapter,
Chapter 7, describes the case study and discusses the results extracted from it. Ultimately,
Chapter 8 concludes this thesis and suggests some ideas for the future work.
6
2 HEART
To be able to build a system that captures, processes, and outputs the electrical activity of
a human heart, it is crucial to understand the very basic biological and physiological
phenomena controlling that activity. This chapter will therefore outline these phenomena.
2.1 Anatomy of the Human Heart
The heart is an autonomously and periodically contracting and relaxing muscle that makes
the blood circulate within the circulatory system. The principal parts of the heart muscle
are the atria and ventricles (Figure 2.1), which can be further divided into the left and
right segments.
2.1.1 Cardiac Cycle
The two main phases of the cardiac cycle are illustrated in Figure 2.1. The phase in which
the blood flows into the heart via the atria, filling the ventricles, is called diastole [7].
systole, respectively, refers to the phase when both ventricles are contracted and the blood
is pumped out from the heart.
7
Figure 2.1 Human heart in diastole and systole states [8].
2.1.2 Chambers
The heart consist of four isolated chambers, the right and left atrium chambers, and
similarly the right and left ventricle chambers. The chambers in the right side of the heart
are responsible for pumping the deoxygenated blood returning from the circulation to the
lungs to be oxygenated. The left atrium chamber then receives the oxygenated blood from
the lungs and pumps it to the left ventricle chamber which again pumps it back to the
circulation.
2.1.3 Valves
Atria-ventricular blood flow occurs through the atrioventricular valves [7]. The right
Atrioventricular valve is called the Tricuspid valve. This valve allows the blood to flow
from the right atrium to the right ventricle in the diastole phase and blocks the reflux
during the systole. The left Atrioventricular valve is called the Mitral (or Bicuspid) valve
and it has the similar function on the left side as the Tricuspid has on the right side. In
addition, there are two more unidirectional valves. The Semilunar valves, which allow
the blood to run out from the ventricles. The Pulmonary valve (right Semilunar valve)
8
controls the blood flow from the right ventricle to the lungs. When the ventricle pressure
reaches a certain threshold during the ventricle contraction, the pulmonary valve opens
allowing the blood to run via the Pulmonary Artery to the lungs. Similarly, the Aortic
valve (left Semilunar valve) works in between the left ventricle and Aorta, allowing the
unidirectional bloodstream to flow out from the left ventricle.
2.2 Electrophysiology
Electrical activity in a cell is caused by bidirectional flow of ions, in and out of the cell,
causing changes in electrical potential between the intracellular space and the
extracellular space. The forces that drive the ions to flow are diffusion and electromotive
force. However, those physical phenomena do not solely define the movement of the ions,
which is also highly regulated by various biological processes occurring in a lipid layer
between the cell exterior and the interior called membrane. The equivalent circuit can be
used to model the ionic concentration differences on a miniaturist spot of membrane [9].
2.2.1 ION Current and Membrane
Some elementary ions involved in the electrical activity of an animal cell are: Sodium
(Na+
), Potassium (K+
), Calcium (Ca2+
) as cation, and Chlorine (Cl-
) as anion [10]. Na+
and K+
are the most active when it comes to the ion current across the membrane.
However, Ca2+
has an important role in some cells, such as heart muscle cardio myocytes.
Typically, in an animal cell, there is a higher concentration gradient of K+
inside the
membrane than outside and respectively a higher concentration of Na+
outside the
membrane than inside. The membrane controls the otherwise passively occurring ion
current, caused by diffusion and electrical force, through biological processes such as
voltage gated and resting ion channels, and ion pumps.
2.2.2 Membrane Potentials
Electrical potential difference between the outside and inside of the membrane is
generally called membrane potential, and it can be measured [10]. Different membrane
potentials indicate different functional states of the cell. Typically excitable cells, for
example, the cardio myocytes, have three types of membrane potentials: resting, graded,
and action.
9
When a cell is in a resting potential, there is none or little ion flow through the membrane,
and therefore the membrane potential stabilizes at a certain level. Commonly, the resting
potential of an excitable cell is around -70mV.
As mentioned earlier, membrane controls the ion flow in and out of the cell. A
mechanical, electrical, or molecular external stimulus affects the permeability of the
membrane, making it permeable only for certain ions [10]. Usually Na+
ions are allowed
to flow in the cell. When more Na+
ions flow in the cell, the Na+
current’s membrane
potential becomes more and more positive. At a certain point when the membrane
potential reaches a threshold level (around -55mV), voltage gated Na+
channels open and
the inward Na+
current increases rapidly causing the cell to depolarize with the membrane
potential becoming positive compared to the exterior of the cell. With the Na+
streaming
into the cell, the membrane potential shoots up seeking the Na+
equilibrium potential.
However, when the membrane voltage reaches the 40mV level at which the voltage gated
K+
channels open in the membrane, the level drops downwards as fast as it had risen, due
to the K+
now streaming out of the cell. The exiting K+
now causes the cell to repolarize
below to the resting potential. This polarization phenomenon, which signals the cell to
perform its job, is called the action potential. For example, in a muscle cell, the
depolarization causes the cell to contract and the repolarization returns the muscle cell
back to relaxation.
Right after the action potential there is a phase called the Refractory period [11], during
which the ion concentration of the cell is restored to the state prior to the action potential
and the membrane potential reverts to the resting potential. During the refractory period,
K+
and Na+
ions are exchanged through the membrane via ion pumps (against their
driving force). This requires work, which again needs energy, provided by ATP within
the cell. The subsequent action potential cannot occurs in a cell until the refractory period
ends.
2.3 Cardio Electrophysiology
Cardio electrophysiology includes the electrophysiological phenomena that occur in the
heart muscle. Although it follows the basic rules of electrophysiology, it consists of
mechanisms that are not expressed in any other part of the human body and hence it will
be discussed in the following paragraphs.
10
2.3.1 Cardio Myocytes
Heart muscle consists of cardio myocytes that are a specific type of muscle cell existing
only in the heart. Cardio myocyte has the similar contraction and relaxation features as a
skeletal muscle cell initiated by the action potential. However, cardio myocytes are
electrically interconnected with each other and therefore are able to propagate the action
potential throughout the muscle tissue. In addition, a cardio myocyte automatically
adjusts its contraction pace in relation to the adjacent cardio myocyte having the highest
contraction pace. Hence, all cardio myocytes connecting to each other strive towards a
uniform contraction pace [12].
2.3.2 Cardio Conduction System
The systole and diastole phases are controlled by the conduction system [13]. The
conduction system consists of a special type of cardio myocyte that generate, control, and
carry the action potential throughout the heart muscle. The main tissues in the conduction
system (Figure 2.2) are the Sinoatrial (SA) node, also known as pacemaker node, the
Atrioventricular (AV) node, the bundle of HIS, and the Purkinje Fibres (PF).
Figure 2.2 Location of the SA and AV nodes, AV bundles, and Purkinje Fibres [14].
In general, the SA node lies at the top part of the right atrium spreading downwards and
finally connecting to the AV node via internodal pathways. The AV node sits in between
the right atrium and ventricle, and is the only conduction point between the atria and the
11
ventricles. Continuing down from the AV node, the bundle of HIS further divides into
two branches. One extends down to the bottom of the right ventricle and the other to the
left ventricle respectively. At the ends of those branches, there are Purkinje Fibres that
spread around the ventricles.
2.3.3 Action Potential in Cardio Myocytes
The properties of the action potential in cardio myocytes vary depending on their
anatomical location. The action potential in myocytes, forming the SV node, is similar
with the ones in nerve and skeletal muscle cells. However, that action potential is
autonomously excited by an ion current that is generally referred to the funny current
[15], [16]. The funny current occurs during the refractory phase of the cell causing a slow
continuous increase in the membrane potential. Since the membrane potential is steadily
rising, it finally reaches to the threshold voltage leading to another action potential.
The myocytes in the AV node have a similar mechanism for generating the action
potential. However, since the action potential in the SV node occurs at a higher frequency
than in AV node or in any other part of the cardio conduction system, the SV node is
responsible for setting the heart’s pace [16]. Hence, the name pacemaker node.
In the action potential of atrial and Ventricular myocytes, the repolarization phase is
delayed due to Ca2+
influx [17]. The delay causes a plateau phase in the action potential,
which prolongs the depolarization of the myocyte. The plateau directly defines the
duration of the systole. Although, the plateau phase in action potential is expressed in
both the atrial and ventricular myocytes, it is particularly significant in the ventricular
myocytes.
The plateau phase also defines the length of a period called Effective Refractory Period
(ERP) [18]. During ERP, a new action potential cannot be generated in the
cardiomyocyte. Hence, ERP protects the heart from too intensive beating. A typical ERP
length varies from 150 ms to over 500 ms depending on the heart rate and the location of
the cyrdiomyocyte.
12
2.4 Sinus Rhythms
The heart is said to be in sinus rhythm, if the pace of the heart origins form the SA node.
The normal sinus rhythm is in between 60 – 100 Beats Per Minute (bpm) depending on
the individual [19]. If the pace is below 60 bpm, the rhythm is called sinus bradycardia.
The sinus bradycardia is a normal condition and it often exists with persons in strong
physical condition such as athletics. Conversely, when the heart rate increases over 100
bpm, the rhythm is then called sinus tachycardia. Sort-term sinus tachycardia is normal,
especially when the person is under physical or mental stress. Elevated heart rate is also
normal for infants. However, a long-term sinus tachycardia with no notable cause may
indicate an abnormal behaviour of the heart. Ultimately, an irregularly beating heart,
which is still excited from the SA node, is said to be in sinus arrhythmia. Sinus arrhythmia
is usually a normal condition for young people, caused by the respiration cycle. However,
in some case the sinus arrhythmia may be an indication of abnormal heart functions.
A human heart is a complex system regulated by a vast number of different biological
and physiological mechanisms, many of which still remain undiscovered. This chapter
hopefully has brought up the essential information of those issues guiding the way to a
better understanding of the following Electrocardiogram chapter.
13
3 ELECTROCARDIOGRAM
Electrocardiogram refers to a method in which the electrical activity of the heart is
captured and then visualised as a commonly known waveform of ECG. The resulted ECG
waveform provides the means for doctors to point out different functions of the hearth. In
addition, the waveform provides valuable information in the process of diagnosing
abnormal behaviours of the heart.
An ECG device can roughly be divided into three different units. Firstly, the signal
acquisition unit captures an analogue ECG signal through a set of electrodes placed on
the human body. Secondly, the signal processing unit filters the acquired signal aiming
to reduce noise and other artefacts. In addition, the signal processing unit is responsible
of converting the acquired signal into the digital domain via an A/D converter. The exact
point where the conversion takes place varies depending on the system specifications.
Finally, the processed ECG signal can be read from a user interface unit.
How ECG describes the functionality of the heart is revealed in an interpretation process.
The interpretation process focuses on the five key waves of the ECG waveform namely
P, Q, R, S, and T [20]. Each wave represents a certain functionality in the heart. For
instance, the Q, R, and S waves – generally called as QRS-complex – relate to the
contraction in the ventricles. Alteration in any of the five waves may indicate an abnormal
functionality of the heart. However, noise and other artefacts as well as the de-noising
14
process may equally alter the ECG output. Therefore, the de-noising of the ECG signal
must be carefully designed and implemented in an ECG detection system.
Since the ECG filtering is such a crucial part of an ECG detection system, the complete
chapter 4 has been dedicated for it, and therefore it is not discussed in this chapter. This
chapter, on the other hand, deals with the ECG electrodes and their placements as well as
how electrodes in different locations provides different views from the heart. Finally, the
ECG interpretation process is discussed.
3.1 ECG Signal Acquisition
The ECG waveform is formed by measuring potential differences between two electrodes
placed on human body as function of time. The shape of the waveform, or the Lead as it
is generally referred, depends on from which direction the heart is measured. The
direction again is defined by the placement of the electrodes in relation to the heart. The
amount of measuring electrodes vary from 3-4 in ECG monitoring devices up to 10 in
more accurate diagnosis device [21, p. 15].
The ECG electrodes works as an interface between the body and the ECG device. As
mentioned earlier, the number of electrodes can vary from 3 to 10 depending on the ECG
device. The devices used for the ECG monitoring is based on four electrodes namely the
extremity electrodes or the limb electrodes (an electrode in each extremity). Very often,
however, the number of electrodes is only three as defined by the father of ECG, William
Einthoven [22]. The more accurate 12 Lead ECG devices provide a more thorough view
of the heart by introducing six more electrodes referred as chest electrodes. The 12 Lead
ECG devices are mainly used in the clinical environment for diagnosis purposes. Since
the emphases of this study is on the ECG monitoring devices, this chapter concentrates
only on the ECG acquisition with four or less electrodes.
According to the Einthoven’s Triangle [22], the ECG electrodes are attached on the both
upper limbs and on the left lower extremity. This three electrodes setup creates a triangle-
like formation around the heart, in which the heart forms the centre point for the triangle.
The legs of the triangle are called Leads.
15
Figure 3.1 The placement of the ECG electrodes on human body. The green arrows
represent the I, II, III – basic Leads that are formed between the electrodes. The blue
arrows on the other hand illustrate the three extra Leads provided by the insertion of the
fourth electrode, the permanent ground electrode.
The three Leads and their relation to the polarity of the electrodes are illustrated in Figure
3.1. The polarity of the electrode, which is not participating to the lead, is set to neutral.
In other words, it is set to the ECG device’s reference point which in many cases is the
ground. Another interesting point that was defined by Mr. Einthoven is that the sum of
the outputs of Leads I and III must be equal with the output of Lead II. Hence, the lead II
provides the most extensive view from the heart. For that reason, it is often used in ECG
monitoring devices.
In addition to the three base Leads (I, II, III), it is possible to acquire three more lead
forms by increasing the number of electrodes to four. The fourth electrode works as a
permanent ground electrode whereas the actual ECG acquisition is done with the three
other electrodes placed according to the Einthoven’s Triangle. The three extra leads are
called augmented leads and generally referred as aV-leads [21, p. 16]. There is one aV
for each electrode namely aVR towards the right arm, aVL towards the left arm, and
finally aVF towards the left leg. The aV signals are acquired by combining two of the
three electrodes to a single negative electrode, which is then compared against the
remaining positive electrode. For instance, aVR equals to combination of LL+LA as
negative electrode and RA as positive electrode. The other two aV-signals can similarly
be constructed as indicated in Figure 3.1. Besides the four electrodes ECG devices, it has
RA LA
LL
Lead I
16
been suggested that by combining the RL and LL electrodes to a single LL electrode, it
would be possible to acquire all the six Leads by using only three electrodes [23].
Figure 3.2 The axial reference system defines the viewing angle for each Lead in
relation to the heart [24].
Each Lead provides a specific viewpoint to the heart. The extremity leads works on the
vertical plane only whereas the additional chest leads provides a second – horizontal –
plane to the system [21, p. 17]. Figure 3.2 illustrates the vertical plane and defines the
viewpoints on it for each Lead. The Leads are represented on an axil reference system as
vectors that start from the centre of the hearth. The Lead I looks the heart from the east
on the horizontal centreline. That point is the 0° point to which the other viewpoints relate.
Hence, the Lead II diverts 60° and the Lead III 120° from the Lead I. Moreover, the
equation of I + III = II can easily be proven from the axial reference system. If one moves
the Lead III to the right until its other endpoint meets the endpoint of the Lead I then the
remain endpoint of the Lead III will meet the endpoint of the Lead II.
17
Each of the six monitoring Leads generates a different ECG response for a cardiac cycle
[21, p. 21]. The sample deflections for the all six monitoring Leads are shown in the figure
3.3. A positive ECG deflection is generated whenever a depolarization wave propagates
toward the positive electrode. The same applies if a repolarization wave is moving away
from the positive electrode. In contrast, a depolarization traveling away from the positive
electrode and a repolarization wave approaching to it are shown as a negative deflection
on ECG.
Figure 3.3. The ECG deflections acquired with the four electrodes [25].
As mentioned earlier, the depolarization first travels downwards and then upwards in the
ventricles. Since the Lead II is located under the ventricle, the ventricle depolarization
first propagates towards the positive electrode of the Lead II (R-wave) and then away
from it (S-wave). As a result, the Lead II provides the greatest deflection for QRS-
complex [21, p. 21]. In addition, it can be clearly noticed from Figure 3.3 that the Lead II
is the sum of the other two Leads, I and II. The same rules apply for the augmented Leads
as for the limb Leads. However, the viewing angles are different and therefore the
deflections change accordingly.
There exists a vast variety of commercially available electrodes for long-term ECG
monitoring. A common factor among these electrodes is that they require skin contact.
Typically, an ECG electrode is equipped with a self-adhesive, which allows it to be fasten
18
on the body. The electrode is in contact with the body through some conductive gel that
improves the conductivity between the electrode and the skin, and reduces signal noise.
Table 3.1 The list of ECG electrodes and their placement on the body.
Electrode name Placement on the body
Right Leg (RL) Within the range of the ankle and sub-torso
Right Arm (RA) Within the range of the shoulder and wrist
Left Leg (LL) Within the range of the ankle and sub-torso
Left Arm (LA) Within the range of the shoulder and wrist
The location of the extremity electrodes can be freely chosen within the range defined in
Table 3.1. However, the placement shall be consistent. For instance, if the RA electrode
is placed on the shoulder level then LA shall also be placed on the same level. Moreover,
the further the electrode is from the heart the weaker is the acquired signal. Therefore, it
is a good practice to place the electrodes as close to the heart as possible with the respect
of Einthoven’s Triangle [26, p. 23]. This approach also reduces the amount of artefacts
caused by the limb muscles. In addition, when considering the noise, it is equally
important to make sure that there is no hair or other impurity between the body and the
electrode.
The skin contact oriented electrodes usually introduces discomfort for the patient being
monitored. The discomfort is a sum of many factors such as regular electrode
replacement, routing the wiring of the electrode through the clothing, skin irritation
caused by the self-adhesive or the conductive gel, to mention some of them. This has
motived many researchers to find a solution for a long-term contactless ECG electrodes
[27]–[30]. Contactless ECG electrode would ease the long-term ECG monitoring
tremendously from the patient’s point of view. However, there are still many unsolved
issues when it comes to the signal quality of the contactless ECG electrodes. Therefore,
relying on the traditional ECG electrodes requiring skin contact would be wise when
concerning the signal quality. Especially ECG monitoring devices with autonomous
abnormality detection would benefit from electrodes with high quality signal acquisition
capabilities.
19
3.2 Interpreting ECG Response
The ECG waveform is an electrical interpretation of the different states of cardiac cycle.
By analysing the waveform, it is possible to monitor the condition of the heart.
Furthermore, in the case of an abnormally behaving heart, the ECG analysis provides
robust means for diagnosis. When designing an autonomous ECG detection system, it is
crucial to understand the interpretation process of the ECG signal and also how the signal
maps to the cardiac cycle of a healthy heart.
3.2.1 ECG Waves and Cardiac Cycle
The mapping of the ECG waveform to the cardiac cycle in normal sinus rhythm is shown
in Figure 3.4. Each of the five waves PQRST can directly be map to a certain state of the
cardiac cycle.
Figure 3.4 Wiggers Diagram maps the ECG signal to the cardiac cycle [31].
As mentioned, the cardiac cycle starts at the diastole phase during which the heart muscle
is relaxed. At the end of the diastole, the atria contracts and pushes the blood into the
ventricle. The atria contraction is caused by the SA node which generates a stimulus that
20
leads to the action potential. With the help of the Bachmann’s bundle and since the
cardiomyocytes are interconnected, the action potential rapidly propagates around the
atria leading to atrial contraction [13]. This part of the cardiac cycle is expressed as P-
wave on the ECG waveform and it is the start of the atrial systole state [19, p. 18]. P-wave
detection is important, since its presence with acceptable PQ-interval indicates that the
patient is in sinus rhythm. The Lead II has the most profound response for the P-wave.
Once the Action Potential reaches the AV node, its propagation velocity decreases,
delaying the signal. Since the cardiomyocytes in the atria and those in the ventricles are
electrically connected only via the AV node [13], [32], the contraction in the ventricles is
also delayed. This delay is an important part of the contraction cycle allowing the blood
from the atrial chambers to flow into the ventricle chambers before the start of the systole.
After the delay caused by the AV node, the stimulus propagates rapidly down to the
ventricle via the bundle of His. This is shown as Q- and R-waves in ECG [19, p. 18]. The
Q-wave is the first negative deflection following the P-wave whereas the R-wave starts
right after the peak of the Q-wave.
The systole starts when the stimulus reaches the Purkinje Fibres. This is the R-peak in the
QRS-complex [19, p. 19]. The S-wave deflection on ECG is caused by the stimulus
moving upwards from the bottom of the ventricles via the Purkinje fibres leading to the
contraction in the ventricles. The plateau phase in the action potential of the
cardiomyocytes defines the duration of the systole phase. As a result, this can be seen as
flat line (ST-segment) on ECG. The final state in the cardiac cycle and the end of the
systole is the relaxation of the ventricles. This is due to the repolarization of the ventricle
cardiomyocytes, which reflects as the T-wave on ECG. The atria repolarization on the
other hand occurs in parallel with the stimulus propagation in the ventricles. Therefore, it
mixes with the QRS-complex response.
3.2.2 ECG Intervals and Segments
The previous section explained the ECG waves in amplitude wise and mapped them to
the individual phenomenon of the cardiac cycle. Another equally important extraction of
ECG is the distance between the different waves and it will be discussed in this section.
21
Figure 3.5 The points of interests in the ECG signal are PR-, QT-, QRS intervals and ST
segment.
Figure 3.5 defines the important distances between the waves of a normal ECG response.
The distances that include a wave response are referred as intervals. Segments on the
other hand refer to periods during which the ECG response is flat.
The RR-interval defines the distance between two subsequent QRS-complexes from
where the heart rate can be extracted. Similarly, the PP-interval – does not show in the
figure – is another way for defining the heart rate. The RR-interval tells more about the
ventricles contraction pace whereas the PP-interval targets on the atria.
The first interval in the cardiac cycle is the PR-interval [19, p. 19]. The PR-interval
indicates the time from the start of the P-wave to the start of the Q-wave. Thus, it covers
the atrial depolarization and the delay in the AV node. Normally, the duration for PR-
interval is within the range of 120-200 ms for adults. A shorter interval may refer to an
extra conduction pathway between atria and ventricles whereas longer interval usually
indicates a prolonged delay in the AV node.
The QRS- and QT-intervals start form the end of PR-interval [19, p. 19]. The QRS-
interval reveals how rapidly the depolarization propagates in the ventricles. The end of
22
QRS-interval is at the point where the S-wave return back to zero level and its duration
is from 70 to 100 ms. Problems in the ventricle conduction systems usually reflects as
prolonged QRS-interval. Besides the QRS-interval, the QT-interval measures the
duration of a full ventricle contraction cycle. It contains the whole systole of the ventricles
starting from the rapid shoot up of the action potential (QRS), illustrating the plateau
phase (ST-segment) and finally returning back to membrane potential at the point where
T-wave return back to zero level. It is important to notice that the duration of the QT-
interval varies in relation to the RR-interval as defined in the following equation.
𝑸𝑻 𝒄 =
𝑸𝑻
√𝑹𝑹
Prolonged QTC often refers to serious problems in ventricles. Differing from the QT-
interval, the TQ-interval indicates the relaxation – diastole – period of the ventricles. TQ
starts from where the QT-interval ends and ends to the beginning of the next QRS-
complex. Together the QT- and TQ –intervals contain the complete cardiac cycle starting
from a QRS-complex to the next QRS.
The segments describe the plateau phase of the action potential in the atria and ventricles
[19, p. 19]. The PR-segment relates to the atria whereas the ST-segment follows the
plateau of the ventricles cardiomyocytes. As being part of the PR-interval, the PR-
segment indicates the delay of the sinus excitation while it is propagating from the atrial
to the ventricles. A short PR-segment indicates existents of possible additional pathways
from the atrial to the ventricles. Conversely, a propagation block in the AV node appears
as prolonged PR-segment on ECG. Just like PR-segment in atria, the ST-segment
indicates the contraction phase of the ventricles. Elevation or depression of the ST-
segment generally refers to some problems of the blood circulation in the ventricle
myocardia. However, a reliable detection of the ST-segment usually requires a diagnostic
level ECG devices with 10 or more electrodes to be used, hence it is less attractive
derivate when it comes to the ECG monitoring devices [33].
3.3 Discussion
As shown in this chapter, the ECG signal captures the electrical activity of the heart. The
ECG signal is acquired through a set of electrodes that form a set of Leads. Depending
23
on the selection of the Leads, a different view of the heart can be obtained. Finally, the
acquired signal is processed and displayed to the user.
Once the ECG signal is acquired, it needs to be interpreted. Detection and mapping of the
different waves and intervals are part of the ECG interpretation process. Heart, in a
normal sinus rhythm, provides an ECG waveform that contains the PQRST waves with
predictable amplitudes and intervals. Deviation from those values may be a result of a
signal noise or other artefacts, normal arrhythmia or potential abnormalities of the heart.
However, the noise causes signal distortion and hamper the ECG interpretation, hence its
presence should be reduced as much as possible. In addition, sometimes it is relevant to
see only certain parts of the ECG signal leaving out the others. To achieve this, the ECG
signal is usually passed through different signal processing techniques, generally referred
as filtering. The next chapter will discuss the ECG filtering in more details.
24
4 ECG FILTERING
The previously explained ECG acquisition process results to an ECG signal which not
only comprises signal components originating purely from the heart, but also contains
undesirable components from various different sources. These are generally referred to
as noise. The sources of noise can be Electromyography (EMG) signals caused by body
movement or respiration, external electrical sources such as power grid, or radio
frequency (RF) sources which are commonly present. Their effect on ECG is a distortion
in the desired signal, making reliable interpretation a difficult and sometimes even
impossible task. The noise components need to be removed or attenuated from ECG
before its interpretation. The ECG signal filtering which attenuates noise components
from the acquired ECG signal, is called de-noising. Furthermore, the filtering process also
has other functions. On many occasions, not all the components of the de-noised ECG
signal are needed in the interpretation process. For instance, if the aim is to robustly detect
the QRS-complex of ECG, then the signal components forming the P and T waves are
irrelevant and hence can be filtered out. As a result, in order to design and implement an
ECG filtering system, it is crucial to know all components comprising the clean ECG
signal, as well as the common ECG filtering technics.
25
4.1 Basic Concepts of the Filtering
Signal filtering may be done on signals in both analogue and digital domains. The main
difference between these two is that signals in the analogue domain have a continuous
amplitude as a function of continues time whereas signals in the digital domain have a
discrete amplitude and time [34, p. 11]. The signal transition from analogue to digital
domain occurs through the Analogue-to-Digital Conversion (ADC). In the ADC process,
the amplitude of the analogue signal is measured periodically with a constant predefined
and fixed time-interval called sampling rate. The result is an ordered stream of discrete
samples, digital values which each represent the amplitude of the analogue signal at the
time of measurement. The ADC resolution is defined as the number of bits used for
presenting the amplitude value. The higher the resolution the finer the digital spectrum of
the amplitude value. The sample rate on the other hand defines the time interval between
two consecutive samples. According to the Nyquist-Shanon sampling theorem, in order
to be able to recreate the original signal from the digital samples, the original signal must
be sampled with at least twice the frequency of its highest frequency component. If this
is not the case, a phenomenon called aliasing occurs leading to a distortion in the recreated
signal.
Some advantages of the Digital Signal Processing (DSP) are that it enables an accurate
and reliable filtering process, an ability to store and replay the signal, an easy transform
from time domain to the frequency domain and an introduction of linearity to the system.
Drawbacks with the DSP filtering are that it requires more processing power and
significantly more resources than analogue filtering. Analogue signal processing on the
other hand offers better real-time filtering features with lower processing power and less
resource utilisation. However, an analogue system is more susceptible to noise and is less
accurate since it depends directly on the physical components. In addition, the signal noise
tends to accumulate in multi-stage analogue filtering systems. As a result, a filtering
system is often established as a hybrid mixed-signal system, combining the advantages
of both analogue and digital signal processing [35].
Signal filtering systems are hard to categorize, since they contain many dimensions which
overlap each other. As discussed earlier, one way of categorizing the signal filtering
systems is to divide them based on their input signals to either the analogue or digital
26
filtering system. Similarly, a filtering system can be categorized based on its output
frequency band. A Low-Pass Filter (LPF) attenuates the input frequencies above the cut-
off frequency of the filter. In contrast to LPF, a High-Pass Filter (HPF) passes the
frequencies above its cut-off frequency and attenuates those falling below the cut-off. A
Band-Pass Filter (BPF) allows only a certain frequency band of the input signal to pass
through the filter, while both Band-Stop Filters (BSF) and Notch Filters (NF) attenuate a
predefined frequency band, letting all the other frequencies pass through the filter. The
difference between BSF and NF is that the latter, as the name implies, only attenuates a
very narrow band from the overall frequency band, whereas the stop-band of BSF can be
wider.
Another way of categorization is to divide the filtering systems based on their properties.
These properties include linearity, causality, time variance, and stability [34, p. 112]. In
a linear system, if an input x1 produces an output y1 and similarly another input x2
produces an output y2 then any one of the two inputs scaled with a factor c will produce
the output that is scaled with the same factor of c. A causal filtering system is a real-time
system that only works with the inputs of current time or inputs from the past. Thus,
causality does not allow the system to predict inputs from the future. A time-invariant
system produces the same output for an input no matter if the input is fed to the system
at time t or at time t+T. That is, the output is only delayed in time by the amount of T. In
a time-variant system, however, the delay T does not propagate through the system but
varies causing the output to be produced after some time (t+T +tv). The length of the delay
depends on the input and hence makes the time-variant system hard to predict. Stability
simply refers to a system that produces a bounded output for a bounded input.
Impulse response is yet another way of categorizing filtering systems [34, p. 112]. The
impulse response of a system is defined as the output for an input signal having an
amplitude other than zero for a short period while otherwise the amplitude is zero. The
definition of the impulse signal depends on whether the signal is analogue or digital. The
filtering systems producing a Finite Impulse Response (the impulse response settles back
to zero within a finite period) are called FIR systems. In contrast to FIR, the systems
outputting an Infinite Impulse Response (the impulse response approaches zero but never
settles back to it) are generally referred as IIR systems. FIR and IIR implementations in
the digital domain rely on cascaded filter components called taps. A filter can be either
27
recursive or non-recursive depending on whether or not it uses a feedback loop from the
output to the input. A basic tap contains a delay unit, multiplier and adder. The input
sample is stored in the delay unit. The multiplier has two inputs, one for the sample and
the other for the coefficient. The coefficient defines that portion of the sample passed to
the adder. The adders and the delay units are cascaded to form a digital filter of a certain
length, of order N. The number of taps in a non-recursive FIR filter, which is the most
common form of digital filter, is N+1.
Although ways of categorizing the signal processing systems are many, none of them is
comprehensive. An analogue system may be linear or non-linear, time-variant or time-
invariant, just as an IIR filter can be stable or unstable depending. However, two
properties play an important role in system characterization: linearity and time-
invariance. A linear and time-invariant system (LTI) have many advantages that are
commonly exploited in DSP systems [34, p. 69]. The FIR systems are typical linear and
time-invariant (LTI) systems and hence are commonly used in DSP.
Figure 4.1 Graphical illustration of a waveform and its Fourier Series
The French mathematician Jean-Baptiste Fourier (1968 – 1830), states that any periodic
signal, as well as any quasiperiodic signal, can be presented as a Fourier Series consisting
of a finite or infinite set of sine and cosines waves (Figure 4.1). These sinusoidal signals,
or harmonics, vary in their frequency as well as their amplitude. Harmonics with a lower
frequency have a greater amplitude than those with higher frequencies. This being so, the
low frequency signals have the greatest effect on the original periodical signal.
28
Additionally, the signal amplitudes in a Fourier Series can be presented in either the time
or the frequency domain. The transform from time domain to frequency domain is called
Fourier transform and it is the basis for the modern DSP.
4.2 Fourier Series of the ECG Signal
As we known, the PQRST waves in ECG repeat periodically. However, the duration of
the ECG period is not constant, since the heart may beat faster or slower depending on
the physical or emotional stress to which the body is exposed. Due to its time-varying
nature, the ECG signal is quasiperiodic, as are all bioelectrical signals. Despite the
variations in period length, the ECG signal can be presented as a Fourier Series. A recent
study showed that a typical ECG signal can be decomposed to 169 harmonics of which
the first 40 most influence the shape of the original ECG signal [36].
Table 4.1 The key frequency bands of the ECG signal [37].
ECG Wave Frequency Band of the
Harmonics (Hz)
Description
R-R interval 0,67 – 5 R-R interval is the distance in time between two
subsequent heartbeats. Heart rate can vary between 40
– 300 bpm depending on the body strain. Typical
resting heart rate for adults falls in the range of 60 –
100 bpm.
P-wave 0,67 – 5 P-wave reflects the depolarization in the atria. The
pacemaker node resides in the right atrium and its
frequency range equates with the R-R interval.
QRS-complex 10 – 50 QRS-complex reflects the depolarization in the
ventricles. The propagation velocity is higher in the
ventricles than in the atria, hence higher frequency
harmonics.
T-wave 1 – 2 Repolarization in the ventricles deflects as T-wave in
ECG, revealing the membrane potential. The ION
current against the driving force is slow, hence the
lower frequency.
Table 4.1 lists the typical frequencies in which the harmonics comprising the different
ECG waves fall. The table suggests that the required frequency band for an ECG signal
is between 0.5 and 50 Hz. However, an ECG signal may also contain higher frequency
components such as pacemaker signals which can reach up to 150 Hz in adults and even
250 Hz in infant hearts. Therefore, the required frequency band for a diagnostic level
ECG device must cover frequencies up to that range.
29
The ECG signal also contains Furrier Series from unwanted noise sources. Noise sources
are typically muscle noise from body movements, respiration noise, noise from skin-
electrodes and external electrical noise. Some of these noise components are relatively
easy to filter out while others require much more attention since they mix with the original
ECG signal band.
Table 4.2 Typical noise components that interfere with the ECG signal.
Noise source Frequency Band of the
Harmonics (Hz)
Description
DC 0 The DC component introduced by skin-electrodes has
a high amplitude that shifts the baseline of the ECG
signal above zero. Always present.
Respiratory 0,12 – 0,5 Respiration noise causes the ECG baseline to wander
according to the in- and exhalation. Always present.
Muscles 5 and higher The EMG signals from other body muscles mix with
the ECG harmonics and are therefore extremely
problematic. Always present.
Power line 50/60 Power line noise is a significant noise factor in an ECG
device. Depending on the power grid system, the
frequency is 50 or 60 Hz. Typically the power
frequency in Europe is 50Hz and 60Hz in the USA.
Usually present.
Other ambient 50 and higher RF noise and other external electrical noise. Usually
present.
As can be seen in Table 4.2, DC and respiratory signals do not mix with the ECG signal’s
frequency band whereas the other noise components do. All noise causes distortion in the
ECG signal and therefore its presence needs to be minimized. The DC component has a
constant amplitude, which elevates the baseline of the ECG signal on the y-axis. Thus, a
reliable amplitude measurement becomes impossible. The DC component therefore needs
to be cancelled from the ECG signal. Respiratory noise and some other low frequency
muscle noise cause alterations in the ECG baseline. In other words, although PQRST-
complexes look normal, their baseline drifts, wandering above or sinking below the zero
level over the course of time. This introduces problems in ECG interpretations, especially
in the detection of ECG parts with zero amplitude such as in PT and ST-segments. Muscle
noise inflicts the most distortion on the ECG signal, mixing with the ECG band. This
makes the filtering process a real challenge [38]. Another problem with the muscle noise
is that it is unpredictable. The EMG noise is minimal or none when the patient is at rest.
Once the patient moves his/her limbs, starting to walk or run, the EMG noise is present
30
and its frequency band is constantly changing according to the body movements.
Similarly, ambient electrical noise mixes with the ECG band. However, it is more
predictable and is usually expressed only on a narrow frequency band. Hence, the filtering
process of power line or other ambient noise is more straightforward.
4.3 De-noising ECG Signal
In general, there are two approaches to the de-noising of ECG signal [39]. The signal can
be pre-filtered in the analogue domain and then further de-noised in the digital domain.
Figure 4.2. A typical set up for a hardware based de-noising of ECG signal. The
analogue ECG is band limited and amplified before the A/D conversion [39].
Hardware based analogue de-noising of ECG signal is illustrated in Figure 4.2. The
system contains an HPF and LPF with two stages of gain. Since the de-noising has already
been performed in the analogue domain, ADC resolution of 8 to 16 bits is usually
sufficient to obtain a high enough Signal-to-Noise Ratio (SNR). SNR refers to the ratio
of original signal power to the power of the noise. The higher the SNR is the better are
the chances of detecting the original signal.
Alternatively, an analogue ECG signal can be directly converted to the digital domain
where the de-noising is done [39]. In such a case, the resolution of the ADC-converter
must be greater than in the hardware based de-noising system in order to achieve a
sufficient SNR ratio. Digital de-noising reduces the overall signal resolution, hence the
higher SNR is required. The advantages of this approach are reduced hardware cost and
more accurate and flexible filtering. Despite the chosen de-noising approach, the DSP
filtering plays a crucial role in modern ECG monitoring devices. This is the case also in
this study, where ECG signal filtering of the proposed ECG monitoring framework will
partially rely on DSP filtering techniques.
31
4.3.1 Filtering systems
Digital de-noising of the ECG signal is typically done using FIR or IIR filters. These
filters can be used for basic filtering systems such as LPF, HPF, notch filters or as
components of more complex filtering systems. Some complex filtering systems
commonly used in ECG filtering are adaptive and wavelet filters. The benefit of these
complex systems is that they are generally better suited than basic filtering systems for
de-noising signals containing artefacts, such as all biometric signals which often mix with
each other. The drawback of using the complex filtering systems is that they introduce
more computational complexity and hence consume more processing power and area.
An adaptive filter is typically a digital FIR filter or any other fixed length filter in which
the filter coefficients are adjusted over the course of time [40]. Coefficient adjustment is
based on the difference between the obtained input signal containing some noise and a
desired signal fed to the system as second input. Wavelet filers, based on the Discrete
Wavelet Transform (DWT), also rely on FIR filters. The very basic concept of the wavelet
filter is that it first decomposes the input signal into wavelet coefficients using DWT. It
then compares the coefficients against a threshold value and substitutes them with zero if
they fall under the threshold. The signal is finally reconstructed or synthesised from the
wavelet coefficients. DWT is implemented using a finite length FIR filter bank containing
cascaded pairs of LP and HP filters each followed by a downsampler [41]. Each cascade
level represents a wavelet scale. The highest scale is at the first level, where the raw signal
enters the filtering bank, whereas the last level has the lowest scale. The LP and HP filters
divide the frequency band of the input signal in half, resulting in two separated low and
high frequency bands. Both bands are then downsampled. The downsampling process is
based on Nyqvist’s frequency theorem and alleviates further signal processing. After that,
output of the high frequency band represents the detailed wavelet coefficients and
requires no more processing, while the low frequency band, referred to as approximation
coefficients, and are passed to the next filtering level. There, the low frequency band is
once again divided and downsampled, creating a new pair of low and high frequency
bands. After each level, a new frequency division is introduced. The process stops when
the downsampling process fails to take any samples. The result at this point is a time-
frequency domain representation of the input signal in the form of wavelet coefficients.
The HPF output at the root of the filtering bank – the first filter pair – has the finest time
32
resolution and the most coarse frequency resolution of the input signal. The resolutions
change on each level so that the frequency resolution increases while the time resolution
decreases as it moves on down the cascaded filter bank. The actual filtering is done by
altering the obtained wavelet coefficients. The coefficients with a small amplitude value
have little or no effect on the original signal and can simply be set to zero. Typically, a
predefined threshold level is used to decide whether a particular coefficient is to be taken
into the reconstruction process or zeroed. The coefficients falling under the threshold
level represent the noise components of the original signal and hence can be removed.
The synthesis is simply a reverse procedure of DWT that starts from the lowest level. The
samples on each level are upsampled by a factor of two and then summed. Finally, the
output of the wavelet filter is available on the highest level of the synthesis tree.
4.3.2 ECG De-noising Techniques
The low frequency noise, that is respiratory and DC noise outside the ECG band, is
typically attenuated with a high-pass IIR or FIR filter. IIR is often chosen since it
introduces less computational complexity and delay into the system than FIR. However,
IIR filters have non-linear phase response. In other words, signal components from the
lower frequencies are delayed more than components from the higher frequencies. This
leads to a distortion in the original ECG signal and is especially problematic when
considering the ST-segment. The harmonics, between 0.05 – 0.5 have the most effect on
the ST-segment [36]. More precisely, if the harmonics from that frequency range were
filtered out, the ST-segment would be significantly distorted in the ECG output. The main
reason for this distortion is actually not the attenuation of the low frequency components,
but the non-linear phase shift over the harmonics caused by the IIR filtering. As a result,
when it comes to the precision of the ST-segment, the cut-off point for the high-pass IIR
filter should be no higher than 0.05 Hz. However, choosing such a cut-off frequency
reduces the efficiency of the baseline wander removal. Balanced against that, if a FIR
filter is used the cut-off frequency of HPF can be increased up to 0.5 Hz (the lowest
possible ECG signal component). The reason being that in FIR all frequency components
of the filtered signal are equally delayed. A FIR filter can therefore be used as DC and
baseline wander-remover with minimal distortion in the ST-segment and hence its use as
HPF in an ECG monitoring device is justified [42].
33
As in the de-noising process of baseline wander and DC component, the power line or
other ambient electrical noise can similarly be filtered using either FIR or IIR filters. The
filter type is typically a notch, narrow band, or an adaptive filter. In any case, the goal is
to sufficiently attenuate the unwanted noise band without distorting the ECG signal.
Depending on which part of the ECG band is attenuated, the filtering may cause distortion
in the ECG signal. For instance, a simple notch filter used to attenuate the 50Hz power
line noise may result in a distorted QRS-complex since their frequency bands overlap.
Another cause of distortion can be the non-linear phase response of the de-noising filter.
Optionally, the power line noise can be cancelled by using an adaptive filter for this
purpose [43]. In this case, the desired signal (the second input of the adaptive filter) is
extracted from the power line directly. The desired signal and filter output is used to
produce an estimate of the noise which is then subtracted from the ECG signal. Power
line noise is mainly a problem of more accurate diagnostic ECG devices with a frequency
band from 0.05Hz to 150 or even up to 250Hz in some cases.
Since the EMG noise mixes with the ECG band and varies in time, use of traditional static
filtering techniques for its removal, such as HPF, LPF, or notch filters, could lead to a
severely distorted ECG signal [44]. Therefore, filters used for that purpose are typically
adaptive or wavelet filers. The desired signal of the adaptive filter can be a correlated
noise estimate or an estimate of a clean ECG signal [43]. The wavelet filter on the other
hand provides a simultaneous view of the frequency and time domain components of the
ECG signal. This can be used to determine and suppress the presence of the EMG noise
in the ECG signal. In recent decades, much research has been devoted to this issue of
EMG removal. The consensus is that wavelet filtering is perhaps the most promising
approach to the problem. However, an all-embracing filtering system for EMG or other
artefact-removal still remains to be discovered [45].
4.4 Automated ECG Signal Detection
Automated detection of PQRST-waves, their relationships and intervals is the
fundamental task of an automated ECG monitoring device. Reliably detected ECG waves
allow the device to decide whether the ECG response is within its normal limits. A
reliable ECG wave detection is based on a robust signal peak detection and on an
intelligent decision logic that is able to map the ECG waves to the detected peaks.
34
Peak detection is a fundamental requirement of any signal processing system and has
likewise been a very active research topic over the last three decades. More than 40
publications are listed in reference [46] describing different peak detection methods. The
peak detection process locates the points where the signal amplitude is at its minimum or
maximum. Typically, the area where detection of amplitude and location can occur is
limited by a threshold level which defines the minimum or maximum amplitude value
that a candidate peak must obtain before it is accepted as such. Similarly, in time as in
frequency, rules must be applied to determine which of the adjacent min/max-values are
to be detected as a peak.
4.4.1 QRS-complex detection
The QRS-complex produces the most significant signal response in the ECG waveform.
For this reason, it provides a solid and easily detectable reference point to the cardiac
cycle. Once the QRS-complex is detected, the extraction of the other ECG waves and
their intervals can be done in relation to the detected QRS. Similar methods can be applied
for the detection of P and T waves and ECG intervals, as in the QRS-complex. Another
important feature of QRS is that the monitored heart rate can be determined from their
interval, measuring the time distance of two consecutive R-waves. Heart rate information
is not only valuable for the end users but also it plays an important role in correlating an
ECG detection system with a varying heart rate. The heart rate reveals the time-varying
nature of the ECG signal and can be used to adjust the system parameters of ECG
monitoring device to better match with the current situation. The heart rate information
could for instance be used in a de-noising process based on an adaptive filter system or
in threshold adjustment in various detection algorithms. Consequently, a robust detection
method of the QRS-complex is one of the fundamental parts of an ECG monitoring
device.
A vast number of differing methods for QRS detection have been introduced within the
past four decades [47], [48]. However, many of them share the same algorithmic structure
that divides the detection into two separated stages. In the first stage, called the pre-
processing stage, a feature signal is extracted from ECG. The pre-processing stage is
further divided into linear and non-linear filtering sub-stages. The second stage, the
decision stage, takes the feature signal as an input and detects the presence of the QRS-
35
complex, based on certain decision logic. The decision stage is similarly divide into two
sub-stages: the peak detection logic and the decision sub-stages. Firstly, the peak
detection logic detects the QRS-complex based on static or adaptive thresholds. After
that, possible false detections are then exposed in the decision sub-stage. The decision is
typically based on certain heuristic methods.
The earliest and still commonly used QRS detection methods are based on the digital
filters and differentiators [48]–[50]. At the pre-processing stage, a digital BPF first
attenuates the ECG signal components other than the ones forming the QRS-complex.
Subsequently, the narrow band signal is passed to a differentiator. The final stage of the
pre-processor is the generation of the feature signal. This is done by first squaring the
difference signal and then integrating the result over a predefined window length. From
now on, the feature signal enters into the peak detection stage. The peak detection
continuously monitors the feature signal and stores its most recent maximum into a max
variable. Simultaneously, the detector compares the feature signal with the max variable
and once the signal level descends below half of the max variable, the peak is detected.
At this point, the narrow band signal is examined within a time window preceding the
peak detection. The so- called fiducial mark is set to the location of the highest peak of
the narrow band signal. The window length and location is defined so that if possible it
includes the QRS-complex. After the peak detection, the max variable is updated to the
current value of the feature signal and the detection continues. The fiducial mark and the
height of the highest peak in the narrow band signal are stored into an event vector.
Finally, the decision sub-stage decides which of the peaks in the event vector is the R-
wave. The decision is based on a set of adaptive thresholds.
Another approach uses DWT filtering banks at the pre-processing stage to divide the ECG
signal into wavelet scales [51]. The wavelet scales that contain most of the energy of the
QRS-complex are chosen for the detection process. The QRS-complex shows on the
DWT scales as two modulus maxima with opposite signs and zero crossing in between.
The QRS-complex is detected when a simultaneous modulus maxima on the different
scales produces a signal in the threshold logic.
Many other QRS-detection methods have also been introduced. Some examples of these
include the neural network, matched filter, and adaptive filter methods. Despite their
36
different approaches to the QRS detection, they still follow the well-established division
of the detection process into the pre-processing and decision stages.
In this chapter, the ECG signal processing basics and some of the methods used in it have
been introduced. ECG is a time-varying, quasi-periodic signal, thus it can be represented
as a Fourier Series. The de-noising and other filtering processes of the ECG signal is
based on this very quality. Methods for ECG filtering processes are many and constantly
improving, since the research on this field is very active. For this reason, the framework
of an automated ECG monitoring device should consider this. That is to say, the
framework should allow an easy and flexible integration/upgrade for the signal
processing methods of the future. Furthermore, an agile framework enables an easy
interchange between methods if adaptions in the system are called for.
37
5 TECHNOLOGIES AND MATERIALS
This chapter concentrates on the technologies and materials used in this study. The main
emphasis is placed on the Programmable System-on-Chip (PSoC) technology to which
the proposed ECG Detection Framework is targeted. In addition, the chapter takes a brief
look at the ECG signal acquisition and transmission devices that were used in the case
study for this thesis.
PSoC typically contains a Reconfigurable Unit (RU), a hard core Processing Unit (PU),
reconfigurable interconnectivity buses within the chip, interfaces for external
communication, and finally a flexible design flow via a collection of development tools
[52]–[54]. PU is a collection of hard core devices inside PSoC that are able to interconnect
with RU and external peripherals. The heart of PU is the processor core. All major PSoC
vendors use an ARM core for this purpose. In addition, PU usually contains two levels of
cache memory, on-chip-memory, interfaces for various communication standards and an
interconnection bus allowing internal and external data transfer. RU sits right next to PU.
RU contains a large FPGA fabric and some domain specific programmable logic units
such as DSP blocks and A/D converters. Interconnections between and within units
occurs via a standardized interconnection bus [55]. For the ARM core, the bus protocol
standard is AMBA [56]. Furthermore, the system design and implementation is done
through a collection of development tools. The development environment seamlessly
combines HDL based hardware design to the software design in a Graphical User
38
Interface (GUI). Finally, the development tools offer ready-made accelerators or other
data path units in their Intellectual Property (IP) block libraries. The tools also allow the
creation of a custom IP block through a guided procedure. As a result, PSoC combines
all the essential features for system development on multiple application fields. Systems
requiring optimized parallelism and power consumption can in particular benefit from the
PSoC technology.
5.1 Zynq - All Programmable SoC by Xilinx
Xilinx introduced the first FPGA chip in the early 1980’s and has dominated the FPGA
markets ever since [57]. The recently released Xilinx Zynq-7000 series belongs to the
family of PSoCs and is known in Xilinx as All Programmable SoC (AP SoC). The Zynq
family packages two ARM cores and a vast FPGA fabric into a single chip [58].
Moreover, there are seven devices in the Zynq series each having a different size of FPGA
fabric [59]. In addition, Xilinx offers an extensive development tool set that allows a rapid
and flexible development flow for the Zynq devices.
5.1.1 Architecture
Figure 5.1 Architecture of the Zynq AP SoC by Xilinx [52]
39
Figure 5.1 illustrates the architecture of the Zynq AP SoC. In the Xilinx terminology, PU
is referred to as PS (Processing System) and RU is called PL (Programmable Logic). The
centre of PS is the Application Processing Unit (APU) [60, p. 16]. APU contains two
ARM Cortex-A9 cores, shared level 2 cache, On-Chip-Memory (OCM), Snoop Control
Unit (SCU), Direct Memory Access (DMA) unit, timer units, and other controller units.
Surrounding APU is the interconnect bus [60, p. 197]. The AXI interconnect bus of ARM
AMBA family provides configurable connectivity between the different units inside PS.
Furthermore, it allows PL to communicate with PS and vice versa. Moreover, APU has
dedicated bus interfaces to DRAM memory controller and to PL thus optimising L2 cache
access and coherence. Finally, PS can be linked via the interconnect bus to the
Multiplexed I/O (MIO) interface for external peripherals. As can be seen from the Figure
5.1, Zynq is able to interface with several different serial communication protocols. For
each protocol, Zynq offers two separated interfaces. In addition, there are also two Gigabit
Ethernet interfaces and a SD memory interface. The connections between the interfaces
and MIO are configurable and, within some limits, can also be expanded to the PL side
using the Extended MIO (EMIO). Whereas the PS side only offers the coarse-grained re-
configurability, the PL side provides the FPGA fabric with highly fine-grained
configurability. The size of FPGA varies between 17000 and almost 300000 Look Up
Tables (LUT) depending on the Zynq device. Additionally, the Zynq embeds special
coarse-grained units – DSP slices and Block RAMs – within the FPGA fabric, allowing
for a more optimized implementation of certain types of application specific systems as
in signal processing. Moreover, PL contains two 12-bit A/D converters for internal
condition monitoring (temperature, voltage levels) or for some external analogue system
purposes. For external communication, PL offers General Purpose Input/Output (GPIO)
banks. For clocking purposes, four clock inputs enter PL from PS side. Alternatively, PL
clocks itself independently by generating and distributing a clock signal originating from
PL. As a final feature, the Zynq also offers a hard or soft core security block (depending
on the Zynq device) which supports various security features offering the end user
protection on many different levels [60, p. 35].
40
ARM Cortex-A9
ARM processor – used in the Zynq series – is based on the ARM v7 architecture and is a
customized implementation of the Cortex-A9 processor [61] manufactured by Xilinx. The
customization includes the selection of the number of processor cores and the size of the
L1 cache. In addition, Xilinx has chosen to include some optional units namely NEON
engine and Floating Point Unit (FPU) in their instances from the Cortex-A9 cores [60, p.
20]. Each core has a dedicated level 1 cache which further divides so that there is a
separated 32KB cache for both instructions and data. Furthermore, NEON engine
performs Single Instruction Multiple Data (SIMD) operations on two input vector lines.
The size of the vectors and the line length can be configured. SIMD can be used to
accelerate data intensive processes such as video processing and other DSP processing.
Similarly, FPU offers acceleration for the floating point operation supporting the single
and double precision formats. Finally, since Cortex-A9 is an application level processor,
it is possible to run an Operating System (OS) such as embedded Linux on it. For this
reason, both of the ARM cores need a Memory Management Unit (MMU) to provide
virtual memory access for OS.
FPGA Fabric
Figure 5.2 The architecture of the programmable logic in the Zync-7000[60, p. 23]. The
Block RAMs and DSP48E1 slices are shown as green and blue rectangles respectively.
41
FPGA fabric occupies the largest area inside the Zynq PL. Figure 5.2 shows the
architecture of the FPGA fabric based on the Xilinx 7-series [62]. The main building
blocks of the FPGA fabric are the Configurable Logic Blocks (CLB) which interconnect
via the programmable interconnects. CLBs are placed into a matrix-like formation inside
PL. Right next to each CLB is a switch matrix that enables the configuration of various
interconnectivity routes between the different blocks inside the fabric. Furthermore, the
Input/Output Blocks (IOB) are located on the edges of PL. Finally, the special DSP and
memory resources – marked as green and blue rectangles in Figure 5.2 – are located
between the CLB rows.
Within CLB, there are two logic components called Slices. Each Slice connects directly
to the switch matrix. Additionally, both Slices have a dedicated input and output for carry-
in and carry-out, respectively. The carry I/O can be used for building a bigger arithmetic
logic unit (ALU) by cascading CLBs vertically. Each Slice is further divided into four
Look Up Tables which are the smallest logic units in the Xilinx’s FPGA. LUT is a logic
resource that can be used for several different purposes. For instance, it can implement
any logic function taking six inputs. Alternatively, LUT can be used as a small Read Only
Memory (ROM) or a small Random Access Memory (RAM). Moreover, it can also
function as a shift register. Any of the earlier mentioned functionality can be scaled larger
by combining multiple LUTs together. In addition to LUTs, a Slice also contains eight
Flip-flops (FF) each able to hold a single bit. FFs are resettable and one of them can also
function as a latch if so required.
Special accelerators
As mentioned already, PL also contains special accelerator units namely DSP48E1 slice
and Block RAM [60, p. 25]. The special accelerator units are located in a column-like
formation within CLBs such that a Block RAM unit sits right next to each DSP48E1 slice
(Figure 5.2). This arrangement is optimal for arithmetic operations requiring high speed
and fast access to data.
DSP48E1 is especially designed for DSP operations but can similarly be used for any
other functions requiring addition/subtraction, multiplication or, alternatively, logical
operations. In particular, the operations having medium or long word length benefit from
42
the DSP48E1 slice, since their implementation on traditional FPGA slice logic could
consume an unacceptable amount of resources.
Figure 5.3 The architecture of the DSP48E1 slice [60, p. 27]
I/O ports, their bit widths, and the main operation units of the slice are visualised in Figure
5.3. DSP48E1 slice defines four input ports namely A, B, C, and D and produces a single
output to port P. The main arithmetic units are pre-adder, multiplier, and post-adder. Both
of these adders are also capable of performing subtraction. Moreover, the post-adder can
also function as a logic operator supporting all basic Boolean operations.
Referring again to Figure 5.3, ports A and D connect to the pre-adder/subtractor. The
output of the pre-adder/subtractor and port B form the inputs of the multiplier. The post-
adder/subtractor takes one input from port C and the other can be either the multiplier
output or the previous value of P. The operations performed on the inputs are configured
using a control register called OPMODE. The configuration may include only one, two
or all three operation units depending on the required functionality. For instance, the
DSP48E1 slice can function as a simple accumulator taking its input from port C and
providing its output to port P. In that case, the two other units are not used. Typical usage
of the slice is as a tap for a FIR filter. A complete FIR filter can be achieved through a
cascading configuration that connects adjacent slices or taps together.
The second special resource, Block RAM, offers an alternative to the distributed RAM.
Being dedicated memory units, Block RAMs have advantages over the distributed RAMs
43
when concentrated memories with high capacity and small latency are required. On the
other hand, the distributed RAM is better suited to the systems that require small capacity
memories with sparse physical location. The block RAMs can either be implement as
RAM or ROM. Additionally, it can be used as First In First Out (FIFO) buffer. Each block
RAM unit contains by default a single 36Kb RAM memory divided into 2048 elements.
The default element length is 18-bits. Alternatively, the block can be divided into two
independent memory block of size 18Kb. The element length can similarly be reduced
resulting in greater numbers of elements in each memory block. In contrast, the element
length can also be increased. This naturally results in fewer elements.
Advanced Extensible Interface
Advanced eXtensible Interface (AXI) interconnection set defines the interconnection
switches which allow physical connections between units, bus protocols, and finally
interfaces for bus access [60, p. 30]. AXI is specified in the ARM AMBA 3.0 open
standard and its current version is AXI4.
AXI4 is the fundamental part of the Zynq’s interconnection scene. It provides the means
for the PS-PL communication as well as for the internal communication within both PS
and PL fabrics. The PS-PL communication occurs over three different interconnect
switches and also over a special type of Accelerator Coherence Port (ACP). Through
ACP, a processing element in PL is able to coherently access the APU caches. The three
interconnect switches are named memory interconnect, master interconnect, and slave
interconnect. They all reside on the PS side. These switches further connect to the central
interconnect inside PS. The memory interconnect offers four high-speed master interfaces
(AXI_HP) for PL side. The interfaces are FIFO buffered and sometimes referred to as
AXI FIFO interfaces. Similarly, the master and slave interconnects offer two general
purpose interfaces, slaves (S_AXI_GP) and masters (M_AXI_GP) respectively for the
PL side.
A system designer is able to select between three different AXI4 protocols when
implementing PL-PS inter-communication. First, AXI4 is a memory mapped bus protocol
offering high-speed address based bus communication. After each address transaction, a
burst of data (max. 256 words) can be received. AXI4-Lite is similarly memory-mapped
bus protocol, but without any burst features. Finally, AXI4-Stream is an ultra-high speed
44
streaming protocol which is not memory mapped. That is, a bus transaction over the
AXI4-Stream protocol does not require addressing. Hence, it is well suited for data
streaming.
5.1.2 Embedded System Design for Zynq Devices
In general, system development of a PSoC device requires a setup of the development
environment that provides tools for both hardware and software development as well as
the means for system prototyping. System design for Zynq is no different from the
previous one. Xilinx provides a development tool set called Vivado design suite to be
used with Zynq [60, p. 47]. The Vivado suite comprises the Vivado IDE for the hardware
design, Software Development Kit (SDK) for the Cortex-A9 programming, and
programming and debugging interfaces for the target devices or development boards.
Optionally, the Vivado suite also provides a High Level Synthesis (HLS) tool for
generating and testing IP blocks using only C-language. The HLS synthesises a C based
IP block into a Hardware Description Language (HDL) to be included in the hardware
design using the Vivado IDE. Another optional feature of the Vivado suite is the System
Generator which enables a system design to be done using graphical blocks in the
Mathwork’s Simulink environment [60, p. 241]. Moreover, a system, or a part of the
system, designed in the Simulink environment can be directly simulated on the hardware
via a procedure called co-hardware simulation. Finally, within the Vivado suite are also
delivered a documentation tool and a license management application. The Vivado design
suite is license based, and a stripped-down version of it can be freely obtained [63].
Design Flow
Vivado design flow follows the traditional development path, starting from the system
requirements and specifications phase, continuing to the system design phase, forking
into the hardware and software development, and terminating in the system integration
and testing phase [60, p. 53]. The design flow is unlikely to be a single pass-through
process of all the phases, but will more likely require several different iterations between
phases. Therefore, it is important that the design can be flexibly refined in each phase.
45
Figure 5.4 The embedded system design flow for the Zynq.[60, p. 53]
Figure 5.4 visualises the system design flow of the Vivado suite. The purpose of the first
phase is to extract system parameters from the project requirements and formulate system
specifications based on those parameters. The system parameters should as accurately as
possible describe the end system. The second phase, the system specification phase,
further clarifies the system by describing the behaviour and functionality of the system.
In addition, the system specifications should contain system performance requirements,
definition of used technologies and other implementation details. Once the system is
specified, the actual system design phase may start.
46
The system design phase is probably the most demanding phase in the design flow. In
this phase, a high-level abstraction of the system is created in the form of system
interfaces and parameters. The high-level model is then further broken down into the
different internal system modules and their interconnects. The internal module division
is based on the different system functionalities and their logical sequential ordering. Once
the functional modules are defined, the next step is to determine the PL/PS mappings for
the functional modules. In other words, which of the modules are implemented on the PL
side and which on the PS side. In the traditional software/hardware partitioning scene, PS
represents software while PL relates to the hardware. Typical criteria in PL/PS
partitioning are system performance, energy consumption and required area. In practice,
the end result is a kind of compromise of previous criteria, since their effect to each other
are typically inversely proportional. As a rule of thumb, the functions requiring intensive
computational processing or those susceptible to parallelism are usually implemented on
the PL side. The reason for this is that PL provides higher computational power in terms
of parallelism and reduced power consumption over PS. Conversely, for instance tasks
requiring OS support, or which include complex sequential logic, are more likely to be
mapped on the PS side.
The next step from the system design is the development process. Initially, a rough
hardware base system, containing at least the PS block, is implemented in Vivado IDE
and exported to SDK. This is mandatory, since the PS block represents the ARM
processor on which the software or the application project in SDK is built. From now on,
the development process can occur simultaneously on both Vivado IDE and SDK in
iterative manner. That is, the software is developed in parallel with the hardware system
between two consecutive development iterations. A development iteration occurs when
the next hardware system release is ready to be exported to SDK. Before that, the
hardware system can be tested on the signal level in the Vivado IDE simulator. After each
iteration, the current software release is tested on the new hardware system, and feedback
is given to the hardware development team. The iterations continue until both software
and hardware implementations are considered ready for system integration and final
testing.
As a final phase, the system integration and final testing phase integrates all modules of
the system into a single end system. The final system is then tested against the system
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015
Siirila_Antti_master_thesis_final_june_2015

More Related Content

What's hot

A portable electrocardiogram for real‑time monitoring of cardiac
A portable electrocardiogram for real‑time monitoring of cardiacA portable electrocardiogram for real‑time monitoring of cardiac
A portable electrocardiogram for real‑time monitoring of cardiacArhamSheikh1
 
Towards development of a low cost and
Towards development of a low cost andTowards development of a low cost and
Towards development of a low cost andArhamSheikh1
 
B05507010
B05507010B05507010
B05507010inventy
 
Snomed gpfp ref set and icpc jamoulle m
Snomed gpfp ref set and icpc jamoulle mSnomed gpfp ref set and icpc jamoulle m
Snomed gpfp ref set and icpc jamoulle mMiguel Pizzanelli
 
Cardionics Belgium ECG systems for CRO
Cardionics Belgium ECG systems for CROCardionics Belgium ECG systems for CRO
Cardionics Belgium ECG systems for CROCARDIONICS BELGIUM
 
IRJET- Detection of Abnormal ECG Signal using DWT Feature Extraction and CNN
IRJET- Detection of Abnormal ECG Signal using DWT Feature Extraction and CNNIRJET- Detection of Abnormal ECG Signal using DWT Feature Extraction and CNN
IRJET- Detection of Abnormal ECG Signal using DWT Feature Extraction and CNNIRJET Journal
 
Soroka New CT Scanner project description
Soroka New CT Scanner project descriptionSoroka New CT Scanner project description
Soroka New CT Scanner project descriptionSoroka Medical Center
 
PERFORMANCE EVALUATION OF ARTIFICIAL NEURAL NETWORKS FOR CARDIAC ARRHYTHMIA C...
PERFORMANCE EVALUATION OF ARTIFICIAL NEURAL NETWORKS FOR CARDIAC ARRHYTHMIA C...PERFORMANCE EVALUATION OF ARTIFICIAL NEURAL NETWORKS FOR CARDIAC ARRHYTHMIA C...
PERFORMANCE EVALUATION OF ARTIFICIAL NEURAL NETWORKS FOR CARDIAC ARRHYTHMIA C...IAEME Publication
 
Acquiring Ecg Signals And Analysing For Different Heart Ailments
Acquiring Ecg Signals And Analysing For Different Heart AilmentsAcquiring Ecg Signals And Analysing For Different Heart Ailments
Acquiring Ecg Signals And Analysing For Different Heart AilmentsIJERA Editor
 
Real Time Implementation and Investigation of Wireless Device of Electrical S...
Real Time Implementation and Investigation of Wireless Device of Electrical S...Real Time Implementation and Investigation of Wireless Device of Electrical S...
Real Time Implementation and Investigation of Wireless Device of Electrical S...ijtsrd
 
METHODS FOR IMPROVING THE CLASSIFICATION ACCURACY OF BIOMEDICAL SIGNALS BASED...
METHODS FOR IMPROVING THE CLASSIFICATION ACCURACY OF BIOMEDICAL SIGNALS BASED...METHODS FOR IMPROVING THE CLASSIFICATION ACCURACY OF BIOMEDICAL SIGNALS BASED...
METHODS FOR IMPROVING THE CLASSIFICATION ACCURACY OF BIOMEDICAL SIGNALS BASED...IAEME Publication
 

What's hot (15)

A portable electrocardiogram for real‑time monitoring of cardiac
A portable electrocardiogram for real‑time monitoring of cardiacA portable electrocardiogram for real‑time monitoring of cardiac
A portable electrocardiogram for real‑time monitoring of cardiac
 
Towards development of a low cost and
Towards development of a low cost andTowards development of a low cost and
Towards development of a low cost and
 
Project Report
Project ReportProject Report
Project Report
 
B05507010
B05507010B05507010
B05507010
 
Snomed gpfp ref set and icpc jamoulle m
Snomed gpfp ref set and icpc jamoulle mSnomed gpfp ref set and icpc jamoulle m
Snomed gpfp ref set and icpc jamoulle m
 
Cardionics Belgium ECG systems for CRO
Cardionics Belgium ECG systems for CROCardionics Belgium ECG systems for CRO
Cardionics Belgium ECG systems for CRO
 
Sensors 21-02777
Sensors 21-02777Sensors 21-02777
Sensors 21-02777
 
IRJET- Detection of Abnormal ECG Signal using DWT Feature Extraction and CNN
IRJET- Detection of Abnormal ECG Signal using DWT Feature Extraction and CNNIRJET- Detection of Abnormal ECG Signal using DWT Feature Extraction and CNN
IRJET- Detection of Abnormal ECG Signal using DWT Feature Extraction and CNN
 
eUno R10
eUno R10eUno R10
eUno R10
 
Soroka New CT Scanner project description
Soroka New CT Scanner project descriptionSoroka New CT Scanner project description
Soroka New CT Scanner project description
 
Soroka256 c tscanner
Soroka256 c tscannerSoroka256 c tscanner
Soroka256 c tscanner
 
PERFORMANCE EVALUATION OF ARTIFICIAL NEURAL NETWORKS FOR CARDIAC ARRHYTHMIA C...
PERFORMANCE EVALUATION OF ARTIFICIAL NEURAL NETWORKS FOR CARDIAC ARRHYTHMIA C...PERFORMANCE EVALUATION OF ARTIFICIAL NEURAL NETWORKS FOR CARDIAC ARRHYTHMIA C...
PERFORMANCE EVALUATION OF ARTIFICIAL NEURAL NETWORKS FOR CARDIAC ARRHYTHMIA C...
 
Acquiring Ecg Signals And Analysing For Different Heart Ailments
Acquiring Ecg Signals And Analysing For Different Heart AilmentsAcquiring Ecg Signals And Analysing For Different Heart Ailments
Acquiring Ecg Signals And Analysing For Different Heart Ailments
 
Real Time Implementation and Investigation of Wireless Device of Electrical S...
Real Time Implementation and Investigation of Wireless Device of Electrical S...Real Time Implementation and Investigation of Wireless Device of Electrical S...
Real Time Implementation and Investigation of Wireless Device of Electrical S...
 
METHODS FOR IMPROVING THE CLASSIFICATION ACCURACY OF BIOMEDICAL SIGNALS BASED...
METHODS FOR IMPROVING THE CLASSIFICATION ACCURACY OF BIOMEDICAL SIGNALS BASED...METHODS FOR IMPROVING THE CLASSIFICATION ACCURACY OF BIOMEDICAL SIGNALS BASED...
METHODS FOR IMPROVING THE CLASSIFICATION ACCURACY OF BIOMEDICAL SIGNALS BASED...
 

Similar to Siirila_Antti_master_thesis_final_june_2015

APPLICATION OF 1D CNN IN ECG CLASSIFICATION
APPLICATION OF 1D CNN IN ECG CLASSIFICATIONAPPLICATION OF 1D CNN IN ECG CLASSIFICATION
APPLICATION OF 1D CNN IN ECG CLASSIFICATIONIRJET Journal
 
Real time ECG Monitoring: A Review
Real time ECG Monitoring: A ReviewReal time ECG Monitoring: A Review
Real time ECG Monitoring: A Reviewijtsrd
 
Electrocardiogram signal processing algorithm on microcontroller using wavele...
Electrocardiogram signal processing algorithm on microcontroller using wavele...Electrocardiogram signal processing algorithm on microcontroller using wavele...
Electrocardiogram signal processing algorithm on microcontroller using wavele...IJECEIAES
 
A simple portable ecg monitor with iot
A simple portable ecg monitor with iotA simple portable ecg monitor with iot
A simple portable ecg monitor with iotArhamSheikh1
 
Bachelorthesis.compressed
Bachelorthesis.compressedBachelorthesis.compressed
Bachelorthesis.compressedDhara Shah
 
Classification and Detection of ECG-signals using Artificial Neural Networks
Classification and Detection of ECG-signals using Artificial Neural NetworksClassification and Detection of ECG-signals using Artificial Neural Networks
Classification and Detection of ECG-signals using Artificial Neural NetworksGaurav upadhyay
 
A Review on ECG -Signal Classification of Scalogram Snap shots the use of Con...
A Review on ECG -Signal Classification of Scalogram Snap shots the use of Con...A Review on ECG -Signal Classification of Scalogram Snap shots the use of Con...
A Review on ECG -Signal Classification of Scalogram Snap shots the use of Con...IRJET Journal
 
Heart monitoring
Heart monitoringHeart monitoring
Heart monitoringAmit Sheth
 
Classifying electrocardiograph waveforms using trained deep learning neural n...
Classifying electrocardiograph waveforms using trained deep learning neural n...Classifying electrocardiograph waveforms using trained deep learning neural n...
Classifying electrocardiograph waveforms using trained deep learning neural n...IAESIJAI
 
Fpga based heartbeats monitor with
Fpga based heartbeats monitor withFpga based heartbeats monitor with
Fpga based heartbeats monitor withijcseit
 
Design and implementation of portable electrocardiogram recorder with field ...
Design and implementation of portable electrocardiogram  recorder with field ...Design and implementation of portable electrocardiogram  recorder with field ...
Design and implementation of portable electrocardiogram recorder with field ...IJECEIAES
 
Electrocardiograph signal recognition using wavelet transform based on optim...
Electrocardiograph signal recognition using wavelet transform  based on optim...Electrocardiograph signal recognition using wavelet transform  based on optim...
Electrocardiograph signal recognition using wavelet transform based on optim...IJECEIAES
 
Arduino based heartbeat monitoring system.
Arduino based heartbeat monitoring system.Arduino based heartbeat monitoring system.
Arduino based heartbeat monitoring system.Arkadeep Dey
 
Deep Learning for Health Informatics
Deep Learning for Health InformaticsDeep Learning for Health Informatics
Deep Learning for Health InformaticsJason J Pulikkottil
 
FPGA BASED HEARTBEATS MONITOR WITH FINGERTIP OPTICAL SENSOR
FPGA BASED HEARTBEATS MONITOR WITH FINGERTIP OPTICAL SENSOR FPGA BASED HEARTBEATS MONITOR WITH FINGERTIP OPTICAL SENSOR
FPGA BASED HEARTBEATS MONITOR WITH FINGERTIP OPTICAL SENSOR ijcseit
 

Similar to Siirila_Antti_master_thesis_final_june_2015 (20)

APPLICATION OF 1D CNN IN ECG CLASSIFICATION
APPLICATION OF 1D CNN IN ECG CLASSIFICATIONAPPLICATION OF 1D CNN IN ECG CLASSIFICATION
APPLICATION OF 1D CNN IN ECG CLASSIFICATION
 
Real time ECG Monitoring: A Review
Real time ECG Monitoring: A ReviewReal time ECG Monitoring: A Review
Real time ECG Monitoring: A Review
 
Electrocardiogram signal processing algorithm on microcontroller using wavele...
Electrocardiogram signal processing algorithm on microcontroller using wavele...Electrocardiogram signal processing algorithm on microcontroller using wavele...
Electrocardiogram signal processing algorithm on microcontroller using wavele...
 
A simple portable ecg monitor with iot
A simple portable ecg monitor with iotA simple portable ecg monitor with iot
A simple portable ecg monitor with iot
 
Bachelorthesis.compressed
Bachelorthesis.compressedBachelorthesis.compressed
Bachelorthesis.compressed
 
Classification and Detection of ECG-signals using Artificial Neural Networks
Classification and Detection of ECG-signals using Artificial Neural NetworksClassification and Detection of ECG-signals using Artificial Neural Networks
Classification and Detection of ECG-signals using Artificial Neural Networks
 
A Review on ECG -Signal Classification of Scalogram Snap shots the use of Con...
A Review on ECG -Signal Classification of Scalogram Snap shots the use of Con...A Review on ECG -Signal Classification of Scalogram Snap shots the use of Con...
A Review on ECG -Signal Classification of Scalogram Snap shots the use of Con...
 
Heartm~1
Heartm~1Heartm~1
Heartm~1
 
Heart monitoring
Heart monitoringHeart monitoring
Heart monitoring
 
50620130101003
5062013010100350620130101003
50620130101003
 
Classifying electrocardiograph waveforms using trained deep learning neural n...
Classifying electrocardiograph waveforms using trained deep learning neural n...Classifying electrocardiograph waveforms using trained deep learning neural n...
Classifying electrocardiograph waveforms using trained deep learning neural n...
 
D04101822
D04101822D04101822
D04101822
 
Tesis ver final
Tesis ver finalTesis ver final
Tesis ver final
 
Fpga based heartbeats monitor with
Fpga based heartbeats monitor withFpga based heartbeats monitor with
Fpga based heartbeats monitor with
 
Design and implementation of portable electrocardiogram recorder with field ...
Design and implementation of portable electrocardiogram  recorder with field ...Design and implementation of portable electrocardiogram  recorder with field ...
Design and implementation of portable electrocardiogram recorder with field ...
 
PPT format 1.pptx
PPT format 1.pptxPPT format 1.pptx
PPT format 1.pptx
 
Electrocardiograph signal recognition using wavelet transform based on optim...
Electrocardiograph signal recognition using wavelet transform  based on optim...Electrocardiograph signal recognition using wavelet transform  based on optim...
Electrocardiograph signal recognition using wavelet transform based on optim...
 
Arduino based heartbeat monitoring system.
Arduino based heartbeat monitoring system.Arduino based heartbeat monitoring system.
Arduino based heartbeat monitoring system.
 
Deep Learning for Health Informatics
Deep Learning for Health InformaticsDeep Learning for Health Informatics
Deep Learning for Health Informatics
 
FPGA BASED HEARTBEATS MONITOR WITH FINGERTIP OPTICAL SENSOR
FPGA BASED HEARTBEATS MONITOR WITH FINGERTIP OPTICAL SENSOR FPGA BASED HEARTBEATS MONITOR WITH FINGERTIP OPTICAL SENSOR
FPGA BASED HEARTBEATS MONITOR WITH FINGERTIP OPTICAL SENSOR
 

Siirila_Antti_master_thesis_final_june_2015

  • 1. Reconfigurable Framework for Abnormality Aware ECG Monitoring Device - Programmable SoC Approach UNIVERSITY OF TURKU Faculty of Mathematics and Natural Science Department of Information Technology June 2015 Antti Siirilä Supervisors PhD (Tech), Tomi Westerlund PhD (Tech), Pasi Liljeberg The originality of this thesis has been checked in accordance with the University of Turku quality assurance system using the Turnitin OriginalityCheck service.
  • 2. i UNIVERSITY OF TURKU Department of Information Technology ANTTI SIIRILÄ Reconfigurable Framework for Abnormality Aware ECG Monitoring Device – Programmable SoC Approach Master Thesis, 90 pages, 3 Appendices Embedded Computing June 2015 In the field of public healthcare, there is an increasing need for financially and structurally more efficient health services. This has initiated a new area of research and development named eHealth. The research on this area targets to alleviate and automate common procedures and techniques of healthcare by exploiting novel Information and Communication Technology innovations. One of the best-known and most used healthcare tool is Electrocardiography (ECG). Ever since its invention by William Einthoven at the onset of the 20th century, ECG has provided an indispensable means for monitoring heart functions. For this reason, various eHealth research projects have strived to develop ECG based automated systems for telemedicine purposes. This thesis defines a reconfigurable framework for ECG based patient monitoring systems, targeting implementation on recently introduced Programmable System-on- Chip (PSoC) technology. A procedure for abnormal ECG signal detection was introduced as part of this framework. The feasibility of the proposed ECG Detection Framework was demonstrated in a case study. For this, based on the defined framework, an ECG monitoring system was implemented on a PSoC chip. Furthermore, a customisable Intellectual Property block was developed as part of the implementation process. This block, including required datapath interfaces and drivers, provides an implementation base for the ECG Detection Framework. The results of the case study demonstrate that PSoC technology, together with the proposed ECG Detection Framework, enables fast and flexible development of an ECG monitoring system. Furthermore, detection of an abnormal ECG signal close to the signal source implies reduced data transfer between patient’s device and a healthcare centre, and thus the power consumption of the patient’s device can be optimised. Key words: ECG, Programmable System-on-Chip, Reconfigurable computing
  • 3. ii TURUN YLIOPISTO Informaatioteknologian laitos ANTTI SIIRILÄ Reconfigurable Framework for Abnormality Aware ECG Monitoring Device – Programmable SoC Approach Diplomityö, 90 sivua, 3 Liitesivua Embedded Computing Kesäkuu 2015 Viime vuosikymmenen aikana on tutkittu keinoja tehostaa terveydenhuollon palveluita mm. informaatio- ja kommunikaatioteknologiassa kehitettyjä innovaatiota hyödyntämällä. Yhtenä osana tätä tutkimusta on ollut potilaan etäseurantajärjestelmät. Näistä tärkeimpinä erottuvat Elektrokardiogrammiin pohjautuvat järjestelmät, mihin myös tämän diplomityön aihe sijoittuu. Diplomityössä määritettiin muokattava järjestelmä, joka käyttää ohjelmoitavaa järjestelmäpiiriä Elektrokardiogrammi-pohjaisten potilaan seurantalaitteiden toteutukseen. Yhtenä osana määritettyä järjestelmää on normaalista poikkeavan Elektrokardiogrammin tunnistamismekanismin kuvaaminen, sekä tästä saatavan tiedon hyödyntäminen etälaitteen tiedonsiirron ja siitä mahdollisesti seuraavan energian kulutuksen pienentämisessä. Lisäksi diplomityössä toteutettiin määritettyyn järjestelmään pohjautuva toteutus ohjelmoitavalla järjestelmäpiirillä. Toteutuksesta saadut tulokset osoittavat, että ohjelmoitavaa järjestelmäpiiriä voidaan pitää varteenotettavana teknologiana, kun toteutetaan laitetta, joka tunnistaa normaalista poikkeavia Elektrokardiogrammisignaaleja. Avainsanat: EKG, Ohjelmoitava järjestelmäpiiri
  • 4. iii ACKNOWLEDGEMENT I gratefully acknowledge my supervisors PhD (Tech) Tomi Westerlund and PhD (Tech) Pasi Liljeberg for their valuable guidance and worthy comments during this stimulating project. I also want to thank Pasi for providing me work facilities at the University of Turku. Big thanks to Mikko Koskinen, Janne Rantasalo and Markku Saarinen in KONE for their flexible and helpful attitude towards my studies. Jarno Laiho, Jani Järvinen, and Jarmo Rantanen also get my appreciations for their readiness to arrange work for me whenever I so desired. A special thanks also to all my workmates at KONE Turku for their support. My deepest appreciation goes to my language consultant and beloved friend Andrew Stevenson for his priceless support during the writing process. Merci infiniment mon vieux! I sincerely thank my dear wife Noora for valuable and well-timed pokes she gave me when I needed to move forward. My sons Pessi and Pieti get a big hug for many pleasing and relaxing Lego building sessions we had together. Our dog Rontti gets a big belly rub for taking me out into fresh air in a daily basis. I love you all! A warm thanks to my mother-in-law Kaisa for smoothening our daily routines by looking after the boys and cooking the dinners. That really helped a lot, thank you! I also want to thank Lotta for her medical commentary. I am also deeply grateful to my dad Jouko and my mom Merja for their strong example of never giving up. In Turku 4.6.2015 Antti Siirilä
  • 5. iv CONTENTS 1 INTRODUCTION 1 1.1 Motivation 2 1.2 Problem Statement 4 1.3 Thesis Structure 4 2 HEART 6 2.1 Anatomy of the Human Heart 6 2.2 Electrophysiology 8 2.3 Cardio Electrophysiology 9 2.4 Sinus Rhythms 12 3 ELECTROCARDIOGRAM 13 3.1 ECG Signal Acquisition 14 3.2 Interpreting ECG Response 19 3.3 Discussion 22 4 ECG FILTERING 24 4.1 Basic Concepts of the Filtering 25 4.2 Fourier Series of the ECG Signal 28 4.3 De-noising ECG Signal 30 4.4 Automated ECG Signal Detection 33 5 TECHNOLOGIES AND MATERIALS 37 5.1 Zynq - All Programmable SoC by Xilinx 38 2.1.1 Cardiac Cycle 6 2.1.2 Chambers 7 2.1.3 Valves 7 2.2.1 ION Current and Membrane 8 2.2.2 Membrane Potentials 8 2.3.1 Cardio Myocytes 10 2.3.2 Cardio Conduction System 10 2.3.3 Action Potential in Cardio Myocytes 11 3.2.1 ECG Waves and Cardiac Cycle 19 3.2.2 ECG Intervals and Segments 20 4.3.1 Filtering systems 31 4.3.2 ECG De-noising Techniques 32 4.4.1 QRS-complex detection 34
  • 6. v 5.2 Development Boards 50 6 ECG DETECTION FRAMEWORK 53 6.1 Data Flow 54 6.2 Filtering 55 6.3 Parameters 55 6.4 Analysis and Detection of ECG signal 60 6.5 Multi-Lead ECG Detection System 63 6.6 Summary 64 7 CASE STUDY 65 7.1 ECG Signal Acquisition 66 7.2 ECG Detection Application 68 7.3 Results and Discussion 77 8 CONCLUSION 82 REFERENCES 84 APPENDIX I: SCHEMATICS A APPENDIX II: BLOCK DESIGN, PART I B APPENDIX III: BLOCK DESIGN, PART II C 5.1.1 Architecture 38 5.1.2 Embedded System Design for Zynq Devices 44 5.2.1 ZedBoard Evaluation and Development Kit 50 5.2.2 Arduino Uno/e-Health Sensor Platform 51 6.3.1 Generics 56 6.3.2 Registers 57 7.2.1 Hardware Implementation 68 7.2.2 Filters 69 7.2.3 ECG Detector 70 7.2.4 Control Unit Software 76 7.3.1 Feature Signal 78 7.3.2 R-wave Detection 78 7.3.3 Abnormality Detection 79 7.3.4 Statistical Calculations 80
  • 7. vi FIGURES Figure 2.1 Human heart in diastole and systole states..................................................................................7 Figure 2.2 Location of the SA and AV nodes, AV bundles, and Purkinje Fibres ......................................10 Figure 3.1 The placement of the ECG electrodes on human body............................................................. 15 Figure 3.2 The axial reference system defines the viewing angle for each Lead in relation to the heart ...16 Figure 3.3. The ECG deflections acquired with the four electrodes .......................................................... 17 Figure 3.4 Wiggers Diagram maps the ECG signal to the cardiac cycle....................................................19 Figure 3.5 The points of interests in the ECG signal are PR-, QT-, QRS intervals and ST segment.........21 Figure 4.1 Graphical illustration of a waveform and its Fourier Series .....................................................27 Figure 4.2. A typical set up for a hardware based de-noising of ECG signal.............................................30 Figure 5.1 Architecture of the Zynq AP SoC by Xilinx.............................................................................38 Figure 5.2 The architecture of the programmable logic in the Zync-7000.................................................40 Figure 5.3 The architecture of the DSP48E1 slice .....................................................................................42 Figure 5.4 The embedded system design flow for the Zynq. .....................................................................45 Figure 5.5 The layered software stack of SDK .......................................................................................... 49 Figure 5.6 Arduino Uno and e-Health sensor platform v 1.0 boards ......................................................... 51 Figure 6.1 Architecture of the ECG Detection system...............................................................................54 Figure 6.2 Architecture of the ECG Detector unit .....................................................................................60 Figure 6.3 High-level FSM for the peak detection sequence of the Peak detector.....................................61 Figure 6.4 The queue structure of the extracted peak and interval values of ECG ....................................62 Figure 6.5. Multi-Lead framework for an ECG Detection system with three Leads..................................63 Figure 7.1 ZedBoard and Arduino/e-Health-Shield boards used in the case study....................................65 Figure 7.2 High-level system architecture of the case study application ...................................................66 Figure 7.3 Behavioural state machine of the ECG acquisition program run on Arduino Uno...................67 Figure 7.4 The magnitude response of the de-noising filter.......................................................................69 Figure 7.5 The magnitude response of the difference filter .......................................................................70 Figure 7.6 Re-customise IP window of the ECG Detector.........................................................................71 Figure 7.7 The hierarchy of the ECG Detector IP modules .......................................................................72 Figure 7.8 Behavioural state machine of the CU software.........................................................................76 Figure 7.9 Placement of the electrodes during the ECG acquisition .......................................................... 77 Figure 7.10 The de-noised ECG signal (above) in relation to the feature signal (below) .......................... 78 Figure 7.11 The detection window for the R-wave (above) in relation to the feature signal .....................78 Figure 7.12 ECG Abnormality signal actives ECG signal streaming in CU..............................................79 Figure 7.13 The min, max and mean values of detected R-wave peaks.....................................................80 Figure 7.14 The mean value of detected RR-intervals ...............................................................................81
  • 8. vii TABLES Table 3.1 The list of ECG electrodes and their placement on the body. ....................................................18 Table 4.1 The key frequency bands of the ECG signal ..............................................................................28 Table 4.2 Typical noise components that interfere with the ECG signal ...................................................29 Table 6.1 The generic parameters for the PL side components and the data busses connecting them.......56 Table 6.2 The threshold registers ...............................................................................................................57 Table 6.3 The statistics registers ................................................................................................................58 Table 6.4 The definition of the signals in ECG_STATUS register............................................................ 59
  • 9. 1 1 INTRODUCTION The field of public healthcare around the world is facing new financial and social challenges, as it needs to provide medical care for increasing number of senior citizens. In about 40 years’ time, the amount of people in the group older than 65 years is forecasted to be three times larger than today [1]. Within the near future, for the first time in its statistical history, this age group is estimated to exceed the age group of children under 5 years old. The reasons for this change are twofold. Firstly, vaccinations and other successful public health projects throughout the 20th century led to a drastic decline in communicable diseases, allowing for younger age groups to avoid premature death. Secondly, the average life expectancy in the overall population has grown dramatically and will continue to do so, resulting in a wider age span in the over 65 age group. Consequently, this change in the age range, together with the improved global control over communicable diseases, has led to a shift in disease patterns. The non-communicable diseases and chronical conditions will now cause more deaths and disability than the communicable diseases. Moreover, the non-communicable diseases such as heart disease, cancer, and diabetes will not only be the scourge of the average or high-income countries, but will also be prevalent in lower income countries. Hence, the amount of people globally suffering hearth disease or other non-communicable diseases will significantly increase within the coming decades and this will stress the public health care systems economically and socially worldwide [2].
  • 10. 2 As the pressure on the field of public healthcare increases, many nations have initiated projects targeting novel solutions for the healthcare systems [3]. These initiatives along with the rapid development of information and communication technologies (ICT) has given birth to a new field of research called eHealth. The eHealth concept combines medical science focused on development of new applications in healthcare with ICT. These eHealth applications include, among many others, telemedicine, patients’ data sharing, and intelligent home care. Heart diseases, described in medical terms as Cardio Vascular Diseases (CVD), are the largest group in the family of non-communicable diseases. CVD kills globally more than 17 million people every year, particularly in low and middle income countries [4]. In 2010, the global expenditures resulting from CVD were estimated to be more than 850 billion dollars and this trend is continuing. Early diagnosis of a latent heart problem is the key to the successful treatment in any abnormalities in the heart [5]. The key method for early diagnosis is Electrocardiography (ECG). It captures the heart’s electrical activity expressed in waveform. This waveform provides doctors with visually expressed evidence of a wide variety of heart conditions. As a consequence, the study of ECG based monitoring systems has been one of the leading research topics in the eHealth field [6]. 1.1 Motivation Architectural model for a remote ECG monitoring system is generally divided into several communication domains [6]. Firstly, the ECG signal is collected from sensors placed on the patient’s body and transferred to a gateway device. Communication between sensors and gateway is normally made over a short-range wireless connection commonly referred to as Body Area Network (BAN). The gateway device can be either portable (a smartphone carried on the patient) or stationary (a dedicated device located near the patient). Before the gateway device relays the ECG signal to the next communication domain, it typically performs some de-noising on the signal. The middle ware device at the border with the next communication domain is typically situated at the patient’s home. Desktop, laptop, or similar computers are common examples of this middle ware device. Transfer of the ECG signal from the gateway device to the middle ware device generally occurs over wireless connection such as Wi-Fi, Bluetooth, or similar. In addition, the
  • 11. 3 middle ware device provides some signal processing and storage services as well as further connectivity to a health care centre. Likewise, the middle ware device is capable of analysing the signal and, based on its analysis it can generate alarms or provide statistical information to the health care centre. Alternatively, the signal can be relayed directly to the health care centre for further analysis. The health care centre builds a real- time view of the patient’s health condition using the data received from the middle ware device. Based on the built view, the health professionals are then able to take any required actions concerning the patient’s health. Finally, the physical distance between health care centre and middle ware can be vast, thus the communication between them typically relies on internet protocols. For the gateway device to maintain an adequately long battery life, low power consumption is crucial. As is commonly known, long battery life is clearly an advantage to the user, since recharging or battery replacements occur less frequently. For this reason, in order to reduce computational burden on the gateway device and hence power consumption, the ECG signal is commonly relayed directly to the middle ware device. For this reason all signal data, even that containing normal sinus rhythm, is constantly transferred to the middle ware. However, the communication task is also known to be a large-scale power consumer which again stresses the battery life of the gateway [6]. On the other hand, if pre-analysis of the ECG signal in the gateway device already detects normal sinus rhythm, the communication cost could be reduced. Thus, only the samples containing data of an abnormal ECG signal would be transferred to the middle ware and the normal ECG signals could be ignored. For this scenario, the ECG signal analysis should be robust enough so that misinterpretations could be avoided. Therefore, the rules for detecting a normal ECG signal should be extremely strict. That is to say, no compromise can be allowed for the ECG detector. Any suspicious ECG signal, which by human interpretation could be analysed as normal, would get the status of abnormal in the machine interpretation. Even in this case, the decline of the communication cost could be significant. Additionally, statistical data could be extracted from the ECG signal during normal sinus rhythm. The results could then be sent to the middle ware, if so desired. A novel Programmable System-on-Chip (PSoC) technology has recently been introduced which offers a tempting platform for the applications performing Digital Signal Processing (DSP) or other computationally intensive tasks. It is tempting in the sense that
  • 12. 4 PSoC is a single chip device allowing for high computational tasks of the application to be accelerated in the reconfigurable hardware side of the chip while the actual application can reside on the traditional processor side as software. Moreover, tasks prone to parallelism can easily be executed concurrently on the reconfigurable fabric, thus achieving better performance with lower power consumption. The communication within the chip is based on programmable interconnects providing standardized bus interfaces and protocols. In addition, the development process of PSoC combines hardware and software development tools in a single kit enabling a straightforward and fast way for system implementation and testing. In the IT device markets PSoC, falls between full hardware and software systems by combining the features of both. All in all, PSoC promises selectively faster development times, better performance on reduced physical area, lower device and design cost with lower risks, and lower power consumption than the adjacent technologies. In conclusion, an ECG detection system is a model example of an application that could benefit from the PSoC platform. 1.2 Problem Statement The aim of this thesis study is to investigate the possibilities of using the recently introduced PSoC technology as a platform for an abnormality aware ECG detection system. More precisely, the goal is to propose a framework that provides a high-level description of the ECG detection system. The framework should allow a flexible selection of different digital signal processing techniques used in the abnormality detection process. Furthermore, the framework should describe how the abnormality awareness could be used to reduce the communication cost between the detector and the middle ware device. Finally, the feasibility of the proposed framework should be demonstrated in a case study. The goal of the case study is to produce an IP based block design that could be used as a base implementation for future studies on the ECG detector. 1.3 Thesis Structure The contents of this thesis is organised as follows: Firstly, Chapter 2 briefly discusses the anatomy and electrophysiology of the human heart. Secondly, Chapter 3 introduces ECG, focusing on the ECG signal acquisition and interpretation. Subsequently, Chapter 4 describes the basics of filtering, followed by a deeper analysis of the ECG signal
  • 13. 5 components. In addition, Chapter 4 introduces some de-noising techniques for the ECG signal and provides information on automated ECG signal detection methods. Next, Chapter 5 deals with the technologies and materials that were used in this thesis work. At this point, the ECG Detection Framework is defined in Chapter 6. Proceeding chapter, Chapter 7, describes the case study and discusses the results extracted from it. Ultimately, Chapter 8 concludes this thesis and suggests some ideas for the future work.
  • 14. 6 2 HEART To be able to build a system that captures, processes, and outputs the electrical activity of a human heart, it is crucial to understand the very basic biological and physiological phenomena controlling that activity. This chapter will therefore outline these phenomena. 2.1 Anatomy of the Human Heart The heart is an autonomously and periodically contracting and relaxing muscle that makes the blood circulate within the circulatory system. The principal parts of the heart muscle are the atria and ventricles (Figure 2.1), which can be further divided into the left and right segments. 2.1.1 Cardiac Cycle The two main phases of the cardiac cycle are illustrated in Figure 2.1. The phase in which the blood flows into the heart via the atria, filling the ventricles, is called diastole [7]. systole, respectively, refers to the phase when both ventricles are contracted and the blood is pumped out from the heart.
  • 15. 7 Figure 2.1 Human heart in diastole and systole states [8]. 2.1.2 Chambers The heart consist of four isolated chambers, the right and left atrium chambers, and similarly the right and left ventricle chambers. The chambers in the right side of the heart are responsible for pumping the deoxygenated blood returning from the circulation to the lungs to be oxygenated. The left atrium chamber then receives the oxygenated blood from the lungs and pumps it to the left ventricle chamber which again pumps it back to the circulation. 2.1.3 Valves Atria-ventricular blood flow occurs through the atrioventricular valves [7]. The right Atrioventricular valve is called the Tricuspid valve. This valve allows the blood to flow from the right atrium to the right ventricle in the diastole phase and blocks the reflux during the systole. The left Atrioventricular valve is called the Mitral (or Bicuspid) valve and it has the similar function on the left side as the Tricuspid has on the right side. In addition, there are two more unidirectional valves. The Semilunar valves, which allow the blood to run out from the ventricles. The Pulmonary valve (right Semilunar valve)
  • 16. 8 controls the blood flow from the right ventricle to the lungs. When the ventricle pressure reaches a certain threshold during the ventricle contraction, the pulmonary valve opens allowing the blood to run via the Pulmonary Artery to the lungs. Similarly, the Aortic valve (left Semilunar valve) works in between the left ventricle and Aorta, allowing the unidirectional bloodstream to flow out from the left ventricle. 2.2 Electrophysiology Electrical activity in a cell is caused by bidirectional flow of ions, in and out of the cell, causing changes in electrical potential between the intracellular space and the extracellular space. The forces that drive the ions to flow are diffusion and electromotive force. However, those physical phenomena do not solely define the movement of the ions, which is also highly regulated by various biological processes occurring in a lipid layer between the cell exterior and the interior called membrane. The equivalent circuit can be used to model the ionic concentration differences on a miniaturist spot of membrane [9]. 2.2.1 ION Current and Membrane Some elementary ions involved in the electrical activity of an animal cell are: Sodium (Na+ ), Potassium (K+ ), Calcium (Ca2+ ) as cation, and Chlorine (Cl- ) as anion [10]. Na+ and K+ are the most active when it comes to the ion current across the membrane. However, Ca2+ has an important role in some cells, such as heart muscle cardio myocytes. Typically, in an animal cell, there is a higher concentration gradient of K+ inside the membrane than outside and respectively a higher concentration of Na+ outside the membrane than inside. The membrane controls the otherwise passively occurring ion current, caused by diffusion and electrical force, through biological processes such as voltage gated and resting ion channels, and ion pumps. 2.2.2 Membrane Potentials Electrical potential difference between the outside and inside of the membrane is generally called membrane potential, and it can be measured [10]. Different membrane potentials indicate different functional states of the cell. Typically excitable cells, for example, the cardio myocytes, have three types of membrane potentials: resting, graded, and action.
  • 17. 9 When a cell is in a resting potential, there is none or little ion flow through the membrane, and therefore the membrane potential stabilizes at a certain level. Commonly, the resting potential of an excitable cell is around -70mV. As mentioned earlier, membrane controls the ion flow in and out of the cell. A mechanical, electrical, or molecular external stimulus affects the permeability of the membrane, making it permeable only for certain ions [10]. Usually Na+ ions are allowed to flow in the cell. When more Na+ ions flow in the cell, the Na+ current’s membrane potential becomes more and more positive. At a certain point when the membrane potential reaches a threshold level (around -55mV), voltage gated Na+ channels open and the inward Na+ current increases rapidly causing the cell to depolarize with the membrane potential becoming positive compared to the exterior of the cell. With the Na+ streaming into the cell, the membrane potential shoots up seeking the Na+ equilibrium potential. However, when the membrane voltage reaches the 40mV level at which the voltage gated K+ channels open in the membrane, the level drops downwards as fast as it had risen, due to the K+ now streaming out of the cell. The exiting K+ now causes the cell to repolarize below to the resting potential. This polarization phenomenon, which signals the cell to perform its job, is called the action potential. For example, in a muscle cell, the depolarization causes the cell to contract and the repolarization returns the muscle cell back to relaxation. Right after the action potential there is a phase called the Refractory period [11], during which the ion concentration of the cell is restored to the state prior to the action potential and the membrane potential reverts to the resting potential. During the refractory period, K+ and Na+ ions are exchanged through the membrane via ion pumps (against their driving force). This requires work, which again needs energy, provided by ATP within the cell. The subsequent action potential cannot occurs in a cell until the refractory period ends. 2.3 Cardio Electrophysiology Cardio electrophysiology includes the electrophysiological phenomena that occur in the heart muscle. Although it follows the basic rules of electrophysiology, it consists of mechanisms that are not expressed in any other part of the human body and hence it will be discussed in the following paragraphs.
  • 18. 10 2.3.1 Cardio Myocytes Heart muscle consists of cardio myocytes that are a specific type of muscle cell existing only in the heart. Cardio myocyte has the similar contraction and relaxation features as a skeletal muscle cell initiated by the action potential. However, cardio myocytes are electrically interconnected with each other and therefore are able to propagate the action potential throughout the muscle tissue. In addition, a cardio myocyte automatically adjusts its contraction pace in relation to the adjacent cardio myocyte having the highest contraction pace. Hence, all cardio myocytes connecting to each other strive towards a uniform contraction pace [12]. 2.3.2 Cardio Conduction System The systole and diastole phases are controlled by the conduction system [13]. The conduction system consists of a special type of cardio myocyte that generate, control, and carry the action potential throughout the heart muscle. The main tissues in the conduction system (Figure 2.2) are the Sinoatrial (SA) node, also known as pacemaker node, the Atrioventricular (AV) node, the bundle of HIS, and the Purkinje Fibres (PF). Figure 2.2 Location of the SA and AV nodes, AV bundles, and Purkinje Fibres [14]. In general, the SA node lies at the top part of the right atrium spreading downwards and finally connecting to the AV node via internodal pathways. The AV node sits in between the right atrium and ventricle, and is the only conduction point between the atria and the
  • 19. 11 ventricles. Continuing down from the AV node, the bundle of HIS further divides into two branches. One extends down to the bottom of the right ventricle and the other to the left ventricle respectively. At the ends of those branches, there are Purkinje Fibres that spread around the ventricles. 2.3.3 Action Potential in Cardio Myocytes The properties of the action potential in cardio myocytes vary depending on their anatomical location. The action potential in myocytes, forming the SV node, is similar with the ones in nerve and skeletal muscle cells. However, that action potential is autonomously excited by an ion current that is generally referred to the funny current [15], [16]. The funny current occurs during the refractory phase of the cell causing a slow continuous increase in the membrane potential. Since the membrane potential is steadily rising, it finally reaches to the threshold voltage leading to another action potential. The myocytes in the AV node have a similar mechanism for generating the action potential. However, since the action potential in the SV node occurs at a higher frequency than in AV node or in any other part of the cardio conduction system, the SV node is responsible for setting the heart’s pace [16]. Hence, the name pacemaker node. In the action potential of atrial and Ventricular myocytes, the repolarization phase is delayed due to Ca2+ influx [17]. The delay causes a plateau phase in the action potential, which prolongs the depolarization of the myocyte. The plateau directly defines the duration of the systole. Although, the plateau phase in action potential is expressed in both the atrial and ventricular myocytes, it is particularly significant in the ventricular myocytes. The plateau phase also defines the length of a period called Effective Refractory Period (ERP) [18]. During ERP, a new action potential cannot be generated in the cardiomyocyte. Hence, ERP protects the heart from too intensive beating. A typical ERP length varies from 150 ms to over 500 ms depending on the heart rate and the location of the cyrdiomyocyte.
  • 20. 12 2.4 Sinus Rhythms The heart is said to be in sinus rhythm, if the pace of the heart origins form the SA node. The normal sinus rhythm is in between 60 – 100 Beats Per Minute (bpm) depending on the individual [19]. If the pace is below 60 bpm, the rhythm is called sinus bradycardia. The sinus bradycardia is a normal condition and it often exists with persons in strong physical condition such as athletics. Conversely, when the heart rate increases over 100 bpm, the rhythm is then called sinus tachycardia. Sort-term sinus tachycardia is normal, especially when the person is under physical or mental stress. Elevated heart rate is also normal for infants. However, a long-term sinus tachycardia with no notable cause may indicate an abnormal behaviour of the heart. Ultimately, an irregularly beating heart, which is still excited from the SA node, is said to be in sinus arrhythmia. Sinus arrhythmia is usually a normal condition for young people, caused by the respiration cycle. However, in some case the sinus arrhythmia may be an indication of abnormal heart functions. A human heart is a complex system regulated by a vast number of different biological and physiological mechanisms, many of which still remain undiscovered. This chapter hopefully has brought up the essential information of those issues guiding the way to a better understanding of the following Electrocardiogram chapter.
  • 21. 13 3 ELECTROCARDIOGRAM Electrocardiogram refers to a method in which the electrical activity of the heart is captured and then visualised as a commonly known waveform of ECG. The resulted ECG waveform provides the means for doctors to point out different functions of the hearth. In addition, the waveform provides valuable information in the process of diagnosing abnormal behaviours of the heart. An ECG device can roughly be divided into three different units. Firstly, the signal acquisition unit captures an analogue ECG signal through a set of electrodes placed on the human body. Secondly, the signal processing unit filters the acquired signal aiming to reduce noise and other artefacts. In addition, the signal processing unit is responsible of converting the acquired signal into the digital domain via an A/D converter. The exact point where the conversion takes place varies depending on the system specifications. Finally, the processed ECG signal can be read from a user interface unit. How ECG describes the functionality of the heart is revealed in an interpretation process. The interpretation process focuses on the five key waves of the ECG waveform namely P, Q, R, S, and T [20]. Each wave represents a certain functionality in the heart. For instance, the Q, R, and S waves – generally called as QRS-complex – relate to the contraction in the ventricles. Alteration in any of the five waves may indicate an abnormal functionality of the heart. However, noise and other artefacts as well as the de-noising
  • 22. 14 process may equally alter the ECG output. Therefore, the de-noising of the ECG signal must be carefully designed and implemented in an ECG detection system. Since the ECG filtering is such a crucial part of an ECG detection system, the complete chapter 4 has been dedicated for it, and therefore it is not discussed in this chapter. This chapter, on the other hand, deals with the ECG electrodes and their placements as well as how electrodes in different locations provides different views from the heart. Finally, the ECG interpretation process is discussed. 3.1 ECG Signal Acquisition The ECG waveform is formed by measuring potential differences between two electrodes placed on human body as function of time. The shape of the waveform, or the Lead as it is generally referred, depends on from which direction the heart is measured. The direction again is defined by the placement of the electrodes in relation to the heart. The amount of measuring electrodes vary from 3-4 in ECG monitoring devices up to 10 in more accurate diagnosis device [21, p. 15]. The ECG electrodes works as an interface between the body and the ECG device. As mentioned earlier, the number of electrodes can vary from 3 to 10 depending on the ECG device. The devices used for the ECG monitoring is based on four electrodes namely the extremity electrodes or the limb electrodes (an electrode in each extremity). Very often, however, the number of electrodes is only three as defined by the father of ECG, William Einthoven [22]. The more accurate 12 Lead ECG devices provide a more thorough view of the heart by introducing six more electrodes referred as chest electrodes. The 12 Lead ECG devices are mainly used in the clinical environment for diagnosis purposes. Since the emphases of this study is on the ECG monitoring devices, this chapter concentrates only on the ECG acquisition with four or less electrodes. According to the Einthoven’s Triangle [22], the ECG electrodes are attached on the both upper limbs and on the left lower extremity. This three electrodes setup creates a triangle- like formation around the heart, in which the heart forms the centre point for the triangle. The legs of the triangle are called Leads.
  • 23. 15 Figure 3.1 The placement of the ECG electrodes on human body. The green arrows represent the I, II, III – basic Leads that are formed between the electrodes. The blue arrows on the other hand illustrate the three extra Leads provided by the insertion of the fourth electrode, the permanent ground electrode. The three Leads and their relation to the polarity of the electrodes are illustrated in Figure 3.1. The polarity of the electrode, which is not participating to the lead, is set to neutral. In other words, it is set to the ECG device’s reference point which in many cases is the ground. Another interesting point that was defined by Mr. Einthoven is that the sum of the outputs of Leads I and III must be equal with the output of Lead II. Hence, the lead II provides the most extensive view from the heart. For that reason, it is often used in ECG monitoring devices. In addition to the three base Leads (I, II, III), it is possible to acquire three more lead forms by increasing the number of electrodes to four. The fourth electrode works as a permanent ground electrode whereas the actual ECG acquisition is done with the three other electrodes placed according to the Einthoven’s Triangle. The three extra leads are called augmented leads and generally referred as aV-leads [21, p. 16]. There is one aV for each electrode namely aVR towards the right arm, aVL towards the left arm, and finally aVF towards the left leg. The aV signals are acquired by combining two of the three electrodes to a single negative electrode, which is then compared against the remaining positive electrode. For instance, aVR equals to combination of LL+LA as negative electrode and RA as positive electrode. The other two aV-signals can similarly be constructed as indicated in Figure 3.1. Besides the four electrodes ECG devices, it has RA LA LL Lead I
  • 24. 16 been suggested that by combining the RL and LL electrodes to a single LL electrode, it would be possible to acquire all the six Leads by using only three electrodes [23]. Figure 3.2 The axial reference system defines the viewing angle for each Lead in relation to the heart [24]. Each Lead provides a specific viewpoint to the heart. The extremity leads works on the vertical plane only whereas the additional chest leads provides a second – horizontal – plane to the system [21, p. 17]. Figure 3.2 illustrates the vertical plane and defines the viewpoints on it for each Lead. The Leads are represented on an axil reference system as vectors that start from the centre of the hearth. The Lead I looks the heart from the east on the horizontal centreline. That point is the 0° point to which the other viewpoints relate. Hence, the Lead II diverts 60° and the Lead III 120° from the Lead I. Moreover, the equation of I + III = II can easily be proven from the axial reference system. If one moves the Lead III to the right until its other endpoint meets the endpoint of the Lead I then the remain endpoint of the Lead III will meet the endpoint of the Lead II.
  • 25. 17 Each of the six monitoring Leads generates a different ECG response for a cardiac cycle [21, p. 21]. The sample deflections for the all six monitoring Leads are shown in the figure 3.3. A positive ECG deflection is generated whenever a depolarization wave propagates toward the positive electrode. The same applies if a repolarization wave is moving away from the positive electrode. In contrast, a depolarization traveling away from the positive electrode and a repolarization wave approaching to it are shown as a negative deflection on ECG. Figure 3.3. The ECG deflections acquired with the four electrodes [25]. As mentioned earlier, the depolarization first travels downwards and then upwards in the ventricles. Since the Lead II is located under the ventricle, the ventricle depolarization first propagates towards the positive electrode of the Lead II (R-wave) and then away from it (S-wave). As a result, the Lead II provides the greatest deflection for QRS- complex [21, p. 21]. In addition, it can be clearly noticed from Figure 3.3 that the Lead II is the sum of the other two Leads, I and II. The same rules apply for the augmented Leads as for the limb Leads. However, the viewing angles are different and therefore the deflections change accordingly. There exists a vast variety of commercially available electrodes for long-term ECG monitoring. A common factor among these electrodes is that they require skin contact. Typically, an ECG electrode is equipped with a self-adhesive, which allows it to be fasten
  • 26. 18 on the body. The electrode is in contact with the body through some conductive gel that improves the conductivity between the electrode and the skin, and reduces signal noise. Table 3.1 The list of ECG electrodes and their placement on the body. Electrode name Placement on the body Right Leg (RL) Within the range of the ankle and sub-torso Right Arm (RA) Within the range of the shoulder and wrist Left Leg (LL) Within the range of the ankle and sub-torso Left Arm (LA) Within the range of the shoulder and wrist The location of the extremity electrodes can be freely chosen within the range defined in Table 3.1. However, the placement shall be consistent. For instance, if the RA electrode is placed on the shoulder level then LA shall also be placed on the same level. Moreover, the further the electrode is from the heart the weaker is the acquired signal. Therefore, it is a good practice to place the electrodes as close to the heart as possible with the respect of Einthoven’s Triangle [26, p. 23]. This approach also reduces the amount of artefacts caused by the limb muscles. In addition, when considering the noise, it is equally important to make sure that there is no hair or other impurity between the body and the electrode. The skin contact oriented electrodes usually introduces discomfort for the patient being monitored. The discomfort is a sum of many factors such as regular electrode replacement, routing the wiring of the electrode through the clothing, skin irritation caused by the self-adhesive or the conductive gel, to mention some of them. This has motived many researchers to find a solution for a long-term contactless ECG electrodes [27]–[30]. Contactless ECG electrode would ease the long-term ECG monitoring tremendously from the patient’s point of view. However, there are still many unsolved issues when it comes to the signal quality of the contactless ECG electrodes. Therefore, relying on the traditional ECG electrodes requiring skin contact would be wise when concerning the signal quality. Especially ECG monitoring devices with autonomous abnormality detection would benefit from electrodes with high quality signal acquisition capabilities.
  • 27. 19 3.2 Interpreting ECG Response The ECG waveform is an electrical interpretation of the different states of cardiac cycle. By analysing the waveform, it is possible to monitor the condition of the heart. Furthermore, in the case of an abnormally behaving heart, the ECG analysis provides robust means for diagnosis. When designing an autonomous ECG detection system, it is crucial to understand the interpretation process of the ECG signal and also how the signal maps to the cardiac cycle of a healthy heart. 3.2.1 ECG Waves and Cardiac Cycle The mapping of the ECG waveform to the cardiac cycle in normal sinus rhythm is shown in Figure 3.4. Each of the five waves PQRST can directly be map to a certain state of the cardiac cycle. Figure 3.4 Wiggers Diagram maps the ECG signal to the cardiac cycle [31]. As mentioned, the cardiac cycle starts at the diastole phase during which the heart muscle is relaxed. At the end of the diastole, the atria contracts and pushes the blood into the ventricle. The atria contraction is caused by the SA node which generates a stimulus that
  • 28. 20 leads to the action potential. With the help of the Bachmann’s bundle and since the cardiomyocytes are interconnected, the action potential rapidly propagates around the atria leading to atrial contraction [13]. This part of the cardiac cycle is expressed as P- wave on the ECG waveform and it is the start of the atrial systole state [19, p. 18]. P-wave detection is important, since its presence with acceptable PQ-interval indicates that the patient is in sinus rhythm. The Lead II has the most profound response for the P-wave. Once the Action Potential reaches the AV node, its propagation velocity decreases, delaying the signal. Since the cardiomyocytes in the atria and those in the ventricles are electrically connected only via the AV node [13], [32], the contraction in the ventricles is also delayed. This delay is an important part of the contraction cycle allowing the blood from the atrial chambers to flow into the ventricle chambers before the start of the systole. After the delay caused by the AV node, the stimulus propagates rapidly down to the ventricle via the bundle of His. This is shown as Q- and R-waves in ECG [19, p. 18]. The Q-wave is the first negative deflection following the P-wave whereas the R-wave starts right after the peak of the Q-wave. The systole starts when the stimulus reaches the Purkinje Fibres. This is the R-peak in the QRS-complex [19, p. 19]. The S-wave deflection on ECG is caused by the stimulus moving upwards from the bottom of the ventricles via the Purkinje fibres leading to the contraction in the ventricles. The plateau phase in the action potential of the cardiomyocytes defines the duration of the systole phase. As a result, this can be seen as flat line (ST-segment) on ECG. The final state in the cardiac cycle and the end of the systole is the relaxation of the ventricles. This is due to the repolarization of the ventricle cardiomyocytes, which reflects as the T-wave on ECG. The atria repolarization on the other hand occurs in parallel with the stimulus propagation in the ventricles. Therefore, it mixes with the QRS-complex response. 3.2.2 ECG Intervals and Segments The previous section explained the ECG waves in amplitude wise and mapped them to the individual phenomenon of the cardiac cycle. Another equally important extraction of ECG is the distance between the different waves and it will be discussed in this section.
  • 29. 21 Figure 3.5 The points of interests in the ECG signal are PR-, QT-, QRS intervals and ST segment. Figure 3.5 defines the important distances between the waves of a normal ECG response. The distances that include a wave response are referred as intervals. Segments on the other hand refer to periods during which the ECG response is flat. The RR-interval defines the distance between two subsequent QRS-complexes from where the heart rate can be extracted. Similarly, the PP-interval – does not show in the figure – is another way for defining the heart rate. The RR-interval tells more about the ventricles contraction pace whereas the PP-interval targets on the atria. The first interval in the cardiac cycle is the PR-interval [19, p. 19]. The PR-interval indicates the time from the start of the P-wave to the start of the Q-wave. Thus, it covers the atrial depolarization and the delay in the AV node. Normally, the duration for PR- interval is within the range of 120-200 ms for adults. A shorter interval may refer to an extra conduction pathway between atria and ventricles whereas longer interval usually indicates a prolonged delay in the AV node. The QRS- and QT-intervals start form the end of PR-interval [19, p. 19]. The QRS- interval reveals how rapidly the depolarization propagates in the ventricles. The end of
  • 30. 22 QRS-interval is at the point where the S-wave return back to zero level and its duration is from 70 to 100 ms. Problems in the ventricle conduction systems usually reflects as prolonged QRS-interval. Besides the QRS-interval, the QT-interval measures the duration of a full ventricle contraction cycle. It contains the whole systole of the ventricles starting from the rapid shoot up of the action potential (QRS), illustrating the plateau phase (ST-segment) and finally returning back to membrane potential at the point where T-wave return back to zero level. It is important to notice that the duration of the QT- interval varies in relation to the RR-interval as defined in the following equation. 𝑸𝑻 𝒄 = 𝑸𝑻 √𝑹𝑹 Prolonged QTC often refers to serious problems in ventricles. Differing from the QT- interval, the TQ-interval indicates the relaxation – diastole – period of the ventricles. TQ starts from where the QT-interval ends and ends to the beginning of the next QRS- complex. Together the QT- and TQ –intervals contain the complete cardiac cycle starting from a QRS-complex to the next QRS. The segments describe the plateau phase of the action potential in the atria and ventricles [19, p. 19]. The PR-segment relates to the atria whereas the ST-segment follows the plateau of the ventricles cardiomyocytes. As being part of the PR-interval, the PR- segment indicates the delay of the sinus excitation while it is propagating from the atrial to the ventricles. A short PR-segment indicates existents of possible additional pathways from the atrial to the ventricles. Conversely, a propagation block in the AV node appears as prolonged PR-segment on ECG. Just like PR-segment in atria, the ST-segment indicates the contraction phase of the ventricles. Elevation or depression of the ST- segment generally refers to some problems of the blood circulation in the ventricle myocardia. However, a reliable detection of the ST-segment usually requires a diagnostic level ECG devices with 10 or more electrodes to be used, hence it is less attractive derivate when it comes to the ECG monitoring devices [33]. 3.3 Discussion As shown in this chapter, the ECG signal captures the electrical activity of the heart. The ECG signal is acquired through a set of electrodes that form a set of Leads. Depending
  • 31. 23 on the selection of the Leads, a different view of the heart can be obtained. Finally, the acquired signal is processed and displayed to the user. Once the ECG signal is acquired, it needs to be interpreted. Detection and mapping of the different waves and intervals are part of the ECG interpretation process. Heart, in a normal sinus rhythm, provides an ECG waveform that contains the PQRST waves with predictable amplitudes and intervals. Deviation from those values may be a result of a signal noise or other artefacts, normal arrhythmia or potential abnormalities of the heart. However, the noise causes signal distortion and hamper the ECG interpretation, hence its presence should be reduced as much as possible. In addition, sometimes it is relevant to see only certain parts of the ECG signal leaving out the others. To achieve this, the ECG signal is usually passed through different signal processing techniques, generally referred as filtering. The next chapter will discuss the ECG filtering in more details.
  • 32. 24 4 ECG FILTERING The previously explained ECG acquisition process results to an ECG signal which not only comprises signal components originating purely from the heart, but also contains undesirable components from various different sources. These are generally referred to as noise. The sources of noise can be Electromyography (EMG) signals caused by body movement or respiration, external electrical sources such as power grid, or radio frequency (RF) sources which are commonly present. Their effect on ECG is a distortion in the desired signal, making reliable interpretation a difficult and sometimes even impossible task. The noise components need to be removed or attenuated from ECG before its interpretation. The ECG signal filtering which attenuates noise components from the acquired ECG signal, is called de-noising. Furthermore, the filtering process also has other functions. On many occasions, not all the components of the de-noised ECG signal are needed in the interpretation process. For instance, if the aim is to robustly detect the QRS-complex of ECG, then the signal components forming the P and T waves are irrelevant and hence can be filtered out. As a result, in order to design and implement an ECG filtering system, it is crucial to know all components comprising the clean ECG signal, as well as the common ECG filtering technics.
  • 33. 25 4.1 Basic Concepts of the Filtering Signal filtering may be done on signals in both analogue and digital domains. The main difference between these two is that signals in the analogue domain have a continuous amplitude as a function of continues time whereas signals in the digital domain have a discrete amplitude and time [34, p. 11]. The signal transition from analogue to digital domain occurs through the Analogue-to-Digital Conversion (ADC). In the ADC process, the amplitude of the analogue signal is measured periodically with a constant predefined and fixed time-interval called sampling rate. The result is an ordered stream of discrete samples, digital values which each represent the amplitude of the analogue signal at the time of measurement. The ADC resolution is defined as the number of bits used for presenting the amplitude value. The higher the resolution the finer the digital spectrum of the amplitude value. The sample rate on the other hand defines the time interval between two consecutive samples. According to the Nyquist-Shanon sampling theorem, in order to be able to recreate the original signal from the digital samples, the original signal must be sampled with at least twice the frequency of its highest frequency component. If this is not the case, a phenomenon called aliasing occurs leading to a distortion in the recreated signal. Some advantages of the Digital Signal Processing (DSP) are that it enables an accurate and reliable filtering process, an ability to store and replay the signal, an easy transform from time domain to the frequency domain and an introduction of linearity to the system. Drawbacks with the DSP filtering are that it requires more processing power and significantly more resources than analogue filtering. Analogue signal processing on the other hand offers better real-time filtering features with lower processing power and less resource utilisation. However, an analogue system is more susceptible to noise and is less accurate since it depends directly on the physical components. In addition, the signal noise tends to accumulate in multi-stage analogue filtering systems. As a result, a filtering system is often established as a hybrid mixed-signal system, combining the advantages of both analogue and digital signal processing [35]. Signal filtering systems are hard to categorize, since they contain many dimensions which overlap each other. As discussed earlier, one way of categorizing the signal filtering systems is to divide them based on their input signals to either the analogue or digital
  • 34. 26 filtering system. Similarly, a filtering system can be categorized based on its output frequency band. A Low-Pass Filter (LPF) attenuates the input frequencies above the cut- off frequency of the filter. In contrast to LPF, a High-Pass Filter (HPF) passes the frequencies above its cut-off frequency and attenuates those falling below the cut-off. A Band-Pass Filter (BPF) allows only a certain frequency band of the input signal to pass through the filter, while both Band-Stop Filters (BSF) and Notch Filters (NF) attenuate a predefined frequency band, letting all the other frequencies pass through the filter. The difference between BSF and NF is that the latter, as the name implies, only attenuates a very narrow band from the overall frequency band, whereas the stop-band of BSF can be wider. Another way of categorization is to divide the filtering systems based on their properties. These properties include linearity, causality, time variance, and stability [34, p. 112]. In a linear system, if an input x1 produces an output y1 and similarly another input x2 produces an output y2 then any one of the two inputs scaled with a factor c will produce the output that is scaled with the same factor of c. A causal filtering system is a real-time system that only works with the inputs of current time or inputs from the past. Thus, causality does not allow the system to predict inputs from the future. A time-invariant system produces the same output for an input no matter if the input is fed to the system at time t or at time t+T. That is, the output is only delayed in time by the amount of T. In a time-variant system, however, the delay T does not propagate through the system but varies causing the output to be produced after some time (t+T +tv). The length of the delay depends on the input and hence makes the time-variant system hard to predict. Stability simply refers to a system that produces a bounded output for a bounded input. Impulse response is yet another way of categorizing filtering systems [34, p. 112]. The impulse response of a system is defined as the output for an input signal having an amplitude other than zero for a short period while otherwise the amplitude is zero. The definition of the impulse signal depends on whether the signal is analogue or digital. The filtering systems producing a Finite Impulse Response (the impulse response settles back to zero within a finite period) are called FIR systems. In contrast to FIR, the systems outputting an Infinite Impulse Response (the impulse response approaches zero but never settles back to it) are generally referred as IIR systems. FIR and IIR implementations in the digital domain rely on cascaded filter components called taps. A filter can be either
  • 35. 27 recursive or non-recursive depending on whether or not it uses a feedback loop from the output to the input. A basic tap contains a delay unit, multiplier and adder. The input sample is stored in the delay unit. The multiplier has two inputs, one for the sample and the other for the coefficient. The coefficient defines that portion of the sample passed to the adder. The adders and the delay units are cascaded to form a digital filter of a certain length, of order N. The number of taps in a non-recursive FIR filter, which is the most common form of digital filter, is N+1. Although ways of categorizing the signal processing systems are many, none of them is comprehensive. An analogue system may be linear or non-linear, time-variant or time- invariant, just as an IIR filter can be stable or unstable depending. However, two properties play an important role in system characterization: linearity and time- invariance. A linear and time-invariant system (LTI) have many advantages that are commonly exploited in DSP systems [34, p. 69]. The FIR systems are typical linear and time-invariant (LTI) systems and hence are commonly used in DSP. Figure 4.1 Graphical illustration of a waveform and its Fourier Series The French mathematician Jean-Baptiste Fourier (1968 – 1830), states that any periodic signal, as well as any quasiperiodic signal, can be presented as a Fourier Series consisting of a finite or infinite set of sine and cosines waves (Figure 4.1). These sinusoidal signals, or harmonics, vary in their frequency as well as their amplitude. Harmonics with a lower frequency have a greater amplitude than those with higher frequencies. This being so, the low frequency signals have the greatest effect on the original periodical signal.
  • 36. 28 Additionally, the signal amplitudes in a Fourier Series can be presented in either the time or the frequency domain. The transform from time domain to frequency domain is called Fourier transform and it is the basis for the modern DSP. 4.2 Fourier Series of the ECG Signal As we known, the PQRST waves in ECG repeat periodically. However, the duration of the ECG period is not constant, since the heart may beat faster or slower depending on the physical or emotional stress to which the body is exposed. Due to its time-varying nature, the ECG signal is quasiperiodic, as are all bioelectrical signals. Despite the variations in period length, the ECG signal can be presented as a Fourier Series. A recent study showed that a typical ECG signal can be decomposed to 169 harmonics of which the first 40 most influence the shape of the original ECG signal [36]. Table 4.1 The key frequency bands of the ECG signal [37]. ECG Wave Frequency Band of the Harmonics (Hz) Description R-R interval 0,67 – 5 R-R interval is the distance in time between two subsequent heartbeats. Heart rate can vary between 40 – 300 bpm depending on the body strain. Typical resting heart rate for adults falls in the range of 60 – 100 bpm. P-wave 0,67 – 5 P-wave reflects the depolarization in the atria. The pacemaker node resides in the right atrium and its frequency range equates with the R-R interval. QRS-complex 10 – 50 QRS-complex reflects the depolarization in the ventricles. The propagation velocity is higher in the ventricles than in the atria, hence higher frequency harmonics. T-wave 1 – 2 Repolarization in the ventricles deflects as T-wave in ECG, revealing the membrane potential. The ION current against the driving force is slow, hence the lower frequency. Table 4.1 lists the typical frequencies in which the harmonics comprising the different ECG waves fall. The table suggests that the required frequency band for an ECG signal is between 0.5 and 50 Hz. However, an ECG signal may also contain higher frequency components such as pacemaker signals which can reach up to 150 Hz in adults and even 250 Hz in infant hearts. Therefore, the required frequency band for a diagnostic level ECG device must cover frequencies up to that range.
  • 37. 29 The ECG signal also contains Furrier Series from unwanted noise sources. Noise sources are typically muscle noise from body movements, respiration noise, noise from skin- electrodes and external electrical noise. Some of these noise components are relatively easy to filter out while others require much more attention since they mix with the original ECG signal band. Table 4.2 Typical noise components that interfere with the ECG signal. Noise source Frequency Band of the Harmonics (Hz) Description DC 0 The DC component introduced by skin-electrodes has a high amplitude that shifts the baseline of the ECG signal above zero. Always present. Respiratory 0,12 – 0,5 Respiration noise causes the ECG baseline to wander according to the in- and exhalation. Always present. Muscles 5 and higher The EMG signals from other body muscles mix with the ECG harmonics and are therefore extremely problematic. Always present. Power line 50/60 Power line noise is a significant noise factor in an ECG device. Depending on the power grid system, the frequency is 50 or 60 Hz. Typically the power frequency in Europe is 50Hz and 60Hz in the USA. Usually present. Other ambient 50 and higher RF noise and other external electrical noise. Usually present. As can be seen in Table 4.2, DC and respiratory signals do not mix with the ECG signal’s frequency band whereas the other noise components do. All noise causes distortion in the ECG signal and therefore its presence needs to be minimized. The DC component has a constant amplitude, which elevates the baseline of the ECG signal on the y-axis. Thus, a reliable amplitude measurement becomes impossible. The DC component therefore needs to be cancelled from the ECG signal. Respiratory noise and some other low frequency muscle noise cause alterations in the ECG baseline. In other words, although PQRST- complexes look normal, their baseline drifts, wandering above or sinking below the zero level over the course of time. This introduces problems in ECG interpretations, especially in the detection of ECG parts with zero amplitude such as in PT and ST-segments. Muscle noise inflicts the most distortion on the ECG signal, mixing with the ECG band. This makes the filtering process a real challenge [38]. Another problem with the muscle noise is that it is unpredictable. The EMG noise is minimal or none when the patient is at rest. Once the patient moves his/her limbs, starting to walk or run, the EMG noise is present
  • 38. 30 and its frequency band is constantly changing according to the body movements. Similarly, ambient electrical noise mixes with the ECG band. However, it is more predictable and is usually expressed only on a narrow frequency band. Hence, the filtering process of power line or other ambient noise is more straightforward. 4.3 De-noising ECG Signal In general, there are two approaches to the de-noising of ECG signal [39]. The signal can be pre-filtered in the analogue domain and then further de-noised in the digital domain. Figure 4.2. A typical set up for a hardware based de-noising of ECG signal. The analogue ECG is band limited and amplified before the A/D conversion [39]. Hardware based analogue de-noising of ECG signal is illustrated in Figure 4.2. The system contains an HPF and LPF with two stages of gain. Since the de-noising has already been performed in the analogue domain, ADC resolution of 8 to 16 bits is usually sufficient to obtain a high enough Signal-to-Noise Ratio (SNR). SNR refers to the ratio of original signal power to the power of the noise. The higher the SNR is the better are the chances of detecting the original signal. Alternatively, an analogue ECG signal can be directly converted to the digital domain where the de-noising is done [39]. In such a case, the resolution of the ADC-converter must be greater than in the hardware based de-noising system in order to achieve a sufficient SNR ratio. Digital de-noising reduces the overall signal resolution, hence the higher SNR is required. The advantages of this approach are reduced hardware cost and more accurate and flexible filtering. Despite the chosen de-noising approach, the DSP filtering plays a crucial role in modern ECG monitoring devices. This is the case also in this study, where ECG signal filtering of the proposed ECG monitoring framework will partially rely on DSP filtering techniques.
  • 39. 31 4.3.1 Filtering systems Digital de-noising of the ECG signal is typically done using FIR or IIR filters. These filters can be used for basic filtering systems such as LPF, HPF, notch filters or as components of more complex filtering systems. Some complex filtering systems commonly used in ECG filtering are adaptive and wavelet filters. The benefit of these complex systems is that they are generally better suited than basic filtering systems for de-noising signals containing artefacts, such as all biometric signals which often mix with each other. The drawback of using the complex filtering systems is that they introduce more computational complexity and hence consume more processing power and area. An adaptive filter is typically a digital FIR filter or any other fixed length filter in which the filter coefficients are adjusted over the course of time [40]. Coefficient adjustment is based on the difference between the obtained input signal containing some noise and a desired signal fed to the system as second input. Wavelet filers, based on the Discrete Wavelet Transform (DWT), also rely on FIR filters. The very basic concept of the wavelet filter is that it first decomposes the input signal into wavelet coefficients using DWT. It then compares the coefficients against a threshold value and substitutes them with zero if they fall under the threshold. The signal is finally reconstructed or synthesised from the wavelet coefficients. DWT is implemented using a finite length FIR filter bank containing cascaded pairs of LP and HP filters each followed by a downsampler [41]. Each cascade level represents a wavelet scale. The highest scale is at the first level, where the raw signal enters the filtering bank, whereas the last level has the lowest scale. The LP and HP filters divide the frequency band of the input signal in half, resulting in two separated low and high frequency bands. Both bands are then downsampled. The downsampling process is based on Nyqvist’s frequency theorem and alleviates further signal processing. After that, output of the high frequency band represents the detailed wavelet coefficients and requires no more processing, while the low frequency band, referred to as approximation coefficients, and are passed to the next filtering level. There, the low frequency band is once again divided and downsampled, creating a new pair of low and high frequency bands. After each level, a new frequency division is introduced. The process stops when the downsampling process fails to take any samples. The result at this point is a time- frequency domain representation of the input signal in the form of wavelet coefficients. The HPF output at the root of the filtering bank – the first filter pair – has the finest time
  • 40. 32 resolution and the most coarse frequency resolution of the input signal. The resolutions change on each level so that the frequency resolution increases while the time resolution decreases as it moves on down the cascaded filter bank. The actual filtering is done by altering the obtained wavelet coefficients. The coefficients with a small amplitude value have little or no effect on the original signal and can simply be set to zero. Typically, a predefined threshold level is used to decide whether a particular coefficient is to be taken into the reconstruction process or zeroed. The coefficients falling under the threshold level represent the noise components of the original signal and hence can be removed. The synthesis is simply a reverse procedure of DWT that starts from the lowest level. The samples on each level are upsampled by a factor of two and then summed. Finally, the output of the wavelet filter is available on the highest level of the synthesis tree. 4.3.2 ECG De-noising Techniques The low frequency noise, that is respiratory and DC noise outside the ECG band, is typically attenuated with a high-pass IIR or FIR filter. IIR is often chosen since it introduces less computational complexity and delay into the system than FIR. However, IIR filters have non-linear phase response. In other words, signal components from the lower frequencies are delayed more than components from the higher frequencies. This leads to a distortion in the original ECG signal and is especially problematic when considering the ST-segment. The harmonics, between 0.05 – 0.5 have the most effect on the ST-segment [36]. More precisely, if the harmonics from that frequency range were filtered out, the ST-segment would be significantly distorted in the ECG output. The main reason for this distortion is actually not the attenuation of the low frequency components, but the non-linear phase shift over the harmonics caused by the IIR filtering. As a result, when it comes to the precision of the ST-segment, the cut-off point for the high-pass IIR filter should be no higher than 0.05 Hz. However, choosing such a cut-off frequency reduces the efficiency of the baseline wander removal. Balanced against that, if a FIR filter is used the cut-off frequency of HPF can be increased up to 0.5 Hz (the lowest possible ECG signal component). The reason being that in FIR all frequency components of the filtered signal are equally delayed. A FIR filter can therefore be used as DC and baseline wander-remover with minimal distortion in the ST-segment and hence its use as HPF in an ECG monitoring device is justified [42].
  • 41. 33 As in the de-noising process of baseline wander and DC component, the power line or other ambient electrical noise can similarly be filtered using either FIR or IIR filters. The filter type is typically a notch, narrow band, or an adaptive filter. In any case, the goal is to sufficiently attenuate the unwanted noise band without distorting the ECG signal. Depending on which part of the ECG band is attenuated, the filtering may cause distortion in the ECG signal. For instance, a simple notch filter used to attenuate the 50Hz power line noise may result in a distorted QRS-complex since their frequency bands overlap. Another cause of distortion can be the non-linear phase response of the de-noising filter. Optionally, the power line noise can be cancelled by using an adaptive filter for this purpose [43]. In this case, the desired signal (the second input of the adaptive filter) is extracted from the power line directly. The desired signal and filter output is used to produce an estimate of the noise which is then subtracted from the ECG signal. Power line noise is mainly a problem of more accurate diagnostic ECG devices with a frequency band from 0.05Hz to 150 or even up to 250Hz in some cases. Since the EMG noise mixes with the ECG band and varies in time, use of traditional static filtering techniques for its removal, such as HPF, LPF, or notch filters, could lead to a severely distorted ECG signal [44]. Therefore, filters used for that purpose are typically adaptive or wavelet filers. The desired signal of the adaptive filter can be a correlated noise estimate or an estimate of a clean ECG signal [43]. The wavelet filter on the other hand provides a simultaneous view of the frequency and time domain components of the ECG signal. This can be used to determine and suppress the presence of the EMG noise in the ECG signal. In recent decades, much research has been devoted to this issue of EMG removal. The consensus is that wavelet filtering is perhaps the most promising approach to the problem. However, an all-embracing filtering system for EMG or other artefact-removal still remains to be discovered [45]. 4.4 Automated ECG Signal Detection Automated detection of PQRST-waves, their relationships and intervals is the fundamental task of an automated ECG monitoring device. Reliably detected ECG waves allow the device to decide whether the ECG response is within its normal limits. A reliable ECG wave detection is based on a robust signal peak detection and on an intelligent decision logic that is able to map the ECG waves to the detected peaks.
  • 42. 34 Peak detection is a fundamental requirement of any signal processing system and has likewise been a very active research topic over the last three decades. More than 40 publications are listed in reference [46] describing different peak detection methods. The peak detection process locates the points where the signal amplitude is at its minimum or maximum. Typically, the area where detection of amplitude and location can occur is limited by a threshold level which defines the minimum or maximum amplitude value that a candidate peak must obtain before it is accepted as such. Similarly, in time as in frequency, rules must be applied to determine which of the adjacent min/max-values are to be detected as a peak. 4.4.1 QRS-complex detection The QRS-complex produces the most significant signal response in the ECG waveform. For this reason, it provides a solid and easily detectable reference point to the cardiac cycle. Once the QRS-complex is detected, the extraction of the other ECG waves and their intervals can be done in relation to the detected QRS. Similar methods can be applied for the detection of P and T waves and ECG intervals, as in the QRS-complex. Another important feature of QRS is that the monitored heart rate can be determined from their interval, measuring the time distance of two consecutive R-waves. Heart rate information is not only valuable for the end users but also it plays an important role in correlating an ECG detection system with a varying heart rate. The heart rate reveals the time-varying nature of the ECG signal and can be used to adjust the system parameters of ECG monitoring device to better match with the current situation. The heart rate information could for instance be used in a de-noising process based on an adaptive filter system or in threshold adjustment in various detection algorithms. Consequently, a robust detection method of the QRS-complex is one of the fundamental parts of an ECG monitoring device. A vast number of differing methods for QRS detection have been introduced within the past four decades [47], [48]. However, many of them share the same algorithmic structure that divides the detection into two separated stages. In the first stage, called the pre- processing stage, a feature signal is extracted from ECG. The pre-processing stage is further divided into linear and non-linear filtering sub-stages. The second stage, the decision stage, takes the feature signal as an input and detects the presence of the QRS-
  • 43. 35 complex, based on certain decision logic. The decision stage is similarly divide into two sub-stages: the peak detection logic and the decision sub-stages. Firstly, the peak detection logic detects the QRS-complex based on static or adaptive thresholds. After that, possible false detections are then exposed in the decision sub-stage. The decision is typically based on certain heuristic methods. The earliest and still commonly used QRS detection methods are based on the digital filters and differentiators [48]–[50]. At the pre-processing stage, a digital BPF first attenuates the ECG signal components other than the ones forming the QRS-complex. Subsequently, the narrow band signal is passed to a differentiator. The final stage of the pre-processor is the generation of the feature signal. This is done by first squaring the difference signal and then integrating the result over a predefined window length. From now on, the feature signal enters into the peak detection stage. The peak detection continuously monitors the feature signal and stores its most recent maximum into a max variable. Simultaneously, the detector compares the feature signal with the max variable and once the signal level descends below half of the max variable, the peak is detected. At this point, the narrow band signal is examined within a time window preceding the peak detection. The so- called fiducial mark is set to the location of the highest peak of the narrow band signal. The window length and location is defined so that if possible it includes the QRS-complex. After the peak detection, the max variable is updated to the current value of the feature signal and the detection continues. The fiducial mark and the height of the highest peak in the narrow band signal are stored into an event vector. Finally, the decision sub-stage decides which of the peaks in the event vector is the R- wave. The decision is based on a set of adaptive thresholds. Another approach uses DWT filtering banks at the pre-processing stage to divide the ECG signal into wavelet scales [51]. The wavelet scales that contain most of the energy of the QRS-complex are chosen for the detection process. The QRS-complex shows on the DWT scales as two modulus maxima with opposite signs and zero crossing in between. The QRS-complex is detected when a simultaneous modulus maxima on the different scales produces a signal in the threshold logic. Many other QRS-detection methods have also been introduced. Some examples of these include the neural network, matched filter, and adaptive filter methods. Despite their
  • 44. 36 different approaches to the QRS detection, they still follow the well-established division of the detection process into the pre-processing and decision stages. In this chapter, the ECG signal processing basics and some of the methods used in it have been introduced. ECG is a time-varying, quasi-periodic signal, thus it can be represented as a Fourier Series. The de-noising and other filtering processes of the ECG signal is based on this very quality. Methods for ECG filtering processes are many and constantly improving, since the research on this field is very active. For this reason, the framework of an automated ECG monitoring device should consider this. That is to say, the framework should allow an easy and flexible integration/upgrade for the signal processing methods of the future. Furthermore, an agile framework enables an easy interchange between methods if adaptions in the system are called for.
  • 45. 37 5 TECHNOLOGIES AND MATERIALS This chapter concentrates on the technologies and materials used in this study. The main emphasis is placed on the Programmable System-on-Chip (PSoC) technology to which the proposed ECG Detection Framework is targeted. In addition, the chapter takes a brief look at the ECG signal acquisition and transmission devices that were used in the case study for this thesis. PSoC typically contains a Reconfigurable Unit (RU), a hard core Processing Unit (PU), reconfigurable interconnectivity buses within the chip, interfaces for external communication, and finally a flexible design flow via a collection of development tools [52]–[54]. PU is a collection of hard core devices inside PSoC that are able to interconnect with RU and external peripherals. The heart of PU is the processor core. All major PSoC vendors use an ARM core for this purpose. In addition, PU usually contains two levels of cache memory, on-chip-memory, interfaces for various communication standards and an interconnection bus allowing internal and external data transfer. RU sits right next to PU. RU contains a large FPGA fabric and some domain specific programmable logic units such as DSP blocks and A/D converters. Interconnections between and within units occurs via a standardized interconnection bus [55]. For the ARM core, the bus protocol standard is AMBA [56]. Furthermore, the system design and implementation is done through a collection of development tools. The development environment seamlessly combines HDL based hardware design to the software design in a Graphical User
  • 46. 38 Interface (GUI). Finally, the development tools offer ready-made accelerators or other data path units in their Intellectual Property (IP) block libraries. The tools also allow the creation of a custom IP block through a guided procedure. As a result, PSoC combines all the essential features for system development on multiple application fields. Systems requiring optimized parallelism and power consumption can in particular benefit from the PSoC technology. 5.1 Zynq - All Programmable SoC by Xilinx Xilinx introduced the first FPGA chip in the early 1980’s and has dominated the FPGA markets ever since [57]. The recently released Xilinx Zynq-7000 series belongs to the family of PSoCs and is known in Xilinx as All Programmable SoC (AP SoC). The Zynq family packages two ARM cores and a vast FPGA fabric into a single chip [58]. Moreover, there are seven devices in the Zynq series each having a different size of FPGA fabric [59]. In addition, Xilinx offers an extensive development tool set that allows a rapid and flexible development flow for the Zynq devices. 5.1.1 Architecture Figure 5.1 Architecture of the Zynq AP SoC by Xilinx [52]
  • 47. 39 Figure 5.1 illustrates the architecture of the Zynq AP SoC. In the Xilinx terminology, PU is referred to as PS (Processing System) and RU is called PL (Programmable Logic). The centre of PS is the Application Processing Unit (APU) [60, p. 16]. APU contains two ARM Cortex-A9 cores, shared level 2 cache, On-Chip-Memory (OCM), Snoop Control Unit (SCU), Direct Memory Access (DMA) unit, timer units, and other controller units. Surrounding APU is the interconnect bus [60, p. 197]. The AXI interconnect bus of ARM AMBA family provides configurable connectivity between the different units inside PS. Furthermore, it allows PL to communicate with PS and vice versa. Moreover, APU has dedicated bus interfaces to DRAM memory controller and to PL thus optimising L2 cache access and coherence. Finally, PS can be linked via the interconnect bus to the Multiplexed I/O (MIO) interface for external peripherals. As can be seen from the Figure 5.1, Zynq is able to interface with several different serial communication protocols. For each protocol, Zynq offers two separated interfaces. In addition, there are also two Gigabit Ethernet interfaces and a SD memory interface. The connections between the interfaces and MIO are configurable and, within some limits, can also be expanded to the PL side using the Extended MIO (EMIO). Whereas the PS side only offers the coarse-grained re- configurability, the PL side provides the FPGA fabric with highly fine-grained configurability. The size of FPGA varies between 17000 and almost 300000 Look Up Tables (LUT) depending on the Zynq device. Additionally, the Zynq embeds special coarse-grained units – DSP slices and Block RAMs – within the FPGA fabric, allowing for a more optimized implementation of certain types of application specific systems as in signal processing. Moreover, PL contains two 12-bit A/D converters for internal condition monitoring (temperature, voltage levels) or for some external analogue system purposes. For external communication, PL offers General Purpose Input/Output (GPIO) banks. For clocking purposes, four clock inputs enter PL from PS side. Alternatively, PL clocks itself independently by generating and distributing a clock signal originating from PL. As a final feature, the Zynq also offers a hard or soft core security block (depending on the Zynq device) which supports various security features offering the end user protection on many different levels [60, p. 35].
  • 48. 40 ARM Cortex-A9 ARM processor – used in the Zynq series – is based on the ARM v7 architecture and is a customized implementation of the Cortex-A9 processor [61] manufactured by Xilinx. The customization includes the selection of the number of processor cores and the size of the L1 cache. In addition, Xilinx has chosen to include some optional units namely NEON engine and Floating Point Unit (FPU) in their instances from the Cortex-A9 cores [60, p. 20]. Each core has a dedicated level 1 cache which further divides so that there is a separated 32KB cache for both instructions and data. Furthermore, NEON engine performs Single Instruction Multiple Data (SIMD) operations on two input vector lines. The size of the vectors and the line length can be configured. SIMD can be used to accelerate data intensive processes such as video processing and other DSP processing. Similarly, FPU offers acceleration for the floating point operation supporting the single and double precision formats. Finally, since Cortex-A9 is an application level processor, it is possible to run an Operating System (OS) such as embedded Linux on it. For this reason, both of the ARM cores need a Memory Management Unit (MMU) to provide virtual memory access for OS. FPGA Fabric Figure 5.2 The architecture of the programmable logic in the Zync-7000[60, p. 23]. The Block RAMs and DSP48E1 slices are shown as green and blue rectangles respectively.
  • 49. 41 FPGA fabric occupies the largest area inside the Zynq PL. Figure 5.2 shows the architecture of the FPGA fabric based on the Xilinx 7-series [62]. The main building blocks of the FPGA fabric are the Configurable Logic Blocks (CLB) which interconnect via the programmable interconnects. CLBs are placed into a matrix-like formation inside PL. Right next to each CLB is a switch matrix that enables the configuration of various interconnectivity routes between the different blocks inside the fabric. Furthermore, the Input/Output Blocks (IOB) are located on the edges of PL. Finally, the special DSP and memory resources – marked as green and blue rectangles in Figure 5.2 – are located between the CLB rows. Within CLB, there are two logic components called Slices. Each Slice connects directly to the switch matrix. Additionally, both Slices have a dedicated input and output for carry- in and carry-out, respectively. The carry I/O can be used for building a bigger arithmetic logic unit (ALU) by cascading CLBs vertically. Each Slice is further divided into four Look Up Tables which are the smallest logic units in the Xilinx’s FPGA. LUT is a logic resource that can be used for several different purposes. For instance, it can implement any logic function taking six inputs. Alternatively, LUT can be used as a small Read Only Memory (ROM) or a small Random Access Memory (RAM). Moreover, it can also function as a shift register. Any of the earlier mentioned functionality can be scaled larger by combining multiple LUTs together. In addition to LUTs, a Slice also contains eight Flip-flops (FF) each able to hold a single bit. FFs are resettable and one of them can also function as a latch if so required. Special accelerators As mentioned already, PL also contains special accelerator units namely DSP48E1 slice and Block RAM [60, p. 25]. The special accelerator units are located in a column-like formation within CLBs such that a Block RAM unit sits right next to each DSP48E1 slice (Figure 5.2). This arrangement is optimal for arithmetic operations requiring high speed and fast access to data. DSP48E1 is especially designed for DSP operations but can similarly be used for any other functions requiring addition/subtraction, multiplication or, alternatively, logical operations. In particular, the operations having medium or long word length benefit from
  • 50. 42 the DSP48E1 slice, since their implementation on traditional FPGA slice logic could consume an unacceptable amount of resources. Figure 5.3 The architecture of the DSP48E1 slice [60, p. 27] I/O ports, their bit widths, and the main operation units of the slice are visualised in Figure 5.3. DSP48E1 slice defines four input ports namely A, B, C, and D and produces a single output to port P. The main arithmetic units are pre-adder, multiplier, and post-adder. Both of these adders are also capable of performing subtraction. Moreover, the post-adder can also function as a logic operator supporting all basic Boolean operations. Referring again to Figure 5.3, ports A and D connect to the pre-adder/subtractor. The output of the pre-adder/subtractor and port B form the inputs of the multiplier. The post- adder/subtractor takes one input from port C and the other can be either the multiplier output or the previous value of P. The operations performed on the inputs are configured using a control register called OPMODE. The configuration may include only one, two or all three operation units depending on the required functionality. For instance, the DSP48E1 slice can function as a simple accumulator taking its input from port C and providing its output to port P. In that case, the two other units are not used. Typical usage of the slice is as a tap for a FIR filter. A complete FIR filter can be achieved through a cascading configuration that connects adjacent slices or taps together. The second special resource, Block RAM, offers an alternative to the distributed RAM. Being dedicated memory units, Block RAMs have advantages over the distributed RAMs
  • 51. 43 when concentrated memories with high capacity and small latency are required. On the other hand, the distributed RAM is better suited to the systems that require small capacity memories with sparse physical location. The block RAMs can either be implement as RAM or ROM. Additionally, it can be used as First In First Out (FIFO) buffer. Each block RAM unit contains by default a single 36Kb RAM memory divided into 2048 elements. The default element length is 18-bits. Alternatively, the block can be divided into two independent memory block of size 18Kb. The element length can similarly be reduced resulting in greater numbers of elements in each memory block. In contrast, the element length can also be increased. This naturally results in fewer elements. Advanced Extensible Interface Advanced eXtensible Interface (AXI) interconnection set defines the interconnection switches which allow physical connections between units, bus protocols, and finally interfaces for bus access [60, p. 30]. AXI is specified in the ARM AMBA 3.0 open standard and its current version is AXI4. AXI4 is the fundamental part of the Zynq’s interconnection scene. It provides the means for the PS-PL communication as well as for the internal communication within both PS and PL fabrics. The PS-PL communication occurs over three different interconnect switches and also over a special type of Accelerator Coherence Port (ACP). Through ACP, a processing element in PL is able to coherently access the APU caches. The three interconnect switches are named memory interconnect, master interconnect, and slave interconnect. They all reside on the PS side. These switches further connect to the central interconnect inside PS. The memory interconnect offers four high-speed master interfaces (AXI_HP) for PL side. The interfaces are FIFO buffered and sometimes referred to as AXI FIFO interfaces. Similarly, the master and slave interconnects offer two general purpose interfaces, slaves (S_AXI_GP) and masters (M_AXI_GP) respectively for the PL side. A system designer is able to select between three different AXI4 protocols when implementing PL-PS inter-communication. First, AXI4 is a memory mapped bus protocol offering high-speed address based bus communication. After each address transaction, a burst of data (max. 256 words) can be received. AXI4-Lite is similarly memory-mapped bus protocol, but without any burst features. Finally, AXI4-Stream is an ultra-high speed
  • 52. 44 streaming protocol which is not memory mapped. That is, a bus transaction over the AXI4-Stream protocol does not require addressing. Hence, it is well suited for data streaming. 5.1.2 Embedded System Design for Zynq Devices In general, system development of a PSoC device requires a setup of the development environment that provides tools for both hardware and software development as well as the means for system prototyping. System design for Zynq is no different from the previous one. Xilinx provides a development tool set called Vivado design suite to be used with Zynq [60, p. 47]. The Vivado suite comprises the Vivado IDE for the hardware design, Software Development Kit (SDK) for the Cortex-A9 programming, and programming and debugging interfaces for the target devices or development boards. Optionally, the Vivado suite also provides a High Level Synthesis (HLS) tool for generating and testing IP blocks using only C-language. The HLS synthesises a C based IP block into a Hardware Description Language (HDL) to be included in the hardware design using the Vivado IDE. Another optional feature of the Vivado suite is the System Generator which enables a system design to be done using graphical blocks in the Mathwork’s Simulink environment [60, p. 241]. Moreover, a system, or a part of the system, designed in the Simulink environment can be directly simulated on the hardware via a procedure called co-hardware simulation. Finally, within the Vivado suite are also delivered a documentation tool and a license management application. The Vivado design suite is license based, and a stripped-down version of it can be freely obtained [63]. Design Flow Vivado design flow follows the traditional development path, starting from the system requirements and specifications phase, continuing to the system design phase, forking into the hardware and software development, and terminating in the system integration and testing phase [60, p. 53]. The design flow is unlikely to be a single pass-through process of all the phases, but will more likely require several different iterations between phases. Therefore, it is important that the design can be flexibly refined in each phase.
  • 53. 45 Figure 5.4 The embedded system design flow for the Zynq.[60, p. 53] Figure 5.4 visualises the system design flow of the Vivado suite. The purpose of the first phase is to extract system parameters from the project requirements and formulate system specifications based on those parameters. The system parameters should as accurately as possible describe the end system. The second phase, the system specification phase, further clarifies the system by describing the behaviour and functionality of the system. In addition, the system specifications should contain system performance requirements, definition of used technologies and other implementation details. Once the system is specified, the actual system design phase may start.
  • 54. 46 The system design phase is probably the most demanding phase in the design flow. In this phase, a high-level abstraction of the system is created in the form of system interfaces and parameters. The high-level model is then further broken down into the different internal system modules and their interconnects. The internal module division is based on the different system functionalities and their logical sequential ordering. Once the functional modules are defined, the next step is to determine the PL/PS mappings for the functional modules. In other words, which of the modules are implemented on the PL side and which on the PS side. In the traditional software/hardware partitioning scene, PS represents software while PL relates to the hardware. Typical criteria in PL/PS partitioning are system performance, energy consumption and required area. In practice, the end result is a kind of compromise of previous criteria, since their effect to each other are typically inversely proportional. As a rule of thumb, the functions requiring intensive computational processing or those susceptible to parallelism are usually implemented on the PL side. The reason for this is that PL provides higher computational power in terms of parallelism and reduced power consumption over PS. Conversely, for instance tasks requiring OS support, or which include complex sequential logic, are more likely to be mapped on the PS side. The next step from the system design is the development process. Initially, a rough hardware base system, containing at least the PS block, is implemented in Vivado IDE and exported to SDK. This is mandatory, since the PS block represents the ARM processor on which the software or the application project in SDK is built. From now on, the development process can occur simultaneously on both Vivado IDE and SDK in iterative manner. That is, the software is developed in parallel with the hardware system between two consecutive development iterations. A development iteration occurs when the next hardware system release is ready to be exported to SDK. Before that, the hardware system can be tested on the signal level in the Vivado IDE simulator. After each iteration, the current software release is tested on the new hardware system, and feedback is given to the hardware development team. The iterations continue until both software and hardware implementations are considered ready for system integration and final testing. As a final phase, the system integration and final testing phase integrates all modules of the system into a single end system. The final system is then tested against the system