How to save power on your Raspberry Pi
If your Raspberry Pi project is running on battery power, such as the PiJuice, then you will be looking at ways to save as much unused power consumption on the Raspberry Pi as possible. This guide is for those users and we have come up with some ways which can save you hundreds of milliamps and significantly extend the life of your battery. In the guide below we are going to use the PiJuice HAT “of course”and stock battery that it supplied with it for benchmarking.
The first benchmarking test we are going to compare against is when the Raspberry Pi is in an idle state booting using Raspbian Stretch Full and with the HDMI, USB mouse & keyboard and Wi-Fi connected. We have charged the PiJuice battery to 99% and then run the test script found here:
https://github.com/PiSupply/PiJuice/tree/master/Hardware/Batteries
IDLE State = 3hrs 48mins
Switching off the USB/LAN IC
By far the most power hungry devices are using USB, such as hard drives, dongles, mice & keyboard and various other devices. If you project does not require any of the USB ports on the Raspberry Pi or the use of Ethernet then it is possible to turn off the chip that power them all. Even if you are not using those devices they will still be powered and consume a considerable amount of power. Having the ability to switch the USB BUS chip off can save more than 100mA of power. To turn of the chip open up a terminal window and type in the following commands:
Turn OFF USB chip
echo '1-1' | sudo tee /sys/bus/usb/drivers/usb/unbind
|
Turn ON USB chip
echo '1-1' | sudo tee /sys/bus/usb/drivers/usb/bind
|
Total = 7hrs 21mins
Turn OFF HDMI output
Yes, if you are running your Raspberry Pi headless or using SSH for remote access then chances are you are not using the HDMI port connecting to a monitor. However, even though you do not have anything connected to the HDMI port it will still output and power the port, ready for when do connect a monitor. Well, it is possible to switch off this output by a simple command. This can save you up to 30mA in total, which isn’t too much but overall it can make a big difference when combined with other power saving options.
Turn OFF HDMI output
sudo /opt/vc/bin/tvservice -o
|
Turn ON HDMI output
sudo /opt/vc/bin/tvservice -p
|
Total = 4hrs 11mins
Throttle CPU
We all know that complex and resource heavy applications take up considerable CPU, GPU and RAM and this result in excessive power consumption. However, if you are running some simple application or scripts then chances are you will not be using the full capacity of the CPU but yet it still consumes power then IDLE. Therefore, we can down clock the core by changing some parameters in the /boot/config.txt file:
arm_freq_min=250 core_freq_min=100 sdram_freq_min=150 over_voltage_min=0 |
You may need to play around with some of these setting to suit something better to your needs of your project. The saving here are actually quite minimal when IDLE after running some tests, therefore I did not post the results.
Disable Wi-Fi & Bluetooth
If you are connected to the Wi-Fi for initial internet access to run some updates or download some software then make sure you turn it off when not in use as it will still be connected to your access point and will consume power even when IDLE. You can also do the same for the Bluetooth since most people don’t use or require it. To disable the Wi-Fi and Bluetooth simply edit the /boot/config.txt file and add the following lines:
dtoverlay=pi3-disable-wifi dtoverlay=pi3-disable-bt |
You must reboot the Raspberry Pi for the changes to take effect.
Total = 4hrs 51mins
Disable on-board LEDs
If you really want to save as much power as possible then it is possible to disable the on-board LEDs on the Raspberry Pi. This can be done by editing the /boot/config.txt file and adding the following lines:
dtparam=act_led_trigger=none dtparam=act_led_activelow=on |
You must reboot the Raspberry Pi for the changes to take effect.
The power saving here is very similar to turning off the HDMI output on the Raspberry Pi, therefore I would expect very similar results of a power saving around 30mA.