Easy Automated ECG (1 Amplifier, 2 Filters)

Introduction: Easy Automated ECG (1 Amplifier, 2 Filters)

An electrocardiogram (ECG) measures and displays the electrical activity of the heart using different electrodes placed on the skin. An ECG can be created using an instrumentation amplifier, notch filter, and low pass filter. Lastly, the filtered and amplified signal can be visualized using LabView software. LabView also uses the incoming frequency of the signal to calculate the heartbeat of the human subject. The instrumentation amplifier built was successful in taking the small signal of the body and amplifying it to 1 V, so it could be viewed on the computer using LabView. The notch and low pass filters were successful in reducing 60 Hz noise from power supplies and interfering signals above 350 Hz. The heart beat at rest was measured to be 75 bpm, and 137 bpm after five minutes of intense exercise. The ECG built was able to measure heart beats at realistic values and visualize the different components of a typical ECG waveform. In the future, this ECG could be improved by altering passive values in the notch filter to reduce more noise around 60 Hz.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Create the Instrumentation Amplifier

You will need: LTSpice (or another circuit visualization software)

The instrumentation amplifier was created to increase the size of the signal so it will be visible and allow for analysis of the waveform.

By using R1 = 3.3k ohms, R2 = 33k ohms, R3 = 1k ohms, R4 = 48 ohms a gain of X is achieved. Gain = - R4/R3 (1+R2/R1) = -47k/1k(1-(33k/3.3k)) = -1008

Because in the final op amp the signal goes into the inverting pin, the gain is 1008. This design was created in LTSpice then simulated with an AC sweep from 1 to 1kHz with 100 points per decade for a sine wave input with AC amplitude of 1V.

We checked that our gain was similar intended gain. From the graph we found Gain = 10^(60/20) = 1000 which is sufficiently close to our intended gain of 1008.

Step 2: Create the Notch Filter

You will need: LTSpice (or another circuit visualization software)

A notch filter is a specific type of low pass filter followed by a high pass filter to eliminate a specific frequency. A notch filter is used to eliminate the noise produced by all electronic devices which is present at 60Hz.

The passive values were calculated:
C = .1 uF (value was chosen) 2C = .2 uF (used .22 uF capacitor)

A Q factor of 8 will be used: R1 = 1/(2*Q*2*pi*f*C) = 1/(2*8*2*3.14159*60*.1E-6) = 1.66 kOhm (1.8 kOhm was used) R2 = 2Q/(2*pi*f*C) = (2*8)/(60 Hz*2*3.14159*.1E-6 F) = 424 kOhm (390 kOhm + 33 kOhm = 423 kOhm was used) Voltage Division: Rf = R1*R2/(R1 + R2) = 1.8 kOhm * 423 kOhm / (1.8 kOhm + 423 kOhm) = 1.79 kOhm (1.8 kOhm was used)

This filter design has a gain of 1, which means there are no amplifying properties.

Plugging in the passive values and simulating on LTSpice with an AC Sweep and an input signal of 0.1 V sine wave with an AC frequency of 1 kHz results in the attached bode plot.

At a frequency of around 60 Hz, the signal reaches its lowest voltage. The filter is successful in removing 60 Hz noise to an unnoticeable voltage of 0.01 V and providing a gain of 1, since the input voltage is .1 V.

Step 3: Create the Low Pass Filter

You will need: LTSpice (or another circuit visualization software)

A low pass filter was created to remove the signals above the threshold of interest that would contain the ECG signal. The threshold of interest was between 0 – 350Hz.

The capacitor value was chosen to be .1 uF. The needed resistance is calculated for a high cutoff frequency of 335 Hz:
C = 0.1 uF R = 1/(2pi*0.1*(10^-6)*335 Hz) = 4.75 kOhm (4.7 kOhm was used)

Plugging in the passive values and simulating on LTSpice with an AC Sweep and an input signal of 0.1 V sine wave with an AC frequency of 1 kHz results in the attached bode plot.

Step 4: Create the Circuit on a Breadboard

You will need: resistors of different values, capacitors of different values, UA 471 operational amplifiers, jumper cables, a breadboard, connection cables, a power supply or 9 V battery

Now that you have simulated your circuit, it is time to build it on a breadboard. If you do not have the exact values listed, use what you have or combine resistors and capacitors to make the values you need. Remember to power your bread board using a 9 Volt battery or DC power supply. Each op amp needs a positive and negative voltage source.

Step 5: Setup LabView Environment

You will need: LabView software, a computer

In order to automate the display of the waveform and the calculation of the heart rate, LabView was utilized. LabView is a program used to visualize and analyze data. The output of the ECG circuit is the input for LabView. The data is input, graphed and analyzed based on the block diagram designed below.

First, the DAQ Assistant takes in the analog signal from the circuit. The sampling instructions are set up here. The sampling rate was 1k samples per second and the interval was 3k ms, therefore the time interval seen in the Waveform Graph is 3 seconds. The Waveform Graph received data from the DAQ Assistant then plots it in the front panel window. The lower section of the block diagram encompasses the heart rate calculation. First the maximum and minimum of the wave are measured. Then, these amplitude measurements are used to determine if peaks are occurring which are defined as 95% of the maximum amplitude, and if so the time point is recorded. Once the peaks are detected, the amplitude and time point are stored in arrays. Then number of peaks/ seconds is converted to minutes and displayed on the front panel. The front panel shows the waveform and beats per minute.

The circuit was connected to LabVIEW through a National Instruments ADC as shown in the figure above. The function generator produced the simulated ECG signal was input into the ADC which transferred the data to LabView for graphing and analysis. Additionally, once the BPM was calculated in LabVIEW, the Numeric Indicator was used to print out that value on the front panel of the application along side the waveform graph, as seen in figure 2.

Step 6: Test Circuit Using Function Generator

You will need: circuit on breadboard, connection cables, a power supply or 9 V battery, National Instruments ADC, LabView Software, a computer

To test the LabView instrumentation a simulated ECG was input to the circuit and the output of the circuit was connected to LabView through the National Instruments ADC. First a signal of 20mVpp at 1Hz was input to the circuit to simulate resting heart beat. The LabView front panel is shown in the image below. The P, T, U wave and QRS complex are all visible. The BMP is correctly calculated and displayed in the numeric indicator. There is a gain of about 8 V/0.02 V = 400 through the circuit which is similar to what we saw when the circuit was attached to the oscilloscope. A picture of the result in LabView is attached. Next, to simulate a raised heart beat for example during exercise, a signal of 20mVpp at 2Hz was input to the circuit. There was a comparable gain to the test at resting heart rate. Below the waveform is seen to have all the same parts as before just at a faster rate. The heart rate is calculated and displayed in the numeric indicator and we see the expected 120 BPM.

Step 7: Test Circuit Using Human Subject

You will need: circuit on breadboard, connection cables, a power supply or 9 V battery, National Instruments ADC, LabView Software, a computer, electrodes (at least three), a human subject

Lastly, the circuit was testing with a human subject ECG leads input into the circuit and output of the circuit going into LabView. Three electrodes were placed on a subject to get a real signal. Electrodes were placed on both wrists and the right ankle. The right wrist was the positive input, the left wrist was negative and the ankle was ground. Again the data was input into LabView for processing.The electrode configuration is attached as a picture.

First, the subject’s resting ECG signal was displayed and analyzed. At rest, the subject had a heart rate of roughly 75 bpm. The subject then participated in intense physical activity for 5 minutes. The subject was reconnected and the raised signal was recorded. The heart rate was roughly 137 bpm after activity. This signal was smaller and had more noise. Electrodes were placed on both wrists and the right ankle. The right wrist was the positive input, the left wrist was negative and the ankle was ground. Again the data was input into LabView for processing.

An average person has an ECG signal of about 1mV. Our expected gain was about 1000, therefore we would expect an output voltage of 1V. From the recording at rest seen in image XX, the amplitude of the QRS complex is roughly (-0.7)- (-1.6) = 0.9 V. This produces a 10% error. (1-0.9)/1*100 = 10% The resting heart rate of a standard human is 60, the measured was about 75, this produces |60-75|*100/60 = 25% error. The raised heart rate of a standard human is 120, the measured was about 137, this produces |120-137|*100/120 = 15% error.

Congrats! You now have built your own automated ECG.

Assistive Tech Contest

Participated in the
Assistive Tech Contest

1 Person Made This Project!

Recommendations

  • Magnets Challenge

    Magnets Challenge
  • Raspberry Pi Contest 2020

    Raspberry Pi Contest 2020
  • Wearables Contest

    Wearables Contest

Discussions