PiSupply / PiJuice

Resources for PiJuice HAT for Raspberry Pi - use your Pi Anywhere
https://uk.pi-supply.com/collections/pijuice/products/pijuice-portable-power-raspberry-pi
GNU General Public License v3.0
438 stars 104 forks source link

potential to reduce CPU clock speed to increase battery life? #29

Open shawaj opened 6 years ago

shawaj commented 6 years ago

@francesco-vannini was inspired by the recent news about apple dynamically reducing the CPU power on their devices due to aging batteries - and had a neat idea.

Potential to underclock the CPU to increase battery life.

Needs further investigation

klint-k commented 6 years ago

Only a good idea if it has some use control.

shawaj commented 6 years ago

@klint-k what do you mean?

klint-k commented 6 years ago

The user needs to have the choice, to slow down or not.

shawaj commented 6 years ago

Yep, that was the whole idea

shawaj commented 6 years ago

https://raspberrypi.stackexchange.com/questions/8877/overclocking-via-command-line

And

http://www.pantz.org/software/cpufreq/usingcpufreqonlinux.html

And

http://www.jackenhack.com/raspberry-pi-3-overclocking/

And

https://www.raspberrypi.org/forums/viewtopic.php?t=138123

And

https://www.raspberrypi.org/forums/viewtopic.php?t=33159

And

https://www.raspberrypi.org/forums/viewtopic.php?t=19253

shawaj commented 6 years ago

Basically, it seems that he underclock and under volting will provide savings and is very easy to do (just a config file edit and reboot so we could automate this) but the power savings may end up being negligible in comparison to the power consumed by LAN9514 chip and any USB peripherals.

Worth playing around with and testing though. Although it seems best option for lower power consumption is model A or Zero v1.3

Maybe we should do an article called "extreme pi power saving" or something ;-)

ChristopherRush commented 5 years ago

Had a look at this and came up with the following guide - https://learn.pi-supply.com/make/how-to-save-power-on-your-raspberry-pi/

The power savings from underclocking/undervolting where actual minimal. The biggest saving was to disable the LAN chip, which almost doubled the battery life when IDLE.

francesco-vannini commented 5 years ago

I agree with frequency scaling the CPU already uses very little when IDLE. As for the system LEDs there are differences between the Zero and the A/B ones https://www.jeffgeerling.com/blogs/jeff-geerling/controlling-pwr-act-leds-raspberry-pi and I find confusing the logic between the two a part from one having one LED and the other having two. In my script I use this at the start of the service:

revision=`cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}'`

if [[ "9000" == ${revision:0:4} ]]; then
    echo 1 | sudo tee /sys/class/leds/led0/brightness
else
    echo 0 | sudo tee /sys/class/leds/led0/brightness
    echo 0 | sudo tee /sys/class/leds/led1/brightness
fi

which determines if the Pi is a Zero or not and acts on the LEDs accordingly.

As for the USB if you are running say on an A+ as I am you have different devices for bind/unbind ls /sys/bus/usb/devices 1-0:1.0 usb1 whereas for the B+ 1-0:1.0 1-1 1-1.1 1-1:1.0 1-1.1.1 1-1.1:1.0 1-1.1.1:1.0 usb1

for the A+ I had to issue: echo 'usb1' |sudo tee /sys/bus/usb/drivers/usb/unbind