Intro: Designing an ECG Digital Monitor and Circuit
This is not a medical device. This is for educational purposes only using simulated signals. If using this circuit for real ECG measurements, please ensure the circuit and the circuit-to-instrument connections are utilizing proper isolation techniques.
The goal of this project is to build a circuit that can amplify and filter an ECG signal, also known as an electrocardiogram. An ECG can be used to determine heart rate and heart rhythm, as it is able to detect the electrical signals that pass through various parts of the heart during the different stages of the cardiac cycle. Here we use an instrumentation amplifier, notch filter, and a low pass filter to amplify and filter the ECG. Then, using LabView, the beats per min is calculated and a graphical representation of the ECG is displayed. The finished product can be seen above.
Step 1: Instrumentation Amplifier
The necessary gain for the instrumentation amplifier is 1000 V/V. This would allow for sufficient amplification of the incoming signal that is much smaller. The instrumentation amplifier is broken into two parts, Stage 1 and Stage 2. The gain of each stage (K) should be similar, so that when multiplied together, the gain is around 1000. The equations below are used to calculate the gain.
K1 = 1 + ((2*R2)/R1)
K2 = -R4/R3
From these equations, the values of R1, R2, R3, and R4 were found. To build the circuit seen in the images, three uA741 Operational Amplifiers and resistors were used. The op amps are powered with 15V from a DC power supply. The input of the Instrumentation Amplifier was connected to a Function Generator and the output was connected to an Oscilloscope. Then, an AC sweep was taken, and the Instrumentation Amplifier gain was found, as can be seen on the "Instrumentation Amplifier Gain" plot above. Finally, the circuit was recreated in LabView, where a simulation of the gain was run, as can be seen in the black plot above. The results confirmed the circuit worked correctly.
Step 2: Notch Filter
The notch filter is used to remove noise that occurs at 60 Hz. The values of the components can be calculated using the equations below. A quality factor (Q) of 8 was used. C was chosen given the capacitors available.
R1 = 1/(2*Q*ω*C)
R2 = 2*Q/(ω*C)
R3 = (R1*R2)/(R1+R2)
The resistor and capacitor values were found and the circuit above was constructed, the calculated values can be seen there. The operational amplifier was powered by a DC Power Supply, with the input connected to a Function Generator and the output to an Oscilloscope. Running an AC Sweep resulted in the "Notch Filter AC Sweep" plot above, showing that a frequency of 60 Hz had been removed. To confirm this, a LabView simulation was run which confirmed the results.
Step 3: Low Pass Filter
A Second Order Butterworth low pass filter is used, with a cut off frequency of 250Hz. To solve for the resistor and capacitor values, the equations below were used. For these equations, the cutoff frequency in Hz was changed to be in rad/sec, which was found to be 1570.8. A gain of K = 1 was used. The values for a and b were supplied to be 1.414214 and 1 respectively.
R1 = 2 / (wc (a C2 + sqrt(a^2 + 4 b (K - 1)) C2^2 - 4 b C1 C2))
R2 = 1/ (b C1 C2 R1 wc^2)
R3 = K (R1 + R2) / (K - 1)
R4 = K (R1 + R2)
C1 = (C2 (a^2 + 4 b (K-1)) / (4 b)
C2 = (10 / fc)
Once the values had been calculated, the circuit was constructed with the values, which can be seen in one of the images above. It should be noted that since a gain of 1 was used, R3 was replaced with an open circuit and R4 was replaced with a short circuit. Once the circuit had been assembled, then the op amp was powered with 15V from a DC Power Supply. Similar to the other components, the input and output were connected to a Function Generator and an Oscilloscope respectively. A plot of the AC sweep was created, seen in the "Low Pass Filter AC Sweep" above. The plot in black in the LabView simulation of the circuit, confirming our results.
Step 4: LabVIEW
The LabVIEW program shown in the image is used to calculate beats per minute, and to display a visual representation of the input ECG. The DAQ Assistant acquires the input signal and sets the sampling parameters. The waveform graph then plots the input the DAQ receives on the UI to display to the user. Multiple analyses are done on the input data. The maximum values of the input data is found using the Max/Min Identifier, and the parameters to detect peaks are set using Peak Detection. Using an index array of the locations of peaks, the time between maximum values given by the Change in Time component, and various arithmetic operations, the BPM is calculated and displayed as the numeric output.
Step 5: Completed Circuit
Once all the components were connected, the full system was tested with a simulated ECG signal. Then, the circuit was used to filter and amplify a human ECG with the results displayed through the aforementioned LabView program. Electrodes were attached to the right wrist, left wrist, and left ankle. The left wrist and right wrist were connected to the inputs of the instrumentation amplifier, while the left ankle was connected to ground. The output of the low-pass filter was then connected to the DAQ Assistant. Using the same LabView block diagram from before, the program was run. With the human ECG passing through, a clear and stable signal was seen from the output of the full system, which can be seen in the image above.