A/D Converters |
We can think
a little bit about error in an A/D. First, note that the error limit
depends upon the range and the number of bits.
-
If there are N bits, the number
of divisions is 2N-1.
-
If the total range of voltage
is VRange, then the size of a division is:
-
The error is related to the
Division size.
-
If the calculated voltage is
SmallestDivision*Count, the error is the same size as the smallest division.
-
If the calculated voltage is
SmallestDivision*Count + SmallestDivision/2, the error is SmallestDivision/2,
i.e. half the size of the smallest division.
-
See the simulations above for a
better appreciation/understanding of the error.
We're not
going to give you any more simulators with more bits. Actually, we've
almost reached the resolution limit for the screen. The simulators with
the "nudge buttons" just nudge the controls by a single pixel, and that is too
much for a twelve bit converter, for example.
Example
E3
A popular A/D board gives a count and requires you to perform the computation
shown in the line of C code shown below. The variable binary is the count
value that is returned.
MeasuredVolts =
(((binary-2048)*20)/4096);
The A/D converts voltages
from -10v to +10v. We can conclude the following.
Let's
sum up a few points.
-
More is better when it comes to
bits in an A/D. The indicated voltage will be closer to the actual value
of the voltage being measured when there are more bits.
-
More is pricier when it comes
to bits in an A/D. It takes more parts, and they have to be made more
accurately if there are more bits.
How Does An
A/D Work?
While
we have discussed A/D converters above, we haven't yet given you any insight
into how you could build an A/D. Here we will discuss a simple way to
build an A/D. This might not be the fastest A/D possible, but it will
start to give you some insight into what happens inside an A/D.
The
circuit is shown in the simulator below.
Simulator - Showing How You Might
Construct An A/D
Sim 5
This simulator is a four bit A/D, and it consists of the following components.
-
A pulse generator that produces
a sequence of 0's and 1's.
-
A counter which counts the
pulses and produces an increasing count.
-
A D/A which produces an analog
signal proportional to the count output from the counter.
-
An adjustable input voltage
source.
-
A comparator which produces a
"1" when the D/A output is larger than the input voltage.
Here is how the A/D Simulator
works.
-
First, set a DC voltage from
the adjustable source.
-
Second, click the "Convert"
button.
-
The counter begins counting,
and the count is displayed on the LEDs and the numerical value of the count is
displayed.
-
The digital count signals (four
bits of signals in this case) form the input to a D/A converter which produces
an output voltage proportional to the count.
-
The output voltage from the D/A
is compared to the input voltage.
-
When the output voltage from
the D/A becomes larger than the input voltage the comparator develops a "Stop"
signal that is used to stop the counter.
-
The count that remains in the
counter is a digital representation of the input voltage.
Try the simulator, using
different voltages within the allowable range, i.e. 0-5v.
The simulator lets you see the inner workings of one type of A/D converter.
Note the following about any A/D converter.
-
The conversion takes time.
In the simulator, there is a variable amount of time until the counter reaches
the correct count. We have slowed down the simulator so you can see what
happens, but even in the best A/Ds there is some time that must elapse between
the start of a conversion and the end of a conversion. That time limits
how many conversions can be done per second. People have worked on that
problem and there are other kinds of converters that convert more quickly.
-
The conversion is not exact,
and the accuracy depends upon the number of bits in the counter.
-
The result of the conversion is
an integer, and that integer still must be translated into an equivalent voltage
(although the conversion isn't hard to do).
Practical A/Ds
Now, consider what happens in a typical application of an A/D. We'll look
at a voltmeter. In a voltmeter, this is what happens.
-
A voltage is applied to the
voltmeter, and an A/D converts the voltage to a count.
-
The count is converted to a
floating point number.
-
The floating point number is
displayed on an LCD or LED display.
If the voltmeter is connected
to a computer (say through an IEEE-488 bus) the following also takes place.
You can
see that there are a few conversions that have to take place in this process.
There are a number of other considerations here as well.
-
The number of bits in the A/D
converter will affect the accuracy of the voltmeter. There is a lot of
legend and lore in that area.
-
You need to be aware of how to
make conversions. Actually, you need to become knowledgeable about the
different representations as well as how to program those conversions in various
programming environments like C, C++, Visual Basic and LabView.
A/D converters are found in many places - including places where you might not
think that you would find them. Here are a few.
-
Voltmeters are digital today.
To display a digital result for a voltage measurement the voltage is first
converted to digital form in an A/D, and then it is changed to a decimal format
to be displayed.
-
A/Ds are used in digital
thermometers, so if you've spent some time in the hospital, you've used an A/D.
And, you get the idea.
However, there is an important situation where you need to dig deeper into how
A/Ds operate, and how they interface with the software and hardware that is
often used in measurement and control situations. Let's think about a few
typical situations.
-
Assume that you are recording
temperature at four points in a heat-treating oven. You need to do the
following.
-
You have three tanks used for
chemical processing. You need to control the level of the liquid in the
three tanks. Each tank has a small computer with an A/D board that
measures and controls the liquid level in each tank and also measures the
temperature. Each computer has a network card that connects it to an
Ethernet LAN. There is a central computer on the LAN and you need to send
information from each of the control computers to the central computer.
In both of
these situations you need to consider how to manipulate the data that you
measure and want to store. Here are some of the considerations.
-
If you take data with an
instrument connected to a computer (like a data acquisition unit or a voltmeter)
the instrument may be connected to the computer with an IEEE-488 (GPIB)
connection. IEEE-488 connections have some
considerations.
-
If you send data over a
network, you must send strings of characters.
The
conclusion that you need to reach is that you need to be aware of how data has
to be converted in these kinds of situations. Let's look at the sequence
of operations you might face.
-
The A/D converter gets some raw
data or information and it is in the form of an
integer count. Often it is simply a binary
number represented with some fixed number of bits.
-
The count could be a number
like 10001000 (or 129 in decimal numbers).
-
If the A/D converter has eight
(8) bits or less, the data will take a single byte.
-
If the A/D converter has more
than eight bits (which is typical) the data will take more than one byte.
Usually, for most converters, the data will take two bytes, since most
converters are 10, 12 or more bits.
-
The count is converted to a
number that represents the voltage (or possibly some other physical variable).
That takes some computer code (And there will probably be some sort of computing
chip in the instrument.) and the process results in a number that is probably a
floating point number.
-
If you transmit that floating
point number you need to generate a string of characters.
-
The string of characters might
be something like a "3", a period ("."), a "1", a "4", etc.
-
In many cases you may need to
add one or more characters to signal the end of a string. That could be a
carriage return and a line feed, for example.
Representing Instrument Data
Taking
data with an instrument immediately leads you to consider several things about
data. Here is a sample.
-
If you take a lot of data, you
need to know how the data is represented.
-
If you take a lot of data, you
need to know how the data is transmitted from the instrument to a computer.
-
If you take a lot of data, you
need to know how the data you get will be stored if you store it in a computer
file.
Digital Voltmeters
Digital Voltmeters are a special case of A/Ds. Obviously, if
voltage measurements are taken and the results are displayed digitally with LED
or LCD displays, the instrument has to contain an A/D converter. Digital
voltmeters have some characteristics that you might need to understand.
-
Digital voltmeters usually have
scales that are 0-0.3v, 0-3v, 0-30v, 0-300v, etc.
You need to learn a little terminology and the
reasons for the terminology. Let's take a look at a sample voltmeter.
Example
E4
Consider a voltmeter built around a 10 bit A/D converter. We will assume
the following.
Then, with 10 bits we can draw
these inferences.
-
Ten bits will produce 210
intervals. That's 1024 intervals.
-
If there are 1024 intervals
over a range of 3v, each interval will be 3/1024 = .00293v.
-
It is easier to compute the
displayed voltage if the interval is adjusted to .003v.
-
That would make the range
0-3.072v. (That's .003 x 1024.)
-
If you are measuring a voltage
that varies around 3v, that would allow you to keep the range the same, but
still change the range when the voltage got large enough. Manufacturers
like to build in a little "hysteresis" to prevent constant range changes in
situations like that and it might be especially hard on auto-ranging meters.
-
If you wanted to measure
negative voltages and have the range be from -3v to +3v, you would have
intervals of .006v, and the meter would measure from -3.072v to +3.072v.
-
If you wanted to measure
voltages on a 0-30v scale, you would probably use a voltage divider or some
other way to reduce the voltage by a factor of (exactly) 10 (i.e., multiply it
by exactly 0.1) and then use the same converter as on the 0-3v scale.
If we could use a 12 bit A/D,
then some conclusions would change.
-
Twelve bits will produce 212
intervals. That's 4096 intervals.
-
If there are 4096 intervals
over a range of 3v, each interval will be 3/4096 = .000732v.
-
It is easier to compute the
displayed voltage if the interval is adjusted to .0075v.
-
That would make the range
0-3.072v - just as it was in the case of the 10 bit converter,
-
That produces the same
advantages as you had with the 10 bit converter.
-
If you wanted to measure
negative voltages and have the range be from -3v to +3v, you would have
intervals of .0015v, and the meter would measure from -3.072v to +3.072v.
At this
point, you should have a good idea about how the number of bits in an A/D
converter determines the accuracy of the converter - i.e. the resolution of the
converter.
You
also need to learn how to determine the resolution of an instrument in the
laboratory, and relate the resolution of lab instruments to what you know about
the number of bits in a converter.
|