piclist 1999\09\23\235006a >
www.piclist.com/techref/power.htm?key=voltage
BY : Mike Keitz email (remove spam text)

On Fri, 24 Sep 1999 11:30:02 +1000 Thomas Brandon <tomPSY.UNSW.EDU.AU>
writes:

> I would like a system whereby you can plug any voltage into the box
> and it
> will detect the voltage range allowing it to auto calibrate itself
> for that
> input.

If you use a "larger" ADC such as a 12-bit unit then you can scale the
converted result with software and still have 7 useful bits.  For
example, set the converter up so an input of 1V results in a reading of
127.  This decision sets the minimum full-scale voltage that can be used.
The user's source must be able to supply at least 1V full scale in order
to be able to convert it to 128 discrete readings.  But without changing
any hardware, the converter can linearly accept voltages up to 32 V.  An
input of 32V will convert to the full scale of a 12-bit converter, 4095.
This is the maximum voltage that can be used, more than that and the
digital output will stop increasing.  It would be fairly easy to design
the input to tolerate hundreds of volts without burning anything out
though.

The software would be real simple.  Have the user turn the external
voltage up to its maximum and press a "calibrate" button.  The processor
takes a reading from the ADC and remembers it.  Then for operational
reading / 128 (It may be faster to convert the full scale reading to a
factor for multiplying and throw away a bunch of LSB's instead of
dividing).  This gives a 7-bit useful result over the full range.

For the input I'd use an op-amp inverting amplifier.  The input voltage
goes through a large resistor to the (-) input of the op-amp.  The
maximum input voltage this circuit can handle is limited only by the
input resistor.  If you don't care too much about always having a
constant impedance at the inputs you can simply multiplex many inputs to
one amplifier.  Each input needs its own resistor and a set of diodes to
keep the voltage after the resistor in range of the multiplexer while the
channel is not selected.  (If you have SPDT switches at each input then
all the unused inputs could be connected to ground, and the used one
connected to the amplifier.  Clamping diodes would still be a really good
idea though.)  The input to the amplifier is a "virtual ground".  When a
channel is selected, the voltage at the multiplexer is forced to zero so
the clamp diodes do not conduct.  You will probably need to add a small
capacitor in parallel with the feedback resistor to keep the amplifier
from oscillating with all the capacitance of multiplexers, etc. at its
input.  This forms a low-pass filter which can be useful, but it also
limits the maximum sampling speed.

You could also add more analog switches to switch in different feedback
resistors, changing the gain of the amplifier under software control and
extending the input range even further.   The circuit should be safe from
damage even if a high voltage is applied inadvertently while the
amplifier is set for high gain.  The amplifier would just saturate
(causing the ADC to read out of range) while the clamp diodes would keep
the amplifier input voltage from rising too much.

___________________________________________________________________
Get the Internet just the way you want it.
Free software, free e-mail, and free Internet access for a month!
Try Juno Web: dl.http://www.juno.com/dynoget/tagj.

<19990923.233754.-361927.0.mkeitz@juno.com> 7bit