Introduction to Functional ECG Circuit

by shen207 in Circuits > Electronics

919 Views, 2 Favorites, 0 Comments

Introduction to Functional ECG Circuit

ECG general.PNG

Electrocardiograms (ECGs) are used to measure the electrical waveform produced by a beating heart. The ECG can provide important details into the health of a heart. A standard ECG has three main distinct peaks: a P-wave, the QRS complex, and the T-wave.

Figure 1. Schematic representation of normal ECG waveform [1].

Physicians known as cardiologists can analyze the output of an ECG to look for abnormalities in the peaks, the cadence, and amplitude of the waveform. Heart attacks, heart disease, and arrhythmias can all be diagnosed by ECGs. As ECGs record electrical signals, oftentimes the output of an ECG may pick up signals, known as noise, from sources other than the heart. This can include muscle contractions, movement, and even a standard signal found in most all ECGs - the 60Hz artifact caused by AC current from surrounding electrical equipment. To make an ECG easy to read, manufacturers will often put filters in the ECG circuitry to only only signals specific to the ECG. The objective of this instruction sheet is to: Construct instrumentation amplifier, a notch filter, and low-pass filter using resistors, capacitors, and amplifiers for a functional ECG Test each individual component and combine circuit using a function generator Using connected circuitry and electrode leads, pass an human ECG signal through the entire circuit to validate its functionality Use an Arduino to display an ECG signal and the corresponding BPM

This report discusses three main circuit components added to ECG circuitry to ensure ease of analysis. First, an instrumentation amplifier (INA) while receiving the ECG signal. Electrical heart signals have very low voltage values, within the 0.01mV to 10mV range [2]. This signal is too low for most analog to digital converters to analyze, thus the INA will amplify the signal. The INA described below has a gain of 1000 to convert a 1mV input into a 1V output. Second, a notch filter is used to filter out signals at a certain frequency. Specifically, the notch filter described below filters out 60Hz signals, to remove any artifacts due to other electrical equipment. Finally, a low-pass filter will be used to remove signals and noise that have high frequencies. The heart produces electrical signals with a low frequency; thus, the low pass filter will filter out high frequencies that will have potential to be part of the heart signal. The low-pass filter described below has a cutoff frequency of 200Hz, meaning signal switch frequencies higher than 200Hz will be attenuated to 0V. ECG electrodes will be placed on the ankles and wrist of a patient and lead to the input of the circuit containing the INA, notch filter, and low-pass filter. After the signal passes through the entire circuit, the output will lead to an ECG readout machine such as an oscilloscope.

Supplies

An electrocardiogram functionalized with biosignal plotting and blood pressure measurement requires complex circuitry involving three basic electrical circuits: an instrumentation amplifier (INA), a notch filter, and a low pass filter. To produce an operational device, these basic electrical circuits were first tested using a graphical simulation software, LTSpice. LTSpice is freeware manufactured from Analog Devices available and functional in both OS and Windows based systems [3].

Next, physical circuits were constructed on a Solderless Breadboard using wires and the following electrical components: resistors, capacitors, and UA741 operational amplifiers (op-amps). A DC power supply was used to provide power to the op-amps and a Agilent 33220A function generator was used to supply bioelectric signals. An Agilent DSO6014A oscilloscope was necessary to visually observe the input signals. In creating an integrated circuit acquisition of a human ECG, electrodes were used to measure the changes in electrical signals on various areas of a human test subject’s skin. These electrodes were connected to the constructed circuit using alligator clips and various cables. An Arduino microcontroller and Arduino software were used to generate a functional ECG with automated plotting of the biosignal and BPM readout.

Step 1: Determine Components

notch calc.PNG
INA calc.PNG
lowpass eqns.PNG
low pass calc.PNG

Instrumentation amplifier:

An Instrumentation Amplifier (INA) has the ability to measure small signals found in noisy environments. ECG signals are typically recorded at very low voltages, so these weak signals need to be amplified before analysis can occur, since most readout machines- such as an oscilloscope- require much higher voltage inputs to produce accurate waveforms. A gain of 1000 (30dB) was chosen as the optimal amplification for the ECG signal, as literature reported an identical amplifier design suggested a gain of 40dB was appropriate [4]. However, extremely high gains have been associated with voltage saturation [2]. Thus, for ease of data reading and recommendations from the teaching team, a gain of 1000 was deemed appropriate. The values chosen are based on the equation below, which is a standard equation for an amplifying circuit. A standard 1mV ECG input was used as an estimation for calculations, as typical ECG input voltages range from 0.01mV to 10mV [2]. Using the defined gain of 1000 and input voltage of 1mV, R1, R2, and R3 resistor values were chosen so that we can solve for R4. The only stipulation considered in the choice of R1, R2, and R3 was that the values must be greater than 1kΩ to prevent excessively high curent values in the circuit. For ease of calculations, R1 and R2 were both defined at 10kΩ, while R3 was defined to 5kΩ. Using the INA resistor equation, the following calculation can be made: VoutVin=1+2R2R1R4R3 VoutVinR1R1+2R2R3=R4 R4=1000mV1mV10k10k+(210)k5k R4=1666.61670k

Notch Filter Noise is very prominent in ECG recordings, so filtering is required to clean the signals. These sources of noise include motion and muscle artifacts, electronic interference, baseline wander, and instrument noise [5]. One common source of noise associated with the ECG is caused by power lines and other electronic equipment. The alternating current standard in electrical outlets in North America oscillates at 60 Hz, so electric fields produced by the 60-Hz activity in the environment that surrounds our indoor environments frequently contaminates the ECG [6]. A 60-Hz Notch Filter can be used to attenuate or eliminate this unwanted signal. To design a sufficiently accurate circuit, a quality factor (Q) of 8, capacitance (C) of 100nF, and center frequency (0) of 2**60 Hz were defined. These values then allowed for the calculation of the resistor values using the following equation::

R1=12Q0C=12(10)(2*60)(1*10-7)=1326.2912 1326 R2=2Q0C=2(10)(2*60)(1*10-7)=530516.477 530516 R3=R1R2R1+R2=1326 * 5305161326 + 530516=1322.694 1323

Low-Pass Filter A Low-Pass Filter is a circuit that passes sinusoidal input signals based on their frequency and is designed to “filter-out” all unwanted high frequencies of an electric signal. This filter only allows frequencies from 0Hz to its cutoff frequency (Fo) to pass, while blocking any higher frequencies. On an ECG, low-pass filters are used to remove high frequency muscle artifacts and external interference to isolate the ECG signal. To determine the resistor and capacitor values necessary for the low-pass filter, the following equations should be used:

Figure 2. Equation used to determine the component values of the low-pass filter

The gain K is defined as 1 and the cutoff frequency should be defined as 200Hz. C1 and C2 can also be chosen as any value as long as they follow the parameters defined in the equation shown in figure 2. C2 is defined as 110-7 F. C1 must be 1.510-8F. Using these values, the following calculations can be made: R1= 22aC2+a2+4bK-1C22-4bC1C2=2200Hz0.15921.414110-7+1.4142+0110-14-410-71.510-8=6129

R2=1bC1C2R1c2=1 110-7 F 1.510-8F 6129 200Hz0.15922 = 68918 Since K =1, R3 is an open circuit and R4 is a short circuit.

Step 2: Create Schematics on LTSpice

fig 3.PNG
fig 4.PNG
fig 5.PNG

Each of the three components were created and ran individually on LTSpice with an AC sweep analysis. We used the values we calculated in step 1 for each component in the schematic. The INA should have the schematic in figure 3 shown below.

Figure 3. Example instrumentation amplifier circuit provided by teaching team

The notch filter should have the schematic shown in figure 4 below.

Figure 4. Example Notch Filter circuit provided by teaching team

The low-pass filter should have the schematic shown in figure 5 shown below.

Figure 5. Example Low-Pass Filter circuit provided by teaching team

These circuits will be drawn on LTSpice for initial value testing. After LTSpice has confirmed the correct amplification and cutoff frequencies, the step 3 can be started.

Step 3: Build INA (and Test Individually)

fig 6.PNG
fig 7.PNG

Figure 6. Individual INA on the breadboard

Following the LTSpice simulation, the schematic was used to build an INA circuit with physical amplifiers and resistors on a breadboard. All op-amps within the circuit were provided with ±15V from the Agilent DC power supply to the positive and negative supply pins (pins 7 and 4, respectively). The input AC voltage source was provided by the Agilent Function Generator using wires and alligator clips connecting to the positive end of the source to the non-inverting op-amp pin of the first amplifier and the negative end to the ground. A sine wave was generated with an input amplitude voltage of 20mV and frequency of 100Hz was chosen to test the INA. 20mV was used due to the minimum allowable voltage produced by the function generator being 10mV. 100Hz was used as the standard ECG frequency ranges from 0.05-150Hz [2]. The output and input signals are read using an analog-to-digital converting oscilloscope. The ADC oscilloscope displays the waveforms produced by the function generator and after passing through the circuit graphically, as well the quantitative amplitude values. The amplitude of the output waveform should be 1000x that of the input waveform as shown in figure 7.

Figure 7. Oscilloscope display of Instrumental Amplifier (INA) Circuit.

Step 4: Build Notch Filter (and Test Individually)

fig 8.PNG
fig 9.PNG
fig 10.PNG

Figure 8 Individual notch filter on the breadboard

After completing the LTSpice simulation, the circuit was designed in the lab. We then displayed the input and output signal on the oscilloscope at different input frequencies to measure the magnitude of the output signal. Graphing VoutVin, the magnitude response on the y-axis and the frequency on the x-axis to achieve a graph that looks similar to figure 9. The trough should spike downward at 60Hz.

Figure 9. Data and magnitude response plot of the notch filter

Some examples of the oscilloscope display at different frequencies are shown below.

Figure 10. Oscilloscope display of Notch Filter Circuit.

Step 5: Build Low-Pass Filter (and Test Individually)

fig 11.PNG
fig 12.PNG
fig 13.PNG

Figure 11. Individual low-pass filter on the breadboard

After completing the LTSpice simulation, the low-pass filter circuit was then designed in the lab. We then displayed the input and output signal on the oscilloscope at different input frequencies to measure the magnitude of the output signal. The cutoff frequency we were verifying is 200 Hz. Graphing VoutVin, the magnitude response on the y-axis and the frequency on the x-axis to achieve a graph that looks similar to figure 12.

Figure 12. Data and magnitude response plot of the notch filter

Some examples of the oscilloscope display at different frequencies are shown below.

Figure 13. Oscilloscope Display of Low-Pass Filter circuit.

Step 6: Put It All Together

fig 14.PNG
fig 15.PNG

After successful testing of all three circuits above individually on LTSpice, we then connected the individual circuits on LTSpice as shown in figure above and then ran the simulation.

Figure 14. Combined INA, notch filter, and low-pass filter

The three components were connected by attaching the output of the INA to the input of the notch filter and the output of the notch filter to the input of the low-pass filter. The function generator can then be used to generate a simulated ECG signal that sends its signal to the INA through leads and alligator clips. The output from the low-pass filter can then pass through leads going to the oscilloscope. The oscilloscope will show the waveform after it has passed through the circuit.

Figure 15. Oscilloscope display of simulated ECG signal

Step 7: Test on a Human Subject

After completing the LTSpice simulation of integrated circuits, and successfully running individual circuits we then combined the individual circuits together as shown in figure. We used two 9V batteries, one to supply Vin(+) and the other one to supply Vin(-). We then connected 3 electrodes to the circuit; the electrode carrying Vin+ was attached to the left ankle, the electrode carrying Vin- was connected to the right wrist, and the ground electrode was connected to the right ankle. The output of the integrated circuit was connected to channel 2 of the oscilloscope. After adjusting the circuit and the scope, we recorded the ECG reading successfully.

Step 8: Test Arduino

table 1.PNG
fig 16.PNG

After testing the integrated circuit, we then wrote an Arduino code that would measure heart rate and show the ECG graph. Firstly, we connected the Arduino with the integrated circuit using jumper wires and then connected the Arduino with our desktop using a USB cable. Once the circuit is correctly set up,select the Arduino board on Arduino IDE software and import the code into the Arduino. After that is done, run the code as well as the scope to see the Arduino generated graph on the software and integrated circuit generated ECG wave on oscilloscope. Note: We would expect to see similar graphs in the scope and the Arduino.

In order to measure heart rate on the Arduino, you need to connect the function generator directly to the Arduino to test the code. For our Arduino, we attached the positive (red) wire to the zero node and the negative/ground (black) wire to the ground node of the Arduino. Then set the function generator to send a 1 V amplitude signal with 1 Hz frequency. The waveform should be a simulated heartbeat/ECG signal. The plot and BPM readings should look similar to the images used. The code to be run is shown below in table 1. The BPM output and waveform output should look similar to those seen in figure 16.

Table 1. Arduino code to be run

Figure 16. BPM and ECG waveform from Arduino code

References

[1] M. AlGhatrif and J. Lindsay, “A brief review: History to understand fundamentals of electrocardiography,” Journal of Community Hospital Internal Medicine Perspectives, vol. 2, no. 1, p. 14383, Apr. 2012.

[2] Du WY, Jose W. Design of an ECG sensor circuitry for cardiovascular disease diagnosis. Int J Biosen Bioelectron. 2017;2(4):120–125. DOI: 10.15406/ijbsbe.2017.02.00032

[3] LTspice Simulator | Analog Devices. (n.d.). Retrieved April 28, 2022, from https://www.analog.com/en/design-center/design-to...

[4] Xiu, L., & Li, Z. (2012). Low-Power Instrumentation Amplifier IC Design for ECG System Applications. Procedia Engineering, 29, 1533–1538. https://www.analog.com/en/design-center/design-to...

[5] G. Friesen, T. Jannett, M. Jadallah, S. Yates, S. Quint and H. Nagle, “A comparison of the noise sensitivity of nine QRS detection algorithms”, IEEE Trans. Biomed. Eng, 37(1) 85–98, 1990.

[6] American Clinical Neurophysiology Society Guideline 3: Minimum Technical Standards for EEG Recording in Suspected Cerebral Death. (2006).