Introduction: ECG and Heart Rate Monitor
NOTICE: 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.
One of the most important diagnostic tools used for detecting these conditions is the electrocardiogram (ECG). An electrocardiogram works by tracing the electrical impulse through your heart and transmitting it back to the machine . The signal is picked up from electrodes placed on the body. Placement of the electrodes is crucial to picking up the physiological signals since they work by recording the difference of potential across the body. The standard placement of electrodes is to use the Einthoven Triangle. This is where one electrode is placed on the right arm, left arm and left leg. The left leg acts as a ground for the electrodes and it picks up the frequency noise in the body. The right arm has a negative electrode and the left has a positive electrode to calculate the potential difference across the chest and therefore pick up the electrical energy from the heart .The objective of this project was to create a device that can successfully acquire an ECG signal and clearly reproduce the signal without noise and with the addition of a heart rate measurement.
Step 1: Materials and Tools
- Various resistors and capacitors
- Function generator
- DC power supply
- Computer with LABView installed
- BNC cables
- DAQ assistant
Step 2: Build Instrumentation Amplifier
In order to adequately amplify the bioelectric signal, the overall gain of the two stage instrumentation amplifier should be 1000. Each stage is multiplied to get the overall gain and the equations used to calculate the individual stages are shown below.
Stage 1 Gain: K1=1+2*R2/R1 Stage 2 Gain: K2= -R4/R3
Using the above equations, the resistor values that we utilized were R1 = 10kΩ, R2 = 150kΩ, R3 = 10kΩ, and R4 = 33kΩ. In order to ensure that these values will provide the desired output, you can simulate it online or you can test it using an oscilloscope after building the physical amplifier.
After connecting the selected resistors and the op-amps in the breadboard, you will need to power the op-amps ±15V from a DC power supply. Next, connect the function generator to the input of the instrumentation amplifier and the oscilloscope to the output.
The photo above shows the completed instrumentation amplifier will look like in the breadboard. To check that it is working properly, set the function generator to produce a sine wave at 1kHz with a peak to peak amplitude of 20 mV. The output from the amplifier on the oscilloscope should have a peak to peak amplitude of 20 V, since there is a gain of 1000, if it is working properly.
Step 3: Build Notch Filter
Due to the power line noise, a filter was needed to filter out noise at 60Hz which is the power line noise in the United States. A notch filter was used since it filters a specific frequency. The following equations were used to calculates the resistor values. A qualitative factor (Q) of 8 worked well and capacitor values of 0.1uF were chosen for ease of construction. The frequency in the equations (depicted as w) is the notch frequency 60Hz multiplied by 2π.
Using the above equations, the resistor values that we utilized were R1=1.5kΩ, R2=470kΩ and R3=1.5kΩ. In order to ensure that these values will provide the desired output, you can simulate it online or you can test it using an oscilloscope after building the physical amplifier.
The image above shows what the completed notch filter will look like in the breadboard. The setup for op-amps is the same as the instrumentation amplifier and the function generator should now be set to produce a sine wave at 1kHz with a peak to peak amplitude of 1V. If you perform an AC Sweep you should be able to verify that frequencies around 60Hz are filtered out.
Step 4: Build a Low Pass Filter
In order to filter out the high frequency noise that is not related to the ECG a low-pass filter was created with a cutoff frequency of 150 Hz.
C1 <= C2[a^2+4b(K-1)]/4b
Using the above equations, the resistor values that we utilized were R1 = 12kΩ, R2 = 135kΩ, C1 = 0.01 µF, and C2 = 0.068 µF. The values for R3 and R4 ended up being zero since we wanted the gain, K, of the filter to be zero, therefore we used wires instead of resistors here in the physical set-up. In order to ensure that these values will provide the desired output, you can simulate it online or you can test it using an oscilloscope after building the physical amplifier.
To build the physical filter, connect the chosen resistors and capacitors to the op-amp as shown in the schematic. Power the op-amp and connect the function generator and oscilloscope in the same way as described in the previous steps. Set the function generator to produce a sine wave at 150Hz and with a peak-to-peak amplitude of about 1 V. Since 150Hz should be the cutoff frequency, if the filter is working properly, the magnitude should be 3dB at this frequency. This will tell you if the filter is set up correctly.
Step 5: Connect All Components Together
After building each component and testing them separately, they can all be connected in series. Connect the function generator to the input of the instrumentation amplifier, then connect the output of that to the input of the notch filter. Do this again by connecting the output of the notch filter to the input of the low-pass filter. The output of the low-pass filter should then connect to the oscilloscope.
Step 6: Setup LabVIEW
The ECG heart beat waveform was then captured using a DAQ assistant and LabView. A DAQ assistant acquires analog signals and defines sampling parameters. Connect the DAQ assistant to the function generator outputting a arb cardiac signal and to the computer with LabView. Setup LabView according to the schematic shown above. The DAQ assistant will bring in the cardiac wave from the function generator. Add the waveform graph to your LabView setup as well to view the graph. Use numerical operators to set a threshold for the maximum value. In the schematic shown 80% was used. Peak analysis should also used to find peak locations and link them with the change in time. Multiply the peak frequency by 60 in order to calculated the beats per minute and this number was outputted next to the graph.
Step 7: You Can Now Record an ECG!
 “Electrocardiogram - Texas Heart Institute Heart Information Center.” [Online]. Available: http://www.texasheart.org/HIC/Topics/Diag/diekg.cfm. [Accessed: 09-Dec-2017].
 “The ECG Leads, Polarity and Einthoven’s Triangle – The Student Physiologist.” [Online]. Available: https://thephysiologist.org/study-materials/the-ecg-leads-polarity-and-einthovens-triangle/. [Accessed: 10-Dec-2017].