# How to test what power a raspberry pi is using per day

I am using a raspberry pi 3 as part of a system that takes time-lapse photos. I have a camera, router and the pi plugged into a 12v battery, attached to a charge controller and a solar panel. With a bit of trail and error, it works. But I need to make the whole thing more portable and run more efficiently.

I need to know exactly how much power the whole thing needs and work out energy saving things I can do to the pi and program it uses.

I have never tested the energy usage before and looked online but get confused with all the calculations and testing methods, as there are so many. Please could someone explain, in basic terms how to work out what energy it all needs and uses and how long it should work without charging it via the panel (just thinking about smaller battery, less voltage).

Thanks

• You need to find out how much energy it is consuming per day. Power is instaneous and measured in watts (W.) Energy is over a period of time, and would be measured in watt hours (Wh.)
– JRE
Nov 16, 2017 at 11:05
• It's a RPi, so "too much". You are using lots of power to generate a video signal that no one looks at, and the CPU is also vastly overpowered for your application. Nov 16, 2017 at 14:40
• The RPi does not have a sleep mode, so you can't even save power there. So I have to agree with the "too much" for your application. Nov 16, 2017 at 14:55

Inline power meters for DC systems are available from many sources. The better ones can measure cumulative power in mAH or mWH. Just insert between the charge controller and the loads.

• This will work IF the current is always in the range this device can detect. If the RPi goes into sleep mode it might consume so litlle current (less than 100 uA for example) that this device cannot measure it so it assumes it is zero. Over a long period of time that small current can still add up to be a significant contribution. Nov 16, 2017 at 13:41
• The latter does not happen with the Raspi. It always consumes a few hundred mA because of the GPU. Nov 16, 2017 at 14:17
• You could also use one of the better engineered USB power monitors on the RPI, although I suspect the router will also be consuming enough power to get you above the measurement floor. A measurement power supply like an HP 66312A (reasonably cheap used) or HP 66332 (better and cheaper used) is a very accurate tool for these kinds of measurements and a good investment if you are going to be doing ongoing projects. If cost is not an issue, get a Keithley sourcemeter. Nov 16, 2017 at 16:51

Have you seen this video from Dave from the EEVBlog: https://www.youtube.com/watch?v=Dh0xYu8YvaE&t=642s ? It explains the basics and how to measure current consumption on a board with a microcontroller. You can use the same approach for an RPi.

Note how Dave uses the integration function of an oscilloscope to accurately measure the power usage when the device is active (in your case that would be: when taking a photo).

To determine battery life Duty-cycle is a very important factor. To illustrate look at this example:

Let's say that your device uses 0.2 A (average current, you might have to use Dave's method to determine this accurately) when it is active.

When it is inactive (in sleep mode) it uses 100 uA

When the device is active (needs to take a photo) it is active for 3 seconds.

A photo needs to be taken every 5 minutes.

Now we know enough to calculate the average current consumption:

Per hour the device will be active 1 hour/5 minutes = 12 times That times 3 seconds per photo = 36 seconds per hour in active more at 0.2 A

That's a 36 seconds / 3600 seconds (on hour) = 1 % Duty cycle.

So that's an average current of 1% * 0.2 A = 2 mA Add to that the constant 100 uA of the sleep mode gives: 2.1 mA average current.

So on a 1000 mAh battery your device would then last: 1000 mAh / 2.1 mA = 476 hours which is equal to about 20 days.

Now look at the numbers and think what happens if you would:

take more photos, every 2.5 minutes instead of every 5 minutes: the battery life would practically be halved

the sleep mode current would double: not much would change.

This is just an example so depending on your actual numbers the situation might be different but I hope it is clear now how to do the estimation.

• This would be more applicable to a well engineered solution; the pi in question here can't go into low power sleep, though it's possible some peripherals may at times increase power substantially above the baseline, and that would indeed need to be handled in the way proposed here. Nov 16, 2017 at 19:22