Computer Interfacing and the Sampling Theorem
Chemistry 4451
Introduction
Computers have become an integral part of many analytical processes. The marriage of computers
and laboratory instrumentation provides the analyst with better precision and more efficient use
of the available time - especially when repetitive analyses are to be carried out.
Interfacing
Data is transferred back and forth between the instrument and the computer via a device called a
digital interface. In many cases, this means converting analog signals into digital values or vice-versa, but interfaces are also used to perform other tasks such as pulse-counting. Two of the
most common interfacing devices are digital-to-analog converters (DAC), and analog-to-digital
converters (ADC). These devices convert numbers into voltages, or voltages into numbers
respectively. The resolution of these converters depends on the number of bits they possess. For
instance, an 8-bit DAC converts a number between 0 and 255 into a voltage, the magnitude of
which depends upon the electronics built around the DAC. The significance of the range of
numbers between 0 and 255 is that there are 256 possible values that can be converted, or 28.
Likewise, a 16-bit ADC can take an input voltage and convert it into a number between 0 and
65535 (a range of 216). Obviously, the more bits that the converter has, the better the resolution
on the device. In the case of both DAC's and ADC's there is a linear relationship between the
analog and digital signals which can be readily determined.
The Nyquist Sampling Theorem
When the input signal varies with respect to time, the computer must sample the signal fast enough
so that it can be accurately described. The faster the sampling rate with respect to the frequency
of the signal, the more reliably the input waveform is reproduced. There is a limiting sampling
frequency below which the input waveform is not accurately reproduced and information is lost.
This frequency is called the Nyquist Sampling Frequency and is defined as twice the frequency of
the input signal.
Procedure
In this lab, you will first interface a DC voltage source to a laboratory computer via an 13-bit
ADC converter (12 bits plus sign). Next you will utilize the same ADC to have the computer
sample an AC input signal in order to determine the minimum frequency which can be accurately
digitized.
The Sampling Theorem
(1) With all electronic components turned off, connect the waveform generator to the input
labeled "V" on the Labworks interface. Also connect the output of the waveform generator
to the oscilloscope. Adjust the "amplitude" setting on the waveform generator to its
minimum level. Have the instructor check your setup before proceeding!!
(2) Turn on the scope and the function generator. Adjust the frequency to the minimum
value. Run the "meter" program.
(3) While observing the values printed on the computer CRT, gradually increase the amplitude
of the waveform until the numbers on the CRT begin to oscillate. Continue to increase
the amplitude but do not let the numbers on the CRT go as high as 24000 or as low as -24000. These correspond to the limiting input voltages on the ADC in millivolts. The
purpose of this step is to get the maximum variation in the digital signal without saturating
the ADC.
(4) Load the experiment entitled "Nyquist" into the computer. This program simply samples
the ADC as fast as it can (this is limited by the speed at which the program runs) and
outputs the values to the CRT and to your data file.
(5) With the output frequency adjusted to 5 Hz, run "Nyquist". Take note of the appearance
of the waveform on the scope and use the scope and compare this with the digitized
waveform on the CRT. Record the exact frequency of the waveform using the DMM.
(6) Repeat step 5 with the function generator set to frequencies between 5 and 80 Hz in
increments of 10 Hz. In each case, make a note of the appearance of the waveform on the
scope - this is an accurate representation of the output of the waveform generator. Record
the actual frequencies with the DMM.
(7) Plot the data collected in steps 5 and 6 using the internal spreadsheet for the Labworks
interface in order to determine approximately when the sampling theorem is violated.
Obtain hardcopies of all graphs and data. Rerun "Nyquist" at several frequencies around
the limiting frequency and determine precisely where the computer begins to fail to
accruately reproduce the waveform. Hardcopy these plots as well.
Questions
(1) How do these digitized representations resemble the actual waveforms? How do they
differ?
(2) At what frequency does the digitized waveform deviate in appearance from the actual
output of the waveform generator?
(3) Based on your observations, calculate the sampling rate of the "Nyquist" progam.