Electrocardiogram (ECG) Circuit: Instructables

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

instructables

Electrocardiogram (ECG) Circuit

by h_salaman

Note: This is not a medical device. This is for Many electrical devices are used to measure and
educational purposes only using simulated record biological activity in the human body. One
signals. If using this circuit for real ECG such device is the electrocardiogram, which
measurements, please ensure the circuit and the measures the electrical signals produced by the
circuit-to-instrument connections are utilizing heart. These signals give objective information about
proper isolation techniques. the structure and function of the heart. The ECG was
first developed in 1887 and gave physicians a new
We are two students in Biomedical Engineering and way to diagnose heart complications. ECGs can
after taking our first circuits class, we were quite detect heart rhythm, heart rate, heart attacks,
excited and decided to use the basics we learned to inadequate blood and oxygen supply to the heart, and
do something useful: display an ECG and read heart structural abnormalities. Using simple circuit design,
rate. This would be the most complex circuit we've an ECG can be made that could monitor all of these
built yet! things.

Some background on an ECG:

Electrocardiogram (ECG) Circuit: Page 1


Step 1: Materials

Building the circuit

Basic materials needed to build the circuit are shown in pictures. They include:

Breadboard
Operational amplifiers
All op amps used in this circuit are LM741.
For more info, see the datasheet: http://www.ti.com/lit/ds/symlink/lm741.pdf

Resistors
Capacitors
Wires
Stick-on electrodes
These are only needed if you decide to try the circuit on a real person.

Software used includes:

LabVIEW 2016
CircuitLab or PSpice for simulations to check values
Excel
This is highly recommended in case you need to change any characteristics of your
circuit. You may also need to play with the numbers until you find resistor and
capacitor values that are readily available. Pen-and-paper calculations discouraged for
this one! We have attached our spreadsheet calculations to give an idea.

Testing the circuit

You will also need some larger electronic equipment:

DC Power supply
DAQ board to interface the circuit to LabVIEW
Function generator to test circuit
Oscilloscope to test circuit

Electrocardiogram (ECG) Circuit: Page 2


1 1

5 2
3

1. Resistors 1. Stick-on electrodes


2. Operational amplifiers
3. Capacitors
4. Jumper wires
5. Breadboard

Electrocardiogram (ECG) Circuit: Page 3


Step 2: Instrumentation Amplifier

Why we need it: values to be R1= 1.8 kiloOhms, R2=8.2 kiloOhms, R3


= 1.5 kiloOhms, and R4 = 15 kiloOhms. K1 is the
We will build an instrumentation amplifier in order to gain of the first stage (OA1 and OA2), and K2 is the
amplify the small amplitude measured from the body. gain of the second stage (OA3). Equal capacitance
Using two amplifiers in our first stage will allow us to bypass capacitors are used on the power supplies of
cancel out the noise created by the body (which will the operational amplifiers to remove noise.
be the same at both electrodes). We will use two
stages of about equal gain -- this protects the user if How to test it:
the system is connected to a person by preventing all
the gain from happening in one place. Since the Any signal that is fed into the instrumentation
normal amplitude of an ECG signal is between 0.1 amplifier should be amplified by 100. Using
and 5 mV, we want the gain of the instrumentation dB=20log(Vout/Vin) this means a ratio of 40 dB. You
amplifier to be about 100. An acceptable tolerance on can simulate this in PSpice or CircuitLab, or test the
the gain is 10%. physical device, or both!

How to build it: The oscilloscope image attached shows a gain of


1000. For a real ECG, this is too high!
Using these specifications and the equations seen in
the table (attached pictures), we found our resistor

Electrocardiogram (ECG) Circuit: Page 4


Step 3: Notch Filter

Why we need it:

We will use a notch filter to remove the 60 Hz noise present in all power supplies in the United States.

How to build it:

We will set the quality factor Q to be 8, which will provide an acceptable filtering output while keeping component
values in a feasible range. We also set the capacitor value to be 0.1 F so that calculations affect the resistors
only . The resistor values calculated and used can be seen in the table (in pictures) or below

Q = w/B
set Q to 8 (or choose your own based on your own need)

w = 2*pi*f
use f = 60 Hz

C
set to 0.1 uF (or choose your own value from available capacitors)

R1 = 1/(2*Q*w*C)
Calculate. Our value is 1.66 kohm

R2 = 2*Q/(w*C)
Calculate. Our value is 424.4 kohm

R3 = R1*R2/(R1+R2)
Calculate. Our value is 1.65 kohm

How to test it:

The notch filter should pass all frequencies unchanged except for those around 60 Hz. This can be checked with
an AC sweep. A filter with a gain of -20 dB at 60 Hz is considered good. You can simulate this in PSpice or
CircuitLab, or test the physical device, or both!

This kind of notch filter may generate a good notch in the simulated AC sweep, but a physical test showed that our
original values generated a notch at a lower frequency than intended. To fix this, we bumped up R2 by about 25
kohm.

The oscilloscope image shows the filter greatly reduces the input signal magnitude at 60 Hz. The graph shows an
AC sweep for a high quality notch filter.

Electrocardiogram (ECG) Circuit: Page 5


Electrocardiogram (ECG) Circuit: Page 6
Step 4: Low-pass Filter

Why we need it:

The last stage of the device is an active low-pass filter. The ECG signal is made of many different waveforms,
which each have their own frequency. We want to capture all these, without any high-frequency noise. The
standard cutoff frequency for ECG monitors of 150 Hz is selected. (Higher cutoffs are sometimes chosen to
monitor for specific heart problems, but for our project, we will use a normal cutoff.)

If you would like to make a simpler circuit, you could also use a passive low-pass filter. This will not include an op
amp, and will consist of just a resistor in series with a capacitor. The output voltage will be measured across the
capacitor.

How to build it:

We will design it as a Second order Butterworth filter, which has coefficients a and b equal to 1.414214 and 1,
respectively. Setting the gain to 1 makes the operational amplifier into a voltage follower. The equations and
values chosen are shown in the table (in pictures) and below.

w=2*pi*f
set f = 150 Hz

C2 = 10/f
Calculate. Our value is 0.067 uF

C1 <= C2*(a^2)/(4b)
Calculate. Our value is 0.033 uF

R1 = 2/(w*(aC2+sqrt(a^2*C2^2-4b*C1*C2)))
Calculate. Our value is 18.836 kohm

R2 = 1/(b*C1*C2*R1*w^2)
Calculate. Our value is 26.634 kohm

How to test it:

The filter should pass frequencies below the cutoff unchanged. This can be tested using an AC sweep. You can
simulate this in PSpice or CircuitLab, or test the physical device, or both!

The oscilloscope image shows the filter's response at 100 Hz, 150 Hz, and 155 Hz. Our physical circuit had a
cutoff closer to 155 Hz, shown by the -3 dB ratio.

Electrocardiogram (ECG) Circuit: Page 7


Step 5: High-pass Filter

Why we need it:

The high-pass filter is used so that frequencies below a certain cut-off value are not recorded, allowing a clean
signal to be passed through. The cut-off frequency is chosen to be 0.5 Hz (a standard value for ECG monitors).

How to build it:

The resistor and capacitor values needed to achieve this are seen below. Our actual resistance used was 318.2
kohm.

R = 1/(2*pi*f*C)
set f = 0.5 Hz, and C = 1 uF
Calculate R. Our value is 318.310 kohm

How to test it:

The filter should pass frequencies above the cutoff unchanged. This can be tested using an AC sweep. You can
simulate this in PSpice or CircuitLab, or test the physical device, or both!

Electrocardiogram (ECG) Circuit: Page 8


Step 6: Setting Up LabVIEW

The flowchart lays out the design concept of the is set to take continuous samples at a rate of 1 kHz,
LabVIEW portion of the project which records the with the number of samples changed between 3,000
signal at a high sampling rate and displays the heart and 5,000 samples for peak detection and signal
rate (BPM) and ECG. Our LabView circuit contains clarity purposes.
the following components: DAQ assistant, index
array, arithmetic operators, peak detection, numerical Mouse over the different components in the circuit
indicators, waveform graph, change in time, max/min diagram to read where in LabVIEW to find them!
identifier, and number constants. The DAQ assistant

2
1 6
3 9

4 5 7

1. Find in Measurement I/O


2. Find in Front Panel. Modern >> Graph
3. Search for 'get waveform components'. Choose analog
waveform. Click to change the default dy to dt.
4. Find in Programming >> Waveform >> Analog Waveform
5. Find in Signal Processing >> Waveform Measurements >>
Waveform Monitoring
6. Find in Front Panel. Silver >> Numeric
7. Find in Programming >> Array
8. Find in Programming >> Numeric
9. Find in Programming >> Numeric

Electrocardiogram (ECG) Circuit: Page 9


Step 7: Collecting Data

Now that the circuit has been assembled, data can be If you choose to test the device on a human be sure
collected to see if it works! Send a simulated ECG the power supply you are using for the op amps limits
through the circuit at 1 Hz. The result should be a the current at 0.015 mA! There are several
clean ECG signal where the QRS complex, P wave, acceptable lead configurations but we chose to place
and T wave can be clearly seen. The heart rate the positive electrode on the left ankle, the negative
should also be displaying 60 beats per minute (bpm). electrode on the right wrist, and the ground electrode
To further test the circuit and the LabVIEW setup, on the right ankle as seen in the attached picture.
change the frequency to 1.5 Hz and 0.5 Hz. The heart
rate should change to be 90 bpm and 30 bpm Using some basic circuitry concepts and our
respectively. knowledge of the human heart we have shown you
how to create a fun and useful device. We hope
For slower heart rates to accurately be displayed you you've enjoyed our tutorial!
may need to adjust the DAQ settings to show more
waves per graph. This can be done by increasing the
number of samples.

Electrocardiogram (ECG) Circuit: Page 10

You might also like