Linear regulators are simply inefficient. In this setup using a 9V battery, 4V have to be dropped across the regulator in order to produce the 5V output (I am assuming an ideal battery for the sake of discussion). At the same time, the rest of the circuit for the project is going to need what current it needs. Knowing that Power = Volts x Amps, we can see that about 44% of the power delivered by the battery is dissipated across the regulator as heat for any given current draw. So 56% efficiency. Ouch. My initial design for the whole project only drew about 70mA, which I thought was pretty decent. But a quick search of the internet revealed that a typical 9V battery has around 565mAh (milli-amp hours) of life. My device would drain the battery in only 8 hours!
This is where switching regulators become really nice. Some are drop in replacements, and others require a few external components, but all are still simple enough to work with. And with efficiencies north of 90%, they are a very attractive option. Lets consider our 9V battery in terms of mWh instead of mAh. That means we have 5085mWh of life in the battery. Multiply by the 56% efficiency of the linear regulator and we have only 2848mWh remaining to power the circuit. The circuit itself draws 350mW. Again doing the math we see 8 hours of life. Let's consider a 91% efficiency switch regulator now. Only 9% of the power is lost regulating, leaving us with 4627mWh. Now the device can last 13 hours! Not great but still better.
At the end of the day what I really did was make the whole circuit more efficient. This was done through a combination of selecting better resistor values, and writing code to turn things on and off as needed to save on idle power draw. After several iterations of changes the current draw was reduced to <10mA. Now I could operate the device for at least 56 hours (again, ideally). I could take it a step further and add a switching regulator to eclipse 90 hours, but guess what? I don't have one of those lying around.....
