**3.1 Digital ECG design**

Signals produced by bioelectric phenomenon are small potential values and due to this, sophisticated amplifiers are required so as to easily obtain signal values (Vidal & Pavesi, 2004).

Against a physiologic backdrop, these ionic signals are transmitted at a fast-rate without synaptic delay in both direction directed by the electric synapse transmission model. This electric potential is later transformed in a mechanical signal as of using calcium ion that comes from extracellular condition which is also useful for cooking calcium that is released from the internal section of cardiac cells provoking a massive cardiac muscle like a sincitio or functional unit (Clusin, 2008). In this sense, the main finality of an amplifier is to increment the measurable level of the gotten signal by electrodes, avoiding any kind of interference. The capacitive interference of the patient body, electrical fields of electric installations, and other environment electronic devices are examples of interference or noise. (Proakis & Manolakis, 2007) indicate that the quantification can be done using single pole configurations or bipolar. In the single pole quantification, difference between a signal and a common base is measured whereas the bipolar mode measures the difference of two voltage sources (two electrodes) with respect to a common base where any interference voltage generated at the quantification point appears at the amplifier input as common-mode interference signals. Figure 5 illustrates this phenomenon in a bipolar quantification.

Fig. 5. Common-Mode Interferences in a bipolar quantification

A strong source noise which interferes on the ECG signal is the capacitive interference of the patient body. This interference voltage is coupled to the ECG signal reaching values of 2.4 V approximately. A value which is very higher than the ECG signals value range (0.02 mV to 5 mV). In addition to this interference, the capacitive interference due to the equipment or device used to measure the ECG signal which is produced by the equipment power supply. Another noise source is the denominated inductive interference that is caused by the electric net which produces variable in time magnetic fields inducing extra voltages on the next of patient electrodes (Townsend, 2001).

156 Applications of Digital Signal Processing

(Cuesta, 2001; Vidal et al., 2008; Vidal & Gatica, 2010) where the most important part corresponds to the amplifying module because of a bioelectrical signal that represents a low potential, and sophisticated amplifiers are required for obtaining and recording it (Vidal &

The following sections present experiences building a device for getting the ECG signal, and

Signals produced by bioelectric phenomenon are small potential values and due to this, sophisticated amplifiers are required so as to easily obtain signal values (Vidal & Pavesi,

Against a physiologic backdrop, these ionic signals are transmitted at a fast-rate without synaptic delay in both direction directed by the electric synapse transmission model. This electric potential is later transformed in a mechanical signal as of using calcium ion that comes from extracellular condition which is also useful for cooking calcium that is released from the internal section of cardiac cells provoking a massive cardiac muscle like a sincitio or functional unit (Clusin, 2008). In this sense, the main finality of an amplifier is to increment the measurable level of the gotten signal by electrodes, avoiding any kind of interference. The capacitive interference of the patient body, electrical fields of electric installations, and other environment electronic devices are examples of interference or noise. (Proakis & Manolakis, 2007) indicate that the quantification can be done using single pole configurations or bipolar. In the single pole quantification, difference between a signal and a common base is measured whereas the bipolar mode measures the difference of two voltage sources (two electrodes) with respect to a common base where any interference voltage generated at the quantification point appears at the amplifier input as common-mode

interference signals. Figure 5 illustrates this phenomenon in a bipolar quantification.

A strong source noise which interferes on the ECG signal is the capacitive interference of the patient body. This interference voltage is coupled to the ECG signal reaching values of 2.4 V approximately. A value which is very higher than the ECG signals value range (0.02 mV to 5 mV). In addition to this interference, the capacitive interference due to the equipment or device used to measure the ECG signal which is produced by the equipment power supply. Another noise source is the denominated inductive interference that is caused by the electric net which produces variable in time magnetic fields inducing extra voltages on the next of

Fig. 5. Common-Mode Interferences in a bipolar quantification

patient electrodes (Townsend, 2001).

Pavesi, 2004; Vidal et al., 2008; Vidal & Gatica, 2010).

works related to processing ECG signal.

**3.1 Digital ECG design** 

2004).

For these reasons, common mode rejection ratio (CMRR) rate is a desirable characteristic of an amplifier working on differential mode. On a day today practice, a problem denominated contact impedance disbalance appears (Townsend, 2001) that is produced when there are different interfaces impedances between the skin and electrodes in a form that the commonmode potential is higher in one of the two voltage sources. Therefore, part of the commonmode voltage is worked as differential voltage and amplified according to the amplifier gain. This occasionally produces saturation on the next amplifying module stage, if the amplification module were composed by more stages. This voltage, which is generally continuous, can be eliminated using a simple high-pass filter. Hence, the output voltage of the differential amplifier would consist of 3 components (Townsend, 2001; Vidal & Pavesi, 2004):


(Wells & Crampton, 2006) indicate that weak signals require an amplification of 1000 at least to produce adequate signal levels for future works on it. (Vidal & Pavesi, 2004) used an instrument amplifier model INA131 which presents a fixed CMRR of 100, and according to the associated datasheet it is adequate for biomedical instrumentation. The analog to digital conversion stage (A/D conversion) is always done when the signal is amplified. The electronic schemes of a digital electrocardiographic device according to (Vidal & Gatica, 2010) are presented on figures 6 and 7, respectively. (Vidal & Pavesi, 2004; Vidal & Gatica, 2010) use the TLC1541 A/D converter. It is necessary to indicate that both electronic items, INA131 and TLC1541, are less expensive.

Fig. 6. ECG Signal Amplifying Module Circuit

A DSP Practical Application: Working on ECG Signal 159

(Vidal & Pavesi, 2004; Vidal & Gatica, 2010) worked on the digital filters application to eliminate noise on an ECG signal, and the use of algorithms for QRS complex detecting. Following subsections describe digital filters to work on the ECG signal, and present the

To work the ECG signal it is necessary to apply digital filters which helps to diminish the noise present on it. One of the most useful filters is Lynn's filters (Goldschlager, 1989) and there are previous works where Lynn's filters are successfully applied to processing ECG signal (Thakor et al., 1984; Kohler et al., 2002; Ahlstrom & Tompkins, 1985). These filters present desirable properties of real-time filters like lineal phase and integer coefficients. There are low-pass and high-pass Lynn's filters versions which are described as follows.

Lynn's filters described in (Ahlstrom & Tompkins, 1985) and used on ECG signal processing in (Pan & Tompkins, 1985; Hamilton & Tompkins, 1986), represent a simple and effective form of applying low-pass filter on ECG signals. These filters obey the next transfer

> (1 ) (1 2 ) ( ) (1 ) (1 2 ) *z zz H z*

*yn yn yn xn xn xn* [ ] 2 [ 1] [ 2] [ ] 2 [ ] [ 2 ]

D

This filter can be implemented by means of the following differences equation:

*z zz* 

2 2 1 2 1 2

D

 D

D D

(2)

(1)

Fig. 9. Triangle Signal obtained by the A/D Change Module

Fig. 10. ECG Signal obtained by the A/D Change Module

main principles of a QRS detector algorithm (Vidal et al., 2008).

**4. ECG signal processing** 

**4.1 Digital filters for ECG signal** 

**4.1.1 Low-pass filter** 

function:

Fig. 7. Data Acquisition Module Circuit

#### **3.2 Acquiring and processing ECG signal**

The acquisition data stage has a hardware part composed by the A/D converter, and a software part which is in charge of directing the A/D converter work. Any programming language allowing low level hardware instruction is usable. (Vidal & Pavesi, 2004) and (Vidal & Gatica, 2010) describe the use of C and Visual Basic programming languages for getting and processing the ECG signal. According to these works, the routine written in C language is used to direct the A/D converter functioning using non-standard functions to access the personal computer ports. The obtained quantity of samples is stored in a binary file which is rescued by the Visual Basic programming language routine to processing (applying filters and QRS detection algorithms) and showing the signal. Showing the signal at the computer is done "offline" from the generated file with the ECG signal samples. As (Vidal & Gatica, 2010) highlights using current high level programming languages would be possible to build a showing graphics routine. Using lineal interpolation it is possible to get high level graphic results. Even though the Nyquist's sample theorem indicates that a signal can be rebuild using an ideal interpolation method (Lindner, 2009; Proakis & Manolakis 2007), by means of lineal interpolation, and through this it is possible to get good results for low frequency signals like ECG. It is possible to build a universal graphics generator for getting signals (Vidal & Pavesi, 2004; Vidal & Gatica, 2010). Figures 8 and 9 present a universal graphics generator for a sine curve signal and a triangle signal, respectively. These signals are low frequency signals (2 Hz) generated by a function or electrical waves generator with some acquisition deformities (high negative values are not considered). Figure 10 shows a pure ECG signal got by means of an implemented ECG system (Vidal & Gatica, 2010).

Fig. 8. Sine Signal obtained by the A/D Change Module

158 Applications of Digital Signal Processing

The acquisition data stage has a hardware part composed by the A/D converter, and a software part which is in charge of directing the A/D converter work. Any programming language allowing low level hardware instruction is usable. (Vidal & Pavesi, 2004) and (Vidal & Gatica, 2010) describe the use of C and Visual Basic programming languages for getting and processing the ECG signal. According to these works, the routine written in C language is used to direct the A/D converter functioning using non-standard functions to access the personal computer ports. The obtained quantity of samples is stored in a binary file which is rescued by the Visual Basic programming language routine to processing (applying filters and QRS detection algorithms) and showing the signal. Showing the signal at the computer is done "offline" from the generated file with the ECG signal samples. As (Vidal & Gatica, 2010) highlights using current high level programming languages would be possible to build a showing graphics routine. Using lineal interpolation it is possible to get high level graphic results. Even though the Nyquist's sample theorem indicates that a signal can be rebuild using an ideal interpolation method (Lindner, 2009; Proakis & Manolakis 2007), by means of lineal interpolation, and through this it is possible to get good results for low frequency signals like ECG. It is possible to build a universal graphics generator for getting signals (Vidal & Pavesi, 2004; Vidal & Gatica, 2010). Figures 8 and 9 present a universal graphics generator for a sine curve signal and a triangle signal, respectively. These signals are low frequency signals (2 Hz) generated by a function or electrical waves generator with some acquisition deformities (high negative values are not considered). Figure 10 shows a pure ECG signal got by means of an

Fig. 7. Data Acquisition Module Circuit

**3.2 Acquiring and processing ECG signal** 

implemented ECG system (Vidal & Gatica, 2010).

Fig. 8. Sine Signal obtained by the A/D Change Module

Fig. 9. Triangle Signal obtained by the A/D Change Module

Fig. 10. ECG Signal obtained by the A/D Change Module

#### **4. ECG signal processing**

(Vidal & Pavesi, 2004; Vidal & Gatica, 2010) worked on the digital filters application to eliminate noise on an ECG signal, and the use of algorithms for QRS complex detecting. Following subsections describe digital filters to work on the ECG signal, and present the main principles of a QRS detector algorithm (Vidal et al., 2008).

#### **4.1 Digital filters for ECG signal**

To work the ECG signal it is necessary to apply digital filters which helps to diminish the noise present on it. One of the most useful filters is Lynn's filters (Goldschlager, 1989) and there are previous works where Lynn's filters are successfully applied to processing ECG signal (Thakor et al., 1984; Kohler et al., 2002; Ahlstrom & Tompkins, 1985). These filters present desirable properties of real-time filters like lineal phase and integer coefficients. There are low-pass and high-pass Lynn's filters versions which are described as follows.

#### **4.1.1 Low-pass filter**

Lynn's filters described in (Ahlstrom & Tompkins, 1985) and used on ECG signal processing in (Pan & Tompkins, 1985; Hamilton & Tompkins, 1986), represent a simple and effective form of applying low-pass filter on ECG signals. These filters obey the next transfer function:

$$H(z) = \frac{(1 - z^{-\alpha})^2}{\left(1 - z^{-1}\right)^2} = \frac{\left(1 - 2z^{-\alpha} + z^{-2\alpha}\right)}{\left(1 - 2z^{-1} + z^{-2}\right)}\tag{1}$$

This filter can be implemented by means of the following differences equation:

$$y[n] = 2y[n-1] - y[n-2] + x[n] - 2x[n-a] + x[n-2a] \tag{2}$$

A DSP Practical Application: Working on ECG Signal 161

Like a low-pass Lynn's filters, there are high-pass Lynn's filters which are described in (Ahlstrom & Tompkins, 1985) and applied to ECG signal processing on (Pan & Tompkins, 1985; Hamilton & Tompkins, 1986). These filters are designed using an all-pass filter and resting over it a low-pass filter, and the result is a high-pass filter (Vidal & Pavesi, 2004). However for an effective design,

> <sup>1</sup>

*z*

D

(4)

*z*

1 ( ) <sup>1</sup>

*jsen*

 DZ  DZ

 Z

2 2

 Z

 Z

> Z

 Z DZ (5)

cos cos cos cos

 DZ

The High-Pass Lynn's filter starts using the following low-pass filter transfer equation:

*H z*

DZ

Z

cos

 DZ

 Z

> DZ

 Z

¨ © cos

22 2 2 2

Z

> D

*sen sen sen j sen sen*

cos cos

*sen j*

 Z

ª§ · § ·º Ǭ ¸ ¨ ¸» © ¹ © ¹¼

Z

2 22 22 22 22

*sen*

 Z

· § · ¸ ¨ ¸ ¹ © ¹ § · § · ¨ ¸ ¨ ¸ © ¹ © ¹

2

Z

 DZ

> ZZ

cos

§ · ¨ ¸ © ¹ § · ¨ ¸ © ¹

cos

*sen sen j sen j*

 DZ

22 2

cos ( 1) ( 1) 22 2

§ · § ·§ · ¨ ¸ ¨ ¸¨ ¸ © ¹ © ¹© ¹

2

Z

*sen*

Fig. 13. Amplitude Response of Low-Pass Lynn's Filter for ǂ=5

low-pass filter and all-pass filter must be in phase (Smith, 1999).

Amplitude and phase responses are got by:

Z  2

 

Z

DZ

DZ

 DZ

DZ

DZ

2

*sen j sen*

Z

*sen j sen*

 DZ

 DZ

> Z

22 2

*sen sen j*

*sen sen j*

ZZ

22 2

§

*sen jsen*

D

 Z

*sen sen j*

ZZ

2 2 cos 2 22 2 2 cos 2 22

<sup>1</sup> 1 cos ( ) <sup>1</sup> 1 cos

Z

DZ

DZ

*j j <sup>e</sup> jsen <sup>H</sup>*

**4.1.2 High pass filters** 

The amplitude answer of this filter is calculated as follows:

$$H(\alpha) = \frac{1 - 2\cos\alpha\alpha + \cos 2\alpha\alpha + j(2\sin\alpha\alpha - \sin 2\alpha\alpha)}{1 - 2\cos\alpha + \cos 2\alpha + j(2\sin\alpha\alpha - \sin 2\alpha)} = $$

$$\frac{|\cos\alpha\alpha - 1|}{|\cos\alpha - 1|} = \frac{\sin^2\left(\frac{\alpha}{2}\alpha\right)}{\sin^2\left(\frac{\alpha}{2}\right)}\tag{3}$$

For a sample frequency of 430 Hz, possible ǂ values and associated cut frequency (-3 dB.) are shown in Table 2. Figures 11, 12, and 13 show associated amplitude response for these filters.


Table 2. Cut Frequencies of Low-Pass Lynn Filter

Fig. 11. Amplitude Response of Low-Pass Lynn's Filter for ǂ=3

Fig. 12. Amplitude Response of Low-Pass Lynn's Filter for ǂ=4

Fig. 13. Amplitude Response of Low-Pass Lynn's Filter for ǂ=5

#### **4.1.2 High pass filters**

160 Applications of Digital Signal Processing

1 2 cos cos2 (2 2 ) ( ) 1 2 cos cos2 (2 2 )

 Z

D

§ ·

Z

 DZ

*j sen sen*

ZZ

 DZ  DZ

(3)

2

*sen*

*sen*

¨ ¸ © ¹ §· ¨ ¸

*j sen sen <sup>H</sup>*

DZ

Z

2

2

© ¹

**ǂ Value Cut Frequency**  3 48 Hz 4 35 Hz 12 11.46 Hz

For a sample frequency of 430 Hz, possible ǂ values and associated cut frequency (-3 dB.) are shown in Table 2. Figures 11, 12, and 13 show associated amplitude response for these

Z

The amplitude answer of this filter is calculated as follows:

Z

Table 2. Cut Frequencies of Low-Pass Lynn Filter

Fig. 11. Amplitude Response of Low-Pass Lynn's Filter for ǂ=3

Fig. 12. Amplitude Response of Low-Pass Lynn's Filter for ǂ=4

filters.

cos 1 2 cos 1

DZ

Z

> Like a low-pass Lynn's filters, there are high-pass Lynn's filters which are described in (Ahlstrom & Tompkins, 1985) and applied to ECG signal processing on (Pan & Tompkins, 1985; Hamilton & Tompkins, 1986). These filters are designed using an all-pass filter and resting over it a low-pass filter, and the result is a high-pass filter (Vidal & Pavesi, 2004). However for an effective design, low-pass filter and all-pass filter must be in phase (Smith, 1999).

The High-Pass Lynn's filter starts using the following low-pass filter transfer equation:

$$H(z) = \frac{\left(1 - z^{-\alpha}\right)}{\left(1 - z^{-1}\right)}\tag{4}$$

Amplitude and phase responses are got by:

 2 2 <sup>1</sup> 1 cos ( ) <sup>1</sup> 1 cos 2 2 cos 2 22 2 2 cos 2 22 cos 22 2 cos 22 2 cos 22 2 *j j <sup>e</sup> jsen <sup>H</sup> jsen sen j sen sen j sen sen sen j sen sen j sen sen j* DZ Z DZ DZ Z Z Z Z DZ DZ DZ Z ZZ DZ DZ DZ ZZ Z DZ DZ DZ § · ¨ ¸ © ¹ § · ¨ ¸ © ¹ § ¨ © cos 2 2 cos cos 22 2 2 2 cos cos cos cos 2 22 22 22 22 2 cos ( 1) ( 1) 22 2 2 *sen j sen sen j sen j sen sen sen j sen sen sen sen jsen sen* Z Z ZZ Z Z Z DZ DZ Z DZ Z DZ Z Z DZ Z DZ Z Z D D Z · § · ¸ ¨ ¸ ¹ © ¹ § · § · ¨ ¸ ¨ ¸ © ¹ © ¹ ª§ · § ·º Ǭ ¸ ¨ ¸» © ¹ © ¹¼ § · § ·§ · ¨ ¸ ¨ ¸¨ ¸ © ¹ © ¹© ¹ (5)

A DSP Practical Application: Working on ECG Signal 163

Fig. 15. Low-Pass / High-Pass Lynn's Filter Amplitude Response - Cut Frequency 0.5 Hz

Fig. 16. Low-Pass / High-Pass Lynn's Filter Amplitude Response - Cut Frequency 5 Hz

Lynn's filter application there is a group delay of 160 samples.

Fig. 18. Filtered ECG Signal Using Low-Pass 35 Hz Lynn's Filter

Fig. 17. Pure ECG Signal

Figures 17, 18, 19, 20 and 21 present signals registered by an implement ECG device using Figure 4 and 5 circuits (Vidal & Gatica, 2010). Figure 15 shows a pure signal ECG without applying filters to delete noise. Figure 18 shows the 35 Hz low-pass Lynn's filter application on the Figure 17 signal. Figure 18 presents the application of a 48 Hz low-pass filter application over the Figure 17 signal. In Figures 20 and 21 the application of 0.2 and 0.5 high-pass Lynn's filters respectively on the Figure 17 signal is shown. It is important to be aware of the group delay effect on the ECG signal after the 0.2 Hz high-pass Lynn's filter application, 423 samples in this case (around 1 second). Likewise, for the 0.5 Hz high-pass

Finally, amplitude and phase responses are showed on Eq. 6 and Eq. 7, respectively.

$$\left| H(\alpha) \right| = \left| \frac{\operatorname{sen}\frac{\alpha \alpha}{2}}{\operatorname{sen}\frac{\alpha}{2}} \right| \tag{6}$$

$$\Theta(\alpha) = -\frac{\alpha}{2}(\alpha - 1) \tag{7}$$

The filter's group delay is ( 1) /2 D , and the associated gain for ǚ=0 is ǂ determined evaluating |H (ǚ=0)|.

Once completely characterized the low-pass filter, designing the high-pass filter is an easy task using the following transfer function:

$$H(z) = z^{\frac{-(a-1)}{2}} - \left(\frac{1-z^{-a}}{1-z^{-1}}\right) / a = \frac{-1/\left.a+z^{\frac{-(a-1)}{2}} - z^{-\frac{-(a-1)}{2}-1} + z^{-a}/a}{1-z^{-1}}\right) \tag{8}$$

This filter can be implemented directly by the following difference equation:

$$y[n] = y[n-1] - x[n] / \left| a + x \right[n - \frac{(a-1)}{2}] - x \left[ n - \frac{(a-1)}{2} - 1 \right] + x[n-a] / \left| a \right] \tag{9}$$

Getting amplitude response for this filter is mathematically complex. Nevertheless, theoretically this filter must have the same cut frequency of the subjacent low-pass filter in inverse order. Furthermore, the values of phase response and group delay of the high-pass filter are the equal to the same parameters for the low-pass filter (Smith, 1999).

For a cut frequency of 430 Hz, ǂ values and associated cut frequency (-3 dB.) are shown on Table 3.


Table 3. Cut Frequencies of High-Pass Lynn Filter

Figures 14, 15 and 16 show the low-pass filter amplitude response which give an idea of the amplitude response of the associated high-pass filter because the cut frequencies are the same.

Fig. 14. Low-Pass / High-Pass Lynn's Filter Amplitude Response - Cut Frequency 0.2 Hz

162 Applications of Digital Signal Processing

2 ( )

( ) ( 1) <sup>2</sup> Z

Once completely characterized the low-pass filter, designing the high-pass filter is an easy

( 1) ( 1) <sup>1</sup> ( 1) 2 2

( 1) ( 1) [ ] [ 1] [ ]/ 1 [ ]/ 2 2 *yn yn xn x n x n x n* D

Getting amplitude response for this filter is mathematically complex. Nevertheless, theoretically this filter must have the same cut frequency of the subjacent low-pass filter in inverse order. Furthermore, the values of phase response and group delay of the high-pass

For a cut frequency of 430 Hz, ǂ values and associated cut frequency (-3 dB.) are shown on

Figures 14, 15 and 16 show the low-pass filter amplitude response which give an idea of the amplitude response of the associated high-pass filter because the cut frequencies are the same.

Fig. 14. Low-Pass / High-Pass Lynn's Filter Amplitude Response - Cut Frequency 0.2 Hz

**Valor de ǂ Frecuencia de Corte**  850 0.2 Hz. 320 0.5 Hz. 35 5 Hz.

ª ºª º « »« »

1 1 1 1 / / ( ) / 1 1 *z zz z Hz z*

D D

*z z*

 § · ¨ ¸

*sen*

*sen*

 D 2

Z

(6)

(7)

, and the associated gain for ǚ=0 is ǂ determined

 D

¬ ¼¬ ¼ (9)

© ¹ (8)

 D  D

D

D D

DZ

Finally, amplitude and phase responses are showed on Eq. 6 and Eq. 7, respectively.

Z

 4 Z

*H*

The filter's group delay is ( 1) /2

task using the following transfer function:

2

Table 3. Cut Frequencies of High-Pass Lynn Filter

D

evaluating |H (ǚ=0)|.

Table 3.

D

D

D

This filter can be implemented directly by the following difference equation:

filter are the equal to the same parameters for the low-pass filter (Smith, 1999).

D

Fig. 15. Low-Pass / High-Pass Lynn's Filter Amplitude Response - Cut Frequency 0.5 Hz

Fig. 16. Low-Pass / High-Pass Lynn's Filter Amplitude Response - Cut Frequency 5 Hz

Figures 17, 18, 19, 20 and 21 present signals registered by an implement ECG device using Figure 4 and 5 circuits (Vidal & Gatica, 2010). Figure 15 shows a pure signal ECG without applying filters to delete noise. Figure 18 shows the 35 Hz low-pass Lynn's filter application on the Figure 17 signal. Figure 18 presents the application of a 48 Hz low-pass filter application over the Figure 17 signal. In Figures 20 and 21 the application of 0.2 and 0.5 high-pass Lynn's filters respectively on the Figure 17 signal is shown. It is important to be aware of the group delay effect on the ECG signal after the 0.2 Hz high-pass Lynn's filter application, 423 samples in this case (around 1 second). Likewise, for the 0.5 Hz high-pass Lynn's filter application there is a group delay of 160 samples.

Fig. 17. Pure ECG Signal

Fig. 18. Filtered ECG Signal Using Low-Pass 35 Hz Lynn's Filter

A DSP Practical Application: Working on ECG Signal 165

In the literature there are several algorithmic approaches for detecting QRS complexes of

The implementation of incremental improvements to a classical algorithm to detect QRS complexes was realized in an experiment as mentioned in (Vidal et al., 2008; Vidal & Gatica, 2010) which in its original form do not have a great performance. The first improvement based on the first derivative is proposed and analyzed in (Friese at al., 1990). The second improvement is based on the use of nonlinear transformations proposed in (Pan & Tompkins, 1985) and analyzed in (Suppappola & Ying, 1994; Hamilton & Tompkins, 1986). The third is proposed and analyzed in (Vidal & Pavesi, 2004; Vidal et al., 2008), as an extension and improvement of that is presented in (Friesen et al., 1994) using characteristics of the algorithm proposed in (Pan & Tompkins, 1985). It should be noted that the three algorithmic improvements recently mentioned, used classical techniques of DSP (Digital Signal Processing). It is noteworthy to indicate that the second improvement proposed in (Pan & Tompkins, 1985) is of great performance in the accurate detection of QRS complexes,

To test the algorithms that work on ECG signal, it is not necessary to implement a data acquisition system. There are specialized databases with ECG records for analyzing the performance of any algorithm to work with ECG signals (Cuesta, 2001; Vidal & Pavesi, 2004). One of the most important is the MIT DB BIH (database of arrhythmias at

In Tables 4, 5, 6 and 7, respectively, are the results obtained with the application of incremental improvements made to the first algorithm for detecting QRS complexes in some records at MIT DB BIH. A good level of performance reached in the final version of algorithm of detection of QRS complexes implemented in this work could be appreciated,

R. 1118 - S. 1 2278 2278 79676 0 3497,63% R. 118 - S. 2 2278 2278 77216 0 3389,64% R. 108 – S. 1 562 562 8933 0 1589,50% R. 108 – S. 2 562 562 17299 0 3078,11% Table 4. Results obtained with the Holsinger Algorithm in its Original version, for some of

R. 1118 - S. 1 2278 1558 874 720 69,97% R. 118 - S. 2 2278 1650 798 628 62,60% R. 108 – S. 1 562 346 246 216 82,20% R. 108 – S. 2 562 490 182 72 45,20% Table 5. Results obtained with the Holsinger Algorithm in its Modified version 1, for some

**False Positives (PF)** 

**False Positives (PF)** 

**False Negatives (NF)** 

**False Negatives (NF)** 

**(PF + NF) / NL** 

**(PF + NF) / NL** 

ECG signal with pre-filtering of the signal (Thakor et al., 1984)

for even the modern technology are not able to provide better results.

**True Positives (PV)** 

**True Positives (PV)** 

Massachusetts Institute of Technology,) (MIT DB, 2008).

(Table 7), compared to its original version (Table 4)

**Pulses Heart (NL)** 

**Pulses Heart (NL)** 

**Signal** 

**Signal** 

the MIT Database records.

of the MIT Database records.

Fig. 19. Filtered ECG Signal Using Low-Pass 48 Hz Lynn's Filter

Fig. 20. Filtered ECG Signal Using High-Pass 0.2 Hz Lynn's Filter

Fig. 21. Filtered ECG Signal Using High-Pass 0.5 Hz Lynn's Filter

The filters application allows improving the ECG signal quality in a remarkable manner. Figure 22 shows the application of a low-pass Lynn's filter of 48 Hz and a high-pass Lynn's filter of 0.5 Hz.

Fig. 22. Filtered ECG Signal Using a Low-Pass 48 Hz Lynn's Filter and a High-Pass 0.5 Hz Lynn's Filter

#### **4.2 QRS detection algorithm on ECG signal**

Within the automatic detection waveform of the ECG signal, it is important to detect QRS complex (Cuesta, 2001; Vidal & Pavesi, 2004). This is the dominant feature of the ECG signal. The QRS complex marks the beginning of the contraction of the left ventricle, so the detection of this event has many clinical applications (Vidal et al., 2008; Townsend, 2001).

164 Applications of Digital Signal Processing

Fig. 19. Filtered ECG Signal Using Low-Pass 48 Hz Lynn's Filter

Fig. 20. Filtered ECG Signal Using High-Pass 0.2 Hz Lynn's Filter

Fig. 21. Filtered ECG Signal Using High-Pass 0.5 Hz Lynn's Filter

filter of 0.5 Hz.

Lynn's Filter

**4.2 QRS detection algorithm on ECG signal** 

The filters application allows improving the ECG signal quality in a remarkable manner. Figure 22 shows the application of a low-pass Lynn's filter of 48 Hz and a high-pass Lynn's

Fig. 22. Filtered ECG Signal Using a Low-Pass 48 Hz Lynn's Filter and a High-Pass 0.5 Hz

Within the automatic detection waveform of the ECG signal, it is important to detect QRS complex (Cuesta, 2001; Vidal & Pavesi, 2004). This is the dominant feature of the ECG signal. The QRS complex marks the beginning of the contraction of the left ventricle, so the detection of this event has many clinical applications (Vidal et al., 2008; Townsend, 2001).

In the literature there are several algorithmic approaches for detecting QRS complexes of ECG signal with pre-filtering of the signal (Thakor et al., 1984)

The implementation of incremental improvements to a classical algorithm to detect QRS complexes was realized in an experiment as mentioned in (Vidal et al., 2008; Vidal & Gatica, 2010) which in its original form do not have a great performance. The first improvement based on the first derivative is proposed and analyzed in (Friese at al., 1990). The second improvement is based on the use of nonlinear transformations proposed in (Pan & Tompkins, 1985) and analyzed in (Suppappola & Ying, 1994; Hamilton & Tompkins, 1986). The third is proposed and analyzed in (Vidal & Pavesi, 2004; Vidal et al., 2008), as an extension and improvement of that is presented in (Friesen et al., 1994) using characteristics of the algorithm proposed in (Pan & Tompkins, 1985). It should be noted that the three algorithmic improvements recently mentioned, used classical techniques of DSP (Digital Signal Processing). It is noteworthy to indicate that the second improvement proposed in (Pan & Tompkins, 1985) is of great performance in the accurate detection of QRS complexes, for even the modern technology are not able to provide better results.

To test the algorithms that work on ECG signal, it is not necessary to implement a data acquisition system. There are specialized databases with ECG records for analyzing the performance of any algorithm to work with ECG signals (Cuesta, 2001; Vidal & Pavesi, 2004). One of the most important is the MIT DB BIH (database of arrhythmias at Massachusetts Institute of Technology,) (MIT DB, 2008).

In Tables 4, 5, 6 and 7, respectively, are the results obtained with the application of incremental improvements made to the first algorithm for detecting QRS complexes in some records at MIT DB BIH. A good level of performance reached in the final version of algorithm of detection of QRS complexes implemented in this work could be appreciated, (Table 7), compared to its original version (Table 4)


Table 4. Results obtained with the Holsinger Algorithm in its Original version, for some of the MIT Database records.


Table 5. Results obtained with the Holsinger Algorithm in its Modified version 1, for some of the MIT Database records.

A DSP Practical Application: Working on ECG Signal 167

x Apply wavelets in the design and implementation of filtering algorithms and detector

x Analyze other techniques for detection of parameters like, fuzzy logic, genetic

x Make use of information technologies, such as a database in order to obtain relevant

Finally, this work is a good demonstration of the potential applications of Hardware - Software, especially in the field of biotechnology. The quantity and quality of the possible future works show the validity of the affirmation in academic and professional aspects. In addition to the likely use of this work in medical settings, it also gives account of the scope

To Dr. David Cuesta of the Universidad Politécnica de Valencia for his valuable contributions and excellent disposition to the authors of this work; to cardiologist Dr. Patricio Maragaño, director of the Regional Hospital of Talca's Cardiology department, for his clinical assessment and technical recommendations for the development of the

Ahlstrom, M. L.; Tompkins, W. J. (1985). Digital Filters for Real-Time ECG Signal

Clusin, W. T. (2008). Mechanisms of calcium transient and action potential alternans in

Cuesta, D. (September 2001). Estudio de Métodos para Procesamiento y Agrupación de

*and Computers (DISCA) , Polytechnic University of Valencia*, Valencia, Spain. Dubin, D. (August 1976). *Electrocardiografía Práctica : Lesión, Trasado e Interpretación,* McGraw Hill Interamericana, 3rd edition, ISBN 978-968-2500-824, Madrid, Spain Goldschlager, N. (June 1989). *Principles of Clinical Electrocardiographic,* Appleton & Lange,

Friesen, G. M.; Janett, T.C.; Jadallah, M.A.; Yates, S.L.; Quint, S. R.; Nagle, H. T. (1990). A

Hamilton, P. S.; Tompkins, W. J. (1986). Quantitative Investigation of QRS Detection Rules

Kohler, B. –U.; Henning, C.; Orglmeister, R. (2002). The Principles of Software QRS

*IEEE Transactions on Biomedical Engineering*, Vol.31, No.11, (November 1984), pp. 702-706,

Vol.32, No.9, (March 2007), pp. 708-713, ISSN 0018-9294

*Volume 294, No 1*, (October 2007), H1-H10, Maryland, USA.

13th edition, ISBN 978-083-8579-510, Connecticut, USA

Vol.31, No.3, (March 2007), pp. 1157-1165, ISSN 0018-9294

February 2002), pp. 42-57, ISSN 0739-5175

Processing Using Microprocessors, *IEEE Transaction on Biomedical Engineering,* 

cardiac cells and tissues. *American Journal of Physiology, Heart and Circle Physiology,* 

Señales Electrocardiográficas. *Doctoral Thesis*, *Department of Systems Data Processing* 

Comparison of the Noise Sensitivity of Nine QRS Detection Algorithms, *IEEE Transactions on Biomedical Engineering*, Vol.31, No.1, (January 1990), pp. 85-98., ISSN

Using MIT/BIH Arrhythmia Database, *IEEE Transactions on Biomedical Engineering*,

Detection, *IEEE Engineering in Medicine and Biology*, Vol.21, No.1, (January-

of waveforms.

**6. Acknowledgment** 

**7. References** 

algorithmic procedures undertaken.

0018-9294

ISSN 0018-9294

approaches and neural networks.

information of the patients and their pathologies.

of works such as ECG digital, which are practically limitless.


Table 6. Results obtained with the Holsinger Algorithm Modified Version 2, for some of the MIT Database records


Table 7. Results obtained with the Holsinger Algorithm Modified Version 3, for some of the MIT Database records
