Disabling voltage measurement with NPN transistor

I have a MCU that runs from battery (battery > voltage regulator > input).
The MCU has an ADC with Vref = 1V.

I want to (roughly) measure the battery voltage (ranging 3.6 - 6V). Therefore I use an voltage divider to scale the input voltage to the allowed Vref range.

The voltage divider draws 80µA (10k + 68k @ 6V). I want to avoid that, because most of the time, the MCU sleeps and so should the voltage divider.

Can I somehow use a NPN-transistor to enable/disable the voltage divider?

I tried the given schematic, but it does not work (the enable signal influences the measure?).

Any tipps? Does a FET help? Any keywords suggestions for google?

Thank you!

P-channel MOSFET between V+ and R4. High on Gate to turn it off, Low to enable it.
Use one with Logic Level Vgs and very low Rds.

Is it possible to enable it with an high signal by using an N-channel MOSFET?

If the MCU sleeps the outputs are low.

@CrossRoads, if the battery voltage is higher then Vcc of the MCU (Arduino? 5V?) that's not possible. Then you have no way of turning it off because you can't drive it as high as Vbat. And because the whole idea of using a resistor divider is to read a higher voltage it does not work.

To make it work you can drive the gate via a NPN (or N-mosfet for that matter) and use a pull up to Vbat.

Indeed use a logic level mosfet. Ron isn't that important. Because the 68k can have an error of 680ohm when you use 1% resistors (and I see no reason to use better resistors and pay a ton). So even if Ron is 100ohm that's still less then the error in the resistor so insignificant.

This circuit would divide by approximately the same ratio yet have lower impedance seen by the analog input A0 for stable and accurate readings.

To measure, set the DIO pin as OUPUT LOW. Allow a few seconds to fully charge the capacitor then take 2 readings on A0 (discard the first). 11µA is drawn from the battery during measure.

When in sleep mode, set the DIO pin as INPUT. If the battery is at 6V, only 1.9µA is drawn into A0. If the battery is at 0V to 5V, there is no current draw.

thomai:
If the MCU sleeps the outputs are low.

Only if you set them low.

^ What dlloyd said.
The voltage divider can be made with 10x, and maybe even 100x the resistor values.
The cap is needed, but 100n might be enough.
Read this.
Leo..

Just realized that the circuit I proposed earlier wouldn't stop the 11µA drain on the battery due to the divider. Changed the capacitor to 100nF as suggested by Wawa ... RC time constant is 47ms.

The corrected circuit:

I agree with Wawa: something like 10M+10M+100 nF cap is the way to go.

If the battery voltage is higher than VCC, adding a buffer transistor to drive the MOSFET gate low can be added, either N-channel or NPN:


(N-channel pulldown could be on the Arduino side of the gate current limit resistor)

Yes, a PFET to switch the voltage and an NFET to turn on the PFET. You can get the FETs in matched pairs in one package. You want your filter before the PFET so that you don’t have to wait for the settling time when you turn the FETs on.

I attached a picture of the circuit. It’s used on a demo board here → DC2343A

disabled_vbat_meas.png

How I solved it:

I added a Polulu switch since it was easier than coming up with my own…

I only measure voltage AFTER the switch is ON and if the voltage gets too low… I can turn the whole thing off with the arduino. My test gear I use this on can go months powered down and only lose maybe 0.1V of battery voltage in that time. Since it is test gear, if I forget to turn it off… the Arduino shuts off after a few minutes.

MyPCB-LC-schematic.jpg

Wawa:
Read this.
Leo..

This might work for a hobbyist, but you'd never do this in a real product. First off he wasn't "picking up all kinds of noise," he was violating the input impedance spec from section 24.6.1 of the Atmega328P datasheet. Adding a cap will make it better, but it needs to be much larger than the capacitor in Figure 24-8 of the datasheet.

Huge resistors have other problems too. The leakage of the capacitor, and just stray resistance on the board will affect 10MΩ. Most point in an electrical circuit that are isolated from each other, still have MΩ of resistance between them. The resistances decrease over time too. If you tried this in a mass produced product, you'd get a lot of failures. And at the end of it all, you still have 100s of nA draining your battery.

The OP should use the circuit Crossroads recommended (same as the one on the demo board I linked to). That will result in ~10nA draining from the battery if it is polled every 1s. It does cost you an I/O, however.

dlloyd:
Just realized that the circuit I proposed earlier wouldn't stop the 11µA drain on the battery due to the divider. Changed the capacitor to 100nF as suggested by Wawa ... RC time constant is 47ms.

The corrected circuit:

And what is the voltage on A0 when DIO1 is high or floating? Something higher than 5V, I expect.

Since we don't need to measure battery voltage down to zero, what about a diode string or Zener diode to bring the voltage down? It still has the float-above-5V problem but perhaps a 10M resistor can pull that down?

And what is the voltage on A0 when DIO1 is high or floating? Something higher than 5V, I expect.

Yes, there will be a tiny leakage current through the A0 and DIO1's protection diodes, perhaps 2uA in total,
not significant.

There's no great problem with using 10--100M resistor values on an FR4 PCB if you use plastic film
capacitors, everything is a quality insulator, 10G ohms or more (unless highly humid conditions, in
which case a conformal coating will be needed).

You'd need to check the DC resistance of the ADC inputs/multiplexor though.

dlloyd:
Just realized that the circuit I proposed earlier wouldn’t stop the 11µA drain on the battery due to the divider. Changed the capacitor to 100nF as suggested by Wawa … RC time constant is 47ms.

The corrected circuit:

This circuit will result in 0.76V at A0 when the battery is 6.0V, and 0.46V at A0 when the battery is 3.6V. I’d assume that you mixed the resistors up, but the reverse would result in 5.24V at A0 when the battery is 6.0V.

When DIO1 is 5V and the battery is 6.0V, the pin will be sinking 1.86uA. Section 35.7 of the datasheet doesn’t have a “VOH vs sink current” graph for a reason.

When DIO1 is 5V and the battery is 3.6V, the pin will be sourcing 2.60A. Since the current being put into the battery, must ultimately come from the battery in the first place, there’s no way to know how much you’re actually drawing from the battery.

The difference between the battery current when DIO1 is off and on is <10uA saved. If you’re going to use an I/O for this circuit, you should get better than an order of magnitude improvement.

Just add the PFET/NFET pair Crossroads recommended … you’ll get 1000x the improvement for pennies.

The ratio is the same as the schematic provided in the original post. The OP is using Vref = 1V.

35.7 of the datasheet doesn’t have a “VOH vs sink current” graph for a reason.

Its generally an accepted rule to keep the current through the protection diodes <1mA. You might be surprised what Atmel does here.

When DIO1 is 5V and the battery is 3.6V, the pin will be sourcing 2.60A. Since the current being put into the battery, must ultimately come from the battery in the first place, there’s no way to know how much you’re actually drawing from the battery.

I think you mean 2.60µA. Anyways DIO would never be set as output HIGH (there’s no reason for this).
DIO as OUTPUT LOW turns on the divider.
DIO as INPUT turns off the divider.

With the divider turned off,
Current draw 0-5V = 0µA
Average draw 5-6V = 1µA
Wh loss in 1 year = 5.5V(avg)0.000001A8760hours = 0.04Wh

What battery is being used??
Self discharge rate of lithium-ion battery is about 10% per month.
Self discharge rate of lithium battery is about 1% per annum.

dlloyd:
The ratio is the same as the schematic provided in the original post. The OP is using Vref = 1V.

I didn’t notice that in the original post. My bad and thanks for correcting me.

dlloyd:
Its generally an accepted rule to keep the current through the protection diodes <1mA. You might be surprised what Atmel does here.

If Atmel really does advocate continuously putting <1mA current through the protection diodes, then there is no reason to set DIO high. Again I’ll thank you as it’s something I did not previously know about the AVR. I’ve worked with a lot of micros, but I’m new to the AVR and I wouldn’t have expected them to have recommended using the protection diodes this way. And thank you for the link.

dlloyd:
What battery is being used??
Self discharge rate of lithium-ion battery is about 10% per month.
Self discharge rate of lithium battery is about 1% per annum.

The OP didn’t say, but we know that 80uA was too much for him and his micro was asleep most of the time. He didn’t say what rate he plans to poll the battery voltage at either.

Basically, what the FET pair gives over your solution is 1) when the circuit is off it draws 0A no matter what the input voltage and 2) the circuit only needs to be turned on for the ADC sample time as opposed to 150ms. For example, if he’s reading the battery voltage every 1s when he’s awake, that averages to ~1uA drain with your circuit as opposed to ~1nA with the FET pair.

Thank you for your answers and the interesting discussion so far.

I'm not posting anything because I'm still waiting for the FETs I ordered. They should arrive this weekend...

I use 4 AA-Alkaline batteries with a HT7333 (low quiescent, 3.3V regulator) to power a 3.3V ESP12E. The polling/wakeup rate is 1 to 4 times an hour.

Turning the circuitry on for 150ms would not be a problem, since the MCU will be awake for at least 1 or 2 seconds.


Thank you crossroads, no (measureable) current when using the P-FET + NPN.
I'm happy and I learned a lot :slight_smile:

Is switching a load by using a NPN on the low side a bad design? Are there any drawbacks except for the voltage drop caused by the transistor’s Vce?

With what I read the last days, I’d always prefer FETs for on-off-switching (Nick does exactly the same here: link), but then, I compared some datasheets and found out, that the leakage current for a P-FET (IRML2244) is 1µA, whereas the leakage current for a NPN (3904) is 50nA.

(Practically, R4 in the image is the DHT22, which is switched ON for 2 seconds, read, and then sent back to sleep for a long time).


edit:
Ok, I answer the question by myself: Low side switching