The Do-It-Yourself Electrocardiogram (ECG)
by radhika10 in Circuits > Wearables
378 Views, 1 Favorites, 0 Comments
The Do-It-Yourself Electrocardiogram (ECG)
![gettyimages-1171765600-2048x2048.jpg](/proxy/?url=https://content.instructables.com/FAZ/F92N/LB6IN833/FAZF92NLB6IN833.jpg&filename=gettyimages-1171765600-2048x2048.jpg)
The electrocardiogram (ECG) is an essential tool used by healthcare professionals to monitor the heart's electrical activity. In this design project, we designed, developed, and tested an ECG instrumentation device with biosignal plotting. The components of this device included an instrumentation amplifier, a low-pass filter, and a notch filter. These components were designed and tested separately and combined to form a fully-functional ECG instrument. Lastly, an Arduino microcontroller was integrated with the circuit to visualize the signal on the user interface.
Supplies
![1.png](/proxy/?url=https://content.instructables.com/FG5/R1Y8/LB6IN81V/FG5R1Y8LB6IN81V.png&filename=1.png)
For this project, you will need:
Software
- LTSpice
- Arduino
Hardware
- 2 breadboards (1 must be large enough to hold 2 circuits)
- Circuit Wire Kit
- 5 general purpose op-amps (We have used LM 741 with +/- 15 V for this tutorial)
- Keysight Instruments: Oscilloscope, Waveform Generator, DC Power Supply
- Arduino UNO
- Resistors and Capacitors (see image above)
Miscellaneous
- BNC Cables, Adaptors, & Probes
- Metal Electrodes
- Electrode Patches
- Alligator Clips
Basic Principles
![2.PNG](/proxy/?url=https://content.instructables.com/F6A/7EPG/LB6IN86L/F6A7EPGLB6IN86L.png&filename=2.PNG)
![1.png](/proxy/?url=https://content.instructables.com/FLC/PUWP/LB6IN8DU/FLCPUWPLB6IN8DU.png&filename=1.png)
The electrocardiogram (ECG) records the heart's electrical activity, providing a record of cardiac electrical activity and valuable information about the heart's function and structure. Due to the electrical nature of the heart's contractions, we can record the change in voltage by placing electrode patches (leads) on the skin and processing the signal. The plot of these voltages over time is called an ECG. A standard 12-lead ECG, with 6 limb leads and 6 chest leads, is used to record the heart's electrical activity from a different angle for each lead.
--
For the design project, many logistical issues emerge such as the size of the signal, artifacts coming from the body, recording machines, and the environment. To compensate for this, we designed a circuit that will be composed of 3 components: an instrumentation amplifier to amplify the size of our signal, a low pass filter to eliminate frequencies above the selected cutoff frequency, and a notch filter to remove 60 Hz noise that is always present in buildings supplied with AC power.
Build Instrumentation Amplifier
![1.png](/proxy/?url=https://content.instructables.com/F4T/DN1I/LB6IN9DM/F4TDN1ILB6IN9DM.png&filename=1.png)
![2.png](/proxy/?url=https://content.instructables.com/FR3/RMOY/LB6IN8QM/FR3RMOYLB6IN8QM.png&filename=2.png)
![3.png](/proxy/?url=https://content.instructables.com/F0R/MGIH/LB6IN8QN/F0RMGIHLB6IN8QN.png&filename=3.png)
![4.png](/proxy/?url=https://content.instructables.com/FE1/D7I7/LB6IN8SN/FE1D7I7LB6IN8SN.png&filename=4.png)
The instrumentation amplifier amplifies the recorded signal to a usable level to be displayed on the oscilloscope. A gain of 50 was selected for stage 1 and 20 for stage 2. Thus, the desired gain of the entire circuit is 1000.
-
Stage 1 equation G1 = 1 + 2* R2 / R1 = 1+ (2*24.5k/1k) = 50
Stage 2 equation G2 = R4 / R3 = 20k/1k = 20
Combined gain equation G = G1 * G2 = 50*20 = 1000
-
The images above include a schematic of the circuit constructed in LTSpice, the circuit built in the lab, the output obtained, and the chip layout for the LM741 Operational Amplifier Model.
In the lab, our experimental gain was 759, and when compared to the expected gain of 1000, yields a percent error of 24.1%.
Build Low Pass Filter
![1.png](/proxy/?url=https://content.instructables.com/FT5/9M0N/LB6INA49/FT59M0NLB6INA49.png&filename=1.png)
![2.png](/proxy/?url=https://content.instructables.com/F8N/QG4D/LB6INA4B/F8NQG4DLB6INA4B.png&filename=2.png)
![1.png](/proxy/?url=https://content.instructables.com/F2Y/CDIY/LB6INACQ/F2YCDIYLB6INACQ.png&filename=1.png)
The low pass filter eliminates all signals higher than the selected cutoff frequency, which we decided to be 150 Hz based on a literature search. This filter is helpful in reducing the noise coming from the body and distorting the output signal.
The images above include a schematic of the circuit constructed in LTSpice, the circuit built in the lab, and the frequency response analysis output plot.
In the lab, our experimental cutoff frequency was 158.5 Hz, and when compared to the expected frequency of 150 Hz, yields a percent error of 5.67%.
Build Notch Filter
![1.png](/proxy/?url=https://content.instructables.com/FIL/BDB6/LB6INAEF/FILBDB6LB6INAEF.png&filename=1.png)
![2.png](/proxy/?url=https://content.instructables.com/F3K/44S0/LB6INAEG/F3K44S0LB6INAEG.png&filename=2.png)
![3.png](/proxy/?url=https://content.instructables.com/FMB/XJA2/LB6INAEH/FMBXJA2LB6INAEH.png&filename=3.png)
As mentioned before, most buildings are wired with 60 Hz AC current which results in large noise signals. To eliminate this frequency, a notch filter is utilized to attenuate this specific frequency and leave the other frequencies untouched.
The images above include a schematic of the circuit constructed in LTSpice, the circuit built in the lab, and the frequency response analysis output plot.
In the lab, the circuit rejects a frequency at 60.3 Hz, and when compared to the expected 60 Hz, yields a percent error of 0.5%.
Put It All Together!
![1.png](/proxy/?url=https://content.instructables.com/FO0/YPVP/LB6INFV0/FO0YPVPLB6INFV0.png&filename=1.png)
![1.png](/proxy/?url=https://content.instructables.com/FJC/PUSC/LB6INB5T/FJCPUSCLB6INB5T.png&filename=1.png)
![2.png](/proxy/?url=https://content.instructables.com/FZ9/3K86/LB6INB6G/FZ93K86LB6INB6G.png&filename=2.png)
![1.png](/proxy/?url=https://content.instructables.com/FRR/P7N0/LB6INBFV/FRRP7N0LB6INBFV.png&filename=1.png)
We now have all the components of an ECG! Our final step is to connect the three circuits, place electrodes on a human subject, and visualize the output on the oscilloscope!
To integrate the circuit, we connected the output of the instrumentation amplifier to the input of the low pass filter and the output of the low pass filter to the input of the notch filter. We read the ECG signal using the Lead II configuration (positive lead on left ankle, negative lead on right wrist, and ground to right ankle).
The images above include a schematic of the circuit constructed in LTSpice, the circuit built in the lab, and the AC analysis output. The P-wave, Q-wave, R-wave, S-wave, and T-wave are labeled for one cardiac cycle.
Integration With Arduino to Read BPM
![1.png](/proxy/?url=https://content.instructables.com/FHR/A9OG/LB6INBR9/FHRA9OGLB6INBR9.png&filename=1.png)
![1.png](/proxy/?url=https://content.instructables.com/FAX/XWFA/LB6IND0T/FAXXWFALB6IND0T.png&filename=1.png)
![2.png](/proxy/?url=https://content.instructables.com/F8Q/2MGZ/LB6IND9V/F8Q2MGZLB6IND9V.png&filename=2.png)
Finally, using a human ECG as the input signal, the Arduino output plot and resulting BPM values were obtained. The average heart rate of the human subject is 76 BPM and when compared to the obtained 80 BPM, yields a percent error of 5.26%.