ECG Design - a Sensor for the Heart

by pchen910310 in Circuits > Arduino

344 Views, 2 Favorites, 0 Comments

ECG Design - a Sensor for the Heart

Screen Shot 2022-04-21 at 23.28.04.png

An electrocardiogram, or ECG , widely use to evaluate the heart. Electrodes are connected to the human body, and electrical signals are amplified and measured through the ECG. The heart is an essential organ in the human body. Its primary function is to pump blood, maintain blood pressure as well as heart rate for the body. There are three parts in a typical ECG wave: the P wave, which indicates how excitation spreads across the two atria of the heart; the QRS complex, indicating where ventricles contract; and the T wave, where the electrical impulses stop spreading and the ventricles relax again. ECGs have had an impact on diagnosis and monitoring in cardiology. It has provided useful insights into the behavior, structure, and function of healthy, diseased and/or enlarged hearts. Because of this, physicians can make early diagnosis and prevent lethal diseases like arrhythmias and myocardial infarction from progressing.


Notice: **The ECG created here is for educational purposes only, and can NOT be used in a clinical setting**

Supplies

Resistors **resistor values used when building the circuit are provided in brackets**

-Instrumental amplifier:

R1: 2 kΩ (2kΩ); R2:49 kΩ (51kΩ); R2-1: 49 kΩ (51kΩ); R3: 1 kΩ (1kΩ); R3-1: 1 kΩ (1kΩ); R4: 20 kΩ (18kΩ); R4-1: 20 kΩ (18kΩ)

-notch filter:

R1: 120.57 Ω (120Ω); R2: 48.23 kΩ (56kΩ); R3: 117.63 Ω (120Ω)

-low pass filter:

R1: 21959 Ω (22kΩ); R2: 23051 Ω (22kΩ)

Capacitors

-notch filter:

C1: 1100nF (F14 105); C2: 1100nF (F14 105); C3: 2200nF (2x F14 105);

-low pass filter:

C1: 33.3nF (A333); C2: 66.67nF (2x A333)

Others:

Op-amps: uA741

Oscilloscope: DSO6014A Agilent Technologies

waveform generator: 33220A Agilent Technologies

power supply: E3631A

Create Stage 1 -- Instrumental Amplifier

Screen Shot 2022-04-24 at 11.53.15.png

Since the signals the human body produces are relatively very small, an amplifier is needed to amplify the signal to a readable, measurable extent. We constructed our instrumental amplifier based on the schematic in LTSpice in Figure 1. Resistor values used for the amplifier are 2 kΩ (2kΩ) for R1, 49 kΩ (51kΩ) for R2 and R2-1, 1 kΩ (1kΩ) for R3 and R3-1, and 20 kΩ (18kΩ) for R4 and R4-1. The calculated gain for this circuit is 1000.

Create Stage 2 -- Notch Filter

Screen Shot 2022-04-24 at 11.54.54.png

When connected to power, power line noise and unwanted baseline drift may affect our data. Those noises usually have a frequency at around 60Hz. In order to bypass that, we will create a notch filter to filter out those noises. Resistor values used are 120.57 Ω (120Ω) for R1, 48.23 kΩ (56kΩ) for R2, and 117.63 Ω (120Ω) for R3. Capacitors used are all 1100 nF (F14 105), with two of them in parallel to construct 2200 nF for C3. The circuit layout is as shown in the LTSpice simulation.

Create Stage 3 -- Low Pass Filter

Screen Shot 2022-04-24 at 12.02.23.png

Apart from the 60 Hz noise, other noises of high frequency may also affect out ECG readings. Such noises are difficult to be filtered individually, so a low pass filter will be constructed in this stage. A low pass filter stops signals that have a higher frequency than the set threshold cutoff frequency and allows the ones with lower frequency to pass. According to online literature, the recommended threshold for adults is 150 Hz and 250 Hz for children. Resistor values used are 21959 Ω (22kΩ) for R1 and 23051 Ω (22kΩ) for R2. Capacitors used are 33.3 nF (A 333) for C1 and 66.67 nF (two A 333 in parallel) for C2. The circuit layout is as shown in the LTSpice simulation.

Combine All Three Stages on Breadboard

Screen Shot 2022-04-24 at 12.56.18.png
Screen Shot 2022-04-24 at 12.56.43.png

After constructing all your stages, it is time to put everything all together! The three stages are then connected together as shown in Figure 4.

Set Up Arduino Board and Code

A/D conversion takes place when the connection between the low pass filter and the Arduino microcontroller is made. With Arduino IDE, BPM is calculated and then displayed along with an electrocardiogram. For BPM calculation, the upper threshold is set to 100 and the lower threshold is set to 120. The output can be evaluated using the Serial plotter and Serial monitor of Arduino IDE. Arduino code can be found in the attachment.

Test ECG on Human Subject :)

Screen Shot 2022-04-24 at 13.03.57.png
Screen Shot 2022-04-24 at 13.04.18.png

Now, it is time to test the ECG! To record human ECG signal, two electrodes are connected to the left and right ankle of the human subject, and a third electrode is connected to the wrist above the pulse. Electrodes correspond to COM, G1, and G2 input respectively. Recorded biological signals will enter the circuit from V14 in Figure 4, amplified with the instrumental amplifier, and filtered to the desired frequencies with the notch and low pass filter. Here, I've tested it with the Arduino and the oscilloscope. The graph should look like this!