Portuguese Version

Since we are powering the Raspberry with batteries, how can we estimate the run time?

When looking for batteries you may spot two very important information. One of them is the voltage of the battery, the other one is the capacity, which is represented by **mAh** (miliamp-hour). When we say a battery is rated 2000mAh, it means that if we draw 2000 miliamps (2 amps) from it, it will last exactly 1 hour. And if we draw just 1000 miliamps? It will last 2 hours!

So it’s easy to know how long the battery will last, if we know its capacity rating and how much the Raspi will draw, right?

More or less. Remember, we are using two 18650 batteries in series, that sum 7.4v. The Raspi runs at 5v, not 7.4v. So our UBEC will draw **X** miliamps from the batteries, and deliver **Y** miliamps to the Raspi. That’s why we can’t do a simple calculation only knowing the Raspi current draw.

So, to make things simpler, we break this problem in three steps:

1) How much energy our battery can store?

2) What is the power draw of our setup?

3) Which are our main losses?

1) How much energy our battery can store?

We can use the following equation to find out how much energy (joules) given battery can store:

Energy *(joules)* = Voltage * Current *(amps)* * 3600 *(1h, in seconds)*

We are using two 18650 batteries (3.7v) rated 2500 mAh. In series we sum the voltage and keep the current, so we have 7.4v and the same 2500mAh. The equation can be expressed like this:

Energy = 7.4v * 2500mAh

Energy = 7.4v * 2.5Ah *// Converting mAh em Ah*

Energy = 7.4v * 2.5A * 1h* // Taking aside the “h” of mAh*

Energy = 7.4v * 2.5A * 3600s* // Converting the “h” em seconds*

Energy = 18.5 Watts * 3600s *// Voltage multiplied by Current gives us the Power value*

Energy = 66600 joules* // We multiply the Power for how long the battery will last if we draw that much (3600s)*

Now we now how much energy can our battery stores: **66600 joules!**

2) What is the power draw of our setup?

Our setup is composed of a Raspberry Pi Model A and a LCD display.

I searched about the display that I bought (still in transit) and found that it will probably draw 350 miliamps at 5v.

As you can see in the photo, the Raspi is drawing 220 miliamps while running Super Mario.

Summing both and we found that the total current draw at 5v is 570 miliamps. This way we know that the power draw of our setup is **2.85 Watts** (5v * 0.570A).

3) Which are our main losses?

When we convert (through the UBEC) the 7.4v of the batteries to 5v we have some energy loss. Normally this is a thermal loss, that is dissipated and not used. Our UBEC have 90% efficiency, which means that **we lose 10%** of the energy to the environment in form of heat.

If our UBEC has 90% of efficiency, then we don’t have 66600 joules to use as we intend anymore, we have just 90% of that. So let’s adjust our “Energy” variable in order to reflect this thermal loss during voltage conversion:

Energy = Energy * UBEC Efficiency

Energy = 66600 joules * 90%

Energy = 66600 * 0.9

Energy = 59940 joules

Ok, now we have the two variables that we need in order to calculate how long our battery will last:

Energy = 59940 joules

Setup Power Draw = 2.85 Watts

We can use a variation of the Energy equation to find out the “Time” variable:

Time* (seconds)* = Energy *(joules)* / Setup Power Draw *(Watts)*

Time = 59940 joules / 2.85 Watts

Time = 21031.57 seconds

Finally we convert these seconds in hours and we have the **estimated run time of our setup: 5:50.**