Nothing Special   »   [go: up one dir, main page]

Lab 3 - ADC and Sampling

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 44

Lab Manual:

Measurements and Instrumentation


Using the Measurements Part Kit for NI ELVIS III

Lab 3: ADC and Sampling


© 2018 National Instruments
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.

LabVIEW and National Instruments are trademarks of National Instruments.

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 3: ADC and Sampling
In this lab you are going to learn about analog-to-digital conversion (ADC), sampling,
and what characteristics define each. 

You will run pre-built examples to identify the effect of resolution and sampling rate,
when converting a real-world signal into a digitized signal.

Next, you will examine how much resolution is available for use with your temperature
and strain measurement scenarios, and what the smallest measurable change detected
by the sensor is.

Finally, you’ll implement a simple data acquisition example, with configurable resolution
and sampling rates.

Figure 1-1 Resolution of ADC

3
Learning Objectives

After completing this lab, you will be able to:

1. Discuss the process of analog to digital conversion, and the effects of resolution
and range on the measured signal.
2. Discuss the complexity of sampling theory, including multiplexing and Nyquist
frequency.
3. Identify the effect of resolution, sampling rate, and range required for the given
measurement scenario.
4. Implement a simple data acquisition task.

4
Required Tools and Technology

Platform: NI ELVIS III  View User Manual: http://www.ni.com/en-


us/support/model.ni-elvis-iii.html
 Use the NI ELVIS III  View Tutorials:
instruments as https://www.youtube.com/playlist?
needed list=PLvcPIuVaUMIWm8ziaSxv0gwtshBA2dh_
M
Note: The NI ELVIS III  Install Soft Front Panel support:
Cables and Accessories Kit http://www.ni.com/documentation/en/ni-elvis-
(purchased separately) is iii/latest/getting-started/installing-the-soft-front-
required for using the panel/
instruments. 

Hardware: NI ELVIS III  View Breadboard Tutorial:


Default Prototyping Board http://www.ni.com/tutorial/54749/en

Hardware: Measurements Components used in this lab:


Parts Kit
 NTC 10 kΩ Thermistor
 C2A-13-125LW-350 Strain Gauge
 Various discrete components to complete
signal conditioning circuits

Software: LabVIEW  Before downloading and installing software,


refer to your professor or lab manager for
Version 18.0 or Later information on your lab’s software licenses
and infrastructure
Toolkits and Modules:  Download & Install for NI ELVIS III:
http://www.ni.com/academic/download
● LabVIEW Real-Time  View Tutorials:
Module http://www.ni.com/academic/students/learn-
● NI ELVIS III Toolkit labview/

5
Expected Deliverables

In this lab, you will collect the following deliverables:

 Check for understanding questions


 Calculations
 Observations
 Completed programs

Your instructor may expect you complete a lab report. Refer to your instructor for
specific requirements or templates.

6
1.1 Theory and Background

Figure 1-2 Video Screenshot. View the video here: https://youtu.be/Z-sDHDI6FFY

Video Summary

 An analog-to-digital converter (ADC) is a chip that provides a digital


representation of an analog signal at an instant in time
 Resolution is the number of bits the ADC uses to digitize a signal
 Device range refers to the minimum and maximum analog signal levels that the
ADC can digitize
 The sampling rate determines how often an analog-to-digital conversion takes
place
 The Nyquist Sampling Theorem explains the relationship between the sample
rate and the frequency of the measured signal

7
Analog to Digital Conversion (ADC)

Analog signals from sensors must be converted into digital signals before they are able
to be manipulated by digital equipment, such as computers. An ADC is a chip that
provides a digital representation of an analog signal at an instant in time. In practice,
analog signals continuously vary over time and an ADC takes periodic “samples” of the
signal at a predefined rate. These samples are transferred to a computer over a
computer bus where the original signal is reconstructed from the samples in software.

How well an ADC performs is measured by both its bandwidth and its signal-to-noise
ratio (SNR). Bandwidth describes the range of frequencies a device can accurately
measure. It is defined as the frequency at which a sinusoidal input signal is attenuated
to 70.7 percent of its original amplitude, which is also known as the -3 dB point.
Bandwidth is the difference between the corner frequencies. SNR is the ratio of the
power of the input signal level to the power of the noise level and is usually expressed
in dB. It can also be calculated using the root mean square (RMS) value of the signal
amplitude and the noise amplitude.

DAQ Hardware

DAQ hardware acts as the interface between a computer and signals from the outside
world. It primarily functions as a device that digitizes incoming analog signals so that a
computer can interpret them. The three key components of a DAQ device used for
measuring a signal are the signal conditioning circuitry, analog-to-digital converter
(ADC), and computer bus. Many DAQ devices include other functions for automating
measurement systems and processes. For example, digital-to-analog converters
(DACs) output analog signals, digital I/O lines input and output digital signals, and
counters/timers count and generate digital pulses.

Here are some important DAQ hardware and software devices to note:

 A device driver which is a program that when installed on a computer will allow
the computer to interface with hardware connected through the computer's buses
 A computer bus which is a communication system that transfers data between
components inside of a computer or between the computer and another device

There are many examples of computer buses including:

 Universal Serial Bus (USB)


 Peripheral Component Interconnect (PCI)
 Peripheral Component Interconnect Express (PCIe)
 Ethernet (LAN)

8
 PCI extensions for Instrumentation (PXI)

You can read more about each bus and the benefits of each here: www.ni.com/white-
paper/9401/en/ .

Resolution

Bits of resolution refer to the number of digits used by the ADC to represent the analog
signal after it’s been converted to a digital representation. This defines the number of
unique levels that a device can use to represent a signal. One way to understand the
concept of resolution is by comparison with a meter stick. Divide a meter stick into
millimeters; what is the resolution? The smallest tick on the meter stick is the
resolution–or 1 out of 1,000. 

The resolution of an ADC is a function of how many parts the maximum signal can be
divided into. The amplitude resolution is limited by the number of discrete output levels
an ADC has. A binary code represents each division; as such, the number of levels can
be calculated as follows: # of levels = 2Resolution

Let's look at the equation for resolution a bit closer. Imagine that you have a 12-bit
resolution on your ADC. You can apply this information to the formula to determine the
number of levels that the device can represent. This would be applied like this: 

# of levels = 2Resolution = 212 = 4,096 levels 

Equation 1-1

The resolution you need depends on your application. Keep in mind that a device with
high resolution doesn’t necessarily mean that it has high accuracy. However, the
achievable accuracy of an instrument is limited by the resolution. Resolution limits the
precision of a measurement; the higher the resolution (number of bits), the more precise
the measurement.

One of the reasons for using a high-resolution digitizer is to measure small


signals. Many signals have both a small signal and a large signal component. Using a
large range, you could measure the large signal but the tiny signal would be in the noise
of the large signal. On the other hand, if you use a small range, then you’d clip the large
signal and your measurement would be distorted and invalid. Thus, for applications that
involve dynamic signals (signals with large and small voltage components), you need a
high-resolution instrument, which has a large dynamic range (the ability of the digitizer
to measure small signals in the presence of large ones).

9
When a signal is clipped, it has been distorted and thus it is limited once it reaches its
threshold. A signal being clipped may occur under any of the following instances:

 If a sensor measuring a signal has data constraints on it


 When a signal becomes digitized 
 Anytime a signal is transformed, whether it is a digital signal or an analog signal

It is important to note that sometimes circuit designers choose to include clips in their
designs to ensure their signals are kept within a desired range. Even if an amplifier is
applied, it will only amplify up to its capacity and no more. 

10
Range

Device range refers to the minimum and maximum analog signal levels that the ADC
can digitize. Many measurement devices can select from several ranges by changing
from unipolar mode to bipolar mode or by selecting from multiple gains, allowing the
ADC to take full advantage of its resolution to digitize the signal.

Unipolar mode means that a device only supports a range of 0 V to +X V. Bipolar mode
means that a device supports a range of -X V to +X V. Some devices support only one
mode or the other, while other devices can change from unipolar mode to bipolar mode.

Devices that can change from unipolar to bipolar mode are able to select the mode that
best fits the signal to measure. The first chart of the following figure illustrates unipolar
mode for a 3-bit ADC. The ADC has eight digital divisions in the range from 0 to 10 V. In
bipolar mode, the range is -10.00 to 10.00 V. The same ADC now separates a 20 V
range into eight divisions. The smallest detectable difference in voltage increases from
1.25 to 2.50 V, and you now have a much less accurate representation of the signal.
The device selects the best mode available based on the input limits you specify when
you create a virtual channel.

11
Figure 1-3 Bipolar mode offers greater range but less resolution

12
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 How many levels are present in a reading with a resolution of 20 bits?

A. 524,288
B. 32,768
C. 128
D. 1,048,576

1.2 Consider an ADC with 6-bit resolution. When operating in unipolar mode, the ADC
supports a 0 V-to-10 V range. What is the smallest detectable difference in voltage?

A. 0.15625 V
B. 0.3125 V
C. 0.5 V
D. 0.3 V

1.3 When operating in bipolar mode, a 6-bit-resolution ADC supports a -10 V to +10 V
range. What is the smallest detectable difference in voltage by the ADC in bipolar
mode?

A. 0.15625 V
B. 0.3125 V
C. 0.5 V
D. 0.3 V

13
Sampling

A/D converters (ADCs) are an integral part of data acquisition (DAQ) boards. One of the
most important parameters of an analog input system is the rate at which the DAQ
board samples an incoming signal. The sampling rate determines how often an analog-
to-digital (A/D) conversion takes place. A fast sampling rate acquires more points in a
given time and can form a better representation of the original signal than a slow
sampling rate. Sampling too slowly may result in a poor representation of your analog
signal.

To use digital signal processing techniques, you must first convert an analog signal into
its digital representation. In practice, this is implemented by using an analog-to-digital
(A/D) converter. Consider an analog signal x(t) that is sampled every ∆t seconds. The
time interval ∆t is known as the sampling interval or sampling period. Its reciprocal, 1/∆t,
is known as the sampling frequency, with units of samples/second. Each of the discrete
values of x(t) at t = 0, ∆t, 2∆t, 3∆t, etc., is known as a sample. Thus, x(0), x(∆t),
x(2∆t), ...., are all samples. The signal x(t) can thus be represented by the discrete set
of samples {x(0), x(∆t), x(2∆t), x(3∆t), …, x(k∆t), … }.

When measuring periodic signals, it’s important to consider how frequently the signal is
being sampled and the effect this will have on the signal.

The sampling theorem states that, if the sampling rate exceeds twice the maximum
signal frequency, the original signal can be reconstructed in the receiver with minimal
distortion. The sampling theorem is used in practice to determine minimum sampling
speeds.

Nyquist Frequency

The Nyquist Sampling Theorem explains the relationship between the sample rate and
the frequency of the measured signal. It states that the sample rate (fs) must be greater
than twice the highest frequency component of interest in the measured signal. This
frequency is often referred to as the Nyquist frequency, f N.

The formula for calculating the sample rate is as follows: f s > 2 * fn 

This means that the sample rate should be greater than twice the Nyquist frequency. In
order to represent the shape of a signal, you need to sample frequencies around five
times greater than the signal frequency. When the Nyquist criterion is violated,
frequency components above half the sampling frequency appear as frequency
components below half the sampling frequency, resulting in an erroneous
representation of the signal. 

14
Alias Frequency

If a signal is sampled at a sampling rate smaller than twice the Nyquist frequency, false
lower frequency components appear in the sampled data. This phenomenon is referred
to as aliasing. 

The alias frequency (fa) can be calculated to determine how an input signal at a
frequency over the Nyquist frequency appears. It is the absolute value of the closest
integer multiple of the sample frequency minus the frequency of the input signal. 

For example, consider a signal with a sample frequency of 100 Hz, and the input signal
contains the following frequencies: 25 Hz, 70 Hz, 160 Hz, and 510 Hz. Frequencies
below the Nyquist frequency of 50 Hz are sampled correctly; those over 50 Hz appear
as alias.

Here are the calculations for the alias frequencies:

 Alias F1 = [100-70] = 30 Hz
 Alias F2 = [2 * 100-160] = 40 Hz
 Alias F3 = [5 * 100-510] = 10Hz

Before a signal is digitized, you can prevent aliasing by using anti-alias filters to
attenuate the frequency components at and above half the sampling frequency to a
level below the dynamic range of the analog-to-digital converter (ADC). If a digitizer has
a full-scale range of 80 dB, then frequency components at and above half the sampling
frequency must be attenuated to 80 dB below full scale.

These higher frequency components do not interfere with the measurement. If you know
that the frequency bandwidth of the signal being measured is lower than half the
sampling frequency, you can choose not to use an anti-aliasing filter.

Note: An antialiasing filter is a lowpass filter that attenuates any frequencies in the input
signal that are greater than the Nyquist frequency, and must be introduced before the
ADC to restrict the bandwidth of the input signal to meet the sampling criteria. Analog
input channels can have both analog and digital filters implemented in hardware to
assist with aliasing prevention.

15
1.4 Given a type of measurement, which considerations of sampling rates should be
accounted for?

A. Frequencies within the frequency band of interest should be filtered and the
bandwidth of the digitizer you use should be higher than the signal you want to
acquire.
B. Frequencies outside the frequency band of interest must be filtered and the
bandwidth of the digitizer you use should be lower than the signal you want to
acquire.
C. Frequencies outside the frequency band of interest must be filtered and the
bandwidth of the digitizer you use should be higher than the signal you want to
acquire.
D. Frequencies within the frequency band of interest should be filtered and the
bandwidth of the digitizer you use should be lower than the signal you want to
acquire.

1.5 Consider an input signal containing frequencies 25 Hz, 45 Hz, 75 Hz and 130 Hz. At
what minimum rate must it be sampled so that it can accurately be reconstructed
from the samples?
A. 130 S/s
B. 260 S/s
C. 65 S/s
D. 100 S/s

1.6 Consider the preceding signal again and suppose that it is sampled at a rate of 120
S/s. Which frequency(ies) undergoes(o) aliasing and what are their respective alias
frequencies?

A. All frequencies undergo aliasing. They are all under the120 limit.
B. 75 Hz and 130 Hz. Their respective alias frequencies are 30 Hz and 110 Hz.
C. 45 Hz and 25 Hz. Their respective alias frequencies are 30 Hz and 70 Hz.
D. 75 Hz and 130 Hz. Their respective alias frequencies are 45 Hz and 10 Hz.

16
Multiplexing the ADC and Digital to Analog Conversion (DAC)

Multiplexing the ADC

On the ELVIS III device, the analog input channels share a single ADC. This means that
if multiple channels are being acquired, they need to take turns using the ADC, and the
sampling rate is limited by this multiplexing setup.

The sampling rate for a single channel running through the ADC is 1.25 million samples
per second, or 1.25MS/s. When multiplexed (i.e. when measuring multiple channels),
the total rate achievable drops to 1MS/s and that amount is shared among all channels.

For example, sampling four channels would allow you 0.25 MS every second, per
channel.

Digital to Analog Conversion (DAC)

The simplest way to look at DAC is that it is the opposite of ADC. Digital signals
represented by a digital system are converted and output as analog signal. DACs have
the same concept of resolution, but in reverse.

DACs are utilized in the ELVIS III device, as in all analog output devices, to generate
the signal being output on the analog output lines.

You can read more about DACs here: https://en.wikipedia.org/wiki/Digital-to-


analog_converter

17
1.2 Exercise: Identify the Effect of Resolution

From the courseware zip file provided with the course materials, open the LabVIEW
Project called ADC and Sampling.lvproj, configure the IP address of the NI EVIS III,
then open the Virtual Instrument (VI) called Resolution Example.vi.

This program simulates the resolution of an ADC. The slider shown at the top indicates
the bits of resolution. The bottom graph shows the original analog signal we are
attempting to measure. The top graph shows the measured signal for the chosen
number of bits of resolution.

Figure 1-4 Resolution Example.vi

1. Run the program and set the slider successively to 2, 3, 4, and 12 bits of
resolution.

18
2. From the Measured Signal graph, when possible count the levels of reading and
find the minimum signal-amplitude detected at each bit of resolution chosen. If it
is not possible to distinguish the number of readings, note that it is not possible.
3. Record your observation in the table below.

Table 1-1 Resolution Readings: -1 V to 1 V


Bits of Resolution # of Reading Levels Minimum Amplitude
2
3
4
12

1.7 These measurements were for a range of -1 V to 1 V. How would the minimum
amplitudes be affected if the range was -5 V to 5 V?

_____________________________________________________________________

_____________________________________________________________________

1.8 What would the minimum amplitude values be for a range of -5 V to 5 V? (Note: the
# of Reading Levels would be the same)

Table 1-2 Resolution Readings: -5 V to 5 V


Bits of Resolution # of Reading Levels Minimum Amplitude
2
3
4
12

19
1.3 Exercise: Identify the Effect of Sampling Rate

From the same LabVIEW project, open the Virtual Instrument (VI) called Sampling
Example.vi.

Consider this LabVIEW program which simulates the sampling rate of an ADC. The
bottom chart shows one full cycle of the original analog signal we are attempting to
read. The slider shown at the top controls the sampling rate (number of readings per
cycle) of the ADC. The top chart shows the measured signal at the indicated sampling
rate.

Figure 1-5 Sampling Example.vi

20
 Run the program and set the slider successively to 1, 2, 3, 4, 6, 10 and 20
Samples/cycle.

Note: The sampling rate is reflected in the number data points in the measured signal.
A real sampling rate would be measured in Hertz, but the interesting piece of
information is the sampling rate relative to the frequency of the repeating signal. For our
purposes, a 20Hz sampling of a 10Hz wave is functionally equivalent of a 100Hz
sampling of a 50Hz wave. So we’re displaying the number of samples per cycle of the
wave in question.

1.9 For each of the rates defined, record your observation of the signal. Include whether
or not a repeating wave is detectable.

Table 1-3 Sampling Example Observations


Sampling Rate Observation
1
2
3
4
6
10
20

Sampling Rate Over Multiple Periods

From the same LabVIEW project, open the Virtual Instrument (VI) called Sampling
Example2.vi.

This program shows the effect of the sampling rate on a signal when considered as
number of samples per 10 cycles.

 Set the slider to 5, 10, 20, 40 and 60.

1-10 In your own words describe why at 5 and 10 samples/cycle the signal is read as a
flat zero signal.
_____________________________________________________________________

21
_____________________________________________________________________

1-11 In your own words describe what is happening at 20 samples/10 cycles rate.
_____________________________________________________________________

_____________________________________________________________________

1-12 What happens when the slider is set to 8, 9, 11, and 15? How many cycles and
what shape of signal do you detect?
_____________________________________________________________________

_____________________________________________________________________

Nyquist Frequency

From the same LabVIEW project, open the Virtual Instrument (VI) called Nyquist.vi.

This program illustrates the effect of the Nyquist frequency. The top graphs show the
original signal components, which make up the complete original signal. It has
frequency components of 3 Hz, 5 Hz and 10 Hz.

The bottom-right graph represents the reconstructed signal from the frequency
components provided by the ADC after being sampled. For components whose Nyquist
frequency has not been achieved, an aliased signal will be generated.

The results of the measured components, whether aliased or not, are displayed in the
Reconstructed Signal Components (Hz) indicator.

The slider sets the frequency rate (Sample(s)/second). The LEDs indicate whether the
Nyquist frequency rate has been achieved for each component.

 Move the slider bar and observe the effect of different sampling rates on the
Nyquist condition of each component and what happens to the measured signal.

22
1-13 What is the Nyquist frequency of the complete signal, when all components are
included? (i.e. When does the measured signal match the original signal?)
_____________________________________________________________________

_____________________________________________________________________

1-14 With the sampling rate set to 4 Hz, what is measured? Which component is
aliased, and what is the resulting aliased frequency?

_____________________________________________________________________

_____________________________________________________________________

1-15 With the sampling rate set to 6 Hz, what is measured? Which component is fully
measured? Which components are aliased and in what way?

_____________________________________________________________________

_____________________________________________________________________

1-16 Set the sampling rate successively to 5, 10, 11 and 19 S/s. In each case record
which frequency component undergoes aliasing and its aliased frequency. Record your
answers below.

5 S/s 10 S/s 11 S/s 19 S/s


Frequency Aliasing Freq. Aliasing? Freq. Aliasing? Freq. Aliasing Freq.
Component ? (Y/N) Value (Y/N) Value (Y/N) Value ? (Y/N) Value
1
2
3

23
1.4 Exercise: Temperature Resolution

Identify/Calculate the Smallest Measurable Temperature Change

From the previous lab, you explored this measurement scenario:

 [Range] Monitor a heating chamber that has an internal temperature of 20°C at


the beginning of the test procedure, and determine if the heating chamber ever
exceeds 40°C.

 [Sensitivity] Consider that for the detectability of temperature changes, a 1-


degree change in temperature near the 40°C point should result in more than a
10mV change in voltage.

 [Linearity] Consider the linearity of the sensor. Linearity will be accounted for in
later activities.

Other Considerations:

 The measurement system should be able to detect changes in the air


temperature as quickly as possible. We won't specify a timing, because the heat
exchange properties of air come into effect. All else being equal, a faster
responding sensor will be better.

 The thermistor costs on the order of $1, whereas the RTD and thermocouple cost
on the order of $10.

In the first lab, you investigated the properties of 3 temperature sensors. In this lab, we
assume again that you chose the thermistor as your sensor. Follow this link to download
the spec sheet: https://cf-ts.mythinkscape.com/Thermistor.pdf

The ADC that we’ll be using is the one inside NI ELVIS III. You will find the spec sheet
at: http://www.ni.com/documentation/en/ni-elvis-iii/latest/appendix/specs/

1-17 Identify the resolution of the ADC and its largest measurement range.
_____________________________________________________________________

_____________________________________________________________________

24
1-18 Calculate the smallest measurable voltage change, assuming the ADC is using the
largest measurement range.
_____________________________________________________________________

_____________________________________________________________________

1-19 Identify the maximum sampling rate.


_____________________________________________________________________

_____________________________________________________________________

1-20 Identify the maximum multichannel (aggregate) sampling rate.


_____________________________________________________________________

_____________________________________________________________________

In the previous lab, you built a voltage divider to condition the signal incoming from the
thermistor. The measured voltage difference between a 40⁰C and 41⁰C measurement
was calculated to be approximately 43 mV.

1-21 Would this change be detected by your ADC? Why?


_____________________________________________________________________

_____________________________________________________________________

1-22 Given the temperature value of interest is 40⁰C and the sensitivity at this
temperature is 43mV / degree, what is the smallest measurable temperature change for
the ADC of the NI ELVIS III?
_____________________________________________________________________

_____________________________________________________________________

25
1.5 Exercise: Strain Resolution
Identify/Calculate the Smallest Measurable Strain Change

In the previous lab, you chose the strain gauge with model number C2A-13-125LW-350
and proceeded to use it in a certain described scenario. You can access the datasheet
for the strain gauge here: https://cfts.mythinkscape.com/ckeditor/Strain_Gauges.pdf.

Given that strain gauges demonstrate small changes in resistance (even smaller than
those of the thermistor), you built a Wheatstone bridge. This allowed for higher
sensitivity of measurement for smaller resistance changes.

1. Using the voltage resolution that was calculated in the previous section, identify
the smallest change in the strain that is measurable. You need to take into
consideration the following:

a. Ignore the amplifier that you built after the bridge circuit.

b. Identify the strain factor of your strain gauge. It should be given on the
packaging that the strain gauge is delivered in. If you don’t have access to
that number, use a gauge factor of 2.1.

c. A change in strain results in a change in resistance. This relationship is


defined by the gauge factor, as given here:
https://en.wikipedia.org/wiki/Strain_gauge

d. A change in resistance results in a change in voltage. This relationship is:

26
where BV is the source voltage provided to the bridge.

1-23 With the smallest measurable voltage, identify the smallest measurable strain.

Note: The strain is a dimensionless unit because it is a ratio of two lengths.

_____________________________________________________________________

_____________________________________________________________________

_____________________________________________________________________

_____________________________________________________________________

27
1.6 Implement: Acquire a Signal

Measuring the Temperature Circuit Output

You will have built the base of this circuit in a previous lab. Now you will connect Analog
Input 0 (AI0) to the voltage measurement of your thermistor.

Figure 1-6 Thermistor Measurement

28
1. Now that the sensor is connected, open the ADC - Thermistor LabVIEW project
that was provided in the courseware zip file.

2. Configure the IP address of your NI ELVIS III.

3. Open the Virtual Instrument (VI) called Thermistor.vi.

4. Run the VI to begin taking measurements.

5. Make sure the Range is set to +/- 5V, the Bits of Resolution is set to 16, and the
Sampling Rate is set to 1000.

6. This program acquires a voltage measurement from the AI0 channel with a
default sampling rate of 1 kHz. It compiles a running average of the last 10
readings, so that measurement fluctuations are decreased.

7. By pressing your fingers against the thermistor, you should increase the
temperature measured.

1-24 From a standing room temperature measurement, does the voltage increase or
decrease by increasing the temperature?
_____________________________________________________________________

_____________________________________________________________________

1-25 Does this correspond to an increase or decrease in resistance? And an increase or


decrease in temperature, according to the spec sheet for the thermistor?
_____________________________________________________________________

_____________________________________________________________________

1-26 With the system resting at room temperature, take a voltage measurement and
convert that voltage to a temperature measurement.
_____________________________________________________________________

_____________________________________________________________________

29
1-27 With the temperature increase, take a voltage measurement and convert that
voltage to a temperature measurement.
_____________________________________________________________________

_____________________________________________________________________

8. Set the Bits of Resolution to 2, 3, 4, and 5 successively. You should see your
measurement rounded to a much smaller amount of precision.

1-28 Set your Bits of Resolution to 5 and record your voltage. Then, set the Bits of
Resolution to 6 and the Range to +/- 10V and record your voltage again. Are these
values the same? Why?
_____________________________________________________________________

_____________________________________________________________________

9. Set your Range to +/- 1V.

1-29 Describe the effect of clipping that occurs.


_____________________________________________________________________

_____________________________________________________________________

10. Set your Sampling Rate to 2000.

1-30 Describe the effect of increasing the sampling rate on the speed of data being
acquired.

_____________________________________________________________________

_____________________________________________________________________

30
31
1.7 Implement: Vibration

The Impact of Resolution on Vibration

So far you have built a data acquisition system that simply reads an analog input from a
conditioned thermistor. The focus of this current section is to observe how resolution
and sampling rate impact the acquisition of a signal from a vibration sensor. Vibration
sensors emit a signal that is “rich” in relatively high-frequency components. This makes
them a good choice to demonstrate the application of the sampling rate.

We will only go through those details that are relevant to this lab. The remaining details
concerning vibration will be covered in later labs.

The sensor that we’ll be using to measure vibration is provided in your kit. Its data sheet
can be found here: https://www.digikey.ca/product-detail/en/te-connectivity-
measurement-specialties/1006015-1/223-1306-ND/5277266%C2%A0

We will go over the specifics of the sensor in Lab 8. For now, it is important to note how
the sensor functions (see the figure below). When the beam is mounted horizontally,
acceleration in the vertical plane creates bending in the sensor tape, due to the inertia
of the mass at its tip. strain in the tape creates a piezoelectric response, which may be
detected as a charge or voltage output across the electrodes of the sensor. The sensor
outputs 1Volts per 1g acceleration. We will use the sensor in measuring vibration
signals with frequency components less than 75. This is because the resonance
frequency of the sensor is 75. At this frequency, the sensor will output 5V/g and we
want to avoid that.

Figure 1-6: Vibration Sensor Figure 1-7: Sensor’s Strip Strain Direction

The vibration signal that we would be measuring is one emitted by a computer fan.
Computer fans are well centered around their axis of rotation. Furthermore, they are
fitted within a frame that provides them with further stability when fastened to a support.
In order to obtain a vibration that would cause the required bending in the sensor’s tape,

32
we need the fan to emit a stronger vibration that wound cause acceleration that could
be detected. One way to do this is to attach a weight to one of the fan blades to disturb
the balance of the fan around its axis of rotation. We used a paper clip to do that (see
the figure below).

Figure 1-8

Another criteria to consider is to fit the fan to an object that will allow its lack of balance
to generate a wobbly movement. We attached our fan to a frame using elastic ropes
that would allow for just that.

Connecting the fan to a voltage source: The fan we used is a typical four-wire computer
fan. The easiest way to get these fans running is to:

 Ground the black wire.

 Connect the yellow and red wires to a DC voltage source. The stronger the
voltage the higher the spin (and the frequency) of the fan would be. We used 5 V
DC source from the NI ELVIS III. You may use 10 V or 15 V depending on your
vibration device.

Connecting the sensor: Connect one electrode of the sensor to channel AI0 in the NI
ELVIS III and the other electrode to channel AI4 (see the figure below). In the following
section, we will explain the reason for connecting the wires to these channels.

33
Figure 1-9 Connecting the Vibration Sensor to the NI ELVIS III

At this stage you do not need any circuit conditioning. Hence the differential voltage
read from the electrodes is fed directly into the channel. This is because our interest is
simply to read the vibration signal. However, we do need to restrict our experiment to
reading signals emitting vibrations with frequency components less than 75 Hz. In Lab
8, we will deploy a frequency band-pass in order to attenuate certain unwanted
frequencies and noise.

The Impact of Sampling Rate on Vibration

We have already illustrated the impact of the sampling rate of an ADC device on the
acquired signal using an artificially generated signal. We will further illustrate that point
in the context of a signal obtained from a vibration sensor.

The minimum sampling rate provided for in the Analog Input Function in LabVIEW is 1
KHz. This rate is way above the Nyquist frequency required to accurately measure the
signal from our sensor (Recall the Nyquist frequency of a signal is double its largest
frequency component). Since we are not excepting frequencies above 65Hz, a sampling
rate of 130 Hz would still allow us to reconstruct the signal. To this end, we will
programmatically manipulate the signal read from the sensor at 1 KHz in order to
simulate sampling rates that are less than 130 Hz.

34
One way of doing that is to decimate the signal read. For example, suppose that the NI
ELVIS III is acquiring the signal in batches of 1000 samples at a time at the rate of
1KHz. Decimating the signal by 10 means that for each 10 samples in the batch, the
last 9 are discarded and the first is kept. This is equivalent to saying that the signal is
being acquired in batches of 100 samples each one second. This way we manage to
simulate a sampling rate of 100 Hz. The following VI puts this concept into practice.

1. Connect the sensor to the NI ELVIS III and make sure it is installed properly in
such a way that your vibrating device is causing a bend in the sensor tape as
described earlier.

2. Open the ADC and Sampling LabVIEW project that was provided in the
courseware zip file.

3. Configure the IP address of your NI ELVIS III.

4. Open the Virtual Instrument (VI) called vibration and sampling Freq.vi.

Open the block diagram and double-click the Analog input (n samples) Express VI (see
figure below) in order to see its specifications.

Figure 1-10 Analog Input Express VI

You can see that this VI acquires 1000 samples of an analog signal from channel AI0 at
the rate of 1KHz. Furthermore, note that the Channel reads A/AI0(DIFF N Samples).
This is because the voltage acquired from the electrodes is a differential one. For the
same reason, we have connected the electrodes to channel AI0 and AI4 as opposed to
using ground.

The Original Signal and Signal Power Spectrum Charts respectively display the signal
read using this Express VI and its corresponding Power Spectrum. No decimation is
performed on this signal. Thus, it is acquired 1000 samples at a time at a sampling rate
of 1KHz (see the figure below).

35
Figure 1-11: Vibration Signal and its Power Spectrum

The Signal Power Spectrum displays the frequency components of the signal. We will
go over the concept of power spectra in Lab 4. For now, you may think of the Power
Spectrum as a computational tool that helps us recover the frequency components of an
analog signal that has been converted to a digital signal. The Power Spectrum is
displayed in a graph indicating the frequency components of the vibration signal of your
device in addition to any other unintended vibrations(noise) that are caused by the
device. The x-coordinate of the graph refers to potential frequencies contained in the
signal and the y-coordinate refers to the power corresponding to each frequency.

Frequencies with power zero are non-existent in the signal. The frequency(ies) with the
highest power component represent the major frequency component(s) of the signal.
Frequency(ies) with relatively lower power represent noise in the signal. Noise on the
graph is the smaller jitters in the major curve of the signal. 0 on the axis of frequency
represents the DC offset in the signal.

1-31 Refer to the power spectrum displayed in the preceding figure.

List the frequency components.

_____________________________________________________________________

_____________________________________________________________________

36
What is the DC offset?

_____________________________________________________________________

_____________________________________________________________________

The Measured Signal and Measured Signal Power spectrum display the signal and its
corresponding spectrum after decimation.

When Decimation was set to 2 the following chart and power spectrum were obtained.

Figure 1-12: Power Spectrum at Decimation 2

1-32 Why isn’t the power spectrum changed?


_____________________________________________________________________

_____________________________________________________________________

_____________________________________________________________________

_____________________________________________________________________

1-33 Set the Decimation to 20. What is the modified acquisition frequency?

_____________________________________________________________________

_____________________________________________________________________

_____________________________________________________________________

37
_____________________________________________________________________

1-34 When setting the Decimation to 20, we obtained the following graph and power
spectrum:

Figure 1-13: Power Spectrum at Decimation 20

What is the Nyquist frequency?

_____________________________________________________________________

_____________________________________________________________________

Which frequencies were aliased and to what aliases?

_____________________________________________________________________

_____________________________________________________________________

Was the DC offset changed?

_____________________________________________________________________

_____________________________________________________________________

38
When setting the Decimation to 10, we obtained the following graph and power
spectrum.

Figure 1-14: Power Spectrum at Decimation 10

1-35 Set the Decimation to 10. What is the modified acquisition frequency?

_____________________________________________________________________

_____________________________________________________________________

1-36 Which frequencies were aliased and why?


_____________________________________________________________________

_____________________________________________________________________

1-37 What are the new frequency components?

_____________________________________________________________________

_____________________________________________________________________

In the remaining part of this section, you will run the VI to analyze the effect of the
sampling rate using your own vibrating device.

5. Make sure the vibrating device is switched on.

6. Open the Front Panel.

39
7. Make sure the Decimation Slider is set to 2.

8. Run the program

1-38 Looking at the chart in Original Signal and the Signal Power Spectrum, complete
the following:

List the frequency components.

_____________________________________________________________________

_____________________________________________________________________

What is the DC offset?

_____________________________________________________________________

_____________________________________________________________________

1-39 Change the decimation rate in such a way that one frequency component gets
aliased.

What is the sampling rate corresponding to that decimation rate?

_____________________________________________________________________

_____________________________________________________________________

What is the corresponding Nyquist frequency?

_____________________________________________________________________

_____________________________________________________________________

Which frequency component was aliased?

_____________________________________________________________________

40
_____________________________________________________________________

What is its alias?

_____________________________________________________________________

_____________________________________________________________________

In lab 4 we will go over the details of the software analysis involved in analyzing an
analog signal and its frequency components.

41
Conclusion

These questions will help you review and interpret the concepts learned in this lab.

1-40 Summarize any observations from the lab that have not been addressed
elsewhere.
_____________________________________________________________________

_____________________________________________________________________

_____________________________________________________________________

_____________________________________________________________________

1-41 In your own words describe the process of digital conversion and the effects of
resolution and range on the measured signal.
_____________________________________________________________________

_____________________________________________________________________

_____________________________________________________________________

_____________________________________________________________________

1-42 Describe sampling theory, both as described in theory and as actually observed.
Include observations about the Nyquist frequency.
_____________________________________________________________________

_____________________________________________________________________

_____________________________________________________________________

_____________________________________________________________________

42
Answer Key – Check Your Understanding Questions Only

Check Your Understanding

1-1 D
1-2 A
1-3 B
1-4 C
1-5 B
1-6 D

43

You might also like