error may be due to the instability of the RC frequency.
Approximately 30 minutes elapsed between the first and
second measurements.
The frequency response, unfortunately, is highly non-linear (see Graph 1). This may not be a problem if your
design is a closed-loop. In this case, you simply increment
or decrement the voltage until a proper response is
obtained. However, if you want to output a particular voltage, say 2.52 volts, it’s not effortless.
The crude way to obtain frequency response is to build
a look-up table based on values you actually measure on
a breadboard. But this is problematic, as resistors and,
especially, capacitors have values that vary by several percentage points. So, there will be differences in the output
voltage from unit to unit. You could tailor your uC by
inputting specific values during program loading for specific components, but this is cumbersome. A better way is to
use the built-in A/D that most uCs have.
During start-up or self-test (a self-test routine is crucial), you could measure the actual voltage with known
applied frequencies and build a look-up table automatically. This limits the resolution to the available A/D resolution,
but this may be adequate for many applications. Most uC
A/D converters specify a 10K or less analog signal impedance. This is not a problem because C2 is very large relative to the A/D capacitor.
Your look-up table will probably contain about 20-40
entries, and you will interpolate between the values. This
procedure reduces the memory requirements and usually
provides adequate results. When you do this, you are really
converting the curve to 20-40 straight-line segments.
Generally, the difference between the curve and the straight
line are minimal. Of course you can, and should, calculate
the difference to be sure it is suitable for your application.
PHOTO 1. A POOR ATTEMPT AT AN FM SINE WAVE.
HOWEVER, THE SIGNAL IS NICE AND CLEAN WITH
NO TRACE OF DIGITAL NOISE.
voltage is created (Figure 2a). If the diode’s anode is
connected to a positive voltage (typically VCC or + 5 volts)
the output voltage can be about 50% greater than that
(Figure 2b). This gives you great flexibility and is something that ordinary D/A converters cannot accomplish.
You can output any voltage from - 3 to + 3 volts and from
+ 4. 5 to + 7. 5 volts with a standard 5-volt power supply.
(There may also be enough current to supply the negative
voltage requirements for an op-amp or two.)
These circuits will work with any digital input. However,
if you are using a uC, you can select whatever output you
desire. All that is needed are a couple of free I/O pins and
another diode. Figure 3 illustrates how this can be done.
The key concept is to realize that an output pin in a high-
FIGURE 2. BY CHANGING THE DIODE CONNECTIONS,
DIFFERENT OUTPUT VOLTAGES CAN BE GENERATED.
Frequency Modulation
DC voltages are nice, but nothing is fixed. Naturally,
you’ll want to change it from time to time. The question is
how quickly the DC level can change. I breadboarded a
quick and dirty modulator that swept the frequency from
3,400 Hz to 175 KHz. It was supposed to be a sine wave,
but if you look at Photo 1 you’ll see that the falling edge
has a ledge in it. The FM frequency was about 10 Hz and
the resultant signal amplitude was about 0.75 volts. You
can change the values of the resistors and C2 to change
the response of the circuit. You can probably get up to a
useful frequency of 60 Hz, but I wouldn’t expect to go
much higher.
Variations on a Theme
By changing the circuit slightly, different output voltages can be obtained. If the diode is reversed, a negative
SEPTEMBER 2005
63