Você está na página 1de 11

IEEE TRANSACTIONS ON BIOMEDICAL ENGINEERING, VOL. 62, NO.

1, JANUARY 2015

165

A Joint QRS Detection and Data Compression


Scheme for Wearable Sensors
C. J. Deepu, Member, IEEE, and Y. Lian , Fellow, IEEE

AbstractThis paper presents a novel electrocardiogram (ECG)


processing technique for joint data compression and QRS detection in a wireless wearable sensor. The proposed algorithm is aimed
at lowering the average complexity per task by sharing the computational load among multiple essential signal-processing tasks
needed for wearable devices. The compression algorithm, which is
based on an adaptive linear data prediction scheme, achieves a lossless bit compression ratio of 2.286x. The QRS detection algorithm
achieves a sensitivity (Se) of 99.64% and positive prediction (+P)
of 99.81% when tested with the MIT/BIH Arrhythmia database.
Lower overall complexity and good performance renders the proposed technique suitable for wearable/ambulatory ECG devices.
Index TermsECG-on-chip, lossless data compression, QRS detection, wearable devices, wireless sensors.

I. INTRODUCTION
EALTHCARE spending is increasingly becoming the major contributor of expenditure in many countries. U.S.
alone spends roughly 18% of its GDP on healthcare [1]. Cardiovascular diseases are one of the leading causes of the overall
expenditure. These expenses are expected to skyrocket in the
coming years due to an aging population, as a result of increasing life expectancies. The quality of life in this scenario
can be improved by focusing on prevention and early detection
of diseases. This can be achieved by proactive and long-term
monitoring of individuals cardiovascular health using low-cost
wearable electrocardiogram (ECG) sensor devices (e.g. [2], [3]).
The main features of the ECG, i.e., the P, Q, R, S, and T points,
give information about the cardiac health of the person.
A wearable ECG sensor, as shown in Fig. 1, can be used to
acquire, process, and wirelessly transmit ECG signal to a monitoring center. The main challenge involved in the development
of the sensor is to make the device low profile, unobtrusive, easy
to use with long battery life for continuous usage. A high level of
integration with inbuilt signal acquisition and data conversion is
required to minimize the size, cost, and power consumption of
such a sensor. The major source of power consumption in such

Manuscript received March 13, 2014; revised June 14, 2014; accepted July
10, 2014. Date of publication July 24, 2014; date of current version December
18, 2014. This work was supported in part by the National Research Foundation
Competitive Research Programme under Grant NRF-CRP8-2011-01 and NUS
Faculty Strategic Funding under Grant R-263-000-A02-731. Asterisk indicates
corresponding author.
C. J. Deepu is with the Department of Electrical and Computer Engineering, National University of Singapore, Singapore 119077 (e-mail: deepu_
john@ieee.org).
Y. Lian is with the Department of Electrical and Computer Engineering, National University of Singapore, Singapore 119077 (e-mail: eleliany@
nus.edu.sg).
Color versions of one or more of the figures in this paper are available online
at http://ieeexplore.ieee.org.
Digital Object Identifier 10.1109/TBME.2014.2342879

Fig. 1.

Wearable ECG monitoring system.

a system is the wireless transceiver, and hence, it is desirable


to carry out preliminary ECG analysis tasks like QRS detection
[4] and RR interval estimation locally. This allows the transmission to be triggered only when it is deemed necessary based
on cardiac rhythm analysis. Further, the large quantity of ECG
data obtained by round the clock monitoring may need to be
either stored locally in a flash device or transmitted wirelessly
to a monitoring gateway for further analysis. The transmission
of data incurs high power consumption, and the use of a local
storage increases the device cost. The cost is further affected
by the need for an on-chip SRAM which is typically used to
interface the ECG chip with a microcontroller [5] to support
burst transfer.
Although lossy compression techniques provide higher compression ratios (CR), we focus on lossless schemes so as to prevent the possibility of losing any patient information of potential
diagnostic value. Also, it is worth noting that lossy compression
techniques have not been approved by medical regulatory bodies in most countries and hence cannot be used in commercial
devices. Most of the existing literature on lossless ECG compression [6], [7] predominantly focuses on achieving higher
CR. However, in the context of wireless sensors and ambulatory devices, the energy and memory savings obtained from the
compression should be higher than what is consumed by the
compressor itself.
QRS detection is not a new topic. A comprehensive review
of existing approaches can be found in [8]. However, most of
the reported approaches are aimed at increasing the accuracy of
detection by using complex signal-processing techniques. For
ambulatory devices and sensors, another very important figure
of merit is the power consumption, and hence, the overall complexity should be low. In recent years, several QRS detection
algorithms with low-power implementations have been reported
for wireless sensors [9][12]. Also several discrete or integrated
lossy and lossless ECG compression implementations have been
reported [13], [14]. It can be noted that using two distinct approaches for QRS detection and data compression will result

0018-9294 2014 IEEE. Personal use is permitted, but republication/redistribution requires IEEE permission.
See http://www.ieee.org/publications standards/publications/rights/index.html for more information.

166

IEEE TRANSACTIONS ON BIOMEDICAL ENGINEERING, VOL. 62, NO. 1, JANUARY 2015

in higher overall system complexity. Till now, there are no reports on joint approaches for QRS detection and lossless data
compression.
In this paper, we present a joint approach for QRS detection
and ECG compression algorithm for use in wireless sensors. The
central idea of the proposed algorithm is to use a single technique for processing of QRS detection and data compression,
instead of using two distinct approaches. The algorithm lowers
the average computational complexity per task by sharing the
computational load among two operations. This is done using a
shared adaptive linear predictor for performing both ECG beatdetection and lossless data compression. In addition, a novel
fixed-length data coding-packaging technique for convenient
representation of the signal entropy is presented.
This paper is organized as follows. Section II introduces
the concept of the joint QRS detection compression (JQDC)
scheme. In Section III, the details of QRS detection scheme
are discussed. Section IV describes the lossless compression
scheme. The performance analysis of the algorithm and the simulation results are detailed in Section V. Concluding remarks
are given in Section VI.

Fig. 2.

Instantaneous prediction error, e(n).

Fig. 3.

JQDC scheme: Overall block diagram.

II. PROPOSED JQDC SCHEME


Several forward prediction-based approaches are used for
QRS detection as reported in [8], [15], and [16]. In these approaches, a forward predictor is used to estimate the current
sample of the ECG signal, x(n), from its past m samples, i.e.,
x
(n) =

m


hk x(n k)

(1)

k =1
k

where x
(n) is the estimate of x(n) and h is the predictor
coefficient. Upon convergence, the predictor is able to closely
estimate the future samples, including the P, T wave segments
and the slow baseline variations in the ECG signal. Therefore,
the instantaneous prediction error e(n), which is the difference
between the actual sample and its estimate x
(n), will be minimal
in these regions
e(n) = x(n) x
(n).

(2)

However, for signal regions with steep amplitude variations,


like the QRS segment, the predictor statistics are considerably
different and hence will result in a higher prediction error, as
shown in Fig. 2. Note that Fig. 2 represents one of simulation
results based on one dataset in the MIT/BIH database [17], [18].
The rest of the datasets show similar characteristics. Therefore,
the prediction error can be used as a marker to locate the QRS
complex in the ECG signal.
Alternatively, the short-term linear predictor can be thought
of being capable of predicting the low-frequency portion of the
ECG signal, while most of the high-frequency signal content and
noise remain in the instantaneous prediction error. The transfer
function of this filter is given in (3). With further processing, the
QRS complex can be extracted from this high-pass filtered

signal [8]


E(z) =

m



h Z
k

X(z).

(3)

k =1

At the same time, we noticed that linear predictive coding is


a main part of lossless data compression techniques [6], [13],
[19] for the redundancy reduction between neighboring signal
samples. This prompts us to develop a new scheme that jointly
performs QRS detection and lossless compression (JQDC) as
shown in Fig. 3. This way, the computational load of the linear
predictive coding can be shared between data compression and
QRS detection.
In the proposed JQDC scheme, a linear predictor is used
to estimate the current sample based on previous m samples.
The estimated value is subtracted from the actual sample to
calculate the instantaneous prediction error, which after further
processing is used for identifying the location of QRS complex.
The prediction error is encoded and packaged so as to obtain
a compressed lossless representation of the original data for
wireless transmission or local storage.
Several factors affect the detection accuracy, CR, and hardware complexity in the proposed joint detection and compression algorithm. In the following, we analyze the effect of linear
predictor selection, order of the predictor, and step size.
A. Adaptive Linear Prediction
In the proposed JQDC scheme, an adaptive predictor, as
shown in Fig. 4, is used, so that predictor self-adjusts output
based on the incoming signal statistics.

DEEPU AND LIAN: A JOINT QRS DETECTION AND DATA COMPRESSION SCHEME FOR WEARABLE SENSORS

Fig. 4.

Fig. 5.

Adaptive linear predictor.


TABLE I
PERFORMANCE OF LMS VARIANTS IN THE JQDC SCHEME

Algorithm

Se (%)

+P (%)

CR

LMS
NLMS
SLMS
SSLMS

99.51
99.56
99.65
99.64

99.75
99.68
99.72
99.81

2.29
2.31
2.30
2.28

TABLE II
HARDWARE COMPLEXITY FOR A FOUR-TAP ADAPTIVE UPDATER
Algorithm
LMS
NLMS
SLMS
SSLMS

Adders

Multipliers

4
7
5
5

8
16
4
0

The predictor is realized by using a tapped-delay line structure. For updating predictor weights, LMS algorithm and its
variants were considered, as follows [20]:
LMS h(n + 1) = h(n) + . e(n) . x(n).
NLMS h(n + 1) = h(n) + .e(n) .

x(n)
.
x(n)2

SLMS h(n + 1) = h(n) + .sgn(e(n)) . x(n).


SSLMS h(n + 1) = h(n) + . sgn(e(n)) . sgn(x(n)).

(4)
(5)

167

Predictor order versus performance.

carried out using the ECG signals from the MIT/BIH database,
along with SSLMS predictor and initialization methodology
mentioned in the next section. Fig. 5 shows the QRS detection
performance and CR versus predictors order. As expected, the
CR improves as the predictor order increases. This is because the
predictor could more accurately predict the future data as predictor order increases. The QRS detection performance based
on SE and +P, on the other hand, shows a different pattern. The
performance increases as the order is increased till 4 and started
to gradually decline thereafter. As the order increases QRS segment becomes more and more predictable, and hence, the instantaneous error contains less signal component of the QRS
complex, which results in a lower detection accuracy. While at
very low orders, the prediction accuracy is lower, which leads
to presence of low-frequency baseline variations and P/T wave
components in the instantaneous error output that affects QRS
detection accuracy.

C. Initialization and Step Size


Adaptive techniques require several cycles to converge to the
optimal point based on the incoming signal characteristics. In
order to speed up the adaptation, we initialized the SSLMS
init
init
init
as
predictor with pre-computed values hinit
1 , h2 , h3 , h4
given below.

(6)
(7)

Here, and are the step sizes, and h (n + 1) and h (n)


are updated and current predictor coefficients, respectively. The
different LMS variants yielded comparable results based on
simulations using the MIT/BIH database for detection and compression as shown in Table I. We chose Sign Sign Least Mean
Square (SSLMS) algorithm as its implementation complexity is
the lowest [21] as shown in Table II.
B. Linear Predictor Order
The order of linear predictor is highly related to performance
of proposed JQDC and hardware cost. It is necessary to analyze
the relationship between the order and performance. This was

hinit
=
1

N
1 
h1n ,
N n =1

hinit
=
2

N
1 
h2n
N n =1

(8)

=
hinit
3

N
1 
h3n ,
N n =1

hinit
=
4

N
1 
h4n
N n =1

(9)

init
init
init
where hinit
are the statistical averages of
1 , h2 , h3 , and h4
the predictor coefficients (h1n , h2n , h3n , h4n ) obtained from the
datasets in the MIT/BIH database. As the signal characteristics
of ECG vary from patient to another, the statistical average from
several datasets serves as a good starting point for the adaptation
for all inputs. The coefficients of the datasets were computed
by using LevinsonDurbin algorithm [20]. A variable step e

168

Fig. 6.

IEEE TRANSACTIONS ON BIOMEDICAL ENGINEERING, VOL. 62, NO. 1, JANUARY 2015

QRS detection block diagram.

was selected as follows:



e =

init ,
nal ,

N < NL
N NL .

(10)

For initial NL iterations, a higher value of step size, init =


0.001, is used in order to speed up predictor adaptation. However, a large step size will result in a lower overall compression
and QRS detection ratios because of higher steady-state error
(in the slowly varying segments) and faster prediction response
to QRS complex (resulting in smaller prediction error for QRS).
Once the predictor coefficients are adapted based on the incoming signal, a smaller value step size, nal = 0.00001, is used.
These and NL (1024) values are selected based on simulations
using the MIT/BIH database.

Fig. 7.

Filtering a noisy signal with (a) moving average filter and (b) SG filter.

sense. A polynomial of order K is defined as


fK (x) =

A. SG Filtering
SG filters are known well in domains like analytical chemistry
and has been of recent interest in ECG signal processing [22].
SG filters smoothen the incoming signal by approximating the
signal within a specified window of size L to a polynomial of
order K, which best matches the given signal in a least-squares

ci xi .

(11)

i=1

III. QRS DETECTION


As noted in the previous section, the instantaneous prediction error, e(n), from the adaptive SSLMS predictor is used for
locating the QRS complex. This is because the error corresponding to QRS segment is relatively higher than that of P, T wave
and baseline variations. The prediction error also contains highfrequency impulse noise, which has to be filtered out so as to
easily locate the QRS complex. Typically, moving average filters are effective in removing impulse noises and smoothening
of such signals. However in doing so, it also smoothens and distorts the shape and the height of the error peaks corresponding to
the QRS complex. It is important to preserve the integrity of the
signal content corresponding to QRS, while smoothening the
high-frequency and impulse noise that corresponds to the other
regions of ECG. To achieve these goals, a SavtizkyGolay (SG)
filter is employed to remove the high-frequency impulse noise
from the prediction error. Once the impulse noise is removed,
the signal is further enhanced by using a squaring and moving sum operation for adaptive thresholding and peak detection.
The block diagram of the QRS detection scheme is illustrated
in Fig. 6.

K


It is shown in [22] that this polynomial fitting and reevaluation is equivalent to discrete convolution with a fixed
impulse response
esg (n) =

M


h[m]e(n m)

(12)

m =M

where L = 2M + 1, K L, esg (n) is the SG filtered prediction


error
In comparison with a moving average filter, SG filters are
beneficial in maintaining the higher order moments in the input
signal, as shown in Fig. 7. It preserves features of the distribution
such as relative maxima, minima, and width and reduces the
smoothening of peak heights, while suppressing the impulse
noise. It can be seen from Fig. 7 that the noise suppression
capability of SG filters is not as good as moving average filter.
However, once the impulse noise level relative to the QRS peaks
is suppressed, a moving average operation can be used to further
smoothen the signal.
To select the order and frame size (K, L) of the filter for
removing noise from the prediction error, we computed the
QRS detection accuracy based on the MIT/BIH database for
various combinations of (K, L) with K ranging from 3 to 6 and L
ranging from 9 to 17. It was found that best detection accuracy
hardware complexity tradeoff was achieved for SG filter with
K = 3 and L = 15. The SG filter coefficients were computed
as described in [22].

DEEPU AND LIAN: A JOINT QRS DETECTION AND DATA COMPRESSION SCHEME FOR WEARABLE SENSORS

169

B. Signal Enhancement by Squaring and Moving Sum


Once the high-frequency impulse noise is suppressed, the
signal is further enhanced by squaring and taking the moving
sum of the signal before the thresholding operation. The instantaneous signal samples are squared, as in (13), to provide
a nonlinear amplification to the prediction error, which helps
to further magnify the QRS component in the signal relative to
the other segments. Furthermore, moving window integration is
done to obtain a smooth waveform for thresholding and peak
detection


m /2

eno(n) =

|e sg(n)|2

(13)

n =m /2

The number of samples for moving integration, M, is selected such that it corresponds to the width of the QRS complex
in the ECG signal. For 360-Hz sampling, M = 26 was chosen
as it gave the best tradeoff between complexity and detection
performance.
C. Adaptive Thresholding and Peak detection
The enhanced signal, eno(n), is continuously scanned to find
QRS peaks. As the signal amplitudes vary across patients and
based on external conditions, an adaptive threshold is used for
detection. The threshold is initialized with a default value, Thdef
in the beginning, and a new threshold is computed based on the
maximum value of the signal in a training period of first 2 s, i.e.,
the threshold is updated to 25% of the maximum value during
this period. Every time the signal exceeds the threshold, the
peak detection algorithm searches and locates the presence of
a peak, Tam p , as described later. The average threshold Thavg
is computed as 25% of the average of last four detected peaks,
i.e.,
1 
Thk .
(14)
Thavg = 0.25
4

Fig. 8.

Threshold adaptation routine for QRS detection.

Fig. 9.

Peak detection.

k 3

In order to prevent sudden amplitude changes from affecting


the threshold adaptation, the peak amplitude considered for each
detection is limited to two times the previously detected peak.
Furthermore, an automated threshold reduction mechanism is
employed to ensure that a decrease in the peak amplitude of
the signal corresponding to QRS peaks does not cause a lockup
condition, whereby subsequent peaks are not detected due to
a higher threshold. For this, the RR intervals from past four
successful detections are averaged to find RRavg
  
4
1
RRavg =
RRi .
(15)

4
i=1
For every RRavg duration, if a new peak is not detected, then
the average threshold is reduced to 75% of its current value.
This threshold reduction continues until the average threshold
hits a predefined minimum value, so that noise signals are not
picked up as QRS peaks. The threshold adaptation routine is
given in Fig. 8.
The peak detection algorithm starts when the filtered signal
eno(n) exceeds the threshold. It begins with finding a continually

rising edge and then a continuously falling edge within a specific


period of time as shown in Fig. 9. The adaptive threshold update mechanism described previously prevents the occurrence
of false detections due to variation in signal amplitude. Further,
we also implemented a false peak elimination mechanism that
eliminates close peaks
2

eno(i j) eno(i j 1) > 0

j =0
2

eno(i + j + 1) eno(i + j) < 0.

j =0

(16)
(17)

The rising edge is identified by a continuous increase in signal


amplitude over at least three points as defined by (16). Once a
rising edge is located, the algorithm looks for a falling edge
within a search window Ts of 100 ms. If within T s, another

170

IEEE TRANSACTIONS ON BIOMEDICAL ENGINEERING, VOL. 62, NO. 1, JANUARY 2015

Fig. 11.

Lossless data compression scheme.

IV. LOSSLESS DATA COMPRESSION

Fig. 10.

Peak detection and false peak cancellation routine.

rising edge is located, the previously detected rising edge is


discarded, and the timer Ts is restarted at the new edge. The
maximum signal amplitude within this search window, when
there is a detection, is considered as the new threshold, Tam p .
A falling edge is determined by a continuous decrease in signal
amplitude over three points as given in (17). If a falling edge is
present, the algorithm checks for the presence of a previous peak
within 35% duration of RRavg (TBlank ) interval, failing which,
a detection is immediately declared. If a previously detected
peak exists within TBlank duration, then either the current peak
or the previous peak is canceled based on a lower Tam p value.
TBlank is bounded by a maximum value, so that the peak can
be declared within a fixed delay. The peak detection routine is
given in Fig. 10.

As discussed previously, the dynamic range of the prediction


error signal e(n) is low and centers around zero except for the
segment corresponding to the QRS complex. However, it should
be noted that for preserving the data without any loss, we need
(M + 2) bits to fully represent e(n), where M is the bit-width
of x(n). Further, a coding scheme can be used to reduce the
bit-width of e(n) without incurring any data loss. Instead of
transmitting the whole sample, only the coded data have to be
stored/transmitted, resulting in power/memory savings.
For coding e(n), variable length coding schemes like Huffman
and Arithmetic coding [13] can be used, which produce prefixfree codes [23]. The proposed JQDC scheme is compatible with
any of these existing coding schemes. The complexity of encoder/decoder implementation is quite high for these techniques
though they produces optimal bit representations [13], [24]. For
example, Huffman coding associates the most frequently occurring symbols with short codewords and the less frequently occurring symbols with long codewords. This symbol-codeword
association table has to be preconstructed using a statistical
dataset and the implementation of this table would require a
large on chip memory [24] which ultimately would negate the
effect of SRAM area savings [5] through compression. A further
suboptimal approach, selective Huffman coding [23], encodes
only m frequently used symbols with Huffman codes and retain
the remaining data unencoded at the expense of CR achieved
[23]. The hardware complexity of [14] and [23] is lower compared to the statistical approach. However, it still needs an m
symbol lookup table at the encoder as well as the decoder. In
addition, these coding schemes produce variable length codes
at the output. Further packaging is required to make it practical fixed-length packets that can be stored in fixed word length
SRAM/Flash or interfaced through a standard I/O like SPI. This
repackaging usually necessitates a complex hardware like the
one proposed in [25].
We adopt a simple coding-packaging scheme which gives a
practical, fixed-length 16-bit output and has low hardware complexity (first presented in [26]). The coding-packaging routine
is summarized in Table III. Here, the 2s complement representation (e_2c(n)) of the error signal is used. Since most error
samples centers around zero, it can be represented in only a few
bits. Therefore, we only retain the necessary LSBs and remove
any MSBs that do not carry information. However, the problem
in using this approach is that the bit clipped, 2s complement
encoded samples are of varying bit widths and cannot be stored
continuously in a memory as it lacks the prefix-free nature of
the Huffman codes. Hence, we introduce a simple bit packaging
scheme which can pack data samples of varying bit widths dynamically to produce a fixed-length data output of 16 bits. Each
individual data packet will be marked with a unique header so

DEEPU AND LIAN: A JOINT QRS DETECTION AND DATA COMPRESSION SCHEME FOR WEARABLE SENSORS

171

TABLE III
SIMPLIFIED CODING-PACKAGING ROUTINE
Simplified data packaging routine.
1) Receive 2sC coded prediction error, e 2 c(n ), into a 6word local memory.
2) If the memory is full go to Step 3), else go to Step 1)
3) If-2 e 2 c(n 5 i n ) 1, append header 0000, use framing format D
form Table IV and go to Step 1) else Step 4)
4) If-4 e 2 c(n 3 i n ) 3, append header 0001, use framing format C
form Table IV and go to Step 1) else Step 5)
5) If-16 e 2 c(n 2 i n ) 15, append header 1, use framing format A
form Table IV and go to Step 1) else Step 6)
6) If-64 e 2 c(n 1 i n ) 63, append header 01, use framing format B
form Table IV and go to Step 1) else Step 7)
7) If-65 e 2 c(n ) 64, append header 0011, use framing format E form
Table IV, replace e 2 c(n ) with corresponding x(n) and go to Step 1)

TABLE IV
SPECIFICATIONS OF THE FABRICATED DEVICES

TABLE V
ECG COMPRESSION DE-COMPRESSION SUMMARY
ECG Compression De-Compression Summary
Compression
1) Initialize the SSLMS predictor
2) While new input sample do
, from previous sample using SSLMS predictor
a. Estimate new sample, x
b. Read new sample, x

c. Compute prediction error e(n ) = x x


d. Update SSLMS predictor weights with Eq(7)
e. Clip e(n) to obtain min bit width 2s C representation
f. Package using routine in Table III
De-Compression

1) Initialize the SSLMS predictor and estimate the first sample, x


2) Unpack frames using data format from Table IV, to get e(n)
(n) + e(n ) and feedback to the predictor.
3) Reconstruct original data with x(n ) = x

as to easily identify and decode the data while decompressing.


The data packaging format is listed in Table IV.
The dynamic data packaging scheme uses a simple priority
encoding technique to frame fixed-length data from samples of
multiple bit widths. As and when the error data are received, the
algorithm checks whether the maximum amplitude of a signal
group (e2 c (n j i n)) exceeds the value that particular
frame format can accommodate from Table IV based on the
packaging routine given in Table III. If not, the algorithm proceeds with the next best framing option. Full data frames of
Type E can be sent periodically at a predetermined interval to
add resilience against transmission errors. The summary of the
compressiondecompression scheme is given in Table V.

Fig. 12. QRS detection over tape 117 of the MIT/BIH database with large T
waves (a) ECG signal (b) Prediction Error (c) SG filtered signal (d)smoothened
signal with adaptive thresholding and detected QRS peaks (Red).

V. PERFORMANCE RESULTS
A. QRS Detection
The performance of the proposed algorithm is evaluated using
the MIT/BIH Arrhythmia database. The MIT/BIH database is a
benchmark database with 48 half-hour two-channel ambulatory
ECG recordings. These recordings have 11-bit resolution over
10 mV and are sampled at 360 Hz.
To evaluate the QRS detection performance, false positive
(FP) and false negative (FN) detections are used. FP indicates
the declaration of a QRS peak when there is actually none and
FN indicates that the algorithm failed to detect an actual beat.
Further, by using FP and FN, the sensitivity (Se) and positive
prediction (+P) are computed using the following equations:
TP
TP + FN
TP
+P (%) =
.
TP + FP
Se(%) =

(18)
(19)

Here, TP stands for true positive, i.e., the number of QRS


correctly detected. Table VI contains the summary of QRS detection results for all recordings. Figs. 1214 show the performance of the algorithm under noisy conditions. The first plot
(a) in each figure shows the original signal. The second plot (b)

172

IEEE TRANSACTIONS ON BIOMEDICAL ENGINEERING, VOL. 62, NO. 1, JANUARY 2015

TABLE VI
PERFORMANCE OF THE PROPOSED ALGORITHM USING
THE MIT/BIH DATABASE
Tape

Total

FP

FN

Se (%)

+P (%)

100
101
102
103
104
105
106
107
108
109
111
112
113
114
115
116
117
118
119
121
122
123
124
200
201
202
203
205
207
208
209
210
212
213
214
215
217
219
220
221
222
223
228
230
231
232
233
234

2273
1865
2187
2084
2229
2572
2027
2137
1774
2532
2124
2539
1795
1879
1953
2412
1535
2278
1987
1863
2476
1518
1619
2601
1963
2136
2980
2656
1860
2955
3004
2650
2748
3251
2265
3363
2209
2154
2048
2427
2483
2605
2053
2256
1571
1780
3079
2753

0
3
0
0
24
27
1
0
30
3
3
0
0
8
0
2
0
1
1
1
1
5
1
2
0
0
22
0
14
4
0
5
2
0
2
3
0
0
0
1
4
0
31
0
0
0
0
0

1
1
0
1
3
9
4
4
3
4
1
0
1
2
0
20
0
0
0
0
0
3
7
2
85
17
56
12
4
24
0
19
0
34
4
4
3
5
0
7
1
6
4
0
0
37
4
3

99.96
99.95
100
99.95
99.87
99.65
99.8
99.81
99.83
99.84
99.95
100
99.94
99.89
100
99.17
100
100
100
100
100
99.8
99.57
99.92
95.67
99.2
98.12
99.55
99.78
99.19
100
99.28
100
98.95
99.82
99.88
99.86
99.77
100
99.71
99.96
99.77
99.81
100
100
97.92
99.87
99.89

100
99.84
100
100
98.93
98.96
99.95
100
98.32
99.88
99.86
100
100
99.58
100
99.92
100
99.96
99.95
99.95
99.96
99.67
99.94
99.92
100
100
99.25
100
99.25
99.86
100
99.81
99.93
100
99.91
99.91
100
100
100
99.96
99.84
100
98.51
100
100
100
100
100

Total

109508

201

395

99.64

99.81

shows the instantaneous prediction error e(n). The third plot (c)
shows the SG filtered signal. It can be observed that the impulse
noise is drastically reduced after SG filtering. The fourth plot
(d) shows the smoothened signal after squaring and integration
with threshold varying adaptively based on signal amplitude.
The peak detections are marked as a red colored spike in the
plot (d). Fig. 12 shows the performance of the algorithm under
the presence of elevated T waves, which are often misidentified as QRS peaks due to their amplitude. It can be seen from
Fig. 12(b)(d) that the T waves are effectively removed by the
filtering and processing stages. Fig. 13 shows the detection performance, when QRS complexes with varying morphologies,

Fig. 13. QRS detection over tape 200 of the MIT/BIH database with irregular
inverted peaks. (a) ECG signal. (b) Prediction error. (c) SG filtered signal. (d)
Smoothened signal with adaptive thresholding and detected QRS peaks (Red).

amplitudes, and intervals are present. Every alternate beat has


inverted morphology, varying amplitude with irregular RR interval as shown in Fig. 13(a). It can be seen from Fig. 13(b)(d)
that the algorithm performs well in presence of these irregularities. Fig. 13(d) also illustrates the automated threshold reduction
mechanism when no new R peak is detected for an RRavg interval. Fig. 14 shows that the algorithm performs well in the
presence of baseline wandering. In Fig. 14, it can be seen that
the automatic threshold adjustment drops the detection threshold based on the signal amplitude so as to enable an accurate
identification of QRS complex.
Table VII compares the performance of existing algorithms
with the proposed one. As shown, the proposed algorithm
achieves good detection error rate in comparison with other
competing algorithms. Some existing algorithms like multiscale morphology technique offer better performance in absolute terms. However, the computational complexities of these
algorithms are relatively high. More importantly, the existing
algorithms only perform QRS detection. In comparison, the
proposed algorithm can share the computational load with data
compression to achieve more power savings in a wearable sensor node. The additional logic needed for carrying out data
compression is very minimal. Hence, the proposed algorithm is
better suited for wearable sensor applications.

DEEPU AND LIAN: A JOINT QRS DETECTION AND DATA COMPRESSION SCHEME FOR WEARABLE SENSORS

173

TABLE VII
PERFORMANCE COMPARISON WITH OTHER PUBLISHED ALGORITHMS

Fig. 14. QRS detection of tape 203 of the MIT database with severe baseline
drift and noise. (a) ECG signal. (b) Prediction error. (c) SG filtered signal. (d)
Smoothened signal with adaptive thresholding and detected QRS peaks (Red).

B. Data Compression Performance


The proposed data compression algorithm is tested using the
MIT/BIH Arrhythmia database for analyzing the compression
performance. The bit compression ratio (BCR) is computed as
follows:
No of uncompressed samples X BWuncom p
BCR =
(20)
No of compressed Samples X BWcom p
where BWcom p and BWuncom p refers to the bit widths of compressed and uncompressed samples, respectively.
Table VIII shows the summary of ECG compression performance for all MIT/BIH recordings. The average and max values
of BCR obtained are also given. The proposed JQDC scheme
can be used with any error coding scheme. Statistical Huffman coding gives the best performance. However, its hardware
complexity is high and produces variable length codes. The selective Huffman codes has moderate complexity but produces
variable length codes that need further packaging [25]. The proposed joint coding-packaging scheme gives fixed-length frames,
which are compatible with Memory/SPI, etc., at a very low complexity compared to [13] and [14].
Table IX compares the compression performance of the proposed approach with other techniques implemented on hardware

Method

Se(%)

+P(%)

Ref

Wavelet De-noising
Genetic Algorithm
Filter Banks
BPF/Search-back
Multiscale Morphology
Quadratic Spline wavelet
Pulse Train approach
Wavelet Delineation
Proposed method

99.55
99.60
99.59
99.69
99.81
99.31
99.58
99.66
99.64

99.49
99.51
99.56
99.77
99.80
99.70
99.55
99.56
99.81

[27]
[28]
[29]
[30]
[31]
[10]
[4]
[32]

for wearable applications. In [13], a delta predictor and Rice


Golomb coding scheme are utilized to achieve a CR of 2.38.
However, the RiceGolomb coding has higher complexity and
requires a SRAM block for its implementation leading to large
area. In [14], a two-stage adaptive predictor and the Huffman
coding achieve the highest CR of 2.43. But it generates variable
length coded data and would need further packaging to interface with a standard IO [25]. In [33], a simple predictor and
the Huffman coding are employed to achieve a CR of 1.92. In
[26], a slope predictor and a fixed-length packaging scheme are
combined to produce a CR of 2.25. In addition, there exist other
approaches for achieving higher CR while using complex signalprocessing techniques. These approaches require the usage of
more complex hardware, which is not suitable for low-power
wearable applications [6], [7], and therefore not included in the
comparison. The proposed technique achieves a CR of 2.28 using an adaptive predictor and fixed-length packaging. Although
the compression performance is slightly lower than that in [13]
and [14], the proposed joint approach implements two functions, i.e., compression and QRS detection, both of which are
essential for wearable applications and share the computational
complexity. All the other approaches only implement one of the
functions. In addition, the proposed scheme always generates
fixed-length output and would not require any further packaging
[25].
In order to estimate the power consumed by the proposed
technique, we have implemented the JQDC scheme in Verilog
HDL and synthesized it using 0.35-m CMOS process for a
two-channel ECG device. The received data contain serially
multiplexed two-channel ECG signal. Initially, the data are demultiplexed and fed into individual predictors (as in Fig. 4)
to compute the estimate. The prediction error from one of the
channels is used for QRS detection and prediction errors from
both channels are multiplexed back and compressed using the
fixed-length packaging scheme discussed in Section IV. A QRS
detector is implemented (see Fig. 6), where threshold adaptation and false peak elimination follows the routines in Figs 8
and 10. The design also includes an SPI slave to interface with
external microcontrollers. The ECG signal from the MIT/BIH
database is used for testing the design. The circuit power has
been estimated with Synopsys Power Compiler after gate level
synthesis. The circuit consumes 490 nW at 1.8-V supply voltage
and 512-Hz clock frequency. When the QRS detector clock is

174

IEEE TRANSACTIONS ON BIOMEDICAL ENGINEERING, VOL. 62, NO. 1, JANUARY 2015

TABLE VIII
COMPRESSION PERFORMANCE OF THE PROPOSED ALGORITHM USING THE
MIT/BIH DATABASE
Tape

Statistical
Huffman
Coding

Selective
Huffman
Coding

Proposed
Joint coding
Packaging

100
101
102
103
104
105
106
107
108
109
111
112
113
114
115
116
117
118
119
121
122
123
124
200
201
202
203
205
207
208
209
210
212
213
214
215
217
219
220
221
222
223
228
230
231
232
233
234

2.7748
2.7287
2.7431
2.7125
2.6096
2.662
2.5418
2.5466
2.6444
2.7443
2.7299
2.9021
2.5496
2.7145
2.7494
2.4911
2.7192
2.5063
2.5856
2.9946
2.5772
2.6791
2.8712
2.6221
2.9862
2.6623
2.3297
2.9638
2.7089
2.5433
2.4936
2.7111
2.4203
2.6227
2.5715
2.4818
2.545
2.8075
2.722
2.6238
2.6923
2.8428
2.664
2.7724
2.848
2.9561
2.7628
2.8064

2.2244
2.1952
2.2198
2.1919
2.1471
2.1512
2.0833
2.0959
2.1395
2.2023
2.1927
2.3004
2.1001
2.1833
2.2199
2.0613
2.1861
2.0537
2.104
2.3554
2.0959
2.163
2.2816
2.1272
2.351
2.15
1.9387
2.3382
2.1804
2.0793
2.0447
2.1815
1.9988
2.1284
2.0938
2.0365
2.0864
2.2443
2.2083
2.1258
2.1694
2.2643
2.1517
2.2226
2.2722
2.3323
2.2141
2.2402

2.3173
2.2858
2.2962
2.288
2.247
2.2533
2.1825
2.1978
2.2452
2.2951
2.245
2.432
2.1748
2.2555
2.3724
2.2054
2.2952
2.2023
2.2422
2.4432
2.2141
2.2907
2.4283
2.2572
2.4281
2.2361
2.1136
2.5446
2.2751
2.18
2.1817
2.2712
2.1449
2.2962
2.1913
2.1593
2.1776
2.4021
2.3582
2.2174
2.2411
2.4042
2.2428
2.3808
2.4149
2.4403
2.3535
2.3855

2.69
2.99

2.17
2.35

2.286
2.544

Avg BCR
Max. BCR

TABLE IX
COMPRESSION PERFORMANCE COMPARISON WITH OTHER ALGORITHMS
Method

BCR

Ref

Delta Predictor/Rice Golomb Coding


Adaptive Predictor/ Huffman Coding
Simple Predictor/ Huffman Coding
Slope Predictor/ Fixed-length Packaging
Proposed method

2.38
2.43
1.92
2.25
2.28

[13]
[14]
[33]
[26]

turned OFF, i.e., when two-channel ECG compressor alone is in


operation, the design consumes 357 nW. The additional power
consumed by the QRS detector (apart from the logic shared
with the compressor) is just 133 nW. The total power consumption of the JQDC scheme is much lower than microprocessor or
DSP-based solutions. Multifunctional implementation and ultralow power consumption makes the design suitable for wearable devices.
VI. CONCLUSION
This paper has presented a novel scheme for joint QRS detection and lossless data compression aimed at wearable ECG
devices. The adaptive prediction-based compression algorithm
achieves a lossless BCR of 2.286x. The QRS detection algorithm achieves a high sensitivity of 99.64% and positive prediction of 99.81% with the MIT/BIH Arrhythmia database. The
algorithm enables the sharing of computational load among multiple critical functions needed in a wearable sensor. To our best
knowledge, this is the first joint algorithm that implements QRS
detection and lossless data compression.
REFERENCES
[1] World Health Statistics 2013, World Health Organisation, Geneva,
Switzerland, 2013.
[2] E. S. Winokur, M. K. Delano, and C. G. Sodini, A wearable cardiac
monitor for long-term data acquisition and analysis, IEEE Trans. Biomed.
Eng., vol. 60, no. 1, pp. 189192, Jan. 2013.
[3] D. R. Zhang, C. J. Deepu, X. Y. Xu, and Y. Lian, A wireless ECG plaster
for real-time cardiac health monitoring in body sensor networks, in Proc.
IEEE Biomed. Circuits Syst. Conf., 2011, pp. 205208.
[4] G. Nallathambi and J. Principe, Integrate and fire pulse train automaton
for QRS detection, IEEE Trans. Biomed. Eng., vol. 61, no. 2, pp. 317326,
Sep. 2013.
[5] C. J. Deepu, X. Xu, X. Zou, L. Yao, and Y. Lian, An ECG-on-chip
for wearable cardiac monitoring devices, in Proc. 5th IEEE Int. Symp.
Electron. Design Test Appl., 2010, pp. 225228.
[6] Z. Arnavut, ECG signal compression based on burrows-wheeler transformation and inversion ranks of linear prediction, IEEE Trans. Biomed.
Eng., vol. 54, no. 3. pp. 410418, Mar. 2007.
[7] S.-G. Miaou and S.-N. Chao, Wavelet-based lossy-to-lossless ECG compression in a unified vector quantization framework, IEEE Trans. Biomed.
Eng., vol. 52, no. 3, pp. 539543, Mar. 2005.
[8] B.-U. Kohler, C. Hennig, and R. Orglmeister, The principles of software
QRS detection, IEEE Eng. Med. Biol. Mag., vol. 21, no. 1. pp. 4257,
Jan./Feb. 2002.
[9] X. Liu, Y. Zheng, M. W. Phyu, B. Zhao, M. Je, and X. Yuan, Multiple
functional ECG signal is processing for wearable applications of longterm cardiac monitoring, IEEE Trans. Biomed. Eng., vol. 58, no. 2, pp.
380389, Feb. 2011.
[10] C.-I. Ieong, P.-I. Mak, C.-P. Lam, C. Dong, M.-I. Vai, P.-U. Mak, S.-H.
Pun, F. Wan, and R. P. Martins, A 0.83-uW QRS detection processor
using quadratic spline wavelet transform for wireless ECG acquisition in
0.35-uM CMOS, IEEE Trans. Biomed. Circuits Syst., vol. 6, no. 6. pp.
586595, Dec. 2012.
[11] Y. Zou, J. Han, X. Weng, and X. Zeng, An ultra-low power QRS complex
detection algorithm based on down-sampling wavelet transform, IEEE
Signal Process. Lett., vol. 20, no. 5, pp. 515518, May 2013.
[12] Y. Wang, C. J. Deepu, and Y. Lian, A computationally efficient QRS
detection algorithm for wearable ECG sensors, in Proc. 2011 Annu. Int.
Conf. Eng. Med. Biol. Soc., 2011, pp. 56415644.
[13] E. Chua and W. Fang, Mixed bio-signal lossless data compressor for
portable brain-heart monitoring systems, IEEE Trans. Consum. Electron.,
vol. 57, no. 1, pp. 267273, Feb. 2011.
[14] S.-L. Chen and J.-G. Wang, VLSI implementation of low-power costefficient lossless ECG encoder design for wireless healthcare monitoring
application, Electron. Lett., vol. 49, no. 2, pp. 9193, Jan. 2013.
[15] A. Kyrkos, E. A. Giakoumakis, G. Carayannis, and G. C. Eurasip, QRS
detection through time recursive prediction techniques, Signal Process.,
vol. 15, no. 4, pp. 429436, Dec. 1988.

DEEPU AND LIAN: A JOINT QRS DETECTION AND DATA COMPRESSION SCHEME FOR WEARABLE SENSORS

[16] K. P. Lin and W. H. Chang, QRS feature extraction using linear prediction, IEEE Trans. Biomed. Eng., vol. 36, no. 10, pp. 10501055, Oct.
1989.
[17] A. L. Goldberger, L. A. N. Amaral, L. Glass, J. M. Hausdorff, P. C.
Ivanov, R. G. Mark, J. E. Mietus, G. B. Moody, C.-K. Peng, and H. E.
Stanley, PhysioBank, PhysioToolkit, and PhysioNet: Components of a
new research resource for complex physiologic signals, Circulation, vol.
101, no. 23, pp. e215e220, Jun. 2000.
[18] G. B. Moody and R. G. Mark, The impact of the MIT-BIH Arrhythmia
database, IEEE Eng. Med. Biol. Mag., vol. 20, no. 3. pp. 4550, May/Jun.
2001.
[19] A. Koski, Lossless ECG encoding, Comput. Methods Programs
Biomed., vol. 52, no. 1, pp. 2333, Jan. 1997.
[20] B. Farhang-Boroujeny, Adaptive filters: Theory and Applications. New
York, NY, USA: Wiley, 1998.
[21] L. Der and B. Razavi, A 2-GHz CMOS image-reject receiver with LMS
calibration, IEEE J. Solid-State Circuits, vol. 38, no. 2, pp. 167175, Feb.
2003.
[22] R. W. Schafer, What Is a Savitzky-Golay filter? IEEE Signal Process.
Mag., vol. 28, no. 4. pp. 111117, Jul. 2011.
[23] A. Jas, J. Ghosh-Dastidar, M.-E. Ng, and N. a. A. Touba, An efficient test
vector compression scheme using selective Huffman coding, IEEE Trans.
Comput.-Aided Des. Integr. Circuits Syst., vol. 22, no. 6, pp. 797806, Jun.
2003.
[24] S. Rigler, W. Bishop, and A. Kennings, FPGA-based lossless data compression using Huffman and LZ77 algorithms, in Proc. Can. Conf. Electron. Comput. Eng., 2007, pp. 12351238.
[25] R. A. Becker and T. Acharya, Variable length coding packing architecture, U.S. Patent US6 653 953 B2, Intel Corporation, 2003.
[26] C. J. Deepu, X. Zhang, W.-S. Liew, D. L. T. Wong, and Y. Lian, An
ECG-SoC with 535nW/channel lossless data compression for wearable
sensors, in Proc. IEEE Asian Solid-State Circuits Conf., 2013, pp. 145
148.
[27] S.-W. Chen, H.-C. Chen, and H.-L. Chan, A real-time QRS detection
method based on moving-averaging incorporating with wavelet denoising, Comput. Methods Programs Biomed., vol. 82, no. 3, pp. 187195,
Jun. 2006.
[28] R. Poli, S. Cagnoni, and G. Valli, Genetic design of optimum linear and
nonlinear QRS detectors, IEEE Trans. Biomed. Eng., vol. 42, no. 11. pp.
11371141, Nov. 1995.
[29] V. X. Afonso, W. J. Tompkins, T. Q. Nguyen, and S. Luo, ECG beat
detection using filter banks, IEEE Trans. Biomed. Eng., vol. 46, no. 2.
pp. 192202, Feb. 1999.
[30] P. S. Hamilton and W. J. Tompkins, Quantitative investigation of QRS
detection rules using the MIT/BIH arrhythmia database, IEEE Trans.
Biomed. Eng., vol. BME-33, no. 12. pp. 11571165, Dec. 1986.
[31] F. Zhang and Y. Lian, QRS detection based on multiscale mathematical
morphology for wearable ECG devices in body area networks, IEEE
Trans. Biomed. Circuits Syst., vol. 3, no. 4, pp. 220228, Aug. 2009.
[32] J. P. Martinez, R. Almeida, S. Olmos, a P. Rocha, and P. Laguna, A
wavelet-based ECG delineator: evaluation on standard databases, IEEE
Trans. Biomed. Eng., vol. 51, no. 4, pp. 570581, Apr. 2004.
[33] S. S.-L. Chen, H. H.-Y. Lee, C. C.-A. Chen, H.-Y. Huang, and C.-H.
Luo, Wireless body sensor network with adaptive low-power design for
biometrics and healthcare applications, IEEE Syst. J., vol. 3, no. 4, pp.
398409, Dec. 2009.

Chacko John Deepu (S07M14) received the


B.Tech. degree in electronics and communication engineering from the University of Kerala, Thiruvananthapuram, India, in 2002, and the M.Sc. and Ph.D. degrees in electrical engineering from National University Singapore (NUS), Singapore, in 2008 and 2014,
respectively.
He is currently a Research Fellow with the Bioelectronics Laboratory, NUS. His research interests
include biomedical signal processing, low-power design, and wearable devices.

175

Yong Lian (M.90SM99F09) received the B.Sc.


degree from the College of Economics and Management, Shanghai Jiao Tong University, Shanghai,
China, in 1984, and the Ph.D. degree from the Department of Electrical Engineering, National University
of Singapore (NUS), Singapore, in 1994.
He spent nine years in industry and joined the
NUS in 1996. He was appointed as the first Provosts
Chair Professor in the Department of Electrical and
Computer Engineering, NUS, in 2011. He is also the
Founder of ClearBridge VitalSigns Pte. Ltd., a startup for wireless wearable biomedical devices. His research interests include
biomedical circuits and systems, and signal processing.
Dr. Lians received many awards including the 1996 IEEE CAS Societys
Guillemin-Cauer Award for the best paper published in the IEEE TRANSACTIONS ON CIRCUITS AND SYSTEMS II, the 2008 Multimedia Communications Best Paper Award from the IEEE Communications Society for the
paper published in the IEEE TRANSACTIONS ON MULTIMEDIA, the 2011
IES Prestigious Engineering Achievement Award, the 2012 Faculty Research
Award, the 2014 CN Yang Award in Science and Technology for New Immigrant
(Singapore). As an educator, he received the University Annual Teaching Excellent Award in two consecutive academic years from 2008 to 2010, and many
other teaching awards from the Faculty of Engineering. Under his guidance,
his students received many awards including the Best Student Paper Award in
ICME 2007, winner of 47th DAC/ISSCC Student Design Contest in 2010, Best
Design Award in A-SSCC 2013 Student Design Contest. He is the Vice President for Publications of the IEEE Circuits and Systems (CAS) Society, Steering Committee Member of the IEEE TRANSACTIONS ON BIOMEDICAL
CIRCUITS AND SYSTEMS and the IEEE TRANSACTIONS ON MULTIMEDIA, the Past Chair of DSP Technical Committee of the IEEE CAS Society.
He was the Editor-in-Chief of the IEEE TRANSACTIONS ON CIRCUITS
AND SYSTEMS PART II: EXPRESS BRIEFS for two terms from 2010 to
2013. He also served as Associate Editors for the IEEE TRANSACTIONS ON
CIRCUITS AND SYSTEMSPART I: REGULAR PAPERS, IEEE TRANSACTIONS ON CIRCUITS AND SYSTEMSPART II: EXPRESS BRIEFS,
IEEE TRANSACTIONS ON BIOMEDICAL CIRCUITS AND SYSTEMS,
and Journal of Circuits, Systems Signal Processing in the past 15 years, and
was the Guest Editor for eight special issues in IEEE TRANSACTIONS ON
CIRCUITS AND SYSTEMSPART I: REGULAR PAPERS, IEEE TRANSACTIONS ON BIOMEDICAL CIRCUITS AND SYSTEMS, and Journal of
Circuits, Systems Signal Processing. He was the Vice President for the Asia Pacific Region of the IEEE CAS Society from 2007 to 2008, AdComm Member of
the IEEE Biometrics Council from 2008 to 2009, CAS Society Representative to
the BioTechnology Council from 2007 to 2009, Chair of the BioCAS Technical
Committee of the IEEE CAS Society from 2007 to 2009, Member of the IEEE
Medal for Innovations in Healthcare Technology Committee from 2010 to 2012,
and a Distinguished Lecturer of the IEEE CAS Society from 2004 to 2005. He
is the Founder of the International Conference on Green Circuits and Systems,
the Asia Pacific Conference on Postgraduate Research in Microelectronics and
Electronics, and the IEEE Biomedical Circuits and Systems Conference. He is
a Fellow of the Academy of Engineering Singapore.