Customize fan activation temperature on ubuntu

Hi guys,
I’m trying to customize a bit my Khadas cooling fan and what I want is to lower the activation temperature so it would stay quiet for light duty usage.

I have read about Fan control for Linux, but I couldn’t find the fan.sh script in my vim3 ubuntu environment.

I know it’s possible to do this with Fenix script but I don’t want to rebuild my system…

Any ideas?

1 Like

Hello @Eurus, which version of firmware are you using 4.9 or 5.x ?

I’m on kernel 4.9 (((

I Think the Script responsible for that is there but not activated, can you check the boot directory?

I did and I couldn’t find anything related to fan under /boot. For the record, the fan is working ok, it turns on at 50C, which I’d like to make it higher

@Eurus can you try to do
echo X > /sys/class/fan/temp
please note that X is the temprature, take your required Temp and multiply by 1000

eg. if X needs to be 80 Celsius

it is,
echo 80000 > /sys/class/fan/temp

If it needs root permission, put sudo in front

hi, what mode is your fan running in right now?

I tried as root and it says input/output error

I think it’s auto mode? I didn’t change anything.
Is there a way to check which mode I’m in?

Will check and tell you a bit later…

Ubuntu seems to me unlikely to go below 50 °, then it’s hard to say your auto mode works 50 °, below 50 ° it stops

well, with my cooling setup(metal case + stock heatsink + cooling fan) in an air-conditioned room, the temperature is normally between 46 to 55. So I know the fan starts working at 50.

in this case automatic mode

yep, so any suggestions on how to tweak the temperature level?

try contacting Archangel1235,
he knows Ubuntu well

1 Like

watched here?

linux (4.9)

added cooling FAN UI setting menu (Applications->Settings->FAN Setting

I don’t have that in my settings (perhaps it’s because I’m using ubuntu mate), but I do have a fan_setup.sh that I can run in the terminal. It allows me to switch between auto, low, middle, high and off.
But what I need is to tweak the auto mode.

@Eurus that is the file I was expecting, could you check inside that file, via sudo nano fan_setup.sh,
if there are any predefined temperature limits for the fan to kick in ?

I peaked into fan_setup.sh and fan.sh.

fan_setup.sh is used to display that GUI in the settings.

fan.sh is used to set fan mode/level or query trigger temperature.

1 Like

What trigger temperature do you need …?

you need to edit dts file for it to work…

download fenix, set env and build kernel once (make kernel) this will download the linux source files
now edit fenix/linux/arch/arm64/boot/dts/amlogic/kvim3_linux.dts
lines 909-912

		compatible = "khadas-mcu";
		reg = <0x18>;
		fan,trig_temp_level0 = <50>;
		fan,trig_temp_level1 = <60>;
		fan,trig_temp_level2 = <70>;

to what temperature you want.
now delete kvims_linux.dtb and go fenix root and build kernel again but now use this command make clean && make kernel-debs
now this would have build some debs in fenix/images take the deb that will replace the device tree and install

4 Likes