Raspberry Pi 5 Fan control

Hey!

I recently met Home Assistant and I immediately bought myself a raspberry pi 5 to start using Home Assistant. Now I find that me Raspberry pi 5 has quite warm (~50 degrees).

I would like to run my fan at a minimum speed. (5000 RPM) but I really have no idea how this should be done through Home Assistant OS?

Anyone have any experience with this or an idea how I could fix this?

Raspberry Pi 5 fan control:
“It is actively managed by the Raspberry Pi firmware: at 60°C the blower’s fan will be turned on, at 67.5°C fan speed will be increased, and finally at 75°C the fan increases to full speed. When the temperature drops back below these limits, the blower’s fan will spin down automatically.”

Thanks :wink:

3 Likes

Have the same issue. The fan doesn’t run on pi 5 with HAOS.

1 Like

Same problem here. Simplist solution is to run the fan 24/7 by direct power. Not ideal, but neither is running hot.

I have a way to do PWM based on temp for regular pi. But I don’t think haos exposes pi pins for Python script use.

If anyone comes up with a tested viable solution, please post it here.

Bump, I need this. I added the ICE tower cooler and that has dropped temps but would be good to be able to control the fan.

I use this box, there is no fan, only a thermal pad. The RPI 5 temperature is on average 44.5°.

I figured it out whist trying to get the full speed from my NMVe…
I will try to explain as best I can.

First I hooked the pi 5 (running Home assistant OS) to my PC monitor. Let it boot up and you get the command line.

type login
then type vi mnt/boot/config.txt
scroll all the way to the bottom where it says all (you have to change to insert mode on keyboard, on my keyboard this was Fn Delete, but I guess they are all different).

When you are ready… These are the settings I have used. this means at 35c the fan will run at 175 until temp drops 5c. I have played with this a lot over the last few days, this I found keeps my pi5 around 35c all the time with very little to no fan noise

dtparam=fan_temp0=35000
dtparam=fan_temp0_hyst=5000
dtparam=fan_temp0_speed=175

Once you have typed in the above you need to press ESC on keyboard then type :wq this saves the file… Reboot and new settings should take effect. I will post screen grabs in the morning.

6 Likes

This is a screen grab, the first part i had the temp set to 45c with 10c change but the fan speed set ar 225

Thank you very much!!

1 Like

Thanks! Easy does it!
Temp was around 44 with only the heat sink.
It dropped instantly to 38.

What did you type in after login? I don’t think I set up any specific login for this so I’m not sure what to put

May i see your video? Thank

[Processing: 17160697938233540644075268069242.jpg…]
Hi there, am I doing something wrong?

Adding to your post, I found this:

fan_temp0               Temperature threshold (in millicelcius) for 1st cooling level (default 50000). Pi5 only.
fan_temp0_hyst       Temperature hysteresis (in millicelcius) for 1st cooling level (default 5000). Pi5 only.
fan_temp0_speed   Fan PWM setting for 1st cooling level (0-255, default 75). Pi5 only.
fan_temp1               Temperature threshold (in millicelcius) for 2nd cooling level (default 60000). Pi5 only.
fan_temp1_hyst          Temperature hysteresis (in millicelcius) for 2nd cooling level (default 5000). Pi5 only.
fan_temp1_speed         Fan PWM setting for 2nd cooling level (0-255, default 125). Pi5 only.
fan_temp2               Temperature threshold (in millicelcius) for 3rd cooling level (default 67500). Pi5 only.
fan_temp2_hyst          Temperature hysteresis (in millicelcius) for 3rd cooling level (default 5000). Pi5 only.
fan_temp2_speed         Fan PWM setting for 3rd cooling level (0-255, default 175). Pi5 only.
fan_temp3               Temperature threshold (in millicelcius) for 4th cooling level (default 75000). Pi5 only.
fan_temp3_hyst          Temperature hysteresis (in millicelcius) for 4th cooling level (default 5000). Pi5 only.
fan_temp3_speed         Fan PWM setting for 4th cooling level (0-255, default 250). Pi5 only.

From here: https://forums.raspberrypi.com/viewtopic.php?t=359778
(HA Supervisor. In terminal: sudo nano /boot/firmware/config.txt; down below [all] paste your code)

1 Like

Has anyone managed to get the fan to only run when the CPU is above 50 degrees? I also have a Raspberry Pi 5 with homeassistant os.

I can’t find this file! Can you help me?

Thanks

How are you attempting to access it? It needs to be done directly on the device, and you’ll need to connect the pin to an HDMI display with a keyboard and mouse

I tryed with ssh! It will not work on this way?

It will not as far as I am aware.

Ok! I’m going to try connecting it directly. Thank you

Quick remark based on my experience with the above written:

  1. Yes, this approach is only available when connetced locally - not via SSH
  2. I was struggling with the VI control as the keyboard layout I used wasn´t properly configured in this mode. I checked for VI commands and found the following useful ones
    i typing a simple “i” enters the editing mode of VI
    ZZ typing a double, capital “ZZ” saves the changes and exits VI
  3. In this logged in mode it is possible to force a reboot with
    shutdown -r now

Hope that helps! For me it worked well