After the popular single board computer, the Raspberry Pi 4 B was released by Raspberry Pi Foundation in mid 2019, I was excited to get my hands on one. I had been using the previous model (the Pi 3) for several years prior, and I enjoyed the small form factor, relative good performance, and access to the processor’s GPIO. Performance was said to be much increased, stemming from a faster processor as well as a number of other enhancements.
As is common with increases in performance, there were trade-offs. The previous model, while providing sufficient performance for many applications, was not subject to overheating in most conditions, especially if heat-sinking was provided. The Pi 4, on the other hand produces just a bit too much heat for a simple heat sink to dissipate when given a fair amount of loading while enclosed in a case. Because of this, I observed some thermal throttling of the CPU after critical temperatures were surpassed. This is done to protect the processor from overheating and is nothing to worry about, although, performance is then limited.
The case I received came with a fan. However, running the fan with the 5v header which was intended for its power, it is quite loud, and an annoyance when sitting on a desk near the user. Because the fan need only run while there are increases in loading or heat, I decided that it may be worthwhile to create a module that can be used to control the fan speed or disable it entirely.
Because a pulse width modulation can be produced on the GPIO of the Pi 4, and the internal temperature of the processor can be queried, the task was reduced in complexity. The main difficulties would then be ensuring the fit of the circuit board into the case. Measurements were taken, a board was designed, and a simple program was written in python. There is a bit of pwm noise when the fan is not at full power, but a filter capacitor should be able to take care of this problem.
I set set the minimum fan temperature threshold to just under the processor thermal throttle temperature, so the fan will not run unless the processor is about to be throttled. This way the fan is off most of the time, except under loading. A temperature sensor on the circuit board would have also been a nice addition in order to ascertain case temperature, and could possibly be added in a future revision, but overall I’m pleased with the performance.