You should not attempt to make these changes to the .dtb
file. The .dtb
files are all "compiled", and not meant to be edited manually.
Instead, you should make your changes in the config.txt
file located in /boot/firmware/config.txt
(last I checked this is where it was found).
It's a bit strange I suppose, but the documentation for available adjustments to config.txt
are in this location on your RPi: /boot/firmware/overlays/README
. You should not make any changes to the README file - it is placed there only for documentation explaining how to make the changes needed in config.txt
Here are the parameters relevant to the changes you want to make for your RPi 5 fan (taken from the README file):
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.
And so we see from reviewing the information above that the default is set up to increase the fan speed as the temperature increases:
at 50 degC (fan_temp0), the fan comes on at a speed of 75 (fan_temp0_speed), and will remain on until the temperature reaches the hysteresis point of 45 degC (45 = fan_temp0 - fan_temp1_hyst), at which point it will turn off.
at 60 degC (fan_temp1), the fan comes on at a speed of 125 (fan_temp1_speed), and will remain on until the temperature reaches the hysteresis point of 55 degC (55 = fan_temp1 - fan_temp1_hyst), at which point it will reduce to fan_temp0_speed.
etc for fan_temps 2 and 3.
And so you can see the designers have already implemented a fairly detailed algorithm for fan cooling. For the change that you want to make, I would suggest that you begin by adding the following lines to your config.txt
file using the nano
editor (or whatever editor you're comfortable with). In other words:
sudo nano /boot/firmware/config.txt
Once the file is open, add these lines:
dtparam=fan_temp0=40000
dtparam=fan_temp0_hyst=10000
dtparam=fan_temp0_speed=125
This will start the fan at a speed of 125 when the temp reaches 40 degC, and turn it off when the temp reaches 30 degC. Finally, you should know that these temperatures are quite low, and you may find that your fan runs continuously. This shouldn't be an issue - just trying to prepare you for something you may not have expected.
So - try this & let us know how it goes!