Introduction: ECG Circuit
An ECG is a test that measures the electrical activity of the heart by recording the heart's rhythm and activity. It works by taking and reading signals from the heart using leads that are attached to an electrocardiograph machine. This Instructable will show you how to build a circuit that records, filters, and displays the bioelectric signal of the heart. 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.
This circuit contains three different stages wired together in series with a LabView program. The resistors in the instrumentation amplifier were calculated with a gain of 975 to ensure that the small signals from the heart can still be picked up the circuit. The notch filter takes out the 60 Hz noise from the power outlet in the wall. The low pass filter ensures that high frequency noise is removed from the circuit for better signal detection.
Before starting this Instructable, it would be helpful to familiarize yourself with the uA741 General Purpose Operational Amplifier. The different pins in the op-amp have different purposes and the circuit will not work if they are connected incorrectly. Connecting the pins to the breadboard incorrectly is also an easy way to fry the op-amp and make it non-functional. The link below contains the schematic used for the op-amps in this instructable. http://www.ti.com/lit/ds/symlink/ua741.pdf
Image Source: http://ak0.picdn.net/shutterstock/videos/17671660/thumb/1.jpg
Step 1: Collect Materials
Materials needed for all 3 stages of filter:
- Function generator
- Power supply (+15V, -15V)
- Solderless breadboard
- Various banana cables and alligator clips
- ECG Electrode Stickers
- Various jumper wires
- 3 Op-amps (uA741)
- 1 kΩ x 3
- 12 kΩ x 2
- 39 kΩ x 2
- 1 Op-amp (uA741)
- 1.6 kΩ x 2
- 417 kΩ
- 100 nF x 2
- 200 nF
Low Pass Filter:
- 1 Op-Amp (uA741)
- 23.8 kΩ
- 43 kΩ
- 22 nF
- 47 nF
Step 2: Build Instrumentation Amplifier
Biological signals often only output voltages between 0.2 and 2 mV . These voltages are too small to be analyzed on the oscilloscope so we needed to build an amplifier.
After your circuit is built, test to make sure that it is working correctly by measuring the voltage at Vout (shown as node 2 in the image above). We used the function generator to send a sine wave with an input amplitude voltage of 20 mV to our instrumentation amplifier. Anything too far above this will not give you the results you are looking for because the op amps were only getting a certain amount of power of -15 and +15 V. Compare the output of the function generator to the output of your instrumentation amplifier and look for a gain of close to 1000 V. (Vout/Vin should be very close to 1000).
Tip for troubleshooting: Make sure all resistors are in kΩ range.
“High Performance Electrocardiogram (ECG) Signal Conditioning | Education | Analog Devices.” [Online]. Available: http://www.analog.com/en/education/education-library/articles/high-perf-electrocardiogram-signal-conditioning.html. [Accessed: 10-Dec-2017].]
Step 3: Build Notch Filter
Our notch filter was designed to filter out a frequency at 60 Hz. We want to filter out the 60 Hz from our signal because that is the frequency of the alternating current found in electrical outlets.
When testing the notch filter, measure the peak-to-peak ratio between the input and output graphs. At 60 Hz, there should be a ratio of -20 dB or better. This is because at -20 dB, the output voltage is essentially 0V, meaning that you successfully filtered out the signal at 60 Hz! Test frequencies around 60 Hz as well to make sure that no other frequencies are being filtered out accidentally.
Tip for troubleshooting: If you can’t get exactly -20dB at 60 Hz, pick one resistor and change it slightly until you get the desired results. We had to play around with the value of R2 until we got the results we wanted.
Step 4: Build Low Pass Filter
Our low pass filter was designed with a cutoff frequency of 150 Hz. We chose this cutoff because the widest diagnostic range for an ECG is 0.05 Hz - 150 Hz, assuming a motionless and low noise environment . The low pass filter is able to get rid of high frequency noise coming from muscles or other parts of the body.
In order to test this circuit to ensure that it is working correctly, measure Vout (shown as node 1 in the circuit diagram). At 150 Hz, the amplitude of the output signal should be 0.7 times the amplitude of the input signal. We used an input signal of 1V in order to be able to easy see that our output should be 0.7 at 150 Hz.
Tips for troubleshooting: as long as your cutoff frequency is within a few Hz of 150 Hz your circuit should still work. Our cutoff ended up being 153 Hz. The range for biological signals will fluctuate a little in the body so as long as you are not off more than a few Hz, your circuit should still work.
 “ECG Filters | MEDTEQ.” [Online]. Available: http://www.medteq.info/med/ECGFilters. [Accessed: 10-Dec-2017].
 K. L. Venkatachalam, J. E. Herbrandson, and S. J. Asirvatham, “Signals and Signal Processing for the Electrophysiologist: Part I: Electrogram Acquisition,” Circ. Arrhythmia Electrophysiol., vol. 4, no. 6, pp. 965–973, Dec. 2011.
Step 5: Create LabView Program
 “BME 305 Design Lab Project “ (Fall 2017).
This labview block diagram is designed to analyze the signal going through the program, detect ECG peaks, collect the time difference between the peaks, and mathematically calculate the BPM. It also outputs a graph of the ECG waveform.
Step 6: Connect All Three Stages
Connect all three circuits in series by connecting the output of the instrumentation amplifier to the input of the notch filter and the output of the notch filter to the input of the low pass filter. Connect the output of the low pass filter to the DAQ assistant and connect the DAQ assistant to the computer. When wiring the circuits together, make sure that the power strips for each breadboard are connected and the ground strips are all connected to the same ground terminal.
In the instrumentation amplifier, the second op-amp needs to be ungrounded so that two electrode leads that are connected to the test subject can each connect to a different op amp in the first stage of that filter.
Step 7: Get Signals From a Human Test Subject
One electrode sticker should be placed on each wrist, and one should be placed on the ankle for ground. Use alligator clips to connect the two wrist electrodes to the inputs of the instrumentation amplifier and the ankle to ground. When ready, click “run” on the LabView program and see your heart rate and ECG on the screen!