Introduction: Electrocardiogram (ECG) Circuit

Who are we?

We are biomedical engineering students constructing a functional ECG with automated plotting of the biosignal and automated BPM readout using an Arduino microcontroller. This instructable is solely for educational purposes and the circuit is not intended to be used for medical diagnosis.


Project Background:

An electrocardiogram (ECG) measures the changes in electrical signals (as voltage potentials) on different areas of the skin and plots them as a graph. An ECG is used to show how the heart is functioning by recording the heart rate and rhythm. A normal ECG pattern contains a P-wave which corresponds to atrial contraction, a QRS complex which corresponds to ventricular contraction, and a T-wave which corresponds to ventricular repolarization. An ECG’s job is to amplify small signals measured from the heart while filtering external (alternating current interference from powerlines) and internal (muscle tremors) noise. To accomplish this goal, basic ECG circuits are typically composed of an instrumentation amplifier, notch filter, and low pass filter.

Supplies

  • Operational Amplifiers
  • Resistors
  • Capacitors
  • Jumper Wires
  • Breadboard
  • DC Power Supply
  • Oscilloscope
  • Function Generator
  • ECG Electrode Pads and Leads
  • Arduino Board Uno
  • BNC to BNC Cable
  • Alligator Clips to Power Supply Cable
  • BNC to Grabber Cable
  • 9V Batteries
  • LTSpice Software
  • Arduino Software

Optional:

  • LED

Step 1: Designing the Instrumentation Amplifier (INA)

Background

An INA amplifies a low-level signal while diminishing noise and interference. Physiological voltages of an ECG are very small (microvolt – millivolt range) so the signal must be amplified for better visualization. An INA schematic is shown in the figures above.


Determining Component Values

In a biopotential amplifier circuit, a gain of over 1000 is typically used to amplify physiological signals. The gain of an INA can be expressed using the equation shown in the figures above. Using this equation and setting the gain equal to 1000, the resistor values can be determined. For our circuit, we used the values listed below; however, these are not the only values that can be used.

R1 = 1000 Ohms

R2 = 4500 Ohms

R3 = 1000 Ohms

R4 = 100000 Ohms

Testing the Circuit

To verify the selection of resistance values, construct the INA in LTSpice and plot the output voltage over time to ensure a gain of 1000 by using transient analysis. The LTSpice schematic and the outputs are included in the attached figures.

After validating the resistance values selected, The INA circuit schematic can be physically constructed and tested using the procedure below:

  1. Turn on the Waveform generator. Select a sine wave with a frequency of 1.2 Hz and an amplitude of 2 mVpp as the output waveform. Connect this source to the appropriate input in the circuit schematic.
  2. Turn on the DC power supply and set the voltage to 15 V and the current to 0.1 A in channels 2 and 3. Connect these sources to the appropriate locations in the circuit schematic.
  3. Measure both the input and output signals using the oscilloscope, be sure to verify the gain of 1000

An image of the constructed INA and the oscilloscope output can be found in the attached figures.

Step 2: Designing the Notch Filter

Background

A notch filter attenuates signals in a specific range of frequencies. A notch filter was used in the ECG circuit design to remove AC current interference at 60 Hz from other electrical devices. A schematic of the VCVS notch filter used to construct the functional ECG circuit is shown in the figures above.


Determining Component Values

The governing equations of a notch filter are included in the images above. Q represents the quality factor, w represents the center frequency in rad/sec, f0 represents the center frequency in Hz, B represents the bandwidth in rad/sec, and w1 and w2 represent the cutoff frequencies in rad/sec. Design requirements for the ECG notch filter are as follows, Q = 8 and f0 = 60 Hz. These requirements were utilized for the calculation of the component values of the notch filter listed below:

C = 0.1 uF

R1 = 1.657 kOhm

R2 = 424 kOhm

R3 = 1.651 kOhm

Testing the Circuit

To validate the component value calculations and ensure that the design requirements were met, a VCVS notch filter can be constructed in LT Spice and an AC analysis can be conducted to produce a frequency response plot. The LTSpice schematic and the outputs are included in the attached figures.

After validating the component values selected, The notch filter can be physically constructed and tested using the procedure below:

  1. Turn on the Waveform generator. Select a sine wave with a frequency of 60 Hz and an amplitude of 1 Vpp as the output waveform. Connect this source to the appropriate input in the circuit schematic.
  2. Turn on the DC power supply and set the voltage to 15 V and the current to 0.1 A in channels 2 and 3. Connect these sources to the appropriate locations in the circuit schematic.
  3. Perform a frequency response analysis using the oscilloscope, and capture images of the frequency response plot for verification of the proposed circuit.

An image of the constructed notch filter and the oscilloscope output can be found in the attached figures.

Step 3: Designing the Low Pass Filter

Background

A low pass filter is a filter that passes low frequencies and blocks high frequencies and is typically used in ECG circuitry to reduce noise from muscle tremors. The American Heart Association guidelines for low-pass filtering in ECGs indicate that a 150 Hz cutoff frequency is appropriate for the reduction of high-frequency electromyographic noise in adolescents and adults. A second-order low pass filter is selected because it provides a clearer distinction for cut-off in comparison to a first-order. The schematic for a second-order low-pass filter is shown in the attached figures above.


Determining Component Values

For a gain of 1, R3 is replaced by an open circuit, and R4 is replaced by a short circuit. The design equations for a low-pass filter are included in the images above. Using a cutoff frequency of 150 Hz, the component values are calculated and listed below:

C1 = 0.01 uF

C2 = 0.067 uF

R1 = 12187.91 Ohms

R2 = 137864.85 Ohms

Testing the Circuit

To verify the component values and ensure that the design requirements were met, the second-order low pass filter can be constructed in LT Spice and an AC analysis was conducted to produce a frequency response plot. The LTSpice schematic and the outputs are included in the attached figures.

After validating the component values selected, The low pass filter can be physically constructed and tested using the procedure below:

  1. Turn on the Waveform generator. Select a sine wave with a frequency of 150 Hz and an amplitude of 1 Vpp as the output waveform. Connect this source to the appropriate input in the circuit schematic.
  2. Turn on the DC power supply and set the voltage to 15 V and the current to 0.1 A in channels 2 and 3. Connect these sources to the appropriate locations in the circuit schematic.
  3. Perform a frequency response analysis using the oscilloscope, and capture images of the frequency response plot for verification of the proposed circuit.

An image of the constructed low pass filter and the oscilloscope output can be found in the attached figures.

Step 4: Put It All Together!

After constructing each component and verifying the outputs, the INA, the notch filter, and the low-pass filter can be connected together on one breadboard in the order stated.

First, we should check our Functional ECG using LTSpice. The LTSpice schematic and output images are included above.

To combine the circuits on one breadboard, connect the output of the INA to the input of the notch filter, and the output of the notch filter to the input of the low pass filter using jumper wires. The image above displays the constructed Functional ECG. To test the circuit, the waveform generator can be used to provide an arbitrary EKG input signal and the oscilloscope can measure and display the input/output signals. Additionally, a lead II or lead I configuration can be used to provide a human EKG input signal, and the oscilloscope can measure and display the input/output signals. For a lead II configuration, the human subject should have an electrode on the inside of each ankle and an electrode on the inside of the right wrist. Connect the electrode on the right ankle to the ground. The right wrist electrode should be connected to the negative input and the left ankle connected to the positive input. When using a human subject to provide input, use 9V batteries instead of the DC power supply. Included in the figures above are the arbitrary EKG output and the human EKG output. The P waves, T waves, and the QRS complex should be visible in the output.

Step 5: Using Arduino for ECG Signal Plotting and Automatic BPM Readout

An Arduino Uno Board can be used to obtain automation in heart rate recording and blood pressure readout. The code in the attached files can be used in the Arduino IDE to be uploaded to an Arduino Uno Board. The outputs of the ECG signal and the BPM measurements as shown in the figures can be viewed in the serial plotter and serial monitor features on the Arduino IDE.

Additionally, an LED can be added to the Arduino Board to illuminate each peak in the QRS. This feature is included in the attached code and an example of the LED flashing can be seen in the attached video file. To include an LED, attach the positive lead to pin 13 and the negative lead to the ground on the Arduino board.