Lab Manual: Analog Electronics: Lab 14: Building An ECG Circuit
Lab Manual: Analog Electronics: Lab 14: Building An ECG Circuit
Analog Electronics
Using the TI Electronics Kit for NI ELVIS III
All rights reserved. Neither this resource, nor any portion of it, may be copied or reproduced in
any form or by any means without written permission of the publisher.
National Instruments respects the intellectual property of others, and we ask our readers to do
the same. This resource is protected by copyright and other intellectual property laws. Where
the software referred to in this resource may be used to reproduce software or other materials
belonging to others, you should use such software only to reproduce materials that you may
reproduce in accordance with the terms of any applicable license or other legal restriction.
All other trademarks or product names are the property of their respective owners.
Additional Disclaimers: The reader assumes all risk of use of this resource and of all
information, theories, and programs contained or described in it. This resource may contain
technical inaccuracies, typographical errors, other errors and omissions, and out-of-date
information. Neither the author nor the publisher assumes any responsibility or liability for any
errors or omissions of any kind, to update any information, or for any infringement of any patent
or other intellectual property right.
Neither the author nor the publisher makes any warranties of any kind, including without
limitation any warranty as to the sufficiency of the resource or of any information, theories, or
programs contained or described in it, and any warranty that use of any information, theories, or
programs contained or described in the resource will not infringe any patent or other intellectual
property right. THIS RESOURCE IS PROVIDED “AS IS.” ALL WARRANTIES, EITHER
EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, ANY AND ALL
IMPLIEDWARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
AND NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS, ARE DISCLAIMED.
No right or license is granted by publisher or author under any patent or other intellectual
property right, expressly, or by implication or estoppel.
IN NO EVENT SHALL THE PUBLISHER OR THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, SPECIAL, INCIDENTAL, COVER, ECONOMIC, OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THIS RESOURCE OR ANY INFORMATION, THEORIES, OR PROGRAMS
CONTAINED OR DESCRIBED IN IT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES, AND EVEN IF CAUSED OR CONTRIBUTED TO BY THE NEGLIGENCE OF THE
PUBLISHER, THE AUTHOR, OR OTHERS. Applicable law may not allow the exclusion or
limitation of incidental or consequential damages, so the above limitation or exclusion may not
apply to you.
2
Lab 14: Project Lab – Building an ECG Circuit
Circuits play an important part in many fields, including medicine. In this lab, you will
explore and build an Electrocardiogram (ECG) circuit using Multisim. An ECG works by
measuring the electrical activity of a heartbeat. Measurements are taken by examining
the electrical activity from every beat of the heart. Typically, this occurs with an
oscillation frequency of 1.3 Hz, which is equivalent to 80 beats per minute.
In a real-world scenario, your readings would be subject to noise and bias. You will
need to account for these factors as you complete this lab. While the noise may be
minimal or non-existent in Multisim, you will still need to account for these factors as you
complete this lab. First, you will amplify the initially quite small input signal. Then, you
will condition the signal to create a heartbeat reading that is as accurate as possible.
Figure 1 Heartbeat
3
Learning Objectives
After completing this lab, you will be able to complete the following activities:
4
Expected Deliverables
In this lab, you will design and implement a conditioned amplification system based on a
specific real-world scenario. You will be responsible for many decisions, and you will
need to test your finished system to confirm that it fulfills the requirements of the real-
world scenario.
You can refer to previous labs for help and information, and while progressing through
this lab, you will answer assessment questions that will guide you through the design
and implementation process.
5
Section 1: Amplifiers
You are responsible for designing a circuit to amplify and filter a noisy input signal. In
the real-world, your circuit could be placed in ECG machines and in turn used by
medical professionals. Your circuit should be able to:
Detect a heartbeat
Amplify the detected signal
Condition the signal so that the signal is as clear as possible
The final output signal will be used by doctors to diagnose critical heart issues and thus
clarity is important. Remember, heartbeat signals are roughly 0.4 mVpp with an
oscillation frequency of 1.3 Hz. This equates to approximately 80 beats per minute.
6
1.2 Theory and Background
Video Summary
7
Amplifiers
Amplifiers convert energy from a power source to increase the amplitude of an input
signal. This is important to the outlined real-world scenario because the input signal
from a heartbeat has a peak to peak voltage of roughly 0.4 mV. This signal is extremely
small and thus must be amplified in order for it to be visible. A common way to rate this
magnification is the ratio of the voltage measured at the output port to the voltage
measured at the input port. This ratio is typically referred to as gain.
In previous labs, you explored various types of amplifiers and their applications. Some
of the amplifiers you may recall include differential amplifiers, inverting amplifiers,
instrumentation amplifiers and non-inverting amplifiers.
As you think about your design, you will need to consider the various characteristics of
each amplifier and choose the amplifier you feel will benefit your design the most. There
may be more than one appropriate choice. The following section will briefly review key
equations and features of each amplifier type. Use this to aid you as you work on your
design.
Inverting Amplifiers
Equation 1-1
−R f
V out = ∙V¿
R¿
8
Equation 1-1 describes the voltage output for an inverting amplifier. Where V in is the
input peak to peak voltage in volts (V), Vout is the output peak to peak voltage in volts (V)
and R refers to the resistance measured in ohms (Ω) of a particular resistor.
Equation 1-2
V out −R f
Gclosed loop = =
V¿ R¿
Equation 1-2 describes the gain for a closed loop inverting amplifier .
https://en.wikipedia.org/wiki/Operational_amplifier_applications#Inverting_amplifier
9
Non-Inverting Amplifiers
Equation 1-3
R1 + R2
V out =V ¿ ∙
R1
Equation 1-4
V out R1 + R2
Gclosed loop = =
V¿ R1
Equation 1-4 describes the voltage gain for a closed loop inverting amplifier.
10
Differential Amplifiers
A differential amplifier amplifies the difference in voltage between its inputs. This makes
this type of circuit a subtractor. Inverting and non-inverting amplifiers are op-amps
where one input is connected to ground. A differential amplifier is an op-amp where both
input ports receive an input voltage.
Equation 1-5
Rf Rg R 1+ R f
V out =−V 1 ∙ +V 2 ∙ ∙
R1 R 2+ R g R1
Note: There is also a simplified case of the voltage output equation when R 1 = R2 and Rf
= Rg:
Equation 1-6
Rf
V out = (V −V 1 )
R1 2
Equation 1-7
11
V out
G=
V 2−V 1
12
Instrumentation Amplifiers
An instrumentation amplifier combines properties like low DC offset, very high input
impedance and high common-mode rejection, which is the rejection of unwanted input
signals common to both input leads. They are constructed by connecting two buffered
amplifiers to a differential amplifier.
Equation 1-8
2 R1 R3
V out =(V 2−V 1 )∙ 1+ ( )( )
∙
R gain R 2
Equation 1-9
V out 2 R1 R3
G=
V 2−V 1
= 1+( ∙
R gain R2 )( )
13
Equation 1-9 describes the voltage gain for an instrumentation amplifier.
Often with instrumentation amplifiers, they are constructed so that R 1 = R2 = R3 and only
Rgain is adjusted to change properties of the amplifier.
Instrumentation amplifiers have the benefit that they do not draw current from the
source being measured.
14
Amplifier Considerations
Clipping
Vout is the output peak to peak voltage of the amplifier. However, sometimes the power
supply range cannot support the output voltage. When this happens, the output signal is
clipped. If the peak to peak voltage range is less than the power supply range, the
clipping could be rectified by adjusting the reference voltage, a pin on the integrated
circuit. The reference voltage simply shifts the midline of the output voltage according to
the value of Vref.
Offset Voltage
When using an ECG, the goal is to measure the voltage difference between the
electrodes, however, there will most likely be another voltage present too. This is called
the offset voltage. The offset voltage is a property of amplifiers, particularly operational
amplifiers. An amplifier is responsible for amplifying the difference between its input
voltages, thus, when the difference is 0, the amplified difference should also be 0.
Temperature, age, manufacturing processes and a variety of other factors can result in
the input transistors varying slightly. This can result in a zero difference being amplified
to a non-zero difference. The offset voltage will not be an issue in Multisim but is
something to consider when working outside of a simulation.
15
Check Your Understanding
Note: The following questions are meant to help you self-assess your understanding so
far. You can view the answer key for all “Check your Understanding” questions at the
end of the lab.
1.1 What is the gain of a circuit where ΔVin = 2V and Vout = 10V?
A. 0.2
B. 5
C. 8
D. 20
1.2 What is the closed loop gain of an inverting amplifier where the input voltage is 70
mVpp, Rin = 20kΩ and Rf = 140kΩ?
A. -7
B. -0.143
C. -2
D. -0.742
16
1.2 Implement: Designing an Amplifier
Given the real-world scenario defined, consider the important aspects of the signal that
will need to be captured. Thinking back to your amplification labs, consider which
amplifier characteristics will be most important to have when addressing the real-world
scenario. Consider the steps of the engineering design process when creating your
circuit. The basic steps of the design process are as follows:
You will begin the lab in Multisim, which will give you access to unlimited possibilities
regarding details such as resistor and capacitor values. Then, you will be expected to
reproduce this virtual circuit on a breadboard where you only have access to specific
components. You may want to keep the TI Electronics Kit for NI ELVIS III in mind when
constructing your circuit in Multisim, or you may choose to create an optimal virtual
solution.
Note: When working in Multisim, default signal generators will have no noise on the
output signal, however, this is unrealistic. To more closely recreate a real heartbeat, we
will utilize a preconfigured waveform. This will look like a 0.4 mVpp, 1 Hz signal with
white noise mixed in.
Note: You may need to adjust the scale settings on your output graph. It is
recommended that you run the simulation for at least 2 seconds and then set the time
axis to range from 0s to 2s and the voltage axis to range from -2 mV to 2 mV.
17
An important measurement when dealing with amplification and attenuation is the
signal to noise ratio. The signal value is the amplitude of the unaffected signal, in
this case the large peak which occurs at roughly 492 ms. The noise value is the
peak to peak voltage of any of the smaller noisy peaks.
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
1.6 Given the measurement scenario, which amplifier characteristics will be important
for your design?
______________________________________________________________________
______________________________________________________________________
1.7 Thinking of the various amplifiers you have explored, which amplifier(s) would
work toward the requirements of the measurement scenario?
______________________________________________________________________
______________________________________________________________________
1.8 Which amplifiers don’t meet the requirements of the scenario, and why?
______________________________________________________________________
______________________________________________________________________
18
Instructions:
Think about what is required of your ECG, and then select an amplifier type that
you feel best meets these requirements.
In Multisim, wire a circuit that contains your selected amplifier. Use the provided
noisy waveform as the input signal.
Note: When wiring the waveform to your amplifier, remove the resistor that is present in
the provided circuit.
1.9 After implementing your circuit in Multisim, what is the peak to peak voltage output
of your amplifier?
______________________________________________________________________
______________________________________________________________________
1.10 Did your amplifier work how you wanted it to? What happened?
Note: If you did not get the desired result, go back and redesign it or try another
amplifier.
______________________________________________________________________
______________________________________________________________________
1.11 What is the gain of your circuit? Recall from the provided equations that gain is
measured as Vout / ΔVin.
______________________________________________________________________
______________________________________________________________________
1.12 Describe your output waveform. Is it cut off? Centered? Noisy? Etc.
______________________________________________________________________
19
______________________________________________________________________
1.13 Explain how this amplified signal would be effective in the real-world example.
Would it be effective?
______________________________________________________________________
______________________________________________________________________
Note: Include a picture or screenshot of your final amplifier circuit and its output signal
with your finished lab.
20
Section 2: Filters
Amplifying a signal is often necessary, especially when dealing with voltage differences
as small as a heartbeat. Unfortunately, as you saw in Section 1, when a signal is
amplified, so is the noise on the signal. As a result, you need a way to remove the noise
from the signal so that just the portion of interest is amplified. This is especially
important when dealing with ECGs as this final outputted signal is used for diagnostics,
it is essential that the medical professional be analyzing an accurate output.
Thus, following amplification, the signal must be filtered to remove the noise. It doesn’t
make sense to attenuate the signal prior to amplifying it, as the difference between the
noise and the actual signal is often too small. As a result, filtering must happen after
amplification.
An electronic filter is a circuit component that allows certain frequencies to transmit and
rejects others. They are used in multiple devices such as radios and telephones. This
lab analyzes four main types of filters: low pass, high pass, band pass and band stop.
These filters can be either passive or active. Passive filters are constructed using
capacitors, resistors or inductors. Active filters are comprised of both passive filter
components and an amplifying component. They require an external power source.
21
Low Pass Filter
The low pass filter allows low-frequency signals to pass through it. Any signal above the
filter’s cut-off frequency is attenuated.
Equation 2-1
Xc 1
V out =V ¿ ∙ X c= Z=√ R 2+ X c 2
Z 2 πfC
Equation 2-1 describes the voltage output for a passive low pass filter.
Equation 2-2
1
f C=
2 πRC
Equation 2-2 describes the cut-off frequency of a passive low pass filter.
22
Figure 2-2 Active low pass filter
Equation 2-3
1
f C=
2 π R1 C 1
Equation 2-3 describes the cut-off frequency of an active low pass filter.
Equation 2-4
R3
G=1+
R2
23
Read more about low pass filters here: https://en.wikipedia.org/wiki/Low-pass_filter
24
High Pass Filter
The high pass filter is the opposite of the low pass filter. It allows high-frequency signals
to pass through it. Any signal less than the filter’s cut-off frequency is attenuated.
Equation 2-5
R 1
V out =V ¿ ∙ X c= Z=√ R 2+ X c 2
Z 2 πfC
Equation 2-5 describes the voltage output for a passive high pass filter .
Equation 2-6
1
f C=
2 πRC
Equation 2-6 describes the cut-off frequency of a passive high pass filter.
25
Figure 2-4 Active high pass filter
Equation 2-7
1
f C=
2 π R1 C 1
Equation 2-7 describes the cut-off frequency of an active high pass filter.
Equation 2-8
R3
G=1+
R2
26
Band Pass Filter
The band pass filter has a lower ( fl ) and upper threshold ( fh ), any frequency that falls
between these two values will pass through. Too small and too large signals are
attenuated. The span of frequencies which can pass through are referred to as the
bandwidth.
Equation 2-9
1
f CL=
2 π RlCl
Equation 2-9 describes the cut-off frequency of the low pass filter.
Equation 2-10
1
f CH =
2 π Rh Ch
27
Figure 2-6 Active band pass filter
The cut off frequencies of the active filter are calculated using the same equations as
the passive band pass filter.
Equation 2-11
R3
G=1+
R2
28
Band Stop Filter
The band stop filter is the opposite of a band pass filter. It has a lower and an upper
threshold, however, the band stop filter attenuates any frequency that falls between
these two values. Frequencies below the lower threshold or above the upper threshold
can pass through the filter. The low pass filter element is formed by R 1, R2, and C1. The
high pass filter element is formed by C2, C3, and R3.
Equation 2-12
1
f N=
4 πRC
Equation 2-12 describes the notch frequency at which maximum attenuation occurs.
29
Check Your Understanding
Note: The following questions are meant to help you self-assess your understanding so
far. You can view the answer key for all “Check your Understanding” questions at the
end of the lab.
2-1 A circuit must be constructed such that no high frequency signals pass through,
which filter should be chosen?
A. Low pass filter
B. High pass filter
C. Band pass filter
D. Band stop filter
2-2 What is the cut off frequency of a high pass filter with a 230 kΩ resistor and a 67 pF
capacitor?
A. 96.8 kHz
B. 18.7 kHz
C. 10.3 kHz
D. 5.4 kHz
30
2.2 Implement: Designing A Filter
In the previous section, you built a simulated circuit and observed noise on the output
signal. Now it is time to condition your signal. In the real world, there will be noise on the
signal and it is imperative that this noise be reduced or eliminated so that medical
professionals may analyze an accurate signal.
2.3 What does the filter need to do in your circuit? What frequencies should pass
through it? What frequencies should not?
______________________________________________________________________
______________________________________________________________________
Based on what is required of your filter, select one of the four discussed filter
types.
2.4 Which filter did you choose? Why did you choose that filter?
______________________________________________________________________
______________________________________________________________________
2.5 To build your filter, you need to decide what cut off value(s) your filter will have.
Your filter will be comprised of different capacitor(s) and/or resistor(s) depending on
what your cutoff frequency is. Include the bound(s) you chose and the math that
helped you to determine which valued capacitor(s) and/or resistor(s) to use to stay
within your restraints:
______________________________________________________________________
______________________________________________________________________
31
Instructions:
Construct the filter in Multisim.
Use the AC Sweep mode in Multisim to create a bode plot of your filter.
______________________________________________________________________
______________________________________________________________________
Note: Include a picture or screenshot of your final working filter as well as a picture or
screenshot of its bode plot with your final lab.
Now, connect the output of your amplifier to the input of your filter.
Place two voltage analyzers, one at the output of the amplifier and one at the
output of the filter.
Run the circuit for at least 3 seconds.
Note: Include a picture or screenshot of your working circuit and a picture of the output.
2.7 What do you observe about the final output compared to the amplifier output?
______________________________________________________________________
______________________________________________________________________
2.8 Compute the signal to noise ratio of the final output. How does it compare to the
signal to noise ratio of the original signal that you calculated previously?
______________________________________________________________________
______________________________________________________________________
32
Section 3: Putting It All Together
Now is the time for you to test your final implementation. Consider a methodology for
confirming the measured signal.
Configure the Arbitrary Waveform Generator to output a custom wave, and use the
ECG_No_Noise.csv file to output a heartbeat signal.
Important Note: Since heartbeats are so small, the noise of the system will be much
greater than the original signal. If your signal noise from the waveform generator is
overpowering your output signal, you can use the gain setting on the Arbitrary
Waveform Generator and then adjust the gain of your amplifier accordingly. For
example, if the total gain of your circuit is 1000, and you set the gain of the generator to
be 100, then you could adjust the gain of your amplifier to be 10.
Instructions:
3.1 Document your testing setup and criteria. How will you confirm that your signal is
being filtered?
______________________________________________________________________
______________________________________________________________________
3.2 Does your circuit fulfill the requirements of the real-world scenario? Explain why this
is the case. If the requirements were not met, how could you improve upon your
design?
______________________________________________________________________
______________________________________________________________________
3.3 Describe the output waveform. Is it cut off? Centered? Noisy? Etc.
33
______________________________________________________________________
______________________________________________________________________
3-4 Does your output signal still have noise? If so, what could you do to eliminate or
reduce it?
______________________________________________________________________
______________________________________________________________________
Note: Take a picture of your final amplified and filtered “heartbeat” as well as a picture
of the connected circuit.
34
3.2 Conclusion
3-5 How could you improve the circuit? What types of new features could be used for
this system?
______________________________________________________________________
______________________________________________________________________
3.6 What was most challenging when you were designing and implementing your
circuit? How did you overcome these challenges?
______________________________________________________________________
______________________________________________________________________
3.7 How could your system be improved? Consider performance, reliability and real-
world applications.
______________________________________________________________________
______________________________________________________________________
35
Answer Key – Check Your Understanding Questions Only
1.1 B
1.2 A
1.3 D
2.1 A
2.2 C
36