Development of A Three-Lead Electrocardiograph with Embedded Digital Filter on FPGA for Noise Removel

An ECG is a bioelectrical signal which has important correlation with electrical activity of the heart. The ECG reflects important information regarding the performance of the heart. ECG devices are currently made for different settings applications including patient’s home, ambulance, general practioner offices, emergency wards or public health center. Most of the commercial ECG machine available today is still expensive for public health service in the rural area. Therefore, there is a need to develop a low cost and high performance of threelead ECG machine which can be used for the medical doctor or health practitioner in the rural area. In general, the ECG machine consits of differential amplifier, filters, isolation amplifier,buffer, analog to digital converter, microcontroller with digital signal processor and displaying unit. However, the biggest problem in designing the ECG machine is on the problem with low signal-to-noise ratio. Since, there are many sources of noise such power line interference, DC drift, EMC contraction, electronic noise, and motion artifacts. The goal of the work is to design and develop a low cost ECG machine with digital signal processor for noise removal. For that purpose, a series of digital filters will be embedded in the Xillinx Spartan 6 FPGA as part of digital signal processor. Results show that the prototype of ECG machine can be successfully recording and displaying the ECG signals with the good performance.


I. INTRODUCTION
Based on the report released by WHO [1], the cardiovascular diseases are still the number one killer in the world.Each year, there are an estimated seven million deaths around the world and more than 60,000 deaths in Indonesia due to cardiac arrhythmias.
The electrocardiogram is a surface measurement of the electrical potential generated by electrical activity in cardiac tissue.Current flow, in the form of ions, signals contraction of cardiac muscle fibers leading to the heart's pumping action [2].The study of this electrical signal can help in determining many abnormalities related to the heart's function.It has a wide variety of applications throughout the medical field in determining whether the heart is functioning properly or suffering from any abnormalities.It helps to screen and diagnosis cardiovascular diseases.
Early diagnosis of heart diseases is typically by analysing the electrocardiogram of the ECG machine.However, most of the commercial ECG machine operated in the hospital and public health center today is still imported and is expensive for public health service in the rural area.Therefore, there is a need to develop a low cost and high performance of three-lead ECG machine which can be used for the medical doctor or * E-MAIL: prabusono@yahoo.comhealth practitioner in the rural area.The goal of this work is to design and develope a three-lead ECG machine with embedded digital filter algorithm.The digital filter for noise removal and electrical power interference is embedded on the FPGA chip.A simple algorithm for detecting the heart beat was also implemented in the device.The devices are currently made for public health center in the rural area.Results show that the prototype of ECG machine can be successfully recording and displaying the ECG signals with the good performance.
The prototipe had been calibrated with ECG simulator and the results shows the prototype had demonstrated its ability for measuring and monitoring the electrical heart activity.The prototype had been applied to the patients for measuring the heart rate.A comparison between commersial PC based ECG (Cardio Card of Nasiff, USA) had been also conducted.It shows that a good agreement is observed between the results measured by prototype and the commersial one.

II. HARDWARE DESIGN
The typical ECG signal obtained from the Ag-AgCl electrodes is 1 mV in amplitude and it is easily corrupted by noise.The main sources of noise include respiration, motion artifacts, muscle contraction, electrode contact noise, power line interference, and electromagnetic interference (EMI).Noise can completely override the ECG waves and make the amplified signal useless.To remove unwanted noise and preserve the useful components of ECG signals, the signal conditioning sequence are needed.A block diagram of PC based ECG machine is shown in Figure 1.In general, this system is composed to two main part: analog front end, digital back end.

Electrode
Three disposable electrodes attached to the patient are connected to the analog front end section of the ECG system.Two electrodes are used to record the ECG signals, while other is for noise reduction.To minimize the drop in contact potential and the polarization effect, a gelly based Ag/AgCl electrode is used.This type of electrode essentially acts as a transducer which converts the ionic current inside the body to an electronic current in the outer circuit.

Differential Amplifier
The weak ECG signals acquired from electrodes is amplified using a differential amplifier with high input resistance, typically more than a few Megaohms.The analog front end section must be able to deal with extremelly weak signals ranging from 0.5 to 2.0 mV, combined with a dc component of up to ± 300 mV [3].
A Burr-Brown INA 118 instrumentation amplifier was used to amplify the potential difference between the right arm and left arm electrodes.Its gain is determined by the gain resistor RG.If the desired gain is 20, the gain resistor can be written following relation, The electrical output of the differential amplifier is further fed to filter sections before passing to Analog to Digital Converter.

Band Pass Filter
ECG signal has a frequency range approximately from 0.05 to 150 Hz.Low pass filter will be needed to eliminate the high frequency noise above 150 Hz.The electrical output of the differential amplifier is further fed to the filter section before passing to Analog to Digital Converter.The filter section consists of Low Pass Filter, High Pass Filter and Twin-T Notch Filter.LPF and HPF forms a band pass filter with frequency range in between 0.05 Hz and 150 Hz.The HPF will be a one stage passive one, the LPF will be built by two stages active LPF as shown in Figure 2. The high and low pass filter cut-off frequency is 0.05 Hz and 150 Hz, respetively.The value of R 1 are 680 kΩ and C 2 is 4.7 nF.

Notch Filter
A notch filter is used to suppress the 50 Hz power line interference which is still left in the ECG signal and needs to be rejected.This requires a small transition bandwidth or high Q factor to achieve the steeper deep notch.An active Twin-T notch filter which consits of two T-shape RC filters combined with operational amplifier is capable of providing an infinite deep notch at a particular frequency.The Q factor can be raised from the usual 0.3 to 2.5.Further, the op-amp provides low output impedance and high input impedance, making it possible to use large resistance values in the T so that only small capacitors are required, even at low frequencies [4].The cut off frequency of notch filter (f c ) is to 50 Hz.

III. SOFTWARE DESIGN
The design of embedded digital filter on the FPGA involves the following steps: determining filter specifications, calculating the filter coeficient, determining the transfer function, converting the transfer function into a suitable filter structure, writing the VHDL code, implementing the code into the hardware, and testing its functionality.Table I shows the filter specification used in this work.This filter specification includes sampling frequency, word length of the input data, pass band frequency and stop band frequency.MATLAB tools is used to generate the filter coeficients.attenuation of 100 dB and maximum order of filter of 180.

IV. RESULT
Figure 7 shows the ECG simulator (PS410, Fluke Biomedical, USA).It provides the 3-lead ECG test signals using for calibration purposes.The amplitude of the P wave, R wave and T wave as well as the distance between the peak are set from the simulator.The simulator is used as gold standard for calibration.
Figure 8 shows the graphical user interface (GUI) of threelead ECG machine.The value of teh gain, filter and QRS detection algorithm can be set externally.
Available QRS algorithms that can be selected at the user interface (GUI) are Wavelet Transform [5] and Pan-Tomkins algorithm [6].Heart rate was calculated by detecting the QRS pulse for certain duration of time [6].The value of heart rate was displayed on the top right of the GUI.Inside the GUI, there is an area for displaying the ECG charts for either one lead, two lead or three leads, simultaneously.Table II shows the comparison between Fluke simulator reading and the ECG result.It can be seen that ECG machine can display the simulated ECG wave and its features close to that of the simulator.After taking 20 measurements (1 hour duration) and compared to the simulator reading, the statistical error is leas than 0.5%.It means that ECG machine has demonstrated its acceptable acuracy.
Table III shows the comparison between 3-lead ECG and 12-lead PC based ECG , Cardio Card Model CUSB (Nasiff Associates, USA) for measuring heart beat of 5 patients.From Table III, it shows that heart rate measured usig prototip 3-lead ECG is similar with the measurement value conducted using commersial 12-lead PC based ECG Cardio Card.

V. CONCLUSION
The analog front end for signal conditioning of ECG signals acquired from three electrodes had been developed and succesfully tested its functionality.The digital back end which consits of digital filter embeddeds on Xillinx FPGA was also developed.Prior to the hardware implementation, the filter specification and filter coeficients was generated using MAT-LAB Filter Design Toolbox.The design specifications of the filter includes sampling frequency, pass band cutoff frequency, stop band cutoff frequency, stop band deviation and pass band deviation.The resulted three lead ECG hardware had been intergrated with the software and had been sucessfully tested its functionality.The calibration had been conducted for the ECG machine.

Figure 3 (
Figure 3(a) shows the prototip of the ECG analog front end connected to the ECG wire.The enclosure had been covered with conductive protection paint to minimize of the noise due to the electromagnetic radiation.The output of the ECG analog front end is first digitized by ADC inside the Microcontroller before connected to the FPGA development board.The output of the Spartan 6 FPGA board as shown in Figure 3(b) is connected to computer via USB port.The filter coefficients of the all filters (BPF and Notch) were obtained with the filter builder function of the MATLAB Filter Design Toolbox.Figure4, 5 and 6 show the magnitude response of the edge of the lower part pass band filter, closing edge of the upper part of the passband filter, and notch filter, respectively.Specifications for notch filter are given as follows, Q factor of 10, pass band riple of 1 dB, center frequency of 50 Hz, corner frequencies of 47-53 Hz, stop band

Figure 4 ,
Figure 3(a) shows the prototip of the ECG analog front end connected to the ECG wire.The enclosure had been covered with conductive protection paint to minimize of the noise due to the electromagnetic radiation.The output of the ECG analog front end is first digitized by ADC inside the Microcontroller before connected to the FPGA development board.The output of the Spartan 6 FPGA board as shown in Figure 3(b) is connected to computer via USB port.The filter coefficients of the all filters (BPF and Notch) were obtained with the filter builder function of the MATLAB Filter Design Toolbox.Figure4, 5 and 6 show the magnitude response of the edge of the lower part pass band filter, closing edge of the upper part of the passband filter, and notch filter, respectively.Specifications for notch filter are given as follows, Q factor of 10, pass band riple of 1 dB, center frequency of 50 Hz, corner frequencies of 47-53 Hz, stop band

Figure 9 ,
10 and 11 show the ECG signals from Lead-I, Lead-II and Lead-III.ECG signals are taken from real patient, male with 41 year old and weight of 70 kg.The data are taken from the patient for 1 hour duration.Top of Figure 9, 10 and 11 represents the original signals generated from the lead (I,II, and III).The signals are corrupted from electronic noise and DC drift.Signals from lead-I, II and III give the different shape and features.Signals lead I gives the clear QRS peak and it is used for heart beat calculation.The midle of the Figures 9, 10 and 11 shows the ECG signals after DC drift removal.It is seen that the ECG signals are still corrupted by noise.When these signals passing the band pass filter, all the noise are removed and smooth signals appear as shown in Figure 9, 10, and 11 (bottom part).

TABLE II :
Comparison between ECG simulator and 3-lead ECG.

TABLE III :
Comparison of heart rate measured by prototype 3-lead ECG and 12-lead PC based ECG-Cardio Card Model CUSB (Nasiff, USA).