by Gerard Fonte
In the midst of the digital revolution, it seems that the utility of analog
mathematical circuits has been shunted aside. This is not surprising.
Generally, digital computing has many advantages over analog
computing. However, in the realm of microcomputers, some of these
calculations are not trivial and can sometimes be downright nasty to
implement. So, there are still useful and important applications for analog
mathematics in today”s digital world. In fact, the marriage between analog
computing and microprocessors (µCs) can be remarkably efficient.
For example, suppose you need to calculate the
logarithm of a voltage to stabilize your robot. You
could try to perform a direct calculation which
would take a lot of time. You could use a look-up table
which would use a lot of memory. Alternatively, you could
employ some sort of recursive estimation which takes a
variable amount of time and fairly complex programming.
However, using an op-amp and a transistor you can find
the logarithm of your voltage as fast as the op-amp can
settle. This article will discuss techniques of analog pre-processing in order to streamline your whole µC system.
Analog Accuracy, Resolution,
The accuracy of a measurement is how close it matches
some standard. That is, if the meter reads 1.000 volts the
voltage should really be 1.000 volts, not 1.100 volts.
Open-ended analog systems usually have an accuracy of a
few percent. This initially seems quite bad. But many µC
analog-to-digital converters (A/D) use the positive power
supply for a reference voltage. This supply can easily vary
by a few percent. The situation is much worse if batteries
are used. If a voltage reference is employed (a device that
provides a precisely defined voltage), then analog and
digital accuracy can be about the same (for simple µC
systems). However, it is rare for the accuracy of analog
systems to be better than about 0.01% ( 13 bits). More
typically, analog accuracies are about 0.1% ( 10 bits).
Resolution refers to the ability to separate two closely
spaced values. Generally, this is defined by the number of
digits or bits. An eight-bit A/D has a resolution of 1/256.
So, if the A/D reference is 5.000 volts then each bit is
0.0195 volts (5V divided by 256) or about 20 mV. This is
pretty bad. Analog systems have “infinite” resolution. That
means that there is nothing inherent to the system that
limits the resolution. Obviously, no system has true
54 May 2009
“infinite” resolution. Noise and other factors create a
practical limit. But this limit can be very tiny. It is not
unreasonable to have analog resolution down to 1 ppm
(Part Per Million). This corresponds to about 20 bits in a
digital system. (This is seen in ordinary audio recordings.
Digital systems of 16 bits are the minimum for Hi-Fi playback. Twenty-four bits and higher are now commonplace.)
Repeatability is the big weakness of analog systems
and the big strength of digital systems. Unit to unit
repeatability is often limited to a few percent for analog
systems (without a reference). Worse, over time and
temperature an analog circuit can change by many
percent. This is generally the result of component value
change. Digital systems do not have this problem.
However, there is a problem associated with analog
repeatability when multiple stages are used. In this case,
the errors are multiplied by the number of stages (or
worse). So, if you are cascading analog math circuits,
don’t expect high precision. This is generally not a
problem with digital math because the only error
associated with multiple operations is the rounding error
of half a LSB (least significant bit). If the word length of the
numeric values are large enough ( 16 to 24 bits), this can
generally be ignored.
Associated with repeatability is the consideration of
noise. Analog systems are susceptible to many sources of
noise at all levels. This causes variations in repeatability.
Depending on the circuit, this noise may or may not be an
important factor. Digital systems are only concerned with
noise when it approaches a significant percent of the bit
value. Once digitized, noise is rarely a concern. Digital values can be repeated virtually forever without degradation.
Analog values (like tape recordings) show a continuous
loss of repeatability every time it is reproduced because
noise is added every time. However, this repeatability concern is not really a factor here because we are examining
analog pre-processing rather than analog reproduction.