UC Berkeley Basic Semiconductor Circuits Labs - A/D and D/A Conversion
Overview
Our world is largely analog and continuous; quantities vary smoothly. There are, of course, intrinsically discrete exceptions to this rule, like the quantization of charge or the quantum hall effect. But even measurements of discrete phenomena tend to be confounded by noise and produce continuous data. Internally, however, modern computers deal only with discrete quantities; specifically, they deal only with quantities that take on only two values: on or off. This so-called digital representation of information has many advantages over analog representations, most importantly that digital information is relatively immune to noise. If a 0, or off state, is represented by a voltage near 0, and a 1, or on state is represented by a voltage near 4 (a scheme used by a common family of digital devices called TTL logic), then noise is unlikely to cause a fluctuation great enough to confuse the two.
Table of Contents
Excerpt from the Physics 111 Laboratory Manual by Dr. James L Siegrist & Donald Orlando
Background
This tutorial provides a brief outline of the A/D and D/A Conversion Lab written at UC Berkeley. The complete lab content is available for download at:
http://socrates.berkeley.edu/~phylabs/bsc/PDFFiles/bscLV-11.pdf
Digital Representation of Numbers
Our world is largely analog and continuous; quantities vary smoothly. There are, of course, intrinsically discrete exceptions to this rule, like the quantization of charge or the quantum hall effect. But even measurements of discrete phenomena tend to be confounded by noise and produce continuous data.
Internally, modern computers deal only with discrete quantities; specifically, they deal only with quantities that take on only two values: on or off. This so-called digital representation of information has many advantages over analog representations, most importantly that digital information is relatively immune to noise.
Conversion
Since the real world is analog, but the computer world is binary, we need to convert signals between the two. Devices that change an analog signal to a digital signal are called analog to digital converters (ADCs). Devices that change a digital signal to an analog signal are called digital to analog converters (DACs). Both are important; DACs are used to control experiments, while ADCs are used to read data from experiments.
Sampling
Real-world signals are continuous in time as well as value. To represent a time-varying signal, we build up a table of the value of the signal as a function of time. We can better visualize sample tables with a graph. The curve in the upper plot of the graph below represents a signal to be sampled. The dots are the samples. If we then use the samples to represent the signal, we get the signal in the lower plot, where the points are joined by the dashed line.
Resolution
The number of bits available to represent each sample is called the resolution. IN base 2, the number of levels that can be represented by an n bit sample is 2^n. This, for 8 bits (the number of bits in a typical low end converter) there are 256 levels, while for 24 bits (the maximum common converter resolution) there are 16,777,216 levels.
Sampling Rate
The effects of sampling too slowly are more subtle than the effects of limited resolution. When we sample too slowly, we do not get an adequate representation of the signal; in fact, we may be badly confused by spurious signals. These effects were codified by Nyquist, who determined that:
A signal can only be perfectly represented by samples taken at more than twice the maximum frequency of the signal.
Picking a Sample Frequency
It is always safest and easiest to pick a sampling frequency well above the highest anticipated frequency. A factor of ten to one hundred times higher provides a comfortable margin. But there are times when it is not feasible to pick such a high frequency. Your converter may not be capable of sampling fast enough, or the desired rate may not be technologically feasible. Even if a converter with the desired sample rate exists, it may be prohibitively expensive; the cost of ADCs and DACs increase rapidly with sampling speed.
Practical Filtering and Aliasing Advice
- Occasionally, the received signal is so free of noise that aliasing of unwanted frequencies is unimportant. If so, either: (1) sample 20 or more times the desired frequency if your ADC and the memory can support it, or (2) sample closer to twice the desired signal frequency and use digital filtering to remove the artifacts.
- The maximum frequency of most received signals is naturally limited by the detector that produced the signal, or by the detector amplifiers. If possible, sample at a frequency that is higher than twice the maximum frequency of the signal, using digital filtering, as necessary, to remove the artifacts.
Digital to Analog Converters
There are several ways to build digital to analog converters, but the simplest way is with a scaled resistor network. This is just an opamp adder circuit, in which each bit bn is added in with weight 2^bn. In practice it is difficult to make a high resolution DAC with a scaled resistor network because it requires precisely scaled resistors over a very wide rante. It is much easier to make precise resistors over a narrow range; a common DAC that takes advantage of this fact uses a ladder network.
Analog to Digital Converters
The simplest way to make an n-bit ADC is to have 2^n separate comparators, each comparing the input voltage to one of the set of all the voltage levels allowed by the resolution of the ADC. An encoder determines the highest “on” comparator, and encodes this information into a number. Such flash, or parallel recorders are very fast, and are used in high frequency applications. But they are not feasible for high resolution ADCs, as every voltage level requires a separate comparator.
In the Lab
This procedure outline presents a brief overview of the complete lab. Download the full procedure at:
http://socrates.berkeley.edu/~phylabs/bsc/PDFFiles/bscLV-11.pdf
Aliasing and the Sample Rate
Run the program Sampling_Simulator. With filtering set to No Filter, explore the effects of the sample rate on Pure Sine and Square waves. Use both Flat Interpolation and Linear Interpolation.
Digital to Analog Conversion
Build a scaled resistor DAC. Use the digital outputs of your DAQ card to drive the outputs; in particular, use the low order bits marked P0.0 (lowest) to P0.4. These digital outputs switch between approximately 0 and +5V; consequently your converter will output negative voltages. You will have to scale your resistors up from the values used in the above schematic; determine the base value (the “1”) from the requirement that the current drawn from any of the digital outputs individually should be less than 2.5 mA.
Student Evaluation of Lab Write-up
Now that you have completed this lab, we would appreciate your comments. Please take a few moments to answer the questions below, and feel free to add any other comments. Since you have just finished the lab it is your critique that will be the most helpful. Your thoughts and suggestions will help to change the lab and improve the experiments.
Return to UC Berkeley Basic Semiconductor Circuits LabsAcknowledgment and Disclaimer
This material is based upon work supported by the National Science Foundation under Grant No. 0411367. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation (NSF).
Reader Comments | Submit a comment »
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). National Instruments does not support this tutorial or guarantee its quality in any way. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
