Fan activation at boot on Rock 5B

How to activate the fan automatically once the board is booted?

Which operating system are you using?

i am using this one --> rock-5b_debian_bullseye_kde_b36.img.xz
I tried to follow the link in this tutorial
Rock5/guide/radxa-debian - Radxa Wiki

running this script below

cat usr/local/bin/test_fan_run.sh

#!/bin/bash
echo “Trun on Fan”
echo 0 > /sys/devices/platform/fd8b0010.pwm/pwm/pwmchip*/export
echo 10000 > /sys/devices/platform/fd8b0010.pwm/pwm/pwmchip*/pwm0/period
echo 5000 > /sys/devices/platform/fd8b0010.pwm/pwm/pwmchip*/pwm0/duty_cycle
echo normal > /sys/devices/platform/fd8b0010.pwm/pwm/pwmchip*/pwm0/polarity
echo 1 > /sys/devices/platform/fd8b0010.pwm/pwm/pwmchip*/pwm0/enable
#echo 0 > /sys/devices/platform/fd8b0010.pwm/pwm/pwmchip*/pwm0/enable

but then I get this error below

rock@rock-5b:/usr/local/bin$ sudo bash test_fan_run.sh
Trun on Fan
test_fan_run.sh: line 4: echo: write error: Device or resource busy
test_fan_run.sh: line 5: /sys/devices/platform/fd8b0010.pwm/pwm/pwmchip1/pwm0/period: No such file or directory
test_fan_run.sh: line 6: /sys/devices/platform/fd8b0010.pwm/pwm/pwmchip1/pwm0/duty_cycle: No such file or directory
test_fan_run.sh: line 7: /sys/devices/platform/fd8b0010.pwm/pwm/pwmchip1/pwm0/polarity: No such file or directory
test_fan_run.sh: line 8: /sys/devices/platform/fd8b0010.pwm/pwm/pwmchip1/pwm0/enable: No such file or directory

You could either use rc.local
https://linuxhint.com/use-etc-rc-local-boot/

Or you could create a systemd service (this is the much cleaner one to use if you ask me). With this one you have much more possibilities…like what type of user, group to run it as…etc. etc.

Btw, i myself don’t have the one with the fan, so i can’t help you further besides how to run the script during boot.

For the newer images you need this guide.

1 Like

fixed it!!
followed this tutorial below:

and then run this command in terminal echo 4 | sudo tee /sys/class/thermal/cooling_device4/cur_state

and the voila!! fan spinning like crazy!:smiley:

1 Like