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?
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?
@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.
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.