Battery efficiency

I am using an attiny 85, two momentary buttons, and a small buzzer. My problem is no matter what battery I try, it gets depleted really fast. I tried both a 9v and a 12vA23 with a L7805 regulator and those die just sitting in an idle state for a few hours. I also tried two CR2032 is series without a regulator and it died in about 8 hours in an idle state. Shouldn't I be able to get weeks/months or maybe even years off of these batteries? The attiny draws such a small amount of current. Any advice would be very much appreciated.

Zalsobrooks:
I am using an attiny 85, two momentary buttons, and a small buzzer. My problem is no matter what battery I try, it gets depleted really fast. I tried both a 9v and a 12vA23 with a L7805 regulator and those die just sitting in an idle state for a few hours. I also tried two CR2032 is series without a regulator and it died in about 8 hours in an idle state. Shouldn’t I be able to get weeks/months or maybe even years off of these batteries? The attiny draws such a small amount of current. Any advice would be very much appreciated.

Did you measure the actual milliamps your circuit is consuming from the battery?
Try larger batteries like “AA”, in series.
The 7805 can waste 50% of the power from the 9v and 12v batteries.
Use a lower battery voltage.

The onboard voltage regulator draws more power than you may expect.
Try powering the 5v line, bypassing the regulator.

Measure how much current it's drawing (most multimeters provide such a mode). An idle ATTiny85 should consume... enough that you can't leave it on for weeks on coin cells.

The first thing you're doing wrong is to use the regulator. Run it at 8mhz, and power it right off the 3v battery - it's still in spec, and at lower voltage, it'll use less power too!

If you must provide full 5v and regulate it, don't use a 7805. They have like 5mA quiescent current, while modern LDOs have much lower quiescent current.

But in order to get decent battery life, you can't just leave the attiny in idle mode. You need to put it to sleep - take a look at Nick Gammon's writeup on AVR power management (google nick gammon power management). Don't forget to turn off the ADC while in sleep!

DrAzzy: If you must provide full 5v and regulate it, don't use a 7805. They have like 5mA quiescent current, while modern LDOs have much lower quiescent current.

A modern regulator, like the NCP1117 used on the UNO, uses typically 6mA quiescent current. Dropout voltage might be the biggest improvement. Leo..

Wawa: A modern regulator, like the NCP1117 used on the UNO, uses typically 6mA quiescent current. Dropout voltage might be the biggest improvement. Leo..

Look a little harder - the 1117's are not optimized for that, but there absolutely are regulators with very very low quiescent current. (TPS783, MPC1703, etc)

DrAzzy: Look a little harder - the 1117's are not optimized for that, but there absolutely are regulators with very very low quiescent current. (TPS783, MPC1703, etc)

Sure. e.g. the Pro-Mini uses such a low dropout, low quiescent current regulator. Just wanted to point out that common modern regulators are NOT lower in quiescent current than the common 78xx family. Leo..

Ah, yeah, I see what you're saying. Perhaps I should have phrased that differently.