Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding additional PWR Energy Savings #186

Open
rudiratlos opened this issue Jul 27, 2022 · 1 comment
Open

adding additional PWR Energy Savings #186

rudiratlos opened this issue Jul 27, 2022 · 1 comment

Comments

@rudiratlos
Copy link

I've wrote a script that uses some tweaks to bring power consumption further down.
Maybe you will find it usefull and use parts of the code (enable_pwrsave) directly in your startup script.
It's only:
/usr/bin/tvservice -o > /dev/null
/usr/bin/cpufreq-set -g powersave
additionally you have to:

  1. install the sw-package cpufrequtils
  2. add some parameters to /boot/config.txt
    this is done by calling the script with parameter setup
    (pls. see function setup_env)

calling the script with parameter status:
this will show the active cpu freq. set by the cpu governor

e.g.
current CPU frequency is 600 MHz (asserted by call to hardware).

have fun
regards Stefan

`#/bin/bash

V1.0 by SF 2022-07-27

inspired by: https://buyzero.de/blogs/news/raspberry-pi-strom-sparen-tipps-tricks

function setup_env {
fn="/boot/config.txt"
tm="# define minimum freq. for energy saving (used by cpu governor)"
grep -Fq "$tm" "$fn"
_ret=$?
if [ "$_ret" != "0" ]; then
if [ "$1" != "noswpkg" ]; then
apt-get -qy update
apt-get -qy install cpufrequtils
fi
echo " " >> $fn
echo "# Disable the PWR LED (save energy)" >> $fn
echo "dtparam=pwr_led_trigger=none" >> $fn
echo "dtparam=pwr_led_activelow=off" >> $fn
echo "$tm" >> $fn
echo "# use turbo speed for 20sec to speed up boot process" >> $fn
echo "initial_turbo=20" >> $fn
echo "force_turbo=0" >> $fn
echo "arm_freq_min=250" >> $fn
echo "core_freq_min=100" >> $fn
echo "sdram_freq_min=150" >> $fn
echo "over_voltage_min=0" >> $fn
fi
return 0
}

function enable_pwrsave {

enable pwr save, LEDs off, HDMI port off, set cpu to lower freq

echo 0 | tee /sys/class/leds/led0/brightness > /dev/null

echo 0 | tee /sys/class/leds/led1/brightness > /dev/null

/usr/bin/tvservice -o > /dev/null
/usr/bin/cpufreq-set -g powersave
_ret=$?
return $_ret
}

function disable_pwrsave {

disable pwr save, LEDs on, HDMI port on, set cpu to higher freq

echo 1 | tee /sys/class/leds/led0/brightness > /dev/null

echo 1 | tee /sys/class/leds/led1/brightness > /dev/null

/usr/bin/tvservice -p > /dev/null
/usr/bin/cpufreq-set -g performance
_ret=$?
return $_ret
}

ret=0
case "$1" in
setup)
setup_env "$2"
ret=$?
;;
start)
enable_pwrsave "$2"
ret=$?
;;
stop)
disable_pwrsave "$2"
ret=$?
;;
status)
/usr/bin/cpufreq-info "$2"
ret=$?
;;
)
echo "Usage: ${0##
/} start | stop | status | setup [noswpkg]"
esac

exit $ret`

@rvt
Copy link

rvt commented Aug 12, 2022

What sort of power savings are we getting ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants