ATtiny power-saving advice

I am designing a circuit that detects the number of times a button is pressed in rapid succession, which then activates a light sequence while the button remains pressed. I have this functionality working nicely, but it requires constant power from the battery so that it can keep count of button presses.

Of course I can reduce this by putting the chip to sleep. I can even use the lowest-energy sleep mode since the only input is a momentary switch which I can use to awaken it. However, sleep mode will still draw a small amount of current. I've seen some data that suggests that in power-down sleep mode, the power in my battery (three 1.5v coin cells) would still last longer than the battery's actual shelf-life anyway. Is that correct?

The circuit contains two ATtiny-85's. Both of them use a timer interrupt for their main program loop, for the purposes of keeping the timing between presses consistent.

So, what are my options here?

If I simply send both chips to sleep, do I need to disable the timer interrupts manually or will power-down mode do this automatically? When I end sleep mode, will those timer interrupts start up again on their own or do I have to restart them manually?

An alternative might be to link the button to the VIN as well as the GPIO pin and use a capacitor in line with VIN to keep the chips powered for about a half-second when the button goes up. I think this would allow the chip to keep counting presses when the power is technically 'off', but would disable power entirely after a brief time without changes, thus saving battery power. Does this sound feasible or advisable? What size of capacitor would I need?

How can one answer if he knows only shape of the battery..

Why two MCUs? Why 4.5V instead of 3V?

Why two MCUs?

Because one of them is producing sound, while the other handles logic and LEDs. If I try and do it all on one chip it can't cope and the audio sounds awful.

Why 4.5v?

Convention, mostly. I could use two if there was a tangible benefit, but they have to be coin cells because of space restrictions. I might also need the extra oomph later on if I add more features.

Voltage is directly related to Attiny power draw.
Anyway, some small 1.5V coin cells have 10mAh capacity, bigger ones more than 150mAh.
Single 3V CR3032 coin has capacity of 500mAh.
And battery quality/chemistry has big effect on self discharge rate.

Chances are good that I'll be using LR44's, as they're the commonest type that's small enough for my needs. CR3032 is too big, unfortunately. A CR2 might be a good alternative if 3v will run the circuit. Does that help?

All timers will be stopped when you enter power down mode. They will resume operation from where they were stopped when you entered power down mode.

1 Like

Brilliant, thanks @jim-p that'll make my life a lot easier if it turns out that it's really not worth pursuing the automatic shutdown option.

Well when in power down the current consumption can be as low as 0.4uA. In the auto shutdown it will be 0, if you can make it work the way you want.

I don't see how this is possible, maybe someone can explain it or point to a source?

Chinese batteries have short shelf-life. :wink:

Anyway, if you have 150mAh 3V battery and power-down sleep current draw is 2uA, it would give ~10 years if self discharge is not considered.

2 Likes

@kmin I finally remembered why I was using 4.5v. It's because the original intent was to use an LM386 to build a small amplifier circuit to improve the sound output, and the LM386 has a minimum supply of 4v.

With a Quiescent Current of 4mA your batteries won't last long

If that's not the case at the moment, prefer 3V.
Have a look some coin battery chart to find the best size for you restricted space.
Also note that silver oxide battery has much lower self discharge than similar alkaline. So if you are looking for battery life longer than few months, AG might be best option.