Development of Electrocardiograph Monitoring System

Electrocardiograph (ECG) monitoring system is one of the diagnostic tools which can help in reduce the risk of heart attack. A cardiologist may be able to determine heart condition from the ECG signal that recorded from subject. The purpose was to design an ECG monitoring system which consists of ECG circuit and digital signal processing system to deny the unwanted signal. In general, the ECG signal is nature weak and only around 1mV amplitude. Therefore filter and amplifier circuits were designed into 3 stages with a total gain of 1000 to bring the signal to around 1V. Circuit designed included of instrumentation amplifier, bandpass filter and notch filter. The frequency bandwidth of ECG is between 0.05Hz until 100Hz. Schematic circuit was tested by software simulation before proceeding to hardware implementation. Simulation analysis was done by using Software Proteus 8 Professional while the further signal processing was done in MATLAB software environment. A PQRST ECG waveform can be seen clearly after digital filtering stage in MATLAB environment. Digital signal processing in MATLAB software included of pre-filtering, Fast Fourier transform and peak detection. As conclusion, the time interval between peaks can be determined automatically which can provide useful information in clinical aspect.


Introduction
Cardiovascular disease is still the first killer in the world although there was a rapid development in medicine and medical technology.ECG system is one of the diagnostic tools used for the heart patient monitoring.ECG is a graphical recording of the cardiac cycle which the electric current generated by the heart muscle during a heartbeat.Electrode is used as a sensor like an antenna to detect and receive the electrical signal generated during the cardiac cycle.In 1901, a high sensitivity of new string galvanometer was developed successfully and implemented in Dr Willem Einthoven's electrocardiogram with weighed 600 pounds [1].Three electrodes were positioned according to Einthoven's Triangle on the body parts: right arm, left arm and left leg of the human body [2].Refer Figure 1.A typical electrocardiogram shows the deflections that express the alternate contraction of the parts of human heart.In general, heart of human consists of four chambers which are two upper atria and two lower ventricles.Figure 2 shows the ECG signal.The first wave is called "P wave", is generated by upper chamber.After a "P wave" there is a flat line indicated that the impulse transfers to lower chamber.The next wave is called "QRS" complex.QRS wave is making by the right and left bottom ventricles.The last wave is called "T wave" which represented the ventricles return to its resting state.It provided information of the heart condition and performance to the medical worker to have a good clinical diagnosis of cardiac disease.

ECG Signal Characteristics
For diagnosis purpose, the recording bandwidth between 0.01 to 300 Hz was used by using the standard 12 lead ECG.For monitoring purpose such as the ambulatory patient, the bandwidth was limited from 0.05 to 100 Hz.Thus the restricted bandwidth attenuates the higher frequency noise caused by contractions of muscle and the lower frequency noise caused by motion of the electrodes [5].The third bandwidth used to maximize the signal to noise ratio and represented the QRS wave.Therefore a filter that can eliminate the non-QRS complex and pass the QRS complex is needed.The non-QRS complex that needs to reject including the P wave and T wave.This filter helps to detect the QRS complexes but distorts ECG so much that the appearance of the filtered signal is not clinically acceptable.These are some small higher-frequency that consists in the QRS complex.An ECG amplifier normally has a gain of about 1,000 in order to amplify the weak peak signal from 1 mV to a range of about 1 V.The table below shows the amplitude and the duration time of the ECG waveform interval.

Noise
ECG technology still need very much research phase to identify and investigate the characteristic of the noise sources and their features in order to obtain a desired real time analysis of ECG signal.Electrode placed on the human body act as an antenna received the signal from heart and also the unwanted signal called noise.Some of the noises and interference signal are difficult to filter away.There were several types of disturbance occurred during the ECG signal collection.The primary noise sources which are electromyography (EMG) noise, power line interference, source impedance unbalance noise and motion artifacts and instrumentation noise.

Circuit Development
The ECG circuit consisted of two stages which are Stage 1: Instrumentation amplifier stage and Stage 2: Filter and amplifier stage.Instrumentation amplifier was the first stage and used to differentiate the voltage difference between two electrodes that act as the input signal of the system.The signal needs to be amplified to a significant gain to be proceeding to the next stage.Different type of filter circuit was constructed to remove the unwanted noise and allowed the desired signal to pass through.An active bandpass filter which combined both low pass and high pass characteristic was designed to pass a board range of frequencies.It matched the requirement bandwidth for ECG signal (0.05Hz to 100Hz) and attenuated the signals which are out of the pass band.At the same time, the signal was amplified by a filter to a gain of 11.For power line interference 50Hz, notch filter was used to remove this particular frequency.
For improvement, the twin-T notch filter with variable Q consisted of low pass circuit and high pass circuit with a variable Q was utilized.

Instrumentation Amplifier
First step for ECG monitoring where a very small voltages passed out from the probes and require certain amplification before go to next stages [6].The differences between two input potentials were amplified by the instrumentation amplifier while any signals that are common to both inputs rejected.The AD620 which has a low current noise was chose for ECG monitoring.
It amplified the ECG signal to around 50 times by an external resistor, R1 connection.The value of capacitor C1 was chose to maintain the stability of the right leg drive loop.The gain values are as follows. ( Where R1 = 1 kΩ, therefore

Display
The active grounding is connected to produce a higher gain [7].

Bandpass
The active bandpass filter was designed to passed a range of ECG frequencies and attenuated the unwanted frequencies signal.The lower cut-off frequency (fL) is 0.05Hz and higher cut-off frequency (fH) was designed to 100Hz.This bandpass filter was designed with a gain of 11.The lower cut-off frequency (fL) is determined by : The higher cut-off frequency (fH) is determined by : The gain of the filter is: Based on the calculated values,  = 0.048 Hz, H = 106.1 Hz and Gain = 11.

Notch Filter
For an ideal notch filter, it can completely flat response to the frequency range and remove the particular notch frequency.In reality the perfection is not achievable.It can be improved when using an active notch filter which employs negative feedback around the operational amplifier [8].Twin-T notch filter with variable Q was designed to remove the 50Hz power line interference [9].The higher the Q, the narrow the notch can be achieved and higher the level of attenuation needed to remove the unwanted signal.Q is designed to 100 so degree of filter's performance increased [10].Gain of the filter was designed to 2.
Notch frequency is calculated by : Gain of the notch filter: Q value:

Proposed ECG Circuit Design
The proposed ECG circuit design consisted of an instrumentation amplifier with gain of 50.4, a bandpass filter with a pass band of 0.05Hz-100Hz with gain of 11 and a notch filter of 50 Hz with gain of 2. This QRS detector circuit amplify the weak ECG signal from around 1mV to approximately 1V.

Signal Processing Method
The signal processing method can divided into 3 steps which are pre-filtering, squaring the signal and rate calculation.ECG signal from circuit still contain the noise which cannot be removed or fail to remove.The unwanted signal was still exist because it shares the same frequency contents with ECG signal bandwidth.In pre-filtering step, MATLAB were used to perform Fast Fourier Transform (FFT) in order to remove the low frequency signal in frequency domain.After the low frequency signal was removed, the Inverse Fast Fourier Transform (IFFT) applied to restore the data to time domain.A notch filter was designed to remove the 50 Hz again to the signal.After that, the signal was squared to make the peak signal become more significant and last is peak detection to count the heart beat rate.

Results and Discussion
The proposed circuit design was simulated in the Proteus 8 Professional.The simulation result was recorded as to compare it to the hardware simulation result.The percentage of error was calculated to determine the performance of the circuit.

Bandpass
The digital oscilloscope failed to display the result as the lower cut-off frequency for bandpass is too small (0.05Hz), in software simulation.The graph in Figure 5 showed that the higher cutoff frequency of the bandpass filter is 101.8Hz based on the software simulation.
Hardware simulation was done by using oscilloscope and signal function generator in lab.The input voltage of signal function generator was adjusted to different value of frequency and the changes of output voltage can be seen in the oscilloscope.Figure 6 showed that the cutoff frequency of the bandpass filter by hardware simulation is100.5Hz.The percentage error of software and hardware simulation compare to theoretical value is -4.053% and -5.278% respectively.

Notch Filter
The frequency was adjusted at the input voltage while the output voltage was recorded.The graph in Figure 7 showed that the notch frequency is 50Hz based on the software simulation.Figure 8 showed that the cutoff frequency of the notch filter by hardware simulation is 48Hz The error percentage of software and hardware simulation compare to theoretical value is 0.4218% an -3.595% respectively.

ECG Circuit
Electrode sensors were placed to human skin to detect the electrical impulse generate from the human heart by Einthoven Triangle method (refer Figure 1) and the waveform is read by using the oscilloscope.A QRS complex with noise was detected by the circuit.The R peak was amplified to average of 1.46V as the figure shown.This signal was collected for further signal analysis in MATLAB.

Analog signal interference to computer
The output signal from the circuit was in analog form, by using an analogue to digital converter (ADC), it can convert the analog signal from circuit to digital signal so that, the digital data can be read by computer and saved for the further signal analysis.The data was exported to excel and converted to text form and also into MATLAB.

Signal Processing Method
The signal which collected in circuit was imported into MATLAB.Figure 9 showed the ECG signal collected from the hardware circuit without any filtering process in MATLAB.On the other hand, Figure 10 showed the ECG signal which after filtering stage in MATLAB.The noise was removed and a clear PQRST ECG signal can be seen clearly.The beat rate can be calculated by detecting the peak of the signal.

Conclusion
The ECG monitoring system was developed successfully.The ECG analog signal was collected and digital signal processing was done in the MATLAB.The signal display was low noise disturbance and acceptable SNR ECG waveform.The data of the signal can be used to study the heart condition by analyses the peak voltage and the time interval between each signal such as coronary heart disease, heart muscles disease, arrhythmia, and coronary thrombosis.For further improvement on the project, ECG signal can be improve to real time analysis.The signal of ECG can be recorded in a real time and displayed on the computer screen.A real time analysis on signal received can be done and enable it to diagnose the heart condition immediately.

Table 2 .
Percentage error of Bandpass Filter

Table 3 .
Percentage error of Notch Filter