Power saving

Hi All, My logger project has gone well, and i have a standby current between readings of 2uA during sleep now. I am using MCP1702 5V part as my regulator

I've tried to add a potential divider to A0 with a 1M/100K division so that I can also measure my battery voltage (12V) but when this is added I am seeing my current draw tend towards 23uA. Presumable flowing through A0

How can I stop this? I have tried making the pin an output.

For info I am using the rocket scream low power lib to turn of ADC during sleep

 LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);

12V / 1100000Ω = ~11µA. Try 10M and 1M + a 10nF to 47nF ceramic cap from A0 to GND, may still pick up noise though?

It turns out that this is not a simple problem. Ideally, you want to enable the divider only when you want to do the measurement. But when the battery voltage is higher than your processor is running at, you're basically looking at two additional transistors. Remember that you have a protection diode in your processor that goes from A0 to Vcc, and it's there no matter how you have A0 configured. So you can't directly drive a PNP transistor or a P-channel mosfet directly from A0 because you would never be able to turn it off. You would need an NPN or N-channel mosfet which in turn drives the PNP or P-channel. And a resistor for each. So it's probably simpler to just accept the current going through the divider, or ask yourself if you really need to know the battery voltage.

I assume you don't use a 12volt lead-acid (car/alarm) battery,
because then those currents (~100mAh/year) would be tiny compared to the self-discharge of the battery.

100k:1Meg sounds a bit off for a 12volt (12.8? or 13.5?) source.
100k:1.2Meg could be better, assuming you switch to 1.1volt Aref in setup() for a better resolution.
Must add that (100n) cap from pin to ground with these values.

Higher values (1Meg:12Meg) would only make some sense if this is a primary lithium battery.
Leo..

I use this circuit.

The pin to control to MOSFET, high to read the voltage, is shared with an LED indicator
pin.

PowerSave VoltageRead.jpg

PowerSave VoltageRead.jpg

That's a slick circuit, srnet. I'm going to steal it. :slight_smile: