Improvement of a FPGA-based Detection of QRS Complexes in ECG
Signal using an Adaptive Windowing Strategy
Amina Habiboullah, Mehdi Terosiet, Aymeric Histace and Olivier Romain
ETIS Lab, ENSEA, University of Cergy-Pontoise, CNRS, 6 av. du Ponceau, 95014, Cergy, France
ECG, QRS Detection, Embedded Processing, FPGA.
This paper presents an FPGA-based algorithm for automatic detection of QRS complexes in ECG signals,
first step for the estimation of cardiac intervals. The proposed algorithm is divided into 3 parts : Filtering,
Contrast Enhancement, and finally a Detection block based on an adaptive windowing and a thresholding of
the enhanced data. The entire detection scheme was developed in accordance with embedding constraints
and in the perspective of a real-time use. We evaluated the algorithm on manually annotated databases, such
MIT-BIH Arrythmia and QT databases. The FPGA-based algorithm correctly detects 91,85 % percent of the
QRS complexes, with a very limited ratio of false detection (only 5%) on standard databases, while for real-
time records obtained from young subjects between 20 and 25 years, the sensitivity reaches 93,77 % with a
false detection ratio of only 4 %. These results are in accordance with the most recent state-of-the-art off-line
algorithms on the same database, and improves significantly FPGA-based ones that were tested on a limited
number of ECG extracted from the MIT-BIH set of data only.
Heart disease is the first cause of death in western
world. In France, 32% of deaths are caused by cardio-
vascular disease and in United States, only 10.6% of
people survived after an emergency medical services.
Hence, algorithms, providing good interpretation of
ECG signals, represent a big priority in Biomedical
Engineering nowadays. For example many studies
have shown that segment abnormalities are good indi-
cators of particular cardiovascular diseases (Spodick,
1973; Baljepally and Spodick, 1998).
A standard non-pathological ElectroCardioGram
(ECG) signal is composed of five different waves (in
chronological order, the P, Q, R, S and T waves), each
one corresponding to a particular physiological exci-
tation of Atria and Ventricles of the heart (Einthoven,
1912). The QRS complex is the name given to the
combination of the Q, R, and S deflections: It is usu-
ally the central and most visually obvious part of the
tracing as illustrated in Fig. 1. The QRS complex
corresponds to the depolarization of the right and left
ventricles of the human heart.
A precise time-detection of this complex is the
first and necessary step in the perspective of physi-
ological feature extractions. In fact, the shape, the
moment of occurrence and the frequency of the QRS
Figure 1: Illustration of a standard ECG signal.
complex are primary characteristics of the heart con-
dition (Ohkawa S, 1981). Nevertheless, QRS detec-
tion is still a difficult task because of the various types
of noise which can be present in the ECG signal, par-
ticularly, muscle noise, power-line interference, base-
line wander and in some cases, it happens that the
P waves and T waves present with high-frequency
characteristics, similar to QRS complexes (Stolojescu,
Moreover, in the particular context of “Connected
Systems for Healthcare”, the need for efficient em-
Habiboullah, A., Terosiet, M., Histace, A. and Romain, O.
Improvement of a FPGA-based Detection of QRS Complexes in ECG Signal using an Adaptive Windowing Strategy.
DOI: 10.5220/0005856403270332
In Proceedings of the 9th International Joint Conference on Biomedical Engineering Systems and Technologies (BIOSTEC 2016) - Volume 4: BIOSIGNALS, pages 327-332
ISBN: 978-989-758-170-0
2016 by SCITEPRESS Science and Technology Publications, Lda. All rights reserved
bedded algorithms is definitely on the increase. The
main challenge is, then, to propose low-power detec-
tion algorithms with real-time processing capabilities
and a limited level of complexity.
Many QRS detection method are present in the
literature (see (Zine-Eddine, 2006) for an overview).
A brief description of the most used ones, as well as
their performance when available, are given below:
In Pan and Tompkins (Pan and Tompkins, 1985)
authors propose a method based upon digital analy-
sis of slope, amplitude and width of different waves
of the ECG signal. It includes a bandpass filtering, a
differentiation and a nonlinear transformation of the
ECG signal. Applied on the standard 24h MIT/BIH
arrhythmia database, this method detects 99.3 percent
of the QRS complexes. This approach remains cur-
rently the most cited paper of the IEEE Transactions
in Biomedical Engineering.
Laguna (Laguna et al., 1990) leads to delineate
QRS complexes and T waves by applying a differen-
tiation and low-pass filter on the ECG signal. For the
T wave detection, a search window is defined using
R-position. Then, the T peak is detected by search-
ing the zero of the differentiation output inside this
window. Due to both a low complexity and an easy
implementation, this method is heavily used.
The method of Ying Sun et al. (Meissimilly et al.,
2003) is based on an adaptive amplitude thresholding.
It includes three steps : a differentiation, a nonlinear
transformation and a thresholding. It has been tested
on eight records of the American Heart Association
database. It detects 99.20 percent of the QRS com-
plexes. The weakness of this method is the lack of
post-processing for eliminating acquisition noise.
Martinez (Martinez et al., 2004) proposed to use
a wavelet transform for the detection of QRS com-
plexes. Each QRS complex is delineated and the de-
termination of P-waves and T-waves peaks, onsets
and ends is performed. The algorihm was tested on
MIT-BIH Arrythmia, QT, European ST-T and CSE
databases. For the QRS complex detection, the al-
gorithm reaches 99.66 % of sensitivity and 99.56 %
of specificity.
The method of Dubois (Dubois et al., 2007) is
widely inspired on the method of Pan and Tompkins
(Pan and Tompkins, 1985). The algorithm includes
six steps : a bandpass filtering, a differentiation, a
nonlinear transformation, an integration, a low-pass
filtering and an adaptive thresholding. Compared to
the method of Pan and Tompkins, he adds an adaptive
thresholding to avoid the detection of P and T waves
with high amplitudes.
The method of Saurabh (Suarabh and Madhuch-
handa, 2009) presents a multiresolution wavelet trans-
form based system for detection and evaluation of
QRS complex, P and T waves. It was tested on the
Physionet PTB diagnostic database. The test result
shows over 99% true detection rate for R peak and
over 97%, 96%, 95%, 98% for heart rate, P wave,
QRS complex and T wave respectively.
And finally, the method of Guven (Guven et al.,
2014) presents a method for ECG baseline drift re-
moval. For this, authors propose to detect onset and
end of QRS complex and a point of T-P segment.
Then, the algorithm finds the isoelectric line using an
interpolation method.
If each of the aforementioned methods proposes
efficient algorithms for various types of wave detec-
tions in ECG, none of them addresses the embedding
issue, whereas it has become for the last 5 years a pri-
mary need with the increase of the “Smart Embedded
Systems for Health” market.
In (El Hassen et al., 2015), we proposed an au-
tomatic QRS-complex detector based on a signifi-
cant improvement of the Dubois’ approach using a
systematic search of maximas on a fixed-size neigh-
borhood was proposed. This particular algorithm
was developed both in software, using MATLAB
code, and in hardware (VHDL). Simulations per-
formed on the MIT-BIH Arrythmia Database from
the Physionet database project (
showed a sensibility of 99.9 % and a specificity of
96.57 % using MATLAB and a sensibility of 95.35
% with a specificity of 91.80 % using RTL simu-
lations. These results were in accordance with the
most recent state-of-the-art off-line algorithms tested
on the same database, and improved significantly
FPGA-based one of Yu et al. (Yu et al., 2013) that
reaches a 98.68% sensibility but considering only a
limited number (only 11) of ECG extracted from the
MIT/BIH set of data (48 recordings in total), exclud-
ing the most challenging ones. Nevertheless, the ex-
periments were limited to one database with no real-
time recordings included; The size of the search-
window for maxima detection was manually tuned
to obtain the best performance on the considered
database showing a lack of robustness of this param-
eter; and finally the proposed hardware architecture
could be improved to fully take advantage of the par-
allelism capabilities of FPGA platform.
In this paper we propose to address these limi-
tations in the following ways: First of all an adap-
tive windowing strategy, which allows the system to
adapt, in a flexible way, to all types of ECG sig-
nals is proposed and validated on different kind of
databases, including real-time acquisitions. Secondly,
if the real-time processing of multiple simultaneous
channels can improve considerably the detection rate,
Smart-BIODEV 2016 - Special Session on Smart Embedded Biomedical Devices for In Situ Physiological Signal Processing
their implementation must be optimized in order to
reduce power consumption, area, latencies, etc. For
this purpose, a time sharing processing seems to be
the best tradeoff as illustrated in Figure 2. Indeed, the
overall duration of all the processing scheme should
be less than the time period over which the ECG is
stored in a RAM block.
Figure 2: Real-time processing of several simultaneous
To address this, we propose an architecture of a
minimal time processing and energy consumption as
it will be shown in the Experiments section.
The remainder of this article is organized as fol-
lows: In section 2, the overall proposed processing
scheme is presented with a focus on the adaptive win-
dowing for maximum detection. Section 3 introduced
the proposed architecture for hardware implementa-
tion of the proposed methods for automatic QRS de-
tection. Section 4 is focuses on performance eval-
uation of the proposed approach on several type of
databases. And finally conclusions and perspectives
are proposed in last section.
As introduced in (El Hassen et al., 2015), the all pro-
cessing scheme for QRS detection is composed of
3 main blocks : A “Bandpass Filtering” in order to
eliminate the baseline wander, P waves and T waves
in low frequencies, and to remove the electromyo-
graphic interferences in high frequencies. Based on
(Thakor et al., 1984) and the ECG power spectrum,
the bandwidth of this filter is chosen between 9Hz
and 15Hz. A “Contrast Amplification” block which
increases the contrast of QRS complexes and avoid
false detections and finally, a “Detection” block based
on an adaptive maxima detection and an amplitude
and time thresholding for QRS localization.
Main originality of this article lies in the improve-
ment of the maxima detection block and in the cor-
responding proposal for an hardware implementation
in accordance with the real-time processing time con-
This part of the algorithm consists in finding max-
ima in a sequence of N
window containing N
ples each, such as N
× N
= N
, the total number of
samples of the considered ECG recording. In (El Has-
sen et al., 2015), N
was chosen empirically using
a manual tuning that maximizes the performance de-
tection (estimated using a ROC Curve strategy). If
obtained detection results were very satisfying on the
MIT BIH database (?) originally considered ( 99.70
% of sensitivity and 96.57 % of specificity), unfor-
tunately, N
had to be tuned again for a different
database making difficult a systematic use of the pro-
posed approach.
In this paper, an adaptive approach is proposed.
More precisely, N
parameter is automatically esti-
mated using information brought by the last five pre-
vious R-R intervals: The size of the search window
is then calculated according to the following pseudo-
code where flagIndRRD is a flag permitting the auto-
matic counting of the 5 last R-R intervals.
Algorithm 1: Adaptive windowing.
if flagIndRRD = 1 then
WindowSize = mean(R-R intervals).
WindowSize = 100.
As a consequence, the size of the window detec-
tion can be adapted automatically to the characteris-
tics of the ECG signals, like arrhythmia pathologies
for instance.
In the following, the architecture for implementa-
tion is presented and the improved performance pre-
sented and discussed.
For hardware implementation of the different pre-
vious IP corresponding to the different processing
blocks, we chose on purpose to design the global ar-
chitecture using handwritten VHDL code. It allows
us to design the corresponding architecture with a low
level of abstraction and to optimize the code with re-
spects to the implementation constraints related to a
FPGA use. Furthermore, it permits us to migrate from
one hardware support to another without starting from
scratch each time.
The global architecture is shown in Figure 3.
A shift register and a ”FP Removal” blocks have
been added in addition to the processing steps pre-
sented in Section 2 in order to reduce the false rate
Improvement of a FPGA-based Detection of QRS Complexes in ECG Signal using an Adaptive Windowing Strategy
Filtering Contrast Amplification
Search of Maxima
Shift Register Thresholding
FP Removal
Figure 3: Description of the algorithm: Blocks in blue are clocked at CLK and blocks in green are clocked at CLK
able because of the adaptive windowing). The block ”FP Removal” contains 2 blocks : a shift register and an amplitude
and to improve the specificity. Noticing that a false
positive is, in general, surrounded by two true posi-
tives, we propose to place a shift register after the IP
”Thresholding” to store three peaks. Then, the ”FP
Removal” IP leads to compare each peak with 53 per-
cent of the average of the amplitudes of the previous
and following one.
In Figure 4, the efficiency of the proposed strategy
for the automatic estimation of the size of the detec-
tion window N
is illustrated on a simulation using
proposed architecture.
Inside the red ellipses are shown the False Positive
(FP) detection on the ECG signal considered for this
experiment. First row is for the adaptive windowing
and second row for the previously proposed fixed-size
strategy (optimal value). One can clearly notice here
that if 3 FP were detected with the non adaptive win-
dowing, this amount is lower down to 3 with the new
4.1 Data
In order to compute significant performance and to
make sure that our detection scheme is efficient in
terms of sensibility and specificity, we have com-
pared our detection indexes with the annotations pro-
vided by cardiologists in standard databases, such as
MIT Arrhythmia and QT databases. We also added
real-time acquisitions provided by Sahloul Hospital
of Sousse - Tunisia. Again, the automatic detected
QRS complexes are compared with the ground truth
provided by the clinical staff.
The MIT-BIH Arrhythmia Database contains 48
half-hour excerpts of two-channel ambulatory ECG
recordings, obtained from 47 subjects studied by
the BIH Arrhythmia Laboratory between 1975 and
1979. Twenty-three recordings were chosen at ran-
dom from a set of 4000 24-hour ambulatory ECG
recordings collected from a mixed population of in-
patients (about 60 percent) and outpatients (about 40
percent) at Boston’s Beth Israel Hospital; the remain-
ing 25 recordings were selected from the same set
to include less common but clinically significant ar-
rhythmias that would not be well-represented in a
small random sample.
The QT database contains 105 fifteen-minute
records, representing a wide variety of QRS and ST-
T morphologies, in order to challenge QT detection
algorithms with real-world variability. These records
are chosen from among seven ECG databases of Phy-
. The distribution of the 105 records according
to original databases is shown in Table 1. All records
are sampled at 250 Hz. The 67 chosen records are :
the European ST-T Database records, the MIT-BIH
Arrythmia Normal Sinus Rythm Database records
and the Sudden Death Database records whose names
in Table 1 are respectively European ST-T, MIT-BIH
NSR DB and Sudden Death. Each record has 8 an-
notation files. The annotation file used for the perfor-
mances calculation is a manual annotation file, pro-
vided by a cardiologist.
The twelve real-time ECG records are obtained
from young healthy subjects, between 20 and 25 years
old, of the hospital of Sahloul in Tunisia. Three of
these records are sampled at 200 Hz and nine of them
are sampled at 256 Hz. Before processing, the sam-
pling frequency has been changed to 250 Hz. The aim
of testing our algorithm on these records is to be more
in line with a real-time processing.
4.2 Implementation Plateform
Our algorithm is implemented using the DE2-115
board of Altera. This board contains a CYCLONE IV
4CE115 FPGA device, including 114,480 logic ele-
ments, 432 M9K memory blocks, 3,888 Kbits embed-
ded memory and 4 PLLs. The 7-segment displays on
the DE2-115 board are used to display the number of
detected QRS complexes.
4.3 Performance Results
Simulations and testing have been carried out on a
total of 127 different ECG signals, presenting dif-
ferent characteristics and provided from the different
databases presented in previous section. Results are
shown in Table 2.
The resource occupation of the overall detection
system on the FPGA device use for experiments is
shown in Table 3.
1 : offers free web access to large collec-
tions of recorded physiologic signals
Smart-BIODEV 2016 - Special Session on Smart Embedded Biomedical Devices for In Situ Physiological Signal Processing
Figure 4: False positive ratio improvement using the adaptive windowing strategy proposed in this article. This chronogramm
is generated during the simulation mode of the proposed corresponding hardware architecture.
Table 1: Distribution of the 105 records according to the original Database.
Arryth. ST DB Sup.Vent. Long Term ST-T NSR DB Death
15 6 13 4 33 10 24
Table 2: Results.
Results Sensitivity Specificity
MIT-BIH Arrythmia Database 94.93% 92.81%
European ST-T 89.15% 95.31%
MIT-BIH NSR DB 96.79% 95.48%
Sudden Death 86.79% 97.65%
Total on standard DB 91.85% 94.59%
Real signals (Sahloul Hospital) 93.77% 97.37%
Table 3: FPGA Hardware utilization.
Resource Name Occupied Total Number Proportion
Logic elements 33747 114480 29%
Combinational functions 32084 114480 28%
Logic registers 3899 114480 3%
I/O 45 529 9%
GCLK 1 3 33.33%
In addition, it can be noticed than the total power
consumption of the proposed architecture is only of
148.79 mW, while the dynamic power consumption
is close to 0 mW.
According to the timing analyzer report, maxi-
mum frequencies of the system are about 25.86 MHz
for CLK and 4.57 MHz for CLK
(see Figure 3). The
latence of the whole system is equal to 5 CLK + 5
. Considering the values of frequencies, we can
treat one minute of a MIT-BIH database signal (with
a sampling rate of 360 Hz) in 28.31 ms and a QT
database signal (with a sampling rate of 250 Hz) in
19.31 ms.
In this paper, we proposed a FPGA-Based algo-
rithm for the QRS complex detection in ECG signals.
The original signal goes through a series of process-
ing steps allowing to eliminate the various types of
noise present in ECG signal. Then, a ”Detection”
step, composed of a R-peak search using an adap-
tive window and thresholding, is proposed. To re-
duce the false positives rate, an ”FP Removal” has
been also proposed in order to increase the speci-
ficity of the system detection. The algorithm has been
validated on the MIT-BIH arrhythmia database, the
QT database and finally on 12 real-time acquisitions.
The all algorithm was finally synthesized and tested
on a DE2 FPGA Platform: the corresponding perfor-
mance are of real interest considering the recent lit-
erature on this particular aspect both in terms of per-
formance and compatibility power consumption: ob-
tained results shows that the sensitivity reaches 91.85
% and the specificity 94.59% in standard databases
and 93.77 % of sensitivity with 97.37 % of speci-
ficity on real signals. These results are in accor-
dance with the most recent state-of-the-art off-line al-
gorithms on the same database, and improves signifi-
cantly FPGA-based one of Yu et al. (Yu et al., 2013)
Improvement of a FPGA-based Detection of QRS Complexes in ECG Signal using an Adaptive Windowing Strategy
that reaches a 98.68% sensibility but considering only
a limited number (only 11) of ECG extracted from
the MIT/BIH set of data (48 recordings in total), ex-
cluding the most challenging ones. Furthermore the
dynamic power consumption of Yu et al. (Yu et al.,
2013) system is around 20 mW, while our is close to
0 mW.
Baljepally, R. and Spodick, D. (1998). PR-segment de-
viation as the initial electrocardiographic response in
acute pericarditis. Am J Cardiol.
Dubois, R., Maison-Blanche, P., Quenet, B., and Dreyfus,
G. (2007). Automatic ecg wave extraction in long-
term recordings using gaussian mesa function models
and nonlinear probability estimators. Comput. Meth-
ods Prog. Biomed., 88(3):217–233.
Einthoven, W. (1912). The different forms of the human ele-
cotrocardiogram and their signification. The Lancet,
179(4622):853 861. Originally published as Volume
1, Issue 4622.
El Hassen, A., Histace, A., Terosiet, M., and Romain, O.
(2015). FPGA-Based Detection of QRS Complexes in
ECG Signal. In IEEE, editor, Conference on Design
and Architectures for Signal and Image Processing,
Cracow, Poland.
Guven, O., Eftekhar, A., Hoshyar, R., Frattini, G., Kindt,
W., and Constandinou, T. (2014). Realtime ecg
baseline removal: An isoelectric point estimation ap-
proach. In Biomedical Circuits and Systems Confer-
ence (BioCAS), 2014 IEEE, pages 29–32.
Laguna, P., Thakor, N., Caminal, P., Jane, R., Yoon, H.-
R., Bays de Luna, A., Marti, V., and Guindo, J.
(1990). New algorithm for qt interval analysis in
24-hour holter ecg: performance and applications.
Medical and Biological Engineering and Computing,
Martinez, J., Almeida, R., Olmos, S., Rocha, A., and La-
guna, P. (2004). A wavelet-based ecg delineator: Eval-
uation on standard databases. IEEE TRANSACTIONS
Meissimilly, G., Rodriguez, J., Rodriguez, G., Gonzalez,
R., and Canizares, M. (2003). Microcontroller-based
real-time qrs detector for ambulatory monitoring. In
Engineering in Medicine and Biology Society, 2003.
Proceedings of the 25th Annual International Confer-
ence of the IEEE, volume 3, pages 2881–2884 Vol.3.
Ohkawa S, Hackel DB, I. R. (1981). Correlation of the
width of the qrs complex with the pathologic anatomy
of the cardiac conduction system in patients with
chronic complete atrioventricular block. Circulation.
Pan, J. and Tompkins, W. J. (1985). A real-time qrs detec-
tion algorithm. Biomedical Engineering, IEEE Trans-
actions on, BME-32(3):230–236.
Spodick, D. (1973). Diagnostic electrocardigraphic se-
quences in acute pericarditis: significance of pr seg-
ment and pr vector changes. Circulation.
Stolojescu, C. (2008). Estimation of noise in ecg signals us-
ing wavelets. In Optimization of Electrical and Elec-
tronic Equipment, 2008. OPTIM 2008. 11th Interna-
tional Conference on, pages 113–118.
Suarabh, P. and Madhuchhanda, M. (2009). Detection of
ecg characteristic points using multiresolution wavelet
analysis based selective coefficient method. Measure-
Thakor, N., Webster, J., and Tompkins, W. J. (1984). Esti-
mation of qrs complex power spectra for design of a
qrs filter. Biomedical Engineering, IEEE Transactions
on, BME-31(11):702–706.
Yu, H., Ma, L., Wang, R., Jiang, L., Li, Y., Ji, Z., Pingkun,
Y., and Fei, W. (2013). A fpga-based real time
qrs complex detection system using adaptive lifting
scheme. In Gaol, F. L., editor, Recent Progress in Data
Engineering and Internet Technology, volume 156 of
Lecture Notes in Electrical Engineering, pages 497–
504. Springer Berlin Heidelberg.
Zine-Eddine, H. S. (2006). Analyse et synthese de methodes
de detection du complexe QRS du signal electrocar-
diogramme. PhD thesis.
Smart-BIODEV 2016 - Special Session on Smart Embedded Biomedical Devices for In Situ Physiological Signal Processing