Raspberry Pi 3 (And to a lesser extent, Zero) power saving techniques

If you are hopeing that there is some magic bullet for power consumption, some setting you can change that will cut power use in half, forget it. The Pi doesn't have much in the way of energy saving features.

It is not that the hardware lacks energy saving support. The BCM2837 and BCM2837B0 processors, used in the Pi 3 model B and B+ respectively, do have some very capable power management capabilities allowing for selective shutdown of processor sections when not in use and even entire cores. It's just that none of that is available if you're running linux on it, as almost everyone is. It's too specialised, too propritary - unless someone with an extensive knowledge of both the processor and the linux kernel is able to tackle the problem, it's not going to help you. Going from a 4-core to a 1-core configuration without a reboot is not something the kernel can handle. This is further complicated by the Pi's unusual use of the GPU to carry out system management functions, so it cannot be powered down.

If power consumption is tight enough that you are reading this guide, you should seriously consider using a Zero or Zero W. If you really need the hardware capabilities of the Pi 3 B/B+ though, there are some techniques you can use to reduce the power use of your pi. They can shave a bit off, and sometimes that's enough. This guide is written primarily with the 3B/B+ in mind, but some of the techniques can be applied to the Zero.

1. Look outside the pi, and to your power supply.

Before even considering the power savings of the pi itsself, look to what is powering it. The efficiency of your power supply circuit matters just as much as anything you might achieve in software, if not more. In most power-critical applications you will be running your Pi off of batteries, utilising either a buck or a boost converter circuit depending upon supply voltage. The efficiency of these circuits varies widely - while 85% is typical, a syncronous converter running at optimal load is capable of achieving an efficiency upwards of 95%. Conversely, a poorly-designed, low-cost converter operating far from optimal conditions may achieve an efficiency as low as 50%.

There is one rule you can bear in mind. Both buck and boost converters come in two major types: Syncronous and non-syncronous. The non-syncronous converters are lower in cost, but also lower in efficiency - so you should probably make sure to get a syncronous one. Careful on eBay, as sellers tend to mis-label their listings: Don't trust a module that claims to be syncronous, find the datasheet for the actual converter IC and look it up to make sure. A good choice for a buck converter is the MP2307 - converters based on this IC can perform with a very high efficiency, in the 90-95% range.

Note that the LiPo Rider series of modules, to date, all use non-syncronous converters - they offer the convenience of one module to handle both charge and discharge functions, but they are not the most efficient solution.

There is some debate if buck or boost converters are more efficient. Neither is inherently more efficient - they both utilise exactly the same components and experience similar losses. The efficiency depends upon operating conditions and component choice more than the topology.

The Pi itsself contains a number of buck converters to turn the 5V input into the required 3.3V, 1.8V and 1.2V, all handled by the mysteriously undocumented XR77004 chip - a custom component designed specifically for the Raspberry Pi. Fortunately the Pi 3's power supply electronics are already well-engineered, so there is nothing you can do to impove the efficiency here. It's actually quite impressive the lengths that the Pi design team went to in achieving such efficient performance within a very tight cost constraint.

According to the official specifications, all Pis to date require a supply of 5V ± 5%. That is, 4.65V to 5.25V. It is worth noting though that the most voltage-sensitive components are the HDMI interface and the USB functions, including ethernet (which is internally connected via USB). If you are not using these functions at all, such as if you have a headless pi A, Zero or Zero W and do not intend to use the USB port, then the supply voltage may safely be substantially lower. In the case of a Pi Zero, it's possible to go one step further - powering the Pi via the 3.3V rail, and avoiding the use of the 5V entirely. This configuration means you cannot use use an USB peripherals, and I have not tested if HDMI, camera or TFT work, but all GPIO pins and associated functions as well as the wireless will operate normally - and the Pi will consume 10% less power, as you are no longer losing efficiency to the onboard buck converter.

There is a transient supressing diode located near the USB power input on both the 3B and 3B+ which connects between +5V and ground. As it is a fairly large component and easy to place test points or solder wires to, you might find this a convenient place to monitor the rail voltage during testing, or even to supply power if you have a hat which obscures the GPIO header.

2. Underclock and apply conventional processor-use-minimisation techniques.

You might think that underclocking the processor is the way to go. You'd be half-right: The processor does support (and most distros will have enabled) frequency scaling, so some saving can be achieved just by minimising processor load. Yes, halving the clock will save power - but it won't halve power use. For underclocking to save a lot of power requires it be quite aggressive, and it also means minimising CPU load and activity to make sure that it can stay at that slow clock for as much time as possible.

The clock speed settings are in /boot/config.txt on Raspberrian. It's possible to independently set clock speeds for CPU, core, memory, GPU, and this is a good way to get an unstable system - there are many complex interactions within the Pi. Also, altering core clock can mess up the UART. I found best results meddling in just two frequencies: arm_freq_min and gpu_freq_min. I can't tell you what works best on a Pi 3, as I was using a Zero W for testing here - but arm_freq_min=400 and gpu_freq_min=50 certainly achieved a drop in power consumption for me. It'll kill graphics performance, of course. While you're in here, gpu_mem=16, framebuffer_width=16, framebuffer_height=16. The first frees up precious memory. The other two, I do not fully understand their impact, but I did measure a tiny drop in power use after putting them in. They'll also render the video output unusable, so have SSH ready before you do that.

The usual advice here from any linux system applies. Do not run X, uninstall or disable every service you possibly can, monitor top to see where the processor time is spent. As an added bonus this will free memory too. One significent power-consumer is network transmission, so make sure to minimise the time spent waking up the wireless as well - that means disable avahi unless you really need it. You have to be aggressive here: Anything and everything which could cause the CPU to do any work or the network interface to transmit needlessly does have to go. Anything which might generate events on a timer has to go unless it is essential for your application.

3. Disable the HDMI output.

Now we're getting into pi-specific techniques. There is no way to selectively cut power to parts of the Pi hardware to reduce power consumption, with the exception of the HDMI circuity. You can disable this with the command '/usr/bin/tvservice -o' - power use will immediately drop quite significently. You can add that command to rc.local or your distribution's equivilent.

The Pi 3 B/B+'s audio circuitry, rather cleverly, uses the processor's PWM driver outputs through a power buffer chip and analog filtering - in essence, a directly driven class D amplifier. While you could cut power to this by physically removing the buffer chip, there is no reason to do so: It uses negligable power when not playing sound. Class D amplifiers are remarkably efficient, especially in regards to quiescent current.

4. Turn the status LED off.

Add one line to config.txt: "dtoverlay=pi3-act-led,gpio=17"

This save 5mA from the 3.3V rail... or maybe 4mA from the 5V input. It's pretty tiny. But it's an easy thing to do, so there is no reason not to.

5. Remove the power LED.

Remove, not disable - and for good reason, which can be seen on the schematic. The power LED is controlled by one of the GPIO ports of the processor, so it can be turned off from software, just like the status LED - but the electronics for doing so are quite different. When the GPIO is high, this turns on an N-channel MOSFET which shorts out the LED - meaning it actually draws more power to turn off than leave on! 5mA when off, direct from the 5V rail, or 4mA to turn on. This part of the Pi is not designed for efficiency. If you want to save those 4mA, which is a sign that you are getting desperate for power savings, you've only one option: Physically remove either the power LED or the series resistor using a soldering iron. This reduces the power consumption of a Pi 3B+ by approximately 1%.

That's it. You now know every means there is to reduce power consumption, and it's not going to save you very much. Maybe fifty miliamps at most.

There is one more useful thing to know, though: An external INA219 chip may just help you. It can be used as a battery monitor, connected via the I2C interface. It won't actually help you to save power, but it can be used to monitor battery voltage, estimate time remaining before depletion, and initiate a clean shutdown before that happens..