You are on page 1of 6

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

net/publication/340623758

Portable Real Time ECG Monitor and Disease Diagnostics

Conference Paper · November 2019


DOI: 10.1109/BECITHCON48839.2019.9063172

CITATIONS READS
0 26

7 authors, including:

Mahmudul Hasan Syed Taskeen Rahman


Neural Semiconductor 2 PUBLICATIONS   0 CITATIONS   
2 PUBLICATIONS   1 CITATION   
SEE PROFILE
SEE PROFILE

Asiful Arefeen Mohtasim Nakib


Washington State University Bangladesh University of Engineering and Technology
5 PUBLICATIONS   1 CITATION    1 PUBLICATION   0 CITATIONS   

SEE PROFILE SEE PROFILE

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

Algorithm development for a low end device to detect heart abnormality View project

Data Driven Personalized Diet Planner View project

All content following this page was uploaded by Asiful Arefeen on 26 April 2020.

The user has requested enhancement of the downloaded file.


Portable Real Time ECG Monitor and Disease
Diagnostics
Mahmudul Hasan, Asiful Arefeen, Syed Taskeen Rahman, Tanvir Ahmed, Mohtasim Nakib,
Celia Shahnaz and Arik Subhana
Department of Electrical and Electronic Engineering,
Bangladesh University of Engineering and Technology, Dhaka 1205, Bangladesh.
*E-mail: asifularefeen1234@gmail.com

Abstract—Rapid diagnosis of heart disease has become a staple low cost ECG based heart rate monitoring system including
of Cardiology. The electrocardiogram (ECG) is an effective automated interpretation algorithm to detect heart diseases can
diagnostic tool which provides significant signals to detect heart be highly auspicious.
abnormalities. In this context, this paper presents a novel and
economical approach to the quick approximation of hearts overall This paper proposes a unique way to monitor the ECG
condition of a person. Using low cost ECG sensors, the real signal of a patient and process it to calculate the heart rate
time ECG signals have been generated via 3 leads, stored and and detect anomalies if present. A wearable vest is designed
displayed on an android app developed by ourselves and some where necessary signal acquiring electrodes and condition-
techniques have been applied to diagnose common abnormalities. ing circuitry are preinstalled [2]. The process is integrated
The proposed system is convenient and consists of uncomplicated
circuitry compared to analogous recent electrocardiogram mon- in an android application (app) developed for continuous
itoring technologies. It offers an affordable and easily accessible monitoring of the users ECG and heart rate. The developed
way to diagnose heart disease and tackle preventable mishaps by algorithm can also diagnose five types of cardiac anomalies,
early diagnosis. namely, arrhythmia, atrial fibrillation, malignant ventricular
Index terms— ECG, Wearable, QRS, Periodogram, R-R arrhythmia, supravenous ventricular arrhythmia and Ventric-
Interval, SVM, Detection ular fibrillation indicates [3], [4] the detected anomaly in the
app. The generated electrocardiogram signal is transmitted to
I. I NTRODUCTION a dedicated server through an Arduino microcontroller for
Cardiovascular diseases, which include diseases of the heart, the android app utilization. The server also provides storage
are the prime cause of death worldwide. As stated by World for the data to facilitate future uses; for instance, it can be
Health Organization (WHO), 31% of all global deaths are conveyed to a specialist for further interpretation if required.
caused by such diseases and 85% of these deaths are due The database used in this paper extensively is the MIT-
to heart attack and stroke [1]. Therefore, heart diseases have BIH database [5], which includes normal ECG signal along
lately become a crucial issue in public healthcare services. with databases dedicated to patients with the aforementioned
Health hazards related to heart diseases can be significantly abnormalities. The key is to sift through the complete signal
minimized if early detection is possible. An electrocardiogram and determine the positions and spread of the ectopic beats
(ECG) based heart rate monitoring system serves as a useful [6], which are, in a general sense, irregular heartbeats. To
tool in diagnosing such deadly diseases. Heart diseases and date, various works have been done to detect the anomalies in
anomalies cause change in normal ECG signal and so, regular ECG signal such as using long short-term memory (LSTM)
monitoring of ECG signal leads to early detection of various networks, self-organizing maps (SOM), analyzing heart rate
arrhythmia and heart diseases. However, conventional ECG variability (HRV), discrete wavelet transform (DWT) [7]. Most
machines being bulky, unhandy and costly, it is not feasible of these use deep learning models which are not suitable
for general people to own a personal ECG machine for regular for implementation in smartphone applications. Here, two
checkup. Hence, a patient needs to visit a health care center transforms are used namely, Lomb-Scargle periodogram [8]
equipped with an ECG machine to monitor his/her heart and the Hilbert transform [9] and the coefficients are used
condition which is not easily manageable on a regular basis. as the features for model development. These transforms are
Moreover, an expert cardiologist is also needed to interpret computationally efficient and therefore don’t have high system
ECG signal accurately. But in a third world country like requirements.
Bangladesh, people have limited access to properly equipped As the target is to look for a novel idea to apply our
health care services and expert cardiologists; as a consequence, knowledge of Biomedical Signal Processing, it has been
many people die from heart diseases due to late detection. As decided to do something that might benefit the healthcare
reported by WHO, at least three quarters of cardiovascular dis- service [10] of low income countries since patients needing
ease induced global deaths occur in low- and middle- income to visit a health care center equipped with an ECG machine
countries [1]. The problem becomes even more prominent in to monitor his/her heart condition is not easily manageable.
remote rural areas. In this context, a handy, user-friendly and Moreover, an expert cardiologist is also needed to interpret the
ECG signal accurately. But in a relatively low income country
like Bangladesh [11], people have limited access to properly
equipped health care services and expert cardiologists; as a
consequence, many people die from heart diseases due to
delay[12]. As reported by WHO, at least three quarters of
cardiovascular disease induced global deaths occur in low
and middle income countries. The problem becomes even
more prominent in remote areas. In this context, a handy and
low cost ECG based heart rate monitoring system including
automated interpretation algorithm to detect heart diseases
can be highly beneficial [13]. The entire system comprising
both the wearable unit and the android application is very
compact, user-friendly and low-cost; and hence, it is affordable
by masses and adaptable in any communities around the world.
II. M ETHODOLOGY
The discussion on this approach has been divided in two
parts, namely - the hardware and the algorithm.
A. Hardware
The prerequisite of this portion is that it must be portable,
Wearable Vest
easily wearable and low cost. It is considered that three leads
+ Conductive fabric
are enough and hence opt for ECG sensors with conductive Electrode
fabric that can be used a limited yet multiple number of Pocket for AD8232 & Wi-fi module
times. The placement of the three leads on the this fabric
also stabilizes the skin to sensor interface resistance. The
leads are connected to a differential amplifier (model AD8232)
[2] to convey the real time signal to the Arduino. The sole
task of the Arduino is to upload the data to Google Firebase Fig. 1. Schematic diagram of the complete setup
server. There is no processing involved here. This served two
purposes simultaneously. The first one is that the data can be
now transferred over to the hand-held devices for processing
and diagnostic outputs. The second one is that, both the data
and the further diagnosis are stored in the server, which can y(n) = x(n) − x(n − 10ms) (4)
be accessed later by specialists for further interpretation and
C. Feature Extraction
necessary treatment. Fig. 1 shows the schematic diagram of
the setup. 1) Lomb-Scargle Periodogram: For random processes, the
time domain signal is often not well defined. Estimating
B. Preprocessing properties such as its ensemble average, standard deviation etc.
Seemingly, an ECG signal suffers from multitudes of noise might require. In that case, Fourier transform is not applicable
and interference due to the nature of the electrode-body inter- as there is guarantee of convergence. So, Parseval’s theorem
face, human respiratory activity and surrounding environment. of Power Spectral Density (PSD) is also not applicable. The
One of the major effects of this is baseline wander [14]. In Schuester definition of PSD is
order to extract the actual signal from the noisy one. This way,
the baseline is adjusted without needing to address the QRS N N
X X
complex [4], [13]. Px (ω) = sin2 (2πf n − θ)Z 2 + cos2 (2πf n − θ)Z 2
n=1 n=1
y(n) = 2 ∗ y(n − 1) − y(n − 2) + x(n) (5)
(1)
− 2 ∗ x(n − 24ms) + x(n − 48ms) In that case, relying on an estimate of Power Spectral
y(n) = y(n − 1) − x(n) − x(n − 128ms) (2) Density, also known as periodogram is a solution. It is an
useful tool to analyze stationary random processes where the
z(n) = x(n − 64ms) − y(n) (3)
PSD is a biased estimate depending on what window and what
The above equations are low pass and high pass filters [15] length of the signal is chosen.
which remove both low and high frequency noise components In this approach, the Lomb-Scargle Periodogram [8] is
that typically appear in ECG signals. Next, the derivative of used. This falls under the class of Least Squares Spectral
the filtered signal is taken to better approximate the output. Analysis methods. Rather than just taking dot products of
the data with sine and cosine waveforms directly, first a time 3) Final Feature Matrix: The final feature matrix per
delay τ is found such that this pair of sinusoids would be ECG specimen is of length 40. 20 maximum values in the
mutually orthogonal at sample times ni and also adjusted for Lomb Scargle Periodogram and 20 maximum values from the
the potentially unequal powers of these two basis functions analytic function have been chosen and they are merged into
to obtain a better estimate of the power at a frequency. This a single vector.
is exactly what actually required as the necessity is to zero
in on the exact frequency spectrum where the significant III. C LASSIFICATION & R ESULTS
components of heart rate lie. The modified PSD is Using the databases of arrhythmia, atrial fibrillation, ven-
tricular fibrillation, the model has been developed using the
PN features extracted from the signals. All the signals are near-
1 (| j=1 Xj cos(ω)(nj − τ )|)2 noiseless and ground truth labelled. To verify the accuracy of
Px (ω) = PN the model, the SVM classifier has been used, employing a 5
2 j cos2 (ω)(nj − τ )
PN (6) fold cross validation to our database. Adjusting the kernels, it
2
1 (| j=1 Xj sin(ω)(nj − τ )|) has been found that the Gaussian SVM kernel produced the
+
2
PN 2 best accuracy out of all the cases. However, as we recall, the
j sin (ω)(nj − τ )
primary objective is the fast diagnosis of a heart condition. To
Here the time delay τ is defined as, achieve that, a smartphone is the best possible device. But, it is
PN clear, a smartphone has nowhere near the processing capability
j=1 sin(2ωτj )
tan(2ωτ ) = PN (7) of modern parallel computing. So this classification scheme
j=1 sin(2ωτj ) must be robust yet efficient. Therefore, the model developed
The reason why Lomb Scargle periodogram works well from the noiseless and ground truth labelled data has been
for ECG signals is that since the precise sampling rate or uploaded to the app and test any incoming data against this
sensitivity can not be determined in P, R or S waves, the delay pretrained model.
component ensures that unevenly sampled data or missing data Here, a detailed analysis of the obtained results is presented.
is accounted for. A. Sample Analysis
2) Hilbert Transform: The second feature taken is the
For an exemplary case, feature vector of a test signal is
Hilbert Transform coefficients. For an analytic function in
extracted using eclipse, an IDE console for Java. The code
the upper half plane, the Hilbert Transform [9] describes the
has been integrated in the app.
relationship between the real part and the imaginary part of
the boundary values.

Z +∞
1 u(τ )dτ
H(u)(t) = (8)
π −∞ t−τ
One of the key tools of the Hilbert transform is to convert
the signal into an analytic function. That is,

s(t) = sr (t) + jsim (t)


(9)
= A(t)exp(jφ(t))
The analytic signal is complex valued. Here, instantaneous Fig. 2. Original ECG
amplitude and instantaneous frequency can be easily obtained.
This is a significant piece of information while measuring The initial signal is noisy and affected by baseline wander.
properties of signals such as the ECG. To get a noiseless signal, combination of filters has been
The frequency domain representation of the Hilbert trans- applied as mentioned before.
form is fairly simple. It is equivalent to introducing 90◦ phase This signal is suitable for analysis.
shifts to spectral components. The Lomb-Scargle Periodogram displays a modified PSD of
the the signal, accounting for discrepancies in both sampling
rate and availability of data.
F (H(u))(ω) = (−isgn(ω)).F (u)(ω) (10) The Hilbert Transform of the signal presents us with an
According to Euler’s formula analytic expression from which the instantaneous amplitude
and phase can be extracted.


It can observed from the figures above, the significant
i = exp( 2 )
 ω>0 components of the heart rate center around an approximate
σH (ω) = 0 ω=0 (11) spectrum of 0.8-2 Hz, as verified by both Lomb Scargle
−jπ


−i = exp( 2 ) ω < 0 periodogram and Hilbert Transform analysis [16].
TABLE I
ACCURACY OF D IAGNOSIS

Labeled Anomalies Accuracy


Arrhythmia 75.8%
Atrial Fibrillation 64.3%
Malignant Ventricular Arrhythmia 58.6%
Supravenous Ventricular 52.0%
Arrhythmia
Ventricular Fibrillation 61.6%

Researches in this field of study have yet to come up with a


solution to the necessity for rapid diagnosis for heart disease.
This issue has been approached by incorporating real time
Fig. 3. Filtered Signal monitoring of ECG, a primary diagnosis and the option for
further confirmation. In Fig. 6, a sample of the beta version
of the app is represented. where, the x axis denotes time in
seconds and y axis refers to the amplitude of the ECG signal
in mili-volts. IHR and AHR are instantaneous heart beat and
average heart beat of the patient respectively. Set button is
pressed after adequate data (data of 2 minutes) for computing
the AHR are obtained. The P2P option is for viewing real
time ECG along with corresponding anomaly whereas the
Doctor Mode allows reviewing previous data from the server
and can be used for further necessities, for example, if expert
interpretation is needed.

Fig. 4. Original ECG

Fig. 6. Sample Interface of the app, x axis denotes time in seconds and y
axis refers to the amplitude of the ECG signal in mili-volts

IV. C ONCLUSION
This article focuses on implementing an ECG signal mon-
itoring system which symbolizes the necessity of signal pro-
cessing for humanitarian causes. The design is still in its
infancy, as this opens the door for possibilities involving
making the healthcare system bring closer to homes. However,
the challenges are quite elaborate. Medical Science is an
insurmountable collection of data where exceptions tend to
trump examples. There is still a lot more information from
Fig. 5. Hilbert Transform databases with different environments and setups to be gath-
ered. The difficulties of verification from multiple experts are
B. Accuracy and Comparative Analysis necessary yet daunting, as faulty analysis could lead to severe
consequences. We are looking forward to continuing our work
The performance analysis of this approach is discussed in in this field while looking for potential breakthroughs.
elaboration.
ACKNOWLEDGMENT [12] L. Green, “Queueing analysis in healthcare,” in Patient
The authors would like to thank the Department of Elec- flow: reducing delay in healthcare delivery, Springer,
trical and Electronic Engineering, Bangladesh University of 2006, pp. 281–307.
Engineering and Technology (BUET) for providing necessary [13] J. Enderle and J. Bronzino, Introduction to biomedical
experimental platform for research and analysis for the com- engineering. Academic press, 2012.
pletion of the work. [14] M. Blanco-Velasco, B. Weng, and K. E. Barner, “Ecg
signal denoising and baseline wander correction based
R EFERENCES on the empirical mode decomposition,” Computers in
[1] W. H. Organization, Cardiovascular diseases (cvds), biology and medicine, vol. 38, no. 1, pp. 1–13, 2008.
2017. [15] debrawang, Fast lomb scargle power spectral in java,
[2] M. Poliks, J. Turner, K. Ghose, Z. Jin, M. Garg, Q. 2017.
Gui, A. Arias, Y. Kahn, M. Schadt, and F. Egitto, “A [16] M. Kobayashi and T. Musha, “1/f fluctuation of heart-
wearable flexible hybrid electronics ecg monitor,” in beat period,” IEEE transactions on Biomedical Engi-
2016 IEEE 66th Electronic Components and Technology neering, no. 6, pp. 456–457, 1982.
Conference (ECTC), IEEE, 2016, pp. 1623–1631.
[3] P. A. Wolf, R. D. Abbott, and W. B. Kannel, “Atrial
fibrillation as an independent risk factor for stroke: The
framingham study.,” Stroke, vol. 22, no. 8, pp. 983–988,
1991.
[4] M. A. Gatzoulis, J. A. Till, J. Somerville, and A. N.
Redington, “Mechanoelectrical interaction in tetralogy
of fallot: Qrs prolongation relates to right ventricular
size and predicts malignant ventricular arrhythmias and
sudden death,” Circulation, vol. 92, no. 2, pp. 231–237,
1995.
[5] G. B. Moody and R. G. Mark, “The impact of the
mit-bih arrhythmia database,” IEEE Engineering in
Medicine and Biology Magazine, vol. 20, no. 3, pp. 45–
50, 2001.
[6] S.-A. Chen, M.-H. Hsieh, C.-T. Tai, C.-F. Tsai, V.
Prakash, W.-C. Yu, T.-L. Hsu, Y.-A. Ding, and M.-S.
Chang, “Initiation of atrial fibrillation by ectopic beats
originating from the pulmonary veins: Electrophys-
iological characteristics, pharmacological responses,
and effects of radiofrequency ablation,” Circulation,
vol. 100, no. 18, pp. 1879–1886, 1999.
[7] Q. Li, C. Rajagopalan, and G. D. Clifford, “Ven-
tricular fibrillation and tachycardia classification using
a machine learning approach,” IEEE Transactions on
Biomedical Engineering, vol. 61, no. 6, pp. 1607–1613,
2013.
[8] T. Ruf, “The lomb-scargle periodogram in biologi-
cal rhythm research: Analysis of incomplete and un-
equally spaced time-series,” Biological Rhythm Re-
search, vol. 30, no. 2, pp. 178–201, 1999.
[9] N. E. Huang, Hilbert-Huang transform and its applica-
tions. World Scientific, 2014, vol. 16.
[10] B. Ekman, “Community-based health insurance in low-
income countries: A systematic review of the evidence,”
Health policy and planning, vol. 19, no. 5, pp. 249–270,
2004.
[11] E. Van Doorslaer, O. O’Donnell, R. P. Rannan-Eliya,
A. Somanathan, S. R. Adhikari, C. C. Garg, D. Har-
bianto, A. N. Herrin, M. N. Huq, S. Ibragimova, et al.,
“Catastrophic payments for health care in asia,” Health
economics, vol. 16, no. 11, pp. 1159–1184, 2007.

View publication stats

You might also like