The SIJ Transactions on Computer Networks & Communication Engineering (CNCE), Vol. 2, No. 1, January-February 2014 Detection and Elimination of Different Types of Interference in ECG Wave G. Divya Priya* *Master of Engineering, Embedded System Technologies, Sri Shakthi Institute of Engineering and Technology, Anna University, Coimbatore, Tamilnadu, INDIA. E-Mail: div1907{at}gmail{dot}com Abstract—In this fast world, medical field requires improvement in the process. It must be fast and simple. ECG monitoring plays a vital role in medical field. The PQRST waveform of the ECG signal is to be analyzed to evaluate the performance of the heart and the contribution of each portion of the PQRST complex to sort out the abnormal functioning of the heart through the study of different types of arrhythmia. This paper consists of ECG wave detection and eliminating of EMG noise and other interference. Heart rate detection is used here to detect the ECG wave based on discrete wavelet transform. It gives 100% performance even under NonOrdinary conditions with less interference and noise compared to the acquired signal using Matlab. Keywords—ECG Signal; ECG Wave; Interference; NOTCH Filter; PQRST Waveform. Abbreviations—Electrocardiography (ECG); Fast Fourier Transform (FFT); Recursive Least Squares (RLS); Short Term Fourier Transform (STFT); Signal to Noise Ratio (SNR); Sino Atrial (SA). I. T INTRODUCTION ECHNOLOGY has brought many changes with the increasing needs and thereby the medical field has witnessed tremendous improvements in the last few decades. In spite of this fact prevention is critical for cardiovascular diseases and ECG is the most undisputed and widely used tool to detect and diagnose them. The electrocardiography deals with study of the electrical activity of the heart muscles. The potentials originated in the individual heart muscles are added to produce the ECG wave pattern. The electrocardiogram reflects the rhythmic electrical depolarization and depolarization of the myocardium associated with the contractions of the atria and ventricles. The shape, time interval and amplitude of the ECG give details of the state of the heart. Electromyographic noises are the significant factor in the analysis of the ECG waveform [De Chazal & Reilly, 2003]. Apart from their enormous impact in older people life expectancy, cardiovascular diseases are also the main cause of death for the population among 44 and 64 years and detecting their symptoms in time is critical to avoid irreparable damages or death. Nevertheless, methods and systems to acquire an ECG signal with good enough quality in a fast and easy-to-use manner, so that they can be used in domestic or other non-clinical environments, are nowadays far from common. The main objective is to analyses the performance of the PQRST complex based on heart rate detection a by the application of discrete wavelet transforms and to regenerate the ECG waveform by using efficient filtering techniques using Matlab software [Cuiwei Li et al., ISSN: 2321 – 2403 1995; Arumugam, 2002; Korhonen & Parkka, 2003]. Hence methods to reduce interference and to produce a better quality ECG signal are discussed here. II. FUNCTIONING OF THE HEART The heart is divided in to four chambers. The top two chambers are atria and lower two chambers are ventricles. The right atrium receives blood from the veins and pumps it in to right ventricle. The right ventricle pumps the blood into the lungs where it is purified and oxygenated. The oxygen enriched blood enters the left atrium from which it is pumped in to the left ventricle. Then the left ventricle pumps the blood in to arteries through aortic valve for circulation throughout the body. Figure 1: Generation of ECG Signal © 2014 | Published by The Standard International Journals (The SIJ) 10 The SIJ Transactions on Computer Networks & Communication Engineering (CNCE), Vol. 2, No. 1, January-February 2014 Sino Atrial (SA) node is situated in the wall of the atrium and near the entry of the venacava, also called as cardiac pacemaker and generate impulses at the normal rate of the heart, about 70 beats per minute at rest. The rate is governed by the autonomic nervous system being increased by the sympathetic nerves and decreased by the parasympathetic nerves. The action potential contracts the atrial muscle and the impulse spreads through atrial wall during a period of about 0.04 seconds to the Atria-ventricular node which is located at the lower part of the wall between the two atria. This node delays the spread of excitation for about 0.11seconds. Thus the AV node acts as a delay line to provide timing between the action of the atria and ventricles [Linh et al., 2003]. III. RELATED WORK The earlier method of ECG signal analysis was based on time domain method. But this is not always sufficient to study all the features of ECG signals. So, the frequency representation of a signal is required. To accomplish this, FFT (Fast Fourier Transform) technique is applied. But the unavoidable limitation of this FFT is that the technique failed to provide the information regarding the exact location of frequency components in time. As the frequency content of the ECG varies in time, the need for an accurate description of the ECG frequency contents according to their location in time is essential. This justifies the use of time frequency representation in quantitative electro cardiology [Minami et al., 1999]. The immediate tool available for this purpose is the Short Term Fourier Transform (STFT). But the major draw-back of this STFT is that its time frequency precision is not optimal. Hence we opt a more suitable technique to overcome this drawback. Among the various time frequency transformations the wavelet transformation is found to be simple and more valuable [Piotrowski & Rozanoeski, 2010]. The wavelet transformation is based on a set of analyzing wavelets allowing the decomposition of ECG signal in a set of coefficients. Each analyzing wavelet has its own time duration, time location and frequency band. The wavelet coefficient resulting from the wavelet transformation corresponds to a measurement of the ECG components in this time segment and frequency band. IV. SPECIFICATION OF ECG Amplitude: P-wave—0.25mV R-wave—1.60mV Q-wave—25% R wave T-wave—0.1 to 0.5mV Duration: P-R interval: 0.12 to 0.2 Q-T interval: 0.35 to 0.44s S-T interval: 0.05 to 0.15s ISSN: 2321 – 2403 P-wave interval: 0.11s QRS interval: 0.09s The normal value of heart beat lies in the range of 60 to 100 beats/minute. A Slower rate than this is called bradycardia (Slow heart) and a higher rate is called Tachycardia (Fast heart). If the cycles are not evenly spaced, an arrhythmia may be indicated. If the P-R interval is greater than 0.2 seconds, it may suggest blockage of the AV node [Moraes et al., 2002]. 1st degree AV block: Due to prolonged conduction time. 2nd degree AV block: Due to conduction of few pulses instead of all from atrium. 3rd degree AV block: Due to asynchronous action of atrium and ventricle. Adams-stokes attack: Due to sudden attack of the total block. Bundle block: Due to improper conduction of the stimulus to the ventricle. Atrial Fibrillation: Due to fast beating rate (300500beats/min) of the atrium. Here ventricles beat very slowly [Thong et al., 2004]. Ventricular Fibrillation: Due to fast beating rate of the ventricles. No pumping of blood to different parts of the body. Thus Electrocardiography can diagnose any form of arrhythmia or disturbances in heart rhythm. V. METHODOLOGY USED Normally four interference occurs in ECG signal. They are, 1.Baseline Wandering, 2. 50Hz power line interference, 3.Motion artifact, 4. Electromyogram. To remove this noise following method is used. Figure 2: Methodology VI. NOTCH FILTER A Notch filter is used to eliminate the 50Hz power line interference. It is filter that passes all frequencies except those in a stop band centered on a center frequency. A closely related Knowledgebase item discusses the concept of the Q of a filter. This Knowledgebase item focuses on high Q notch filters - the type that eliminates a single frequency or narrow band of frequencies. A closely related type of filter – a band reject filter, is discussed in a separate knowledgebase item. The amplitude response of a notch filter is flat at all frequencies except for the stop band on either side of the center frequency. The standard reference points for the rolloffs on each side of the stop band are the points where the amplitude has decreased by 3 dB, to 70.7% of its original amplitude. © 2014 | Published by The Standard International Journals (The SIJ) 11 The SIJ Transactions on Computer Networks & Communication Engineering (CNCE), Vol. 2, No. 1, January-February 2014 VII. ADAPTIVE FILTER An adaptive filter is a filter that self-adjusts its transfer function according to an optimization algorithm driven by an error signal. Because of the complexity of the optimization algorithms, most adaptive filters are digital filters. Adaptive filters are required for some applications because some parameters of the desired processing operation are not known in advance. The adaptive filter uses feedback in the form of an error signal to refine its transfer function to match the changing parameters [Hu et al., 1997; Reddy, 2005]. In a transversal filter of length N, as depicted in figure 2, at each time n the output sample y[n] is computed by a weighted sum of the current and delayed input samples Figure 3: Adaptive Filter has the following initial value : VIII. RLS ALGORITHM RLS algorithm is proposed for removing artifacts preserving the low frequency components and tiny features of the ECG. Least square algorithm aim at the minimization of the sum of the square of the difference between the desired signal and the filter output. It gives excellent performance when working in time varying environments. Step 1: Calculates the output signal y(n) of the adaptive filter. The RLS algorithm consist of primary signal d(n) which in this case is the ECG signal, secondary signal x(n) which in this case is the power line noise. The filter produces an output y(n) is given by, Here, the c*k[n] are time dependent filter coefficients (we use the complex conjugated coefficients c*k[n] so that the derivation of the adaption algorithm is valid for complex signals, too). Step 2: Calculates the error signal e(n) by using the following equation: where δ is the regularization factor. The standard RLS algorithm uses the following equation to update this inverse correlation matrix. The RLS (recursive least squares) algorithm is used to remove the Baseline Wandering. The RLS algorithm is algorithm for determining the coefficients of an adaptive filter. The RLS algorithm uses information from all past input samples (and not only from the current tap-input samples) to estimate the (inverse of the) autocorrelation matrix of the input vector. The RLS algorithm, whose convergence does not depend on the input signal, is the fastest of all conventional adaptive algorithms. This algorithm has less computational complexity and good filtering capability. Step 3: Updates the filter coefficients by using the following equation: where is the filter coefficients vector and gain vector. is defined by the following equation: is the where is the forgetting factor and P(n) is the inverse correlation matrix of the input signal. Figure 4: Block Diagram of RLS Algorithm IX. WAVELET TRANSFORM The wavelet transform is a mathematical tool for decomposing a signal into a set of orthogonal waveforms localized both in time and frequency domains. It decomposes signals as a superposition of simple units from which the original signals can be reconstructed. ISSN: 2321 – 2403 © 2014 | Published by The Standard International Journals (The SIJ) 12 The SIJ Transactions on Computer Networks & Communication Engineering (CNCE), Vol. 2, No. 1, January-February 2014 The basic Wavelet Transform has the following form: where Ψ(t) is a mother wavelet function. It acts as a window function to localize the integration. Notice that Ψ(t-b)/a is a dilated and shifted version of the mother wavelet function; a is the dilation factor and b is the translation factor. In the Wavelet Transform, a one dimensional signal x(t) is mapped to a two dimensional function Wx(a, b). X. DWT DECOMPOSITION A Discrete Wavelet Transform (DWT) is any wavelet transform for which the wavelets are discretely sampled. The DWT decomposition produces coefficients, which are functions of the scale (of the wavelet function) and position (shift across the signal). We manipulate wavelet in two ways viz., translation and scaling. In the translation the wavelet along the time axis is shifted and adapts to slow down the wavelet activity. In the scaling, fast activity, sharp spikes are captured. In our approach we use three level discrete wavelet transform. This is called compactly supported orthonormal wavelets. Discrete Wavelet Transform (DWT) has two filters, a low pass filter (LPF) and a high pass filter (HPF). They are used to decompose the signal into different scales. 10.1. Scale Factor The scale factor ā either dilates or compresses a signal. When the scale factor is relatively low, the signal is more contracted which in turn results in a more detailed resulting graph. However, the drawback is that low scale factor does not last for the entire duration of the signal. On the other hand, when the scale factor is high, the signal is stretched out which means that the resulting graph will be presented in less detail. Nevertheless, it usually lasts the entire duration of the signal. analysis the filter decomposes the signal into frequency bands. In the wavelet synthesis the filter reconstructs the decomposed signal back into the original bands as shown in figure 5. Four level discrete wavelet decomposition is performed using different wavelet transforms. The wavelet transform decomposes the ECG signal into different frequency scales where the ECG characteristics waveforms are indicated by zero crossings. The wavelet transform used in ECG signal processing, breaks down the ECG signal into scales and makes it easier to analyze the ECG signal in different frequency ranges. The Signal to Noise Ratio (SNR) for the various wavelets and at the various levels of decomposition is calculated and compared. XI. R-WAVE EXTRACTION The final signal (de-trended and de-noised) contains only high amplitude spikes that denote the onset of R-waves. Then by observing the average amplitudes of the R-waves, a threshold voltage level (TP) is set up. The data sets, we characterized, show that some noisy spikes come just after the R-waves, which are approximately of same amplitudes as R-waves. These may be due to noises from supply lines and some other kinds of interferences. Generally, heart rate for a normal adult varies within the range 60-120 beats/min. So any noisy spikes that appear within 180 samples after the Rwaves are ignored and assumed. Before the occurrence of a R-wave, the slope of the signal is positive and after the Rwave, the slope is negative. Again, any upward excursion that exceeds the TP is taken as an R-wave. Thus, by calculating two slope values, one upward & one downward, an R-wave can be detected. Consecutive R-waves are detected using the same technique. Thus, the heart rate is calculated continuously as long as R-waves are encountered. If R-wave is missing somewhere, the corresponding slope values can’t be found [David Cuesta-Frau et al., 2002; Costas Papaloukas et al., 2003; Surawicz & Knilans, 2008; Piotrowski & Rozanoeski, 2010; Clapers Joan Gomez & Ramon Casanella, 2012]. Figure 5: DWT Decomposition The output coefficients of the LPF are called Approximation while the output coefficients of the HPF are called Detail. The Approximation signal can be sent again to the LPF and HPF of the next level for second-level decomposition; thus we can decompose the signal into its different components at different scale-levels. In the wavelet ISSN: 2321 – 2403 Figure 6: Recorded ECG Waveform © 2014 | Published by The Standard International Journals (The SIJ) 13 The SIJ Transactions on Computer Networks & Communication Engineering (CNCE), Vol. 2, No. 1, January-February 2014 Figure 7: ECG Waveform with Power Line Noise Figure 11: R- Wave Extractions XII. Figure 8: ECG Waveform with Baseline Wander CONCLUSION Thus the generation of ECG signal is analyzed and a system for processing real time ECG signals has been developed. The notch filter removes the power line noise at 50HZ and the adaptive filter removes the base line wandering using RLS algorithm. Motion artifacts are also removed by the application of continuous wavelet transform and R wave is detected to calculate the heart beat. In this detection process, the importance of using a particular type of linear transform, wavelet transform has been highlighted using which noise is filtered. After R-wave extraction, heart rate has been calculated and based on the heart rate arrhythmia is determined. Its all done by using Matlab software which is used for processing the signal efficiently and effectively. This method provided excellent performance measures even at very high noise level. REFERENCES [1] [2] Figure 9: Output after Notch and Adaptive Filter [3] [4] [5] [6] Figure 10: Output of Final Stage [7] ISSN: 2321 – 2403 Cuiwei Li, Chongxun Zheng & Changfeng Tai (1995), Detection of ECG Characteristic Points using Wavelet Transforms”, IEEE Transactions on Biomedical Engineering, Vol. 42, No. 1, Pp. 21–28. Y.H. Hu, S. Palreddy & W.A. Tompkins (1997), “Patient Adaptable ECG Beat Classifier using a Mixture of Experts Approach “, IEEE Transactions on Biomedical Engineering, No. 44, Pp. 891–900. K. Minami, H. Nakajima & T. Toyoshima (1999), “Real-Time Discrimination of Ventricular Tachyarrhythmia with FourierTransform Neural Network”, IEEE Transactions on Biomedical Engineering, Vol. 46, No. 2, Pp. 179–185. David Cuesta-Frau, Juan C, Perez-Cortes, Gabriela Andrea Garcia, Daniel Navak (2002), “Feature Extraction Methods Applied to the Clustering of Electrocardiographic Signals. A Comparative Study”, Proceedings of 16th International Conference on Pattern Recognition, Vol. 3, Pp. 961–964 Dr.M. Arumugam (2002), “Biomedical Instrumentation”, Anuradha Agencies. J.C.T.B. Moraes, M.O. Seixas, F.N. Vilani & E.V. Costa (2002), “A Real Time QRS Complex Classification Method Using Mahalanobis Distance, IEEE Computers in Cardiology, Pp. 201–204 Costas Papaloukas, Dimitrios I. Fotiadis, Aristidis Likas & Lampros K. Michalis (2003), “Automated Methods for Ischemia Detection in Long Duration ECG”, Cardiovascular Reviews & Reports, Vol. 24, No. 6. © 2014 | Published by The Standard International Journals (The SIJ) 14 The SIJ Transactions on Computer Networks & Communication Engineering (CNCE), Vol. 2, No. 1, January-February 2014 [8] [9] [10] [11] P. De Chazal & R.B. Reilly (2003), “Automatic Classification of ECG Beats using Waveform Shape and Heart Beat Interval Features”, Proceedings of the IEEE International Conference on Acoustic, Speech and Signal Processing (ICASSP’03), Hong Kong, China, Vol. 2, Pp. 269–272. T.H. Linh, S. Osowski & M. Stodolski (2003), “On-Line Heart Beat Recognition using Hermite Polynomials and Neuro-Fuzzy Network”, IEEE Transactions on Instrumentation and Measurement, Vol. 52, No. 4, Pp. 1224–1231. I. Korhonen & J. Parkka (2003), “Health Monitoring in the Home of the Future”, IEEE Engineering in Medicine and Biology Magazine, Vol. 22, No. 3, Pp. 66–73. T. Thong, J. McNames, M. Aboy & B. Goldstein (2004), “Prediction of Paroxysmal Atrial Fibrillation by Analysis of Atrial Premature Complexes”, IEEE Transactions on Biomedical Engineering, Vol. 51, No. 4, Pp. 561–569. ISSN: 2321 – 2403 [12] [13] [14] [15] D.C. Reddy (2005), “Biosignal Processing and its Applications”, Tata McGraw Hill. B. Surawicz & T. Knilans (2008), “Electrocardiography in Clinical Practice: Adult and Pediatric”, Saunders. Z. Piotrowski & Rozanoeski (2010), “Robust Algorithm for Heart Rate (HR) Detection and Heart Rate Variability (HRV) Estimation”, Acoustic and Biomedical Engineering, Vol. 118, No. 1, Pp. 131–135. Clapers Joan Gomez & Ramon Casanella (2012), “A Fast and Easy to Use ECG Acquisition and Heart Rate Monitoring System Using a Wireless Steering Wheel”, IEEE Sensors Journal, Vol. 12, No. 3, Pp. 610–616. © 2014 | Published by The Standard International Journals (The SIJ) 15