You are on page 1of 6

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/261040389

Real time feature extraction of ECG signal on android platform

Conference Paper · October 2012


DOI: 10.1109/ICCICT.2012.6398230

CITATIONS READS

12 1,028

4 authors, including:

Pankaj K Gakare Raval N Awale

3 PUBLICATIONS   41 CITATIONS   
Veermata Jijabai Technological Institute
48 PUBLICATIONS   57 CITATIONS   
SEE PROFILE
SEE PROFILE

Some of the authors of this publication are also working on these related projects:

design of LDPC code View project

A 50 ohm Microstrip Line Fed Shorted Microstrip Antenna with Reduced Cross-polarization View project

All content following this page was uploaded by Raval N Awale on 24 November 2016.

The user has requested enhancement of the downloaded file.


Real Time Feature Extraction of ECG Signal on
Android Platform
Pankaj K. Gakare Abhilasha M. Patel Jignesh R. Vaghela R. N. Awale
Student, M. Tech Student, M. Tech Student, M. Tech Professor
(Electronics) (Electronics) (Electronics)
Dept. of Electrical Dept. of Electrical Dept. of Electrical Dept. of Electrical
Engineering Engineering Engineering Engineering
VJTI, Mumbai, Maharashtra VJTI, Mumbai, Maharashtra VJTI, Mumbai, Maharashtra VJTI, Mumbai, Maharashtra
pankajgakare@gmail.com abhilasha.patel5@gmail.com jigneshrvaghela@ymail.com rnawale@vjti.org.in

Abstract— Ambulatory cardiac monitoring has become an signal. ECG beats should be classified based on these features
important scenario nowadays as a standard preventive in order to detect different types of CVD. In ambulatory ECG,
cardiological procedure for detection of cardiac abnormalities. In all kinds of noise may occur simultaneously and
the proposed system it is achieved with the Android smart phone. unpredictably. Different kinds of noises interfere with ECG
Heart rate variability (HRV) analysis is well known to give signals are
information about the autonomic heart rate modulation
mechanism. In order to avoid erroneous conclusions, it is of Baseline wandering,
utmost importance that only sinus rhythms are present in the
cardiogram. Therefore, preprocessing of the RR interval time
Motion artifact,
series is necessary. This paper presents an advanced automated Power-line interference, and
algorithm to preprocess RR intervals obtained from a normal
ECG. Validation of this algorithm was performed on recorded Electrode pop or contact noise
ECG signals by holter recorder and MIT-BIH database. The
proposed algorithm therefore restricts the manual data check to ECG preprocessing generally takes care of de-noising the ECG
the absolute minimum and allows a reliable HRV analysis. signal.
For the ambulatory cardiac monitoring and real time
Keywords-component: ECG, mHealth, eHealth, Telemedicine, processing of the recorded data, a novel concept mHealth
RR-interval, Android smartphone (Mobile Health) has been proposed as an integration of mobile
telecommunications and multimedia technologies in healthcare
I. INTRODUCTION delivery [1]. The concept of mHealth involves the use of
The electrocardiogram (ECG) is an important tool for mobile devices in collecting clinical data, delivering
providing information about functional status of the heart. information to medical staff, researchers and patients,
Analysis of ECG is of great importance in the detection of monitoring patient’s vital signs in real time and directly
cardiac abnormalities. In a clinical setting, such as intensive providing health care through mobile telemedicine [2].
care units, it is essential for automated systems to accurately Android smart-phone is chosen as mobile device because
detect and classify electrocardiography signals. The correct of its advanced functionality and open source nature. It has
performance of these systems depends on several important ability to run tens of thousands of application at same time [3].
factors, including the quality of the ECG signal, the applied
classification rule, the learning and testing dataset used. The Section II describes the architecture of the proposed
ECG is characterized by a recurrent wave sequence of P, QRS system. The details of filtering and QRS complex detection
and T- wave associated with each beat. The QRS complex is algorithms are explained in section III and the summary is
the most striking waveform, caused by ventricular concluded in section IV.
depolarization and atrial repolarization of the human heart.
Once the positions of the QRS complexes are found, the II. ARCHITECTURE
locations of other components of ECG like P, T waves and ST
segment etc. are found relative to the position of QRS, in order
to analyze the complete cardiac period.
During the recording process, noise heavily affects the
signal. In addition, the ECG signals collected from different
people are heterogeneous, generally reflected by the variations
in the amplitude of the beats. Hence, computationally
intensive preprocessing is required for beat detection and
feature extraction. The most important features include the
information lying in the P, Q, R, S, and T waves of the ECG
Figure 1. Architecture of Proposed System
Figure 1 depicts the overall structure of the proposed A. Pan Tompkins Algorithm
system and patient/doctor communication links of the ECG As shown in figure 2 this algorithm uses filtering,
system. This paper reports several components of the system, differentiation, signal squaring and time averaging to detect
which are currently functional and prototyped [4]. the QRS complex [8].
An Android smart-phone device is proposed as a Mobile
Monitoring terminal to observe and analyze ECG
(Electrocardiogram) waveforms from the wearable ECG
devices in real time under the coverage of a Bluetooth [5].
Compared with other mature wireless technology, Bluetooth
technology has many properties, such as short distance
convenience communications and devices controlling.
Bluetooth wireless communication technology is based on
portable ambulatory ECG device and smart phones. Such
systems could provide an original and flexible wireless
monitoring scheme for many phone consumers.
Figure 2. Pan – Tompkins real time QRS detection Algorithm
The ECG Analysis is done on Android platform. This
software performs analysis on the of ECG signal after filtering Steps involved in this algorithm are
in real – time. It stores the record of patient for future
reference. 1) Filtering: It uses a bandpass filter to remove the noise
from the recorded signal. The band-pass filter is obtained by
The ECG signal samples are transmitted to server using
cascading the 2nd order low-pass filter and the high-pass filter.
File Transfer Protocol (FTP). For this wireless transmission
excellent switching between Wi-Fi / GPRS / GSM / EDGE is a) Low-pass filter: The transfer function for 2nd order low
required. At server the record of all the patients will be stored pass filter is given by:
so that whenever records are required, they are reproduced. H (z) = (1 - z -6)2 / (1 - z-1)2
From server it is send to intended receiver either through SMS
or MMS or Email. y[n] = 2 y[n-1] - y[n-2] + x[n] - 2 x[n-6] + x[n-12]
Where the cutoff frequency is about 11 Hz and the gain is 36.
III. REAL TIME QRS COMPLEX DETECTION b) High-pass filter: The transfer function for the high pass
The most important of all the waves in the ECG waveform filter is:
is the QRS complex. The accurate detection of the R-peak of H(z) = [Y(z)/X(z)] = (1 +32 z-16 + z-32) / (1 + z-1)
the QRS complex is the prerequisite for the reliable function The gain for this filter is 32.
of ECG-analyzers. The recognition of almost all ECG
parameters is based on a fixed point, identifiable at each cycle. 2) Differentiator: After filtering, the signal is differentiated
R-peak is suitable for use as the datum point, because it has to provide the QRS complex slope information. Using a five
the largest amplitude and sharpest waveform that can be point derivative with transfer function:
extracted from ECG. H(z) = 0.125 (2 + z-1 - z-3 - 2 z-4)
The time and amplitude measurements can be performed 3) Squaring function: After differentiation, the signal is
when the apex of the R-peak is detected at each cycle.
squared point by point. The equation of this operation is
There is a large number of recognition algorithms used in y[n] = (x[n])2
ECG-analyzers and, in many cases, the principles of operation
vary [6]. Some are based on different types of amplitude This makes all data points positive and does nonlinear
triggering, while others examine the signal in the frequency amplification of the output of the derivative emphasizing the
domain. The adaptive properties of algorithms to the changing higher frequencies.
signal may differ and some algorithms use statistical methods 4) Moving-Window Integration: The purpose of moving
for identification. window integration is to obtain waveform feature information
Compared to desktop computers, mobile phones have less in addition to the slope of R wave. It is calculated from:
capable CPUs and lack support for complex mathematical y[n] = (x[n - (N-1)] + x[n - (N-2)] + … + x[n]) / N
operations. Implementation of complex algorithms on mobile Where N is the number of samples in the width of the
phones is a challenging task. Also for the real time processing integration window, here N = 30.
and feature extraction of the ECG waveform the algorithm
should be simple and accurate [7]. A real time QRS detection 5) Threshold adjustment and Decision making: After
algorithm proposed by J. Pan and W.J. Tompkins is best suited moving window integration proper thresholds are adjusted to
for these requirements [8]. detect the R-peaks [8]. In order to detect R-peaks correctly i.e.
no R peaks are missed out and no false peak is detected, a
decision making block is implemented which will decide that
the detected peak is valid QRS complex or not.
6) Results:

Figure 5. Block Diagram of Modified Pan Tompkins Algorithm

Figure 3. Original ECG signal Block diagram of both algorithms is same but filtering
algorithm is different for both and output after decision block
is different. At the end QRS complex along with R peaks is
detected without waveform feature in Pan – Tompkins and R
peaks are detected along with waveform feature in modified
Pan – Tompkins algorithm.
1) Filtering: ECG signals from the electrodes are corrupted by
various sources, such as the 60 Hz power line noise, potentials
from muscular activity, and interferences from other nearby
electronic devices. Hence, the signals must undergo pre-
processing like filtering to remove unwanted data from being
Figure 4. QRS complex detected using Pan-Tompkins algorithm processed and misinterpreted.
a) Moving Average (Low-pass) filter: The transfer
Figure 3 shows raw ECG signal of patient with ID number
function of the low pass filter is given by:
104 from MITDB database of 10 seconds. This raw ECG
signal is processed using Pan – Tompkins algorithm and QRS H(z) = (1/10) [1 + z-1 + z-2 + . . . . . . . + z-9]
complex & R peaks are detected as shown in figure 4. y(nT) = [x(nT - (NT-T)) + x(nT – (NT-2T))
+..............+ x(nT) ] / N
B. Discussion
Where N = 10.
From the results obtained from Pan-Tompkins algorithm it b) Derivative based (High-pass) filter: This filter removes
can be clearly observed that the waveform feature of an ECG the baseline wander in the signal.
signal is lost and only the QRS complexes and R-peaks are
extracted. The transfer function is:
Although the algorithm provides simple steps for obtaining H(z) = [ 0.9975(1 - z-1) / (1 – 0.995 z-1) ]
the QRS complexes and provides accurate results up to 99.3% y(nT) = 0.995y(nT - T)+0.9975[x(nT)–x(nT-T)]
[8]. It cannot be used for the proposed system, where the main
objective is to develop an efficient algorithm able to run in c) Comb filter: Transfer function of the comb filter is
near real-time within a mobile phone that can provide a given as follows:
diagnostically useful ECG recording. That can be analyzed H(z)=0.6310[1+z-9]+ 0.4161[z-1+z-8] – 0.0637[z-2 +z-7]
and if necessary it may be sent to the physician for the +0.0224 [z-3 + z-6]– 0.061[z-4 + z-5]
analysis. For this purpose we need to extract the exact
waveform feature from the captured signal. As this system is y(nT) = 0.6310[x(nT – 9T)]+0.4161[x(nT- T) + x(nT – 8T)]
designed for the ambulatory patient monitoring, many - 0.0637 [x(nT – 2T) + x(nT – 7T)] + 0.0224 [x(nT – 3T)
interferences like Baseline wandering, Motion artifact, Power-
line interference, and Electrode pop or contact noise may + x(nT – 6T)] - 0.061 0 [x(nT – 4T) + x(nT – 5T)]]
occur as discussed previously. The comb filter removes the 60 Hz power line
So we have modified this algorithm proposed by J. Pan and interference and harmonic noise is also suppressed.
W.J. Tompkins to extract the waveform feature from the
captured ECG signal. 2) Differentiation: After filtering the signal is differentiated
using the transfer function
C. Modified (Proposed) algorithm Y(z) = [(1 - z-1)/ z-1 ] X(z)
The proposed algorithm is a modified version of Pan- y(nT) = x(nT+T) - x(nT)
Tompkins algorithm. The steps involved in this algorithm are 3) Squaring: After differentiation the resulted signal is
signal filtering using low-pass, high-pass, and comb filter, squared point by point using the equation
differentiation, squaring function and moving window
integration. y(nT) = [x(nT)] 2
4) Moving window integration: After squaring the signal it is
applied to the moving window integrator. The equation used
for this purpose is
y(nT) = [ x(nT - (NT-T)) + x(nT - (NT-2T))+ …. + x(nT) ] / N
Where N = 30.
N is number of samples in integration window. If the
window is too wide it will merge the QRS and T wave. If it is
too small some complexes will produce several peaks in the
waveform. The width of the window is determined
empirically. Here it is 30 samples wide. i.e. N = 30 Figure 10. Filtered signal and R-peaks
Figure 6 is raw ECG signal of patient from live ECG
5) Results: application. This signal when passed through Low Pass Filter
which is nothing but moving average filter with window size
of 10samples (i.e. for 500 Hz sampling frequency, window
size is 20msec) resulted output is as shown in figure
7. Mathematically, a moving average is a type
of convolution and so it can be viewed as low-pass
filter. They smooth the curve and they cut the highest
frequencies.
Figure 8 shows output of Derivative based High-pass
filter. It does not introduce delay in samples and preserves
most of the energy at the high frequencies corresponding to
Figure 6. Raw (collected) ECG signal
the QRS complex.
Figure 9 shows output of Comb filter. A comb filter adds
a delayed version of a signal to itself, causing constructive and
destructive interference. It improves quality of signal. The
implementation here is feedforward i.e. an FIR filter.
After filtering the raw ECG signal, it is applied to
Differentiator, Squarer and Integrator for QRS complex
detection. The steps and importance of each step is same as
algorithm proposed by Pan- Tompkins [8]. Figure 10 shows R
peak location within each QRS complex.
IV. CONCLUSION
Figure 7 Moving average (Low-pass) Filtered signal Pan Tompkins Algorithm and Modified (Proposed)
Algorithm are tested using MIT-BIH Database i.e. using
MITDB which is available on Physionet website. Table I
summarizes the comparison of two algorithms based on R
Peak Detection.
The database contains record of 48 patients. Total number
of R Peaks in database is 3681. Out of these false or failed
peaks detected using Pan Tompkins Algorithm is 92 (2.499%)
and by using Modified Algorithm are 413 (11.219%). This
suggests efficiency of 97.501% of Pan Tompkins Algorithm
Figure 8. Derivative based (High pass) filtered signal and 88.781% efficiency of Modified (Proposed) Pan
Tompkins Algorithm for 30,000 samples i.e. for record or
60mins.
Pan Tompkins Algorithm is found to be more efficient
than Modified or Proposed Algorithm for MITDB. But
Proposed Algorithm is found to be very effective when
acquired ECG signal is noisy. Modified (Proposed) Pan
Tompkins Algorithm filters the signal very efficiently [Figure
6 and 7] and produces actual waveform features.

Figure 9. Comb filtered signal


REFERENCES [5] Valerie GAY, Peter LEIJDEKKERS, ―A Health Monitoring System
Using Smart Phones and Wearable Sensors‖, International Journal of
[1] Alma Secerbegovic, Aljo Mujcic, Nermin Suljanovic, Midhat Nurkic, ARM, VOL. 8, NO. 2, June 2007, pp no.29-36.
Jurij Tasic, ― The research mHealth platform for ECG monitoring ‖, 11th
[6] Patrick S. Hamilton, Willis J. Tompkins, ―Quantitative Investigation of
International Conference on Telecommunications - ConTEL 2011, pp.
QRS Detection rules using the MIT/BIH Arrhythmia Database‖, IEEE
103 – 108.
Transactions on Biomedical Engineering, Vol. BME-33, N0.12,
[2] Rune Fensli, Einar Gunnarson, Torstein Gundersen, ― A Wearable ECG- December 1986, PP No. 1157-1165.
recording System for Continuous Arrhythmia Monitoring in a Wireless
[7] Thomas Ho Chee Tat, Chen Xiang, Lim Eng Thiam, ―Physionet
Tele-Home-Care Situation ‖, 18th IEEE International Symposium on
Computer based Medical systems, Dublin, June 2005. Challenge 2011: Improving the Quality of Electrocardiography Data
Collected Using Real Time QRS-Complex and T-Wave Detection‖,
[3] Website - http://developer.android.com Institute for Infocomm Research, Singapore, Singapore.
[4] Pei-Cheng Hii and Wan-Young Chung, ―A Comprehensive Ubiquitous [8] J. Pan and W.J. Tompkins, ―A real-time QRS detection algorithm,‖
Healthcare Solution on an Android™ Mobile Device‖, Sensors 2011,pp IEEE Trans. Biomed. Eng., vol. BME-32, pp. 230-236, 1985.
no.6799 – 6815.

Patient ID No. of R Peaks Detected No. of R Peaks Actual False or Failed False or Failed
using PAN Tompkins Detected using Number of Detection in PAN Detection in Modified
Algorithm Proposed Algorithm R Peaks TOMPKINS Algorithm
100 74 74 74 0 0
101 71 71 71 0 0
102 73 73 73 0 0
103 70 70 70 0 0
104 76 27 76 0 49
105 83 83 83 0 0
106 67 55 67 0 12
107 73 76 71 2 5
108 111 12 59 52 47
109 91 91 91 0 0
111 69 68 69 0 1
112 86 85 85 1 0
113 58 77 58 0 19
114 54 98 54 0 44
115 63 63 63 0 0
116 79 79 78 1 1
117 51 95 50 1 45
118 73 73 73 0 0
119 65 65 65 0 0
121 61 60 60 1 0
122 87 87 87 0 0
123 49 49 49 0 0
124 50 49 49 1 0
200 87 83 87 0 4
201 89 90 90 1 0
202 53 52 53 0 1
203 102 98 102 0 4
205 89 89 89 0 0
207 79 92 88 9 4
208 95 107 106 11 1
209 93 93 93 0 0
210 88 89 92 4 3
212 90 90 90 0 0
213 110 111 111 1 0
214 76 76 76 0 0
215 113 8 113 0 105
217 72 72 71 1 1
219 73 73 74 1 1
220 72 72 72 0 0
221 78 78 78 0 0
222 75 69 75 0 6
223 80 80 80 0 0
228 74 12 71 3 59
230 79 78 79 0 1
231 63 63 63 0 0
232 58 57 57 1 0
234 103 104 104 1 0
234 92 92 92 0 0

Total – 48
Patient 3717 3508 3681 92 413
(2.499%) (11.219%)

View publication stats

You might also like