Introduction
The Celtic Engineer is a weekly newsletter produced by Celtic Engineering Solutions. We hope you enjoy it. If you have any suggestions for topics, would like to give feedback or want your email added to the distribution list please send an email to TCE@celticengineeringsolutions.com.

Amp-hour vs. joules
So, I am making this battery powered device and all I want to know is how many batteries do I need to make it last forever? As engineers, we take some things for granted. Specifically, we think that everyone understands the world of electronics the same way we do. So, when we talk about system voltage, battery capacity and useable life, we can often get the response, “Right, so how many batteries do I need?” It’s a fair question, but not an easy one to answer. Especially when you have a microcontroller (mcu) on board. The reason is because an mcu does not use the same amount (a constant amount) of energy all the time.

We might as well start with the idea that energy and power are not the same thing. Energy is the capacity to do work. Power is the rate at which work is being done. Energy is the expressed in the units of Joules or watt-hours. One kilowatt-hour (the units of energy the power company bill you for each month) is equal to 1,000,000 Joules.
Mechanically speaking a joule is the amount of energy used when you apply a force of 1 newton through a distance of 1 meter. Electrically it is when 1 amp is passed through a resistance of 1 ohm for 1 second.
Power is the rate of energy consumption. It has the units of Joules per second or watts. Watts are found by multiplying the voltage and the current in a DC electrical circuit.

Batteries do not contain power they contain energy
That energy can be consumed at different rates. This should be pretty clear. If not, you will want to go back and read that last section again, because here is where things get messy. A typical AA battery has a capacity of 2850mA hours. So quick quiz, is and Amp-hour a unit of energy or power? It’s actually a trick question. The answer is neither. It is a unit of charge. Basically, the battery companies are telling you how many electrons they have put in the battery for you to use. It really does not help you answer the question of how many batteries you need.

The idea behind the amp-hour is that it tells you how many amps an ideal battery can deliver for a certain amount of time. So, a 2850mAh battery can deliver 2850mA (2.85A) for one hour. Or it can deliver 1425mA for 2 hours; or 28.5mA for 100 hours.

System voltage
The system voltage is the voltage at which the device operates. There may be several system voltages, but to keep this simple, lets imaging a battery powered device that has a system voltage of 3V. Three volts is nice, because many mcu’s will work with that voltage. The input voltage is usually higher than the system voltage. To compensate for this, we use regulators. A regulator takes in one voltage and puts out another. A very simple type of regulator is called the linear regulator. It is frequently used in battery powered devices. It will take in a voltage of 4.5, 6, 7.5 or 9 and put out a system voltage. In our case that is 3V. You might think I chose a strange assortment of voltages, but they are just the nominal voltage of new batteries, either 3, 4, 5, or 6 in a row.

You might wonder why not just use two batteries to get 3V and be done with it. Notice I said ideal battery above? Real batteries cannot perform that way. They have a maximum current that can safely be drawn. In fact, a real battery has a discharge curve. This has voltage on the left and time on the bottom, see figure 1. All three devices start at 1.5V, but have different service hours (how long they device works) based on the amount of current being drawn. CCV stands for constant current voltage. It means the voltage you will see on the battery when the device draws a constant current for that length of time.

Figure 1 Battery discharge curve from and AA Energizer battery datasheet.

So, we can’t use 2-AA batteries to get 3V because soon after we start drawing current the voltage begins to drop. We might use 3-AA to start with 4.5V. The regulator keeps the voltage constant to the system at 3V even while the battery voltage falls from 4.5V. The regulator does this until we bump into a parameter known as the dropout voltage. Every regulator has a dropout voltage. They range between 0.1V and 0.5V, typically, for most regulators. This is the difference between the input and the output voltages that the regulator needs to do its job. Once the dropout voltage is hit, as the input voltage continues to drop the output voltage no longer stays constant but will also drop, while still maintaining that same voltage across the device (say 0.1V for a good regulator).

Are we there yet?
When your batteries are 3.1V, your system voltage will begin to fall. How far it can fall before the system stops working is dependent on what type of chips you are using; 2.75V is not unreasonable. That will happen, in our fictitious device, when the batteries are at 2.85V (0.1V across the regulator). Our device will stop working when the battery voltage gets to 2.85V, not when it is completely depleted. For that reason, and because battery voltage is continually dropping, it is really hard to decide how many batteries you need.

You are no doubt wondering what happened to that voltage between 4.5V and 3V when we first started. To answer that, let’s go back to figure 1 and the CCV on the left side. To make the curve they assumed their device draws a constant current. We will do the same. Let’s assume that our device draws 100mA (0.1A). We have a system voltage of 3V, so our power consumption is 0.1A * 3.0V, or 300mW (0.3W). The 100mA is coming from the battery and running through the regulator. The power dissipated, through heat, by the regulator is (4.5V-3.0V)*0.1A or 150mW. The battery is actually supplying 450mW; 1/3 is dissipated as heat and 2/3 is used in the device.

Efficiency cuts no slack
If you want to make your system last longer you might think you can stack more batteries on top of the others. Let’s say we double the number of batteries, instead of 3 let’s use 6. Now we have an input voltage of 9V instead of 4.5 so it should last twice as long. The problem is we still operate at 100mA. We still consume 300mW, but the battery is putting out 0.1A * 9V or 900mW. Now, 2/3 of the power is going to heat and only 1/3 is being used by our system.

If, instead of stacking the batteries on top of one another, we had made two strings of 3 and put them in parallel we would have kept the input voltage the same (4.5V) but doubled the battery capacity.  When you stack batteries in series, the capacity of the string is the same as the individual battery; 2850mA hours for AA’s, and you add the voltage. But when we put batteries in parallel the capacity adds and the voltage stays the same. So, two strings of 3 batteries is still 4.5V, but the capacity is now 5700mA hours.

What is the typical capacity of different sizes of batteries? AAA: 1150mAh; AA: 2850mAh; C: 8000mAh; D: 18000mAh. It is easy to that 3 C size batteries are a much better choice than 6 AA arranged in two strings of three, if you can handle the increased size.

Nothing is free
One side note is that when you put strings of batteries in parallel, you don’t just connect them together. If you do and one battery discharges at a rate slightly different than the others, you can wind up in the situation where one string is charging the other string. While undesirable with rechargeable batteries, when this happens with non-rechargeable batteries an unsafe condition exists. To fix this we put a diode in series with each battery string. Current flows out of the string but cannot flow back into the other string. And of course, there is a voltage drop across the diode. 100mA times the voltage drop across the diode is waste heat. At low currents, typical battery-operated devices, and proper diode selection you can see a forward voltage drop of a few hundred millivolts. At 0.1A that’s tens of milliwatts, not too bad.

Practicality of design
So how do we figure out how many batteries we need? Will you hate me if I say an educated guess? We can spend lots of time modeling the current consumption (because real devices are not going to draw a constant current), we can calculate the amount of energy used over the life of a set of batteries and drop out a number that says it should last this long. Reality is, your mile may vary. Time is best used when we make a good, educated guess, build a prototype and try it out in something like a real-life use case. Then you can go back and decide which arrangement of batteries will best work for your device. That is why prototyping is very important. I had a professor in school who swore that the circuit never lies, it might deceive you, but it never lies.

Final thoughts
This newsletter is sponsored by Celtic Engineering Solutions LLC, a design engineering firm based out of West Jordan and Murray, Utah, which can be found on the web at: www.celticengineeringsolutions.com. If we can ever help you with your engineering needs please contact us. You can find the newsletter on the company blog, LinkedIn or in your inbox by subscribing. Send your emails to The Celtic Engineer at: TCE@celticengineeringsolutions.com, with the subject line SUBSCRIBE.