Introduction: Electrocardiogram (ECG) Circuit Design

Disclaimer: The following is solely for educational purposes. The circuit does not resemble a medical device in any way. If using this circuit for real ECG measurements, please ensure that the circuit and the circuit-to-instrument connections utilize proper isolation methods and that all other relevant precautions are taken.


This Instructable assumes that fundamental concepts of circuit design and analysis, including filters, operational amplifiers, and nodal analysis, are understood.


Background

The ECG, or electrocardiogram, serves as a valuable, non-invasive medical diagnostic tool. An ECG measures the heart’s electrical activity as a function of time, recording the cardiac response to the propagation of actional potentials during each cardiac cycle. The physiological signals observed are then translated into ECG waveforms, where results may be interpreted to monitor and aid determination of patients’ cardiovascular status. However, ECGs are vulnerable to many unwanted noise and disturbances, which can be alleviated via amplification and filtering stages.

Supplies

ECG Circuit Design and Physical Build:

1. Resistors

2. Capacitors

3. Operational amplifiers (op-amp)

  • Only uA741 op-amps were used in this circuit

4. Wires

5. Breadboard

6. Electrode pads and leads


ECG, Heart rate, and BPM simulation:

1. Arduino Uno (R3) microcontroller

2. Function generator

3. DC Power Supply

4. Oscilloscope

5. 9V battery (for ECG testing on a human subject)

6. Relevant cables/wires/adaptors and accessories (ex. alligator clips, etc.)


Software:

1. LTSpice (simulation software for circuit validation and component verification)

2. Arduino software (for biosignal plotting and automated BPM readout)

3. Excel (for computing circuit component values and performing statistical analysis of results)

Step 1: Building the Instrumentation Amplifier (INA)

Purpose:

Instrumentation amplifiers (INA) is a type of differential amplifier used extensively in many measurement applications where dampening of undesired common-mode signals is required. An INA can be used to provide a significant amount of gain for very small, low-level signals, such as biological signals observed on ECGs. It is especially appropriate in applications with presence of high noise and disturbance levels. By using an INA to amplify the raw ECG signals, the signal voltage level can be raised. Alongside use with other filters, DC offset cultivated between electrodes and unwanted artifacts will be greatly reduced or eliminated.


Constructing the INA:

Using the equations displayed on the image attached above, component values within the INA circuitry can be determined. Given that the ideal output ECG is between 1 to 2.5V, the INA gain is set to be 1000. Computing for the resistors yield R1 = 3.9 kΩ, R2 = 390 kΩ, R3 = 10 kΩ, and R4 = 50 kΩ.


Testing the INA:

Signals coming into and through the INA should theoretically be amplified by 1000 (gain). To test its functionality, the an AC sweep analysis can be performed on the LTSpice simulation software. The physical build can also be tested over a range of frequencies and the resultant frequency response plot observed and analyzed.

Step 2: Building the Notch Filter

Purpose:

Notch filters aim to remove a narrow band of frequencies, or a single unwanted frequency. In ECG applications, a 60 Hz notch filter is often utilized to remove interfering frequencies due to the power lines and clean up the raw recorded signals. Notch filters achieve singular frequency removal by strongly attenuating the power over the narrow region of spectrum.


Constructing the Notch Filter:

To develop the 60 Hz notch filter, values of the filter components must first be calculated for. Using the equations on the image attached above will yield values of R1 = 165.7864 Ω, R2 = 42.4413182 kΩ, and R3 = 165.14132 Ω, keeping in mind that the cutoff frequency must be set to 60 Hz to remove 60 Hz noise. In the above circuit schematic and for computational purposes, the capacitor chosen possessed a value of 0.1 µF. For the physical build, as the exact values are not available, rounding was applied to the resistor values for ease of circuit construction on the breadboard. 


Testing the Notch Filter:

The notch filter can be tested on the LTSpice simulation software via an AC sweep analysis, with traces plotting Vout/Vin. The resulting plot (attached above) describes the simulated frequency response, with the solid line depicting the magnitude response and the dotted line representing the phase response. Like with the INA, the physical circuit can be tested by observing the output voltages along a range of frequencies, making sure that the experimental cutoff frequency is also being observed at the desired 60 Hz. The notch filter should pass all frequencies unaltered, except for those at and around 60 Hz. except for those around 60 Hz. This can be checked with an AC sweep analysis on the simulation software.

Step 3: Building the Low Pass Filter

Purpose:

Low pass filters are often utilized to remove or suppress high frequency components, while still passing the lower, desired frequencies within a specified range. In an ECG applications, low pass filters attenuated solely the amplitude of higher frequency components, and subsequently, influence output signal, including the QRS complex.


Constructing the Low Pass Filter:

The low pass filter is designed to have a cutoff frequency of 150 Hz. The equations in the image above is required to solve for the circuit components, where𝑓 refers to the cutoff frequency in Hz, while 𝜔 denotes the cutoff frequencies in rad/sec. The two capacitor values for the low-pass filter circuit were computed to be C2 = 0.6667 µF and C1 = 0.33335396 µF. Resistor values were calculated to be R1 = 18.836 kΩ and R2 = 26.634 kΩ, but were rounded to 18 kΩ and 27 kΩ respectively in the actual physical circuit. In this specific low-pass filter setting, gain, R3, and R4 are not applicable as for a gain of K=1, R3 becomes replaced by an open circuit and R4 is replaced by a short circuit. 


Testing the Low Pass Filter:

The low pass filter can be tested on the LTSpice simulation software, with traces plotting Vout/Vin. Like the previous two stages (INA and notch filter), the resulting plot depicts the relationship between frequency with the magnitude and phase changes – the solid line represents the magnitude response and the dotted line represents the phase response. As shown on the plot (image attached), the frequency response of the filter is nearly flat for lower frequencies, passing all input signal through to the output until it reaches the cutoff frequency. Similarly, the physical build can be tested by feeding a range of frequencies and observing the resultant response.

Step 4: Integrating Circuit Stages and ECG Simulatino

Constructing and Testing the Integrated Circuit:

Once all three stages have been completed and verified individually, it is time to test the integrated circuit as a whole! The breadboard image above shows the three stages physically built next to each other, and the oscilloscope image displays the simulated ECG circuit. The result depicts a clean, ECG signal with evident P waves, T waves, and the QRS complex. Additional ECG functionality assessment can be obtained by testing on human subjects while they are sitting down/inactive. When doing so, ensure that a 9V battery is used, and that electrode placement follows the standard 2 in opposing ankles, and 1 on the wrist. The ground electrode is the one placed on the side of the body with the electrode on the wrist (ex. right ankle = ground electrode, left ankle = positive electrode, and right wrist = negative electrode).

Step 5: ECG Signal Plotting and Automatic BPM Readout on Arduino

Arduino code is attached.

To obtain automation in heart rate recording and blood pressure readout, the following Arduino code can be used, resulting in a simulation of ECG signals and the corresponding BP measurement, as can be seen on the images above.



Step 6: Future Work/modifications

There are a variety of additional modifications that can be designed, built, and implemented into the current ECG device. Options include:

1. Adding extra circuitry to optimize and or condition the acquired signal

2. Generate a Graphical User Interface for automated controlling of signal acquisition starting and stopping

3. Building additional circuitry to interact with the Arduino microcontroller and signal output (ex. having LED within the circuit that lights up when signal reaches QRS peaks)


There are so many potential design modifications that can be iterated through to achieve an effective, functional, and high-resolution ECG device. Utilizing rudimentary electrical engineering/circuits understanding as well as anatomical knowledge will help simplify scaling the modifications for ECG recording applications and with system innovation.


Good luck and we hope you've enjoyed our Instructable!