[HH] low battery indicator: reducing voltage divider current

Greg London email at greglondon.com
Tue May 29 13:08:35 EDT 2012


design challenge:

I have a 12v battery, voltage level is somewhere from 15v to 10v.
I want to measure that voltage using a microcontroller that runs
off of 5v.

The microcontroller has an ADC whose spec says the impedance of the
thing you're measuring should be 10k ohms or less. The impedance
of the microcontroller adc input is apparently around 100k ohms.
So, I'd want the impedance of teh voltage divider to be smaller
than that so that the impedance of the ADC input doesn't affect
the voltage divider circuit.

If I do a simple voltage divider to get 15volts to be below 5 volts,
and have a resulting impedance less than 10k ohms, that would be a 20k
resistor in series with a 10k resistor.

The current draw would be 15v/30kohm which is half a milliamp.

So, I want a simple circuit that will allow me to sample the
battery voltage and then turn off all the current.
It also has to isolate the 12v battery voltage from any pin on the
microcontroller, because every pin on the microcontroller will have
an ESD diode from the pin to 5v.

If I put the 12v battery to the Gate on a n channel mosfet,
have the Source tied to ground, and have a 10k ohm resistor
from the Drain to a programmable output of the microcontroller,
then the Gate will effectively give me zero current there,
and when I want to sample the voltage, I turn on the microcontroller
to the 10k resistor to the Drain and then measure the voltage at
the Drain. The transistor will have the Gate voltage turn into
a Drain-Source current, and that current will give me a voltage
drop across the resistor. Measure the voltage, calculate the current,
and then back-track to figure out the voltage at the Gate.
When I'm not sampling the battery, pull the microcontroller
output to zero volts and no current will flow through the
10k ohm resistor tied to the Drain.

The problem is the transistor amplification factor is different
from transistor to transistor (even the same two models) and
will change as temperature changes. Which means I have to calibrate
the thing, and I also have to measure temperature.

What I want is a simple circuit that will cut off all current
when I'm not sampling the battery voltage and will isolate the
12v from the pins of the microcontroller.

>I guess your concern is that the ADC will see 12 V when the divider
>floats, and tying a small signal diode from that pin to 5 V will again
>provide a path for the voltage divider (or at least R1) to continue to
>needlessly leak current when in sleep mode.

yes, simply cutting off the current at the bottom like that leaves
the voltage divider in place which connects 12v to the microcontroller
input pin, which will have an ESD diode to 5v.

>Is this the challenge you are trying to work around and why you had the
>MOSFET turned around and operating in the linear mode?

Yes, the circuit I described isolates the 12v from the microntroller
by connecting 12v to the gate.


>Do you have any open collector outputs? If so, use that output to drive
>a PNP transistor placed at the top of the voltage divider. If not, use
>an NPN transistor as a driver.

When I tri-state the pin, it will have a pullup resistor to 12v,
which will then draw current through the ESD diode to 5v.
The only way to turn the PNP resistor off is to have it go to 12v.

>I guess this is effectively what you were getting at with the
>optocoupler approach. (I'd be more inclined to use transistors than an
>optocoupler.)

I can't think of a way to do it with a single transistor.
I think it needs at least two transistors or an optocoupler.






>Greg London wrote:
>> The mosfet idea puts the battery voltage on the Gate, the Source
>> tied to ground, and a resistor from the Drain to a programmable
>> pin on the microcontroller.
>
>Huh? The circuit I expected was:
>
>             B+
>             |
>             R1
>MCU ADC|-----|
>       |     R2
>       |     |
>       |    .|D
>    OUT|--G|_   Q1
>       |     |S
>             |
>            GND
>
>Where the MOSFET (Q1) is in series with the voltage divider (R1, R1),
>and an output pin from the MCU drives its gate.
>
>I guess your concern is that the ADC will see 12 V when the divider
>floats, and tying a small signal diode from that pin to 5 V will again
>provide a path for the voltage divider (or at least R1) to continue to
>needlessly leak current when in sleep mode.
>
>Is this the challenge you are trying to work around and why you had the
>MOSFET turned around and operating in the linear mode?
>
>Do you have any open collector outputs? If so, use that output to drive
>a PNP transistor placed at the top of the voltage divider. If not, use
>an NPN transistor as a driver.
>
>I guess this is effectively what you were getting at with the
>optocoupler approach. (I'd be more inclined to use transistors than an
>optocoupler.)
>
> -Tom
>





More information about the Hardwarehacking mailing list