Odroid XU3/4 Silent Fan Control in Lakka / OpenElec

If you are an owner of an Odroid XU4, you are probably annoyed by the noisy fan.

In this workshop we will modify the behavior of an Odroid XU4 Fan. No Hardware Modification, only software tweaks are used.

By default, the fan is always running at full speed and is pretty noisy. There is no need for this, and can easily be silenced down without risking CPU Damage.

Disclaimer !
This is tested on a XU4 only, but it should also work on a XU3 . (And only these 2 Models!)

I cannot be held responsible for any damage that might happen. Use at your own risk!

Credits go to https://github.com/nthx/odroid-xu3-fan-control

I just modified this script so that it works in OpenElec / Lakka

What we are basically doing :

  • Create a Fan Controller script which reads the CPU Temperature, and sets a Value for the Fan Speed accordingly.
  • Create a autostart Script so that our Fan Controller Scripts runs automatically

So, first login to your Odroid running OpenElec or Lakka by SSH. Use Putty on Windows or ssh in a terminal Window on Linux or MacOS. (like ssh root@ip.address.of.odroidxu4)

 

Download Scripts

I have attached the 2 scripts to this post, scroll down to find Download links

Then create the script fancontrol.sh :

nano .config/fancontrol.sh

copy the contents below, and save and quit by pressing “CTRL+X” , confirm with “y”

contents of fancontrol.sh :

#!/bin/sh
# Credits: https://github.com/nthx/odroid-xu3-fan-control
# this must be placed in /storage/.config folder
# for following /storage/.config/autostart.sh startup
# script to work
#
# contents of /storage/.config/autostart.sh :
# (
# /storage/.config/fancontrol.sh
# ) &

CPUTempReadFrom="/sys/devices/10060000.tmu/temp"
FanSpeedSet="/sys/devices/odroid_fan.14/pwm_duty" 
#change to "/sys/devices/odroid_fan.13/pwm_duty" for Xu3

# Assume Fan is running at full Speed
FanSpeedActual=254

# Disable Fan Auto Control Mode
echo 0 > /sys/devices/odroid_fan.14/fan_mode

while [ true ];
do
  # read current CPU Temperature
  CPUTemperature=`cat ${CPUTempReadFrom} | cut -c11- | sort -nr | head -1`

  FanSpeedAdopted=0
  if [ ${CPUTemperature} -ge 78000 ]; then
    FanSpeedAdopted=254
  elif [ ${CPUTemperature} -ge 75000 ]; then
    FanSpeedAdopted=200
  elif [ ${CPUTemperature} -ge 70000 ]; then
    FanSpeedAdopted=130
  elif [ ${CPUTemperature} -ge 68000 ]; then
    FanSpeedAdopted=100
  elif [ ${CPUTemperature} -ge 66000 ]; then
    FanSpeedAdopted=80
  elif [ ${CPUTemperature} -ge 63000 ]; then
    FanSpeedAdopted=75
  elif [ ${CPUTemperature} -ge 60000 ]; then
    FanSpeedAdopted=70
  elif [ ${CPUTemperature} -ge 58000 ]; then
    FanSpeedAdopted=65
  else
    FanSpeedAdopted=60 
  fi
  if [ ${FanSpeedActual} -ne  ${FanSpeedAdopted} ]; then
    echo ${FanSpeedAdopted} > ${FanSpeedSet}
    FanSpeedActual=${FanSpeedAdopted}
  fi
  sleep 3 #check every 3 seconds
done
#eof

Then, make the script fan.sh executable :

chmod +x .config/fancontrol.sh

Repeat the process for the script autostart.sh :

nano .config/autostart.sh

contents of autostart.sh :

(
/storage/.config/fancontrol.sh
) &

Save and quit (“CTRL+X”), confirm with “y”

Script autostart.sh does not need to be executable.

That’s basically it. You just have to restart the Odroid. First Fan should be running at full speed and then slowing down.

The values are pretty safe for the CPU, but can be tweaked furthermore, if you want your Odroid to become even more silent. But beware of not overheating the CPU, you might risk permanent damage! I also removed the option to turn off the fan below 58°, this is to avoid that the Fan starts and stops frequently, which should have a positive Impact on it’s lifetime.

To test if the script is working fine, you can stress-test the CPU by launching (via ssh) :

openssl speed

lakka-openssl-speed

Openssl speed to stress the CPU

The Fan should start varying it’s speed. Let it run for a few minutes, then cancel the stress-test (“CTRL” +”C”) and the Fan should slowly be slowing down as CPU temperature goes down.

Download Scripts
Autostart (38.0 B, 75 downloads)
Fancontrol (1.4 KiB, 75 downloads)

Copy these 2 files over to the network share \\ip.address.of.odroid\Configfiles, and make file fancontrol.sh executable (chmod +x , see above)

i.e. Example for Lakka : \\lakka\Configfiles :

capture

Copy the scripts to this location in Lakka

Enjoy your now silent Odroid XU 3 / 4 !

Please leave a feedback if you found an error or have a question.

Leave a Reply