There is a circuit powered by a battery (3V button cell) and another circuit with a microcontroller (Attiny85 in my case) reading perfectly the battery level (through ADC3 pin) each 5 minutes interval.

                              | *                |
                          -----                  -----
  Circuit+                | 1 |                  | 8 |------------- +5V  
     |                    -----                  -----
     |              ADC3  -----                  -----
     +--------------------| 2 |                  | 7 |  
     |                    -----     ATTINY85     -----
     | BAT+               -----                  -----
     |                    | 3 |                  | 6 |  
 /-------\                -----                  -----
/         \          GND  -----                  -----
|   3V    |     +---------| 4 |                  | 5 |  
|  Cell   |     |         -----                  -----
\         /     |             |                  |
 \-------/      |             --------------------
     |          |
     | BAT-     |
     |          |
     +----------+-------------------------------------------------- GND

As commented bellow by @michael-karas, according to datasheet, the Attiny85 has an input leakage current of 0-1 µA.

So, the question: Is there any circuit configuration or software tip to minimize the battery consumption by the Attiny85?

A friend of mine suggested this solution where R should be higher enough to minimize RTC circuit overvoltage and allow ADC readings to vary proportionally to the cell battery voltage:


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ Which? Minimise consumption or read voltage? \$\endgroup\$ – Solar Mike Jun 27 '19 at 12:02
  • 2
    \$\begingroup\$ @SolarMike To minimize the consumption of cell battery in the waiting interval. \$\endgroup\$ – caligari Jun 27 '19 at 12:22

@rdtsc has removed his answer which IMO raises a valid concern. I don't think the OP can rely on +5V to always be present (else, they wouldn't need the battery, would they?), and when that +5V is removed, the MCU will be powered via the pin's clamping diodes.

It is therefore recommended to either add a significant series resistor to the measurement pin which will reduce the leakage current to a minimum, or add an active circuit which connects the battery to the MCU only when a measure must be taken:

enter image description here

Depending on the expected intervals the system will spend without +5V power, the schematic above may be an overkill, but at least a series resistor should be there.

| improve this answer | |
  • 1
    \$\begingroup\$ I can confirm: in the circuit described in question, MCU is powered by battery when +5V is removed from it. What a slurp! \$\endgroup\$ – caligari Jun 27 '19 at 21:15

As long as the ATTINY85 is powered from a separate power source and not from the "Circuit+" node that you have labeled in your diagram then the only load on the battery will be as defined in the data sheet that you had linked. Here is the relevant data for input pin leakage:

enter image description here

You will want to make sure that you do not have that pin configured as a digital pin, output or try turning on the pullup resistor:

enter image description here

| improve this answer | |
  • \$\begingroup\$ Do you mean turning on the internal pullup resistor on pin to avoid leakage current while not reading? With a diode before ADC3 pin? \$\endgroup\$ – caligari Jun 27 '19 at 12:24
  • 1
    \$\begingroup\$ @caligari - I said three things that you "do not" want to try. One of them was turning on the internal pullup resistor. \$\endgroup\$ – Michael Karas Jun 27 '19 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.