1 Introduction

For the aging population, improved health care and lowering its cost have become a major challenge. The combination of electrical and information technology with recent discoveries in biology and medicine can address many such health management issues [24]. As the demand for healthcare applications such as implantable medical devices increased, researchers are focusing on designing electronic biomedical devices using integrated circuit (IC) technology. One of the most commonly implemented biomedical devices is a cardiac pacemaker [17], which is implanted inside the human body to detect and monitor a person’s heart beating rate and submit the data to medical staff as well as other devices using wireless methods. A typical block diagram of an implantable cardiac pacemaker IC (ICPIC) is shown in Fig. 1 [25].

Fig. 1
figure 1

Block diagram of a typical implantable cardiac pacemaker integrated circuit (ICPIC)

The required cure is provided to the patient after receiving abnormal signals from the pacemaker. Human heart consists of four chambers, i.e., two atria and two ventricles through which blood is injected and purified and electrocardiogram (ECG) waveform gets generated. Electrocardiogram (ECG) waveform consists of P wave, QRS complex (combination of Q, R and S waves) and T wave. It is one of the most important parameters for heart activity monitoring, and full form analysis of the ECG signal is helpful in detection of various types of deflections. Figure 2 shows the characteristic points of sinus rhythm [9].

Among three waves of ECG, QRS complex is the most striking one and has more energy as well as amplitude compared to P and T waves. QRS detection provides the fundamentals for approximately all automated ECG analysis algorithms because after the QRS identification, the heart rate as well as some other parameters can be examined to avoid serious pathologies. In implantable cardiac pacemaker integrated circuits (ICs), QRS complex of the ECG waveform is detected using a QRS complex detector block which is a functional block used to detect the QRS peaks of the sinus rhythm. The working of this block must be highly accurate along with less power consumption and less hardware use (small chip area).

Fig. 2
figure 2

Basic pattern of electrical activity across the heart [9]

In the present work, an improved ECG detector applicable for implantable cardiac pacemaker systems is proposed. Biorthogonal 2.2 wavelet transform has been used to design wavelet filter banks. Biorthogonal 2.2 wavelet transform is chosen for this work due to its higher SNR compared to other wavelet transforms. In addition, it uses lesser number of coefficients and its shape resembles the ECG wave. The proposed filter architecture is different from previously designed architectures. Instead of using filter pairs of low- and high-pass filters, a new architecture that contains only three low-pass filters and a high-pass filter with a pipeline-based architecture is proposed. In the proposed architecture, the number of high-pass filters used is reduced compared to the previous works. Furthermore, decimated wavelet filter banks (WFBs) are used which have the advantages of lower dynamic power dissipation and less number of gates in implementation with different clock frequency at each level, over the undecimated WFBs. Filter architecture also plays important role in low power and processing time of whole system performance; hence, pipelined architecture is used for this purpose. The main advantage of the proposed architecture is that by using this architecture hardware is reduced. This is because there is no use of a multiplier in the present architecture as there is only one signal that comes through the WFBs output. Also, there is no need of noise detector. In the QRS complex detector block, only a comparator and a counter are used.

2 Literature Overview

Several algorithms have been proposed for ECG detection in last few years, such as morphological transform [20], artificial neural networks [7, 18, 22, 26], genetic algorithm [15], wavelet transforms filter banks [1, 8], heuristic methods based on nonlinear transforms [10, 19, 21]. Various ECG detection algorithms have been proposed for noise effect elimination and peak point detection of the ECG signal [3]. Comparison of various ECG detection algorithms based on the hardware complexity and the detection performance is done in [12]. It has been found [12] that a wavelet transform-based approach is most effective, considering the trade-off between hardware complexity and detection accuracy. Another approach based on wavelet transform has taken the help of electrocardiogram (ECG) delineation, and QRS complexes are detected using an algorithm based on the multiscale approach as proposed by Li et al. [11]. Pan et. al [13] proposed an algorithm for electrocardiogram (ECG) characteristics points detection using biorthogonal spline wavelet transform. In it, the equations of the low-pass H(z) and high-pass G(z) filters used in equivalent filter bank architecture are as follows:

$$\begin{aligned} H(z)= & {} \frac{1+3z^{-1}+3z^{-2}+z^{-3}}{4} \end{aligned}$$
(1)
$$\begin{aligned} G(z)= & {} \frac{-1-3z^{-1}+3z^{-2}+z^{-3}}{4} \end{aligned}$$
(2)

where H(z) and G(z) are the transfer functions of biorthogonal spline wavelet transform-based low-pass and high-pass filters. \(z^{-1}\), \(z^{-2}\) and \(z^{-3}\) are the delay elements. Coefficients of the low- and high-pass filters are:

$$\begin{aligned} h_0= & {} \frac{1}{4},h_1 =\frac{3}{4},h_2 =\frac{3}{4},h_3 =\frac{1}{4} \end{aligned}$$
(3)
$$\begin{aligned} g_0= & {} -\frac{1}{4},g_1 =-\frac{3}{4},g_2 =\frac{3}{4},g_3 =\frac{1}{4} \end{aligned}$$
(4)

From equations (3) and (4), it is obvious that the equivalent filter bank architecture uses only four coefficients and all these coefficients are small fractions. As a result, the amount of computation required to do the transformation is relatively small which makes this transformation faster compared to the method used in [11].

Rodrigues et. al [16] proposed the digital implementation of a wavelet-based R-wave detector suitable for the cardiac pacemakers that uses a wavelet filter bank to decompose the input signal into subbands, followed by a hypothesis testing as shown in Fig. 3.

Fig. 3
figure 3

Block diagram of the wavelet-based event detector [16]

Threshold function of the hypothesis test determines whether the incoming beat is considered as noise or as cardiac activity. Significant power savings (around 67%) are achieved by using a dual operation mode detector, and leakage power is also reduced by 97% with the help of sleep transistor used in the power supply rails. The major drawbacks of this approach are: GLRT-based QRS complex detector consumes lots of power, and the detection accuracy is poor. Wang et. al [23] proposed a real-time ECG detection algorithm based on band pass filtering with a peak detection stage and implemented the proposed algorithm on application-specific integrated circuit (ASIC). Major drawback with the time domain-based approaches is that extracting ECG signals by removing noises with band pass filter (a combination of low-pass and high-pass filters) is quite difficult, and detection accuracy is degraded. Min et. al [12] proposed a wavelet transform-based electrocardiogram (ECG) detector for low power implantable cardiac pacemakers that consist of a wavelet decomposer with wavelet filter banks, a QRS complex detector and a noise detector with zero-crossing points. The combination of multi-scaled product algorithm and soft threshold algorithm reduces the power consumption and increased the detection accuracy. The multi-scaled product of wavelet filter bank outputs is expressed as:

$$\begin{aligned} M_{p_I } =\prod _I {|{WF_I}|} \end{aligned}$$
(5)

where \(M_{P_i}\) is the product of wavelet filter bank outputs. \(\prod _i |{WF_I}|\) represents the multiplication of different wavelet filter bank outputs say WF1, WF2, WF3 and WF4, and I is the subset of wavelet filter bank outputs.

The use of add-shift multiplier for signal multiplication in multi-scaled product block increases processing time and consumes more hardware. Bhavtosh et. al [2] proposed a QRS complex detector that has been designed for the wearable ECG system using multi-scaled product with booth multiplier and soft threshold algorithms. The use of booth multiplier instead of add-shift multiplier is helpful in reducing the delay for quick QRS complex wave detection.

The architectures of some of the above-mentioned approaches are shown in Figs. 456 and 7.

Fig. 4
figure 4

Soft threshold-based ECG detector [12]

Fig. 5
figure 5

a Multiscale product-based detector, b soft threshold algorithm-based structure [12]

Fig. 6
figure 6

QRS detection ASIC [23]

Fig. 7
figure 7

Multi-scaled product using booth multiplier [2]

The main drawbacks of [2] are (1) this paper used conventional wavelet filter bank based on dyadic wavelet transform. wavelet filter bank, both decimator- and undecimator-based architectures with the filter pairs of low- and high-pass filters are used which increases the hardware and power consumption; (2) as they perform multiplication using booth multiplier [2] instead of conventional add-shift multiplier, the complexity of the multi-scaled product block has been increased. To remove these problems, a new wavelet filter bank based on biorthogonal 2.2 wavelet transform is used in the present work.

To reveal the hidden features within the signal, wavelet transform is used. It enables variable window sizes in analyzing different frequency components within a signal. Furthermore, wavelets have oscillating wavelike characteristics that resemble band like spectrum which makes them better in removing noises from signals [4]. Wavelet transform is having two types of functions, namely scaling function and wavelet function. Scaling function is used as low-pass filter, and wavelet function is used as high-pass filter. There are only few wavelet functions that can be applied to denoise the ECG signal because out of these so many types of wavelet functions only few wavelet functions have high signal-to-noise ratio and shape of the wavelet function is similar to the ECG signal. There are several types of wavelet transforms available in the literature. Some of these are dyadic wavelet transform, orthogonal wavelet transform, biorthogonal wavelet transform, etc. These are used for different-different applications, but biorthogonal wavelet transform provides more degree of freedom compared to other wavelet transforms. Some of its features are: (1) It generates possibilities to construct symmetrical wavelet functions. (2) It has two different scaling and wavelet functions which generate different multi-resolution analyses. And (3) it is more suitable for biomedical signals due to its waveforms matching with signals. Hence, it removes noises better than other wavelets. Keeping in mind the above-mentioned points, biorthogonal wavelet transform is used in the present work.

Compared to [2, 12, 23], the proposed architecture uses a biorthogonal 2.2 wavelet transform-based modified wavelet filter bank and a modified QRS complex detector block. The wavelet filter bank architecture used in [2, 12] passes the noisy ECG signal through a parallel combination of low-pass and high-pass filters called wavelet filter bank 1 (WF1) and repeats the procedure through wavelet filter bank 4 (WF4). This wavelet filter bank consumes significant amount of hardware. In the proposed architecture, a modified wavelet filter bank that passes the noisy ECG signals through a series combination of three low-pass filters and one high-pass filter is used. Furthermore, the pipelined architecture used in the proposed wavelet filter bank makes it faster compared to [2, 12].

Also, in [2, 12] denoised ECG signal is first multiplied and then compared with the threshold value. But because of the modified wavelet filter bank in the proposed work, denoised ECG signal is directly compared with the threshold value, which makes the proposed architecture efficient and faster compared to [2, 12].

3 Proposed ECG Detector

The methodology used for designing of proposed electrocardiogram (ECG) detector applicable for implantable cardiac pacemakers is presented in this section. Flow chart of the proposed electrocardiogram (ECG) detector is shown in Fig. 8. Various steps shown in Fig. 8 are discussed.

Fig. 8
figure 8

Flow chart of the proposed ECG detector

Initially, different electrocardiogram (ECG) inputs such as 100, 101 and 102 are taken from MIT-BIH arrhythmia database in .mat (i.e., 100.mat, etc.) form. Electrocardiogram (ECG) signals taken from MIT-BIH may be corrupted by various kinds of noises (i.e., power line interference, muscle contraction, baseline drift, motion artifacts, electrode contact noise, electrosurgical noise and instrumentation noise generated by electronic devices used in signal processing). To include the noise, a noise signal is generated and added to the original signal using instruction in MATLAB environment. In the present work, biorthogonal 2.2 wavelet transform with a decomposition level four (4) is used for the analysis of noisy ECG signals. WF1, WF2, WF3 and WF4 are the filter bank outputs which can also be represented as \(W_{2^{1}} f(n)\hbox {W}21\hbox {f}(\hbox {n})\), \(W_{2^{2}} f(n)\hbox {W}22\hbox {f}(\hbox {n})\), \(W_{2^3}f(n)W23f(n)\) and \(W_{2^{4}} f(n)\hbox {W}24\hbox {f}(\hbox {n})\). If scales and position are based on power of two, these are called dyadic scales and positions and in this case analysis becomes more accurate and efficient. In wavelet transform terminology, signals are defined as approximation (high scale and low frequency component) and detail (low scale and high frequency component). The decomposition process can be iterative, with successive approximations being decomposed further on, so that one signal is broken down into many lower resolution components. This is called the wavelet decomposition tree or wavelet filter bank. After that, using the designed ECG detector, incoming wavelet filter bank (WFB) output signal (A) is compared with the threshold value. If the threshold value is greater than A, then it is counted as R-peak. Also, R–R-peak time is calculated, and finally, total number of peaks is counted.

3.1 Selection of Wavelet Transform

Three categories of ECG detection algorithms can be found in the literature, namely syntactic, nonsyntactic and hybrid. Syntactic approach-based ECG detection algorithms are time-consuming because each class of patterns requires grammar inference [14]. This is the reason that a large number of the proposed ECG detectors are based on nonsyntactic approach [5, 6]. This approach-based ECG detectors first filter the ECG signal with a band pass filter (or a matched filter); then, output of the bandpass filter is passed through a nonlinear transformation (i.e., derivative and square) to enhance the QRS complexes, and finally, some logic is applied to determine the QRS complexes present in the signal. Nonsyntactic approaches mainly suffer from two problems: First, frequency band of the QRS complex is different for different subjects and different beats of the same subject. Second, there is a overlapping of the frequency band of the noise and QRS complex.

Out of the total 74 wavelet transforms (i.e., haar, symlet, biorthogonal), biorthogonal 2.2 wavelet transform has been found suitable for the proposed ECG detector. Biorthogonal 2.2 wavelet transform is chosen based on three parameters: 1) signal-to-noise ratio (SNR), 2) no. of coefficients and 3) shape of the wavelet. Table 4 in “Appendix” shows the signal-to-noise ratio for different MIT-BIH signals (100.mat and 215.mat).

Formula used for SNR calculation is:

$$\begin{aligned} \hbox {SNR}=10\log _{10} \frac{\hbox {mean}(\hbox {reconstructed signal})^{2}}{\hbox {mean}( {\hbox {original signal}-\hbox {reconstructed signal}})^{2}} \end{aligned}$$
(6)

It is obvious from Table 4 in “Appendix” that biorthogonal 2.2 wavelet has very high SNR values. Only biorthogonal 3.1 and 3.3 wavelets have better SNR values compared to biorthogonal 2.2 wavelet, but these wavelets need larger number of coefficients. Larger number of coefficients increase the hardware area and power consumption of the system. Furthermore, the shape of biorthogonal 2.2 wavelet closely resembles the ECG signal compared to biorthogonal 3.1 and 3.3 wavelets as shown in Fig. 9. Based on above considerations, biorthogonal 2.2 wavelet is found most suitable for the proposed ECG detector designed for the implantable cardiac pacemaker systems.

Fig. 9
figure 9

Shapes of the different biorthogonal wavelet transforms

3.2 Architecture

The block diagram of the architecture of proposed ECG detector is shown in Fig. 10. The proposed design consists of two main blocks; first one is decimated wavelet filter bank with pipelined structure-based filter pairs used to analyze electrocardiogram (ECG) signal in four levels. Another one is modified threshold comparator.

In the previously published work, Mallat-based architecture is used in which signal is decomposed into two parts, i.e., approximation (high scale and low frequency component) and detail (low scale and high frequency component). Since the QRS complex generally lies in the frequency range of 10 to 25 Hz, a pipelined architecture-based wavelet filter bank as shown in Fig. 11 is proposed in the present work. It consists of three low-pass filters, namely WF1, WF2, WF3 and a high-pass filter WF4.

Fig. 10
figure 10

Block diagram of the proposed ECG detector

Fig. 11
figure 11

a Block diagram of modified wavelet filter bank, b pipelined architecture-based decimated wavelet filter bank circuit

Although the signal at WF4 output is very smooth, in some cases the T wave or impulse noise is in same bandwidth of QRS signal. Decision of threshold comparator is affected in this type of situations due to high amplitude of these noises or unwanted signals. Hence, in the present work soft threshold is preferred over the hard threshold used in earlier works. The block diagram of the proposed ECG detector with soft threshold block and other constituent components is shown in Fig. 10. Output of the WF4 is given to the comparator and a soft threshold (Vth) is set at the maximum value of one fourth (i.e., 0.25) of the wavelet filter bank (WFB) output. Various values of threshold are tested on MIT-BIH arrhythmia database such as 0.15*(max) value of WF4, 0.20*(max) value of WF4, 0.30*(max) value of WF4 and 0.35*(max) value of WF4. Threshold values other than the proposed value either detect the extra number of R-peaks or detect less number of peaks. Hence, the proposed value which is 0.25*(max) value of WF4 is chosen for the proposed work. Performance comparison of different thresholds with 100.mat of MIT-BIH arrhythmia database is shown in Table 1.

After that, comparator compares the wavelet filter bank (WFB) output with the threshold value. If this value is greater than the threshold, then it is counted as a peak; otherwise, no peak is counted. Total number of peaks is counted by the counter.

Table 1 Performance comparison of 100.mat signal with different threshold values

4 Results and Discussions

Various ECG inputs such as 100, 101 and 102 are taken from MIT-BIH arrhythmia database in .mat form; 60 Hz Gaussian noise is generated and added to the original signal using MATLAB R2013b environment. After that, noisy signal is passed through the wavelet filter bank (WFB). All the results are verified at the algorithmic level using inbuilt wavelet toolbox “wavemenu.”

Figure 12 shows the wavelet filter bank output for each scale 1 to 4 for MIT-BIH 100 ECG signal using MATLAB. Frequency response of the WFBs is shown in Fig. 13.

Fig. 12
figure 12

Wavelet decomposition of ECG signal into four levels using MATLAB inbuilt wavelet tool box

Fig. 13
figure 13

Frequency response of wavelet filters at different scales

Various ECG signals (e.g., 100, 101, 102...) taken from MIT-BIH database have been tested using biorthogonal 2.2 wavelet transform. A 60 Hz white Gaussian noise is added to include the effect of the internal and external noise sources. Some of these obtained results are shown here. Figure 14 shows wavelet filter bank (WFB) output of 100 ECG signal, whereas Fig. 15 shows WFB 4 output obtained using MATLAB.

Fig. 14
figure 14

Wavelet filter bank outputs of MIT-BIH 100 signal

Fig. 15
figure 15

WFB 4 output

4.1 Post-Processing Results

Verilog HDL and Xilinx ISE 14.1 have been used for coding, synthesis and performance analysis of the proposed ECG detector. Xilinx Virtex-6 FPGAs are used to implement the proposed detector. 16-bit input ECG signal along with clock and reset signal is applied to WFBs. Figures 16 and 17 show the RTL view of the proposed ECG detector and wavelet filter banks (WFBs), respectively, using Xilinx ISE 14.1.

Fig. 16
figure 16

RTL view of the proposed ECG detector

Fig. 17
figure 17

RTL view of wavelet filter banks (WFBs)

4.2 Output of Wavelet Filter Bank and ECG Detector

Threshold is assumed to be 16 bits, and the input coming from the WF4 preprocessing stage is also 16 bit. Figure 18 shows the output waveform of wavelet filter banks (WFBs). The output of ECG detector block used to determine the R-peak for 100 ECG input is shown in Fig. 19. Figures 18 and 19 confirm the operation of WFBs and ECG detector.

Fig. 18
figure 18

Waveform of wavelet filter banks (WFBs)

Fig. 19
figure 19

Waveforms of ECG detector

Table 2 Performance parameters of the proposed ECG detector

Various performance parameters have been used in the literature to analyze and compare the performance of the ECG detection algorithms. Sensitivity (\(S_\mathrm{e} \)), positive predictivity (\(P^{+}\)) and detection error rate (DER) are used to assess the performance of the proposed ECG detector and its comparison with previously designed ECG detectors.

Sensitivity (\(S_\mathrm{e} \)) is given as

$$\begin{aligned} S_\mathrm{e} =\frac{\mathrm{TP}}{\mathrm{TP}+\mathrm{FN}}\% \end{aligned}$$
(7)

where false TP is the true positive which denotes the number of correctly detected QRS complexes and FN is the false negative which represents the number of missed detection.

Positive predictivity (\(P^{+}\)) is computed by

$$\begin{aligned} P^{+}=\frac{\mathrm{TP}}{\mathrm{TP}+\mathrm{FP}}\% \end{aligned}$$
(8)

where FP is the false positive which represents the detection of false QRS complex.

Detection error rate (DER) is calculated by

$$\begin{aligned} \mathrm{DER}=\frac{\mathrm{FP}+\mathrm{FN}}{\mathrm{Total\ number\ of\ QRS\ complexes}}\% \end{aligned}$$
(9)

Proposed algorithm is tested for almost all signals (i.e., 100.mat, 101.mat, 201.mat), but only some randomly selected ECG signals and their performance analysis are shown in Table 2. It is obvious from Table 2 that the proposed design has positive predictivity of 99.94. Only few false positive peaks are detected during processing of the signal. Detection error rate (DER) of our design is also very low that is 0.13% in comparison with 0.196% of previous design [12]. Sensitivity (\(\hbox {S}_{e}\)) of the proposed detector is found to be 99.92%.

4.3 Hardware Utilization

Proposed design has less hardware than previous designs [12, 22]. Noise detector, 3 multiplexers and one multiplier have been reduced compared to the previous designs. This reduction in hardware blocks makes the proposed design more efficient. Xilinx ISE 14.1 is used to measure the performance, area and power of the proposed ECG detector.

The overall delay of the proposed ECG detector is significantly reduced from 37.036ns to 18.924ns [12] using this technique. The low delay makes the proposed detector useful for the high-performance cardiac applications.

The hardware cost of proposed detector is compared with previous wavelet-based detector [2, 12] which is shown in Table 3. It is obvious from Table 3 that the proposed ECG detector uses lesser hardware which results in lower area on chip and lower cost compared to the previous designs.

Table 3 Comparison of hardware cost for ECG detectors

5 Conclusion

Biorthogonal wavelet transform-based ECG detector applicable in implantable cardiac pacemaker systems has been proposed in the present work. This ECG detector uses four-level wavelet filter banks (WFBs) for filtering purpose and a comparator and counter module for peak detection process. A digitized ECG wave is first applied to the four-level WFBs which separate the QRS Complex peaks from noises (unwanted signals generated by human body, instruments and other external sources). After this, ECG detector is used to detect and count the QRS complex peaks. A threshold (max value of 0.25) is setup to detect peaks from the WFBs outputs using a comparator. If the comparator output is high, it means that a peak is present, and then, it is counted (a counter is used at output stage for this purpose). A low detection error rate (DER) better positive predictivity (\(\hbox {P}^{+}\)) and better sensitivity (\(\hbox {S}_{\mathrm{e}}\)) are achieved for the proposed ECG detector. Hardware cost as well as power dissipation is also reduced compared to the previously designed ECG detectors.