I can see this is a bit dated, but here is my input.
I wrote a PID program in C, to run the fan through IO pins on the Pi4's. It wasn't "perfect", but it kept the temperature steady @ 50 C. Simply run off temperature inputs.
With the Pi5, with it's dedicated fan header, the PiOS runs in steps, 25, 50, 75 and 100% I want to smooth that out, without the OS getting in the way and overwriting my settings. All of the settings, inputs and outputs are in available "files" in the thermal(x) settings.
That's why I say mine is not "perfect", it is hard coded (in a way), instead of using the files in the directory. Then you could modify the P, I, and D variables in the files on the fly. I need to modify it so that it passes over the Integral and Derivative calculation if the Proportional factors are 0 or 100% and return a 0 or 100 if out of range.
It wouldn't come on, until 25% as it approached 50 C, (25% is right at the point that the fan will be able to get the torque to start) then incrementally speed up or slow down to maintain the set temperature. You barely hear it coming up, you don't start noticing it until it is around 100% or so, depending on how "dirty" your fan is. It is much easier to get the temperature under control, before it gets too high, as it is more efficient to keep the delta T low for better heat transfer. The hotter the CPU gets, the delta T goes up, it takes more air flow to take away more heat, than when it was cooler. It's much better to keep it from getting hot, in the first place, than it is to cool it down.
Oh, BTW, you can run the fan down to about 20% once it's running.
I was very happy with the results!
Just gotta find out how to override the system.
I wrote a PID program in C, to run the fan through IO pins on the Pi4's. It wasn't "perfect", but it kept the temperature steady @ 50 C. Simply run off temperature inputs.
With the Pi5, with it's dedicated fan header, the PiOS runs in steps, 25, 50, 75 and 100% I want to smooth that out, without the OS getting in the way and overwriting my settings. All of the settings, inputs and outputs are in available "files" in the thermal(x) settings.
That's why I say mine is not "perfect", it is hard coded (in a way), instead of using the files in the directory. Then you could modify the P, I, and D variables in the files on the fly. I need to modify it so that it passes over the Integral and Derivative calculation if the Proportional factors are 0 or 100% and return a 0 or 100 if out of range.
It wouldn't come on, until 25% as it approached 50 C, (25% is right at the point that the fan will be able to get the torque to start) then incrementally speed up or slow down to maintain the set temperature. You barely hear it coming up, you don't start noticing it until it is around 100% or so, depending on how "dirty" your fan is. It is much easier to get the temperature under control, before it gets too high, as it is more efficient to keep the delta T low for better heat transfer. The hotter the CPU gets, the delta T goes up, it takes more air flow to take away more heat, than when it was cooler. It's much better to keep it from getting hot, in the first place, than it is to cool it down.
Oh, BTW, you can run the fan down to about 20% once it's running.
I was very happy with the results!
Just gotta find out how to override the system.
Statistics: Posted by Bruce Lytle — Tue May 05, 2026 9:01 pm








