Lab 10 Analog To Digital Converters
Lab 10 Analog To Digital Converters
ABSTRACT
In this lab, the basic operation of analog-to-digital converters will be introduced. Students will
also gain practical, hands-on experience using the NI USB-6008 Data Acquisition (DAQ)
module to sample an analog signal.
INTRODUCTION
(Reference: Wikipedia >> Analog-to-digital converter)
The input signal undergoes quantization meaning that the all analog values within a certain range
are assigned to a single digital code. An example of a uniform quantizer is shown in Figure 2.
Since the continuous signal become discrete, some error is introduced, known as quantization
error. The more quantization levels are used, the higher the resolution of the ADC. The number
of quantization levels, N, for an M-bit ADC is given by
𝑁 = 2𝑀 − 1 Eq. (1)
An ADC must first sample the analog input signal at a certain frequency, known as the sampling
frequency, or sampling rate, 𝑓𝑠 . In order to ensure that the digitalized signal accurately
represents the sampled analog signal in the frequency domain, one must ensure that the sampling
rate is at least higher than twice the highest frequency in the analog signal. This condition is
stated in the Nyquist Sampling Theorem:
In practice, a good rule-of-thumb is to sample at 3 or 4 times the highest frequency in the analog
signal. If the Nyquist Theorem is violated, spurious signals called aliases will be produced at the
output of the DAC. This affect is called aliasing. The frequency of the aliased signal is the
difference between the signal frequency and the sampling rate, as given by
While using a sampling rate of 3 or 4 times the highest frequency in the sampled signal will
ensure that no aliased frequencies are introduced, it is recommended that one sample at a rate of
at least 10-12 times 𝑓𝑚𝑎𝑥 to ensure that the signal is also accurately represented in the time
domain, i.e. has the correct shape.
PRE-LAB PREPARATION
1. A 12-bit analog-to-digital converter is used to sample an analog voltage. How many
quantization levels will be used to encode the sampled waveform?
2. A 500Hz sine wave is sampled using an analog-to-digital converter. What must be the
minimum sampling frequency to ensure that the digitalized signal is an accurate
representation of the original waveform? In practice, what sampling frequency should you
use to make sure the frequency content of the reconstructed signal is correct? In practice,
what sampling frequency should you use to make sure the shape of the reconstructed signal
is correct?
An analog-to-digital converter is used to read the signal into LabVIEW. The sampling
frequency is set to 700Hz. What frequency component is introduced when the analog signal
in Figure 3 has been sampled, converted, and then reconstructed? Hint: First, determine the
frequency of the waveform in Figure 3.
EXPERIMENT
This lab uses a NI USB-6008 DAQ and the associated NI-DAQmx (LabVIEW) software. You should
have a DAQ at your lab station already connected to the computer through the USB port, and the
software is already installed on the lab computers. The pinout for the NI USB-6008 DAQ is shown in
Figure 4.
1. Use the function generator to obtain a 500 Hz, 5V peak-to-peak sine wave. Be sure to view
your waveform on the oscilloscope before connecting it to the DAQ.
2. Connect the sine wave to the AI 0+ and AI0- pins on the DAQ. This will allow you to do a
differential measurement of the input voltage.
3. Locate the NI MAX icon on your desktop and run the software. This runs the National
Instruments Measurement and Automation Explorer that is used to check that your DAQ
device is detected by the computer and functioning properly.
4. Locate the Devices and Interfaces submenu in the left-hand panel of the NI MAX window.
Click on the triangle and wait for the software to locate the NI USB-6008 Dev1 item. (See
screenshot below.) This is your DAQ. If you do not see this device listed after a few minutes,
make sure your USB cable is properly connected between your DAQ and your computer.
Close the NI MAX window and re-launch the software.
6. In the Test Panels window, make sure you are on the Analog Input tab, and that Channel
Name is set to Dev1/ai0. In the Mode dropdown menu, select Continuous. Make sure the
Input Configuration selected is Differential. This will allow you to take a differential
measurement of your input signal. Set your Max and Min Input to 5 and -5 respectively. Set
your Rate (Hz) to 6000. This is your sampling rate. Notice that it is 12 times the frequency
of the input signal (500Hz) to ensure that both the frequency content and shape are
reproduced accurately. Set your Samples to Read to 50 samples. It is a good rule of thumb to
set your samples to read to be a factor of 10 less than the frequency of the signal to be
measured. Finally, locate the Auto-scale chart checkbox in the upper right-hand corner of
the window and uncheck this option. (See the screenshot below for setup.)
7. Press the Start button in the Test Panels window. You should see a descent looking sinusoid
in the Amplitude vs. Samples Chart.
8. Now that you have verified that your device is correctly interfacing with the NI software,
press Stop and close out of NI MAX.
9. Download the file EE231_DAQ_Lab11.vi from Blackboard and run this file. What you will
see is the front panel of a virtual instrument program written in LabVIEW.
10. Make sure the Channel Parameter are set as follows: Physical Channel set to Dev1/ai0,
Minimum Value set to -5.00 (this is in units of volts), and Maximum Value set to 5.00
(volts.)
11. Set your Sample Rate (Hz) to 6000 and Samples to Read to 50.
12. Press the white arrow button at the far left of the top toolbar to run the program.
Part C- Observing the Effect of Sampling Rate
Be sure to record all observations and answers in a complete and organized manner. These will
be a major component of your lab report.
13. Observe the resulting waveform. (You may want to press STOP so you can see it better.)
Does it look like your input signal? Discuss any differences and why this may be occurring.
What is the detected frequency?
14. Click on the on the zigzag line to the right of the Dev1/ai0 button near the top right corner of
the waveform graph. Select Point Style and pick a style you like. This shows you the actual
sample points being taken by the ADC.
15. Vary the Sampling Frequency in steps from 6000 to 1000 in steps of 1000. At each
frequency, note the Fundamental Frequency and the shape of the waveform. Write down
your observations. Discuss any strange behavior.
16. Change your Sampling Frequency to 500Hz and write down the Detected Frequency. Is
the detected frequency what you would expect? Discuss why it is or isn’t.
REPORT
1. Present your observations and data from Step 13 of the experiment. Be sure to relate your
observations to concepts discussed in the lab manual introduction.
2. Present your observations and data from Step 15 of the experiment. Be sure to relate your
observations to concepts discussed in the lab manual introduction.
3. Present your observations and data from Steps 16 and 17 of the experiment. Be sure to relate
your observations to concepts discussed in the lab manual introduction.