piclist 1997\08\22\025232a >
www.piclist.com/techref/power.htm?key=voltage
BY : John Payson email (remove spam text)

> My standard for this type of work requires a bit more hardware but is
> cheap and easy to implement. I got this from Steve Ciarcia when he was
> writing for BYTE. Used it in his Intelligent Serial EPROM programmer.
>
> Basic Setup: An LM317 variable regulator is designed so that the output
> is 1.25V above the voltage of the adjust pin. So by simply switching the
> voltage on the adjust pin, the output voltage changes.

> By using multiple resistors and an Open Collector switch to ground it's
> easy to change which resistor is used for generating the adjust voltage
> (and therefore the output voltage). An example:

Unfortunately, this one does not failsafe if your ground-sinks go
open-circuit (e.g. PIC goes into reset).  Instead, the voltage may float
up and away.

An alternative if you don't mind using an opto (which would isolate the
PIC from what you're controlling) would be this:

+-----+
In---| 317 |----+------ Out
+-----+    |
|       R1
|       |
|      Opt
|       |
+-------+ - - - test-point 1
|       |
Cap      R2
|       |
Gnd     Gnd

If the opto's full on, the voltage at test-point 1 will be exactly
1.25*R2/(R1+Ropt).  If the PWM is at 50%, the voltage at test-point 1 will
be half that, etc.  The behavior is linear, and it fails-safe if the opto
is off.  If you want the output to go all the way down to zero, adding a
couple of diodes in series should drop the 1.25 volts.

By the way, the thing that makes this circuit work so well is that when
the opto is on the current through it is simply 1.25/(R1+Ropt),
independent of the output voltage or PWM cycle.  Because of this, and
because the voltage across R2 is directly proportional to the current into
it, the test-point 1 voltage is nice and linear.

Note that the filtering induced by the cap has a time constant of (R2)C.
This may seem a bit odd, given that R2 and the cap are in parallel, but
since the constant current source is equivalent to an infinite R, the
impedance at TP1 is defined entirely by R2.  While the RC will somewhat
limit the circuit's ability to change voltage quickly, it's no more of a
problem here than in any other similar circuit.

Anyone else ever seen anything like that circuit?  How does it look?
<199708220652.BAA08078@Kitten.mcs.com> 7BIT