J MSR 11 2011
J MSR 11 2011
J MSR 11 2011
net/publication/258537747
CITATIONS READS
34 113
4 authors, including:
Danijela Milosevic
University of Kragujevac
75 PUBLICATIONS 262 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
The application of biomedical engineering in the preclinical and clinical practice - III-41007 View project
All content following this page was uploaded by Radovan Stojanovic on 26 January 2015.
Due to complexity of their mathematical computation, many QRS detectors are implemented in software and cannot operate in
real time. The paper presents a real-time hardware based solution for this task. To filter ECG signal and to extract QRS complex
it employs the Integer Wavelet Transform. The system includes several components and is incorporated in a single FPGA chip
what makes it suitable for direct embedding in medical instruments or wearable health care devices. It has sufficient accuracy
(about 95%), showing remarkable noise immunity and low cost. Additionally, each system component is composed of several
identical blocks/cells what makes the design highly generic. The capacity of today existing FPGAs allows even dozens of detectors
to be placed in a single chip. After the theoretical introduction of wavelets and the review of their application in QRS detection, it
will be shown how some basic wavelets can be optimized for easy hardware implementation. For this purpose the migration to the
integer arithmetic and additional simplifications in calculations has to be done. Further, the system architecture will be presented
with the demonstrations in both, software simulation and real testing. At the end, the working performances and preliminary
results will be outlined and discussed. The same principle can be applied with other signals where the hardware implementation of
wavelet transform can be of benefit.
131
MEASUREMENT SCIENCE REVIEW, Volume 11, No. 4, 2011
1 ∗ t −b
ψ a ,b (t ) = ψ ( ) (2)
a a
132
MEASUREMENT SCIENCE REVIEW, Volume 11, No. 4, 2011
⎢1 1 ⎥
CA1[n] = ⎢ X [2n] + X [2n + 1]⎥ (8)
⎣2 2 ⎦
Fig.2. QRS detection using wavelet decomposition. Signal X[n]
CD1[n] = X [2n] − X [2n + 1] (9) sampled with frequency of 800 Hz.
133
MEASUREMENT SCIENCE REVIEW, Volume 11, No. 4, 2011
23 is the largest. According to [11], for QRS-complex with vector X[n], driven in by system clock clk, while the main
high frequency components, the energy at scale 22 is larger outputs are the true zero crossings (ZCi_OK), summing of
than that at scale 23. The authors recommend mainly the true zero crossings (SUM_ZC) and vector of time stamps
scales 23 to 24 for satisfactory detection. which corresponds to the position of R peak (RTIME) in
Another complication is the acquisition of certain time scale. SUM_ZC and RTIME are obtained by summation
thresholds for finding the modulus maxima. the values of of ZCi_OKs and multiplexing RTIMEi by address SL. R
thresholds differ usually from one level to another. The third presents the asynchronous reset which puts all outputs to
obstacle is the change of decision rules according to zero. The threshold parameters TR1 and TR2 as well as
circumstances and it is a very ambiguous and time- parameters Ti_1 and Ti_2 related to the QRS inclination
consuming task. Mentioned restrictions confine the method times are stored in configuration registers or internal Read
to off-line use and put heavy demand on the computing Only Memory (ROM). As seen, the architecture can be
resources. extended very easily to the desired decomposition level by
In the presented research, instead of classical Wavelet adding a new branch of L-H, ZC&MT and DR. Also, in the
Transform, additionally optimised Integer Wavelet case of reduction, unnecessary branches can be omitted.
Transform (S Transform) is used for the task of QRS
detection. Fig.3 shows that the absolute error is less than one B. Wavelet decomposition
count at 4th coefficient when using S transform given by (9) L-H cell from Fig.5 is the core unit in decomposition
and (10) instead of Haar transform given by (6) and (7). scheme from Fig.4. It presents digital expression of
equations (9) and (10). The delay line is implemented by
4. THE DESIGN APPROACH cascade of REG1 and REG2. The ((X(n)+X(n+1))>>1)) and
X(n)-X(n+1) computations are done for each sample. The
A. System Architecture signal clk_out=clk_in/2 is used for downsampling (↓2) and
Simplified diagram of the proposed methodology for QRS stores X(2n)-X(2n+1) and ((X(2n)+X(2n+1))>>1)) values in
complex detection is given in Fig.4. Wavelet decomposition adequate output registers REGs. Ca output from the
is realized with pipelined L-H cells. Each cell is followed by previous cell is the input X to the further cell and so on. The
branch consisting of two circuits/blocks: Zero Crossing and calculation time per Ca and Cd is 2clk. The signal clk_out
Modulus Thresholding (ZC&MT) and Decision Rules (DR). presents a clk_in for the next cell. The implementation of L-
The outputs from ZC&MT and DR are fed to the MUX and H cell in Fig.5 is a very fast way to calculate equations (9)
summing (OR) circuits. The input to the system is the ECG and (10) without multipliers.
134
MEASUREMENT SCIENCE REVIEW, Volume 11, No. 4, 2011
D. Decision making
For each decomposition level the Decision Rules (DR)
circuit receives the signals CRiTR1, CRiTR2 and ZC_i, from
ZC&MT, Fig.6(middle). The detection of true zero crossing
begins on the falling edge of signal CRiTR1 by starting the
counter driven by system clock CLK, Fig.6 (down). The
counter has been previously reset by rising edge of CRiTR1. Fig.6. Graphical illustration of the algorithm for finding modulus
The counter stops on the falling edge of CRiTR2 latching the maxima and zero crossing. Bottom is a decision making technique.
time t0. If Ti_1<t0<Ti_2 the detected ZC_i is declared to be
the true one. Only then the trigger ZCi_OK is generated. If Generally, the system can be implemented till highest
the rising edge of CRiTR2 is not detected within time Ti_2, level, in our case 4th. The signals ZC1_OK, ZC2_OK,
the detected ZC_i is considered to be false, the counter ZC3_OK and ZC4_OK with corresponding values RTIME1,
cleared, and trigger ZCi_OK remains zero. If ZC_i is RTIME2, RTIME3 and RTIME4 have to be considered. A
declared to be true it is necessary to store the time when it number of ZCi_OK within SUM_ZC and adequate RTIMEi
occurred (RTIMEi), because this time corresponds to the are sufficient information for decision. In practice two levels
position of R peak. It is ensured by double latch, Fig.6 (3rd and 4th) are enough for satisfactory detection rate, using
(down); first when ZC_i happened, whether it is true or not, the signals ZC1_OK, ZC2_OK, RTIME1 and RTIME2. In
and then when the ZC_i is declared as true, namely ZCi_OK this case the resources are less occupied, and thresholds are
generated. By multiplexor MUX, Fig.4, the RTIME will be easier to adjust.
taken from RTIMEi which corresponds to the better
accuracy. As an example, if R peak is detected at all four E. Simulation
levels the RTIME1 will be forwarded out. As an alternative The simulation is performed using real ECG samples
the mean value, mean(RTIMEi, RTIMEi, RTIMEi, RTIMEi), brought to the system input X[n]. For this purpose a
can be considered. separately circuit/block (simulation generator) is designed
Here, a possible complication may arise from selection of and embedded into same chip. It consists of an up-counter
parameters Ti_1 and Ti_2 which depend on the inclination which addresses the FPGA’s ROM in incremental order.
and duration times within the QRS complex. These values The counter is driven by clock whose frequency is identical
135
MEASUREMENT SCIENCE REVIEW, Volume 11, No. 4, 2011
136
MEASUREMENT SCIENCE REVIEW, Volume 11, No. 4, 2011
3(L-H) 120
was about 95.23% for using 3rd&4th levels in parallel, Table
4(L-H) 174 2. It had been assumed that R peak appeared if the signal
4(L-H)+ZC&MT+DR 301 ZCi_OK occurred at CD3 or CD4 or at both of them.
137
MEASUREMENT SCIENCE REVIEW, Volume 11, No. 4, 2011
presents the hardware system based on these principles. The [4] Shukla, A., Macchiarulo, L. (2008). Exploring and
QRS detector was implemented in a single chip from FPGA Prototyping Designs for Biomedical Applications.
family. It has accuracy of about 95% and boasts noise Xcell Journal, Third Quarter (65), 18-21.
immunity and low cost. Because of the design optimization [5] Mallat, S.G. (1989). A theory for multiresolution
and capacity of FPGA, dozens detectors can be placed in signal decomposition: The wavelet representation.
same chip and directly embedded in medical instruments or IEEE Trans. Pattern Analysis and Machine
wearable health care devices. After theoretically Intelligence, 11 (7), 674-693.
explanation, overall design methodology was presented [6] Calderbanka, A.R., Daubechiesb, I., Sweldensc, W.,
including description of the components and the system as a Yeod, B.L. (1998). Wavelet transforms that map
whole. Also the software simulation and the verification are integers to integers. Applied and Computational
performed. Further, the testing procedures and preliminary Harmonic Analysis, 5 (3), 332-369.
results were elaborated and discussed. The same principle
[7] Said, A., Pearlman, W.A. (1996). An image
could be applied with other signals where required hardware
multiresolution representation for lossless and lossy
implementation of wavelet transform.
compression. IEEE Trans. Image Processing, 5,
1303-1310.
ACKNOWLEDGMENT
[8] Walker, J.S. (1999). A Primer on Wavelets and
The work presented was funded mainly by the Scientific Applications. Boca Raton: CRC Press.
Montenegrin Ministry of Science. The authors are thankful
[9] Li, C., Zheng, C., Tai, C. (1995). Detection of ECG
for the support.
characteristic points using wavelet transform. IEEE
Trans. Biomedical Engineering, 42 (1), 21-28.
REFERENCES
[10] Almeida, R., Martnez, J.P., Olmos, S., Rocha, A.P.,
[1] Kohler, B.U., Hennig, C., Orglmeister, R. (2002). The Laguna, P. (2004). A wavelet-based ECG delineator:
principles of software QRS detection. IEEE Evaluation on standard databases. IEEE Trans.
Enginering in Medicine and Biology, 21, 42-57. Biomedical Engineering, 51 (4), 570-581.
[2] Pavlatos, C., Dimopoulos, A., Manis, G., [11] Thakor, N.V, Webster, J.G., Tompkins, W.J. (1984).
Papakonstantinou, G. (2005). Hardware Estimation of QRS complex power spectra for design
implementation of Pan & Tompkins QRS detection of a QRS filter. IEEE Trans. Biomedical Engineering,
algorithm. In: Proceedings of the EMBEC’05 31 (11), 702-706.
Conference, November 2005, Prague, Czech
[12] Altera Corp. (1995-2011). Retrieved Jun 6, 2011, from
Republic. Retrieved Jun 6, 2011, from
www.altera.com.
http://mule.cslab.ece.ntua.gr/docs/c8.pdf.
[3] Chio, I.I., Mang, I.V., Peng, U.M. (2008). ECG QRS
complex detection with programmable hardware. Received June 17, 2011.
In: 30th Annual International IEEE EMBS Accepted September 9, 2011.
Conference, 20-24 August 2008. Vancouver, Canada,
2920-2923. Retrieved Jun 6, 2011, from
http://www.bme.eee.umac.mo/PublishedPaper/IEEE%
20EMBS%20Conference%202008.pdf.
138
View publication stats