Single-Lead ECG Signal Collecting System Design

. The purpose of these experiments is to understand the function and importance of an electrocardiogram (ECG). In general, an electrocardiogram experiment entails tests conducted to evaluate the heart’s rhythm and electrical activity. The laboratory activities involved building the circuit required for recording the electrocardiogram, and the respective ECG signals were effectively converted for clearer observation. The experiment objective was achieved through the following procedures in the lab manual. MATLAB software was effectively used to obtain the plot for the ECG signal by exploiting the data obtained from the acquisition software. The report also successfully provides a compelling discussion on electrocardiograms and their general importance. After acquiring effective ECG plots, the laptop was effectively connected to the acquisition system and the obtained plot was employed for effective analysis.


Introduction
The ECG (electrocardiogram) is a test that measures the electrical activity of the heartbeat.With each beat, an electrical impulse travels through the heart.This wave causes the muscle to squeeze and pump blood from the heart [1][2][3][4][5].The right and left atria e-polarization makes the first "P wave" [2].The right and left ventricles depolarization makes the next "QRS complex," which also contains the repolarization of the atrial.The ventricle repolarization makes the "T wave." In general, an electrocardiograph is a graph recording changes in electric potential, which occurs between electrodes placed between a patient's torsos to aid in the practical demonstration of an individual's general cardiac activity [3].This medical-electrical technique is quite essential for many patients.It can be used for effective detection of structural abnormalities and poor blood flows in patients.The electrodes used in the ECG procedure are transducers made of either salts or metals, and an ECG procedure requires approximately 10 electrodes at different body points [10,11].To effectively obtain signals from such electrical concepts, effective procedures must be strictly followed.
In this lab, we designed a circuit to record the ECG and convert that ECG signal we received to a version we could clearly observe.We then used a data acquisition system to import our data into Matlab and generated a final plot of the ECG.
The circuit we built consists of three stages.The first stage is an instrumentation amplifier that is comprised of three functions.Its primary function is to enlarge the signal's amplitude, which was initially too weak for us to observe.It can also measure the voltage difference and serve as a buffer to keep the circuit from being saturated [4, 7, and 8].The second stage is a bandpass filter.It functions as both the high-pass and the low-pass filter to cut off ECG frequencies that weren't needed and to keep the ECG frequencies at a specific range.The bandpass filter is an inverting filter that acquires a gain of about 1.The third stage is an inverting amplifier, and its function is to invert the inverted signal back to normal and provide gain.
When building the circuit, it also requires close attention to the troubleshooting and testing of each stage of the circuit to ensure that each stage of the circuit operates properly.
The data acquisition system samples the conditioned ECG signal and imports it into Matlab for display.The ECG plot of an individual can be analyzed to obtain a number of vital information, such as the heart rate of the individual.

Theoretical design
An Op-amp is an integrated circuit that is used in the amplification of electrical signals.Usage of Opamps was thus highly necessary in the circuit construction.
• We situated the gain of the differential amplifier at 25.4 (G=25.4)so that the voltage caused by temperature drop could be more pronounced.We placed the value of G in the formula Rg = 49.4kohm/(G-1) and calculated the voltage of Rg to be 2 Kohm.We then used a multimeter to measure the real value of Rg, which was 1.965 Kohm.• We situated the cutoff frequency between 0.01 Hz and 225.75 Hz.Based on the specific values of capacitors in the lab, we chose C f = 0.005 μF.According to the formula 20Pi rad/s = 1/(R f C f ), we yielded that the value of R f ≈ 150 Kohm.We used the multimeter to measure the real value of R f = 147.7 Kohm.Because the gain of the low pass filter should be 1, the value of R i was supposed to be equal to R f , and the real value of R i = 148.5 ohms.According to the formula 20Pi rad/s = 1/(R i C i ), we discovered that the value of C i should be 102.5 μF ≈ 100 μF.• To make the total gain of the whole circuit 100, we made the gain of the third stage to be 4 and settled R f at 47 Kohm.The actual value of R f was 46.43 Kohm.According to the formula R f / R c = G, R c =11.7 ≈ 10 Kohm.The real value of R c was 9.82 Kohm.

ECG circuit design
• The first stage of the electrical circuit design involved the building of the AD620 instrumentation amplifier.• The circuit below is an inverting amplifier whose primary role was to bring the inverted signal back into its normal form [11].The circuit construction also supported the provision of again.

Circuit function verification
To understand how each circuit stage works, we connected each stage to the input signal and tested their output signal separately.According to the difference between input and output signal, we realized that the first stage produced a signal and amplified it by 500; the second stage filtered out unnecessary signals with a too high or too low frequency; the third stage inverted the whole signal and amplified it as well.
Then we were able to corroborate that the whole ECG circuit would work as expected to generate valuable results.
In the first stage of our circuit, we adjusted and tested the wave generator to create a 100 mV peak, a 30 Hz sine wave input, +15V and -15V for DC power supply, and the oscilloscope was used to measure the input and output signal.We were able to calculate the actual gain with that input and output signal and compare it with the theoretical gain.The actual gain was 23.675 and was close to the theoretical value of 25.
In the second stage of our circuit, we adjusted and tested the DC power supply to +15V and -15V output voltage and used the wave generator to create a 100mV peak to peak, 30 Hz sine wave input.To evaluate whether the cutoff frequencies were successfully set to 0.01Hz and 225 Hz, we increased the frequency of the input signal and observed a decrease in output voltage.This proved that the bandpass filter took the signal with a high frequency out of the system.We then collected a series of gains and transferred them into dB.The plot of dB versus frequency showed a linear decreasing pattern after the designed higher passband, which proved that stage 2 was accurately functioning.
In the third stage of our circuit, we intended to check if the gain was set to 4 as expected and if the signal was inverted.We charged the opamp with +-15V voltage and used an oscillator to create a 100mV peak to peak, 30 Hz sine wave input.We then tested the input and output together with the oscillator and derived the real gain to be 3.13.The output wave appeared to be opposite to the input, so the third stage was functioning properly.
During the experiment, we changed the gain for the instrumentation amplifier from 25.4 to 500 and processed it again through the bandpass filter, which was about 3.13, to make the signal clearer.We also changed the cutoff frequency from 0.01Hz-225Hz to 0.01Hz-72Hz.We then troubleshot and remeasured the gain and cutoff frequency.However, when we attempted to use the data acquisition system, we found that the National Instruments Data Acquisition Module USB-6211 was not functioning, which might occur because of instrument malfunction and other troubles.In addition, we found that our ECG signal, which appeared in the oscillator, displayed considerably distracting noises.

ECG signal data analysis
To ensure that our circuit worked as expected, we first calculated the theoretical resistance value of each stage using the equation Rg = 49.4kohm/(G-1),then selected the resistor with the closest value to build the circuit and used an oscillator to create an input signal with small frequency.We subsequently used an oscillator to measure the amplitude of input and output signal and divide the output by input to verify if the specific opamp created gain as expected.Our actual data was within an acceptable range of percent error compared to the theoretical value.The error was due to imperfect op-amps, so that we would assess our data collection as successful.The corresponding calculations of percent error in gain are listed in table I.

MatLab evaluation
After analyzing the data, we plotted an ECG diagram using MATLAB.According to the picture, the ECG signal included PQRST stages with little noise.
Figure 5.This plot is a real-time human ECG plot using MATLAB, it first starts with a T wave and a small p wave following, then is the QRS complex and follows a T wave and U wave.A clear ECG cycle can be seen at the second wave.

Conclusion
For this ECG lab, our main purpose is to acquire the ECG signal of the subject and analyze the signal.
To achieve such goal, a circuit is needed to amplify the weak signal, which can rarely be caught, and then a data acquisition system is required to obtain the data in a single plot.In general, our experiment was successful in terms of the circuit building as we successfully tested and troubleshot each stage of our circuit, and we were able to discover a general trend of the ECG plot in the oscillator.However, the signal still appeared noisy for a single-lead ECG recording system.

Figure 1 .Figure 2 .
Figure 1.The design drawing of the AD620 amplifier with the designed value of the resistor

Figure 3 .
Figure 3.The drawing of the second OP07AH amplifier with the designed value of the resistor • A revised version of the whole ECG circuit: increased gain to 500 • The diagram below shows the three stages of the instrumentation amplifier, the bandpass amplifier, and the inverting amplifier.

Figure 4 .
Figure 4.The drawing of the total designed system with designed value

Table 1 .
Theoretical and experimental contraction