Controlling the Fan of the Raspberry Pi 5 in Ubuntu 23.10

November 9th, 2023

The new Raspberry Pi 5 is a really nice upgrade. Both RaspberryPiOS and Ubuntu 23.10 are really running much faster on the new model then on a RPI 4.

Booting RaspberryPiOS takes around 12sec on a ordinary SanDisk SD card. The fan is running full speed at boot, but is slowing down afterwards. And it has not started again during browsing a few websites.

Ubuntu boots a bit slower, but GNOME 3 is also running really fine. Ubuntu is visually more attractive, and it’s really running smooth.

There is a big annoyance for the moment and that is the fan. It is running full speed at boot and keeps running all the time full speed, making to much noise.

Fan control doesn’t seem to work yet, but controlling the fan can be done manually by writing a number in the range 0 (off) to 4 (full speed) to /sys/class/thermal/cooling_device0/cur_state

So I created a startup service that slows down the fan on Ubuntu after boot to speed setting 1, and that is inaudible.

Description=RPI-startup Fan Control service
ExecStart=/bin/bash -c "echo '1' | tee -a /sys/class/thermal/cooling_device0/cur_state" &

Copy above content to a file /etc/systemd/system/fan.service.

And enable it by:

sudo systemctl enable fan.service

That’s all, no reboot the Pi and Ubuntu will be silent.

Remember the Raspberry Pi willl automatically throttle when reaching a temperature of 85°. So there is no danger in letting the fan run on speed 1 continuously. Even when your compiling the Linux Kernel.

Off course you can always check the temperature with, and yes that works also in Ubuntu 23.10 on the Pi

sudo vcgencmd measure_temp

You can always bump up the speed to 3 by issuing this in the terminal

echo '3' | sudo tee -a /sys/class/thermal/cooling_device0/cur_state


Tags: ,

Leave a Reply