Do You Need to Use a Fan for Cooling with the New Raspberry Pi 4?
Passive and active cooling for thermal control of the Raspberry Pi
Every time a new Raspberry Pi is released there are mutterings about the thermal control of the new board. But this time, it looks like it might well be necessary to add some passive, or even active, cooling to the Raspberry Pi to keep it from thermally throttling if it is under heavy load for extended periods of time.
I observed thermal throttling occurring during my extended machine learning benchmarking on the new board just after launch, and as it turned out, I wasn’t alone in seeing something of the sort.
Looking at Gareth Halfacree’s benchmarks of the Raspberry Pi 4 we see can see that he also observed unusually severe heating of the board, concluding that “…while it’s still entirely possible to use the board without extra cooling, those looking to put one in a case will find active cooling is required to avoid thermal throttling.”
I decided to go ahead and carry out a proper exploration of the matter to try and determine if active cooling was necessary, or whether most people could ‘get by’ with only passive cooling. I therefore used the vcgencmd Python bindings to monitor and log the temperature, along with the current CPU clock speed, to a file.
Four thermal management regimes were examined; no cooling, passive cooling only, continuous active cooling, and managed active cooling. However, the Raspberry Pi 4 was not placed inside a case, instead temperatures were observed while the board was sitting in the open air on the lab bench.
With no cooling we see an idle temperature of approximately 61°C, with a maximum temperature of 85°C during extended testing leading to sustained thermal throttling after the temperature reported by the processor rises above 81°C. Inferencing time is extended, with an time of 119.1 ms on average for each inferencing iteration. The total run time was just under 20 minutes.
With passive cooling only, using a single 20 mm × 20 mm heatsink for the processor package, we see a 5°C decrease in the idle temperature reported by the processor to approximately 56°C, with a corresponding 2°C drop in the maximum temperature to 83°C. Additionally, it takes longer to reach the maximum reported temperature, and we see only sporadic throttling for some time before sustained thermal throttling is finally seen. More processing power is therefore available, and inferencing completes some 200 seconds earlier than without cooling, with the average inferencing time falling to 99.4 ms. The total run time was approximately 16.5 minutes.
Adding continuous active cooling on top of the heatsink by connecting the ground and power pins of a 40mm brushless fan to GND and +5V pins of the Raspberry Pi’s GPIO header, we see a significant decrease in the temperature reported by the processor when idle down to just 36°C, with the maximum temperature during inferencing being 52°C.
No thermal throttling occurs, and inferencing completes another 200 seconds earlier, with the average inferencing time falling to only 83.8ms. The total run time was just under 14 minutes.
However, this approach leaves the fan on continuously, which is both noisy and wasteful. We can improve on this situation with active management of the cooling. Here we connect the same 40mm fan to the GND and +5V pins of the Raspberry Pi’s GPIO header again, but in addition connect the (blue) fan management wire to pin BCM18 on the GPIO header.
We use GPIO Zero to toggle the fan on when the temperature reported by the processor is equal to 75°C or more, and then to toggle the fan back off when the temperature drops back to 70°C or less.
With managed cooling initial rise in temperature during inferencing follows the track of our passive cooling curve until the trigger temperature of 75°C was reached. The fan did not struggle to maintain the temperature between the desired bounds, and no thermal throttling was observed. Inferencing completes with an average inferencing time of 84.1ms, with a run time of 14 minutes.
The difference between the total run times seen when using active and managed cooling was not statistically significant.
A heavy continuous load, such as the inferencing benchmarks for machine learning, will force the new Raspberry Pi 4 into thermal throttling. For heavy loads thermal throttling can severely extend processing times. The overall run time was reduced by 20% when passive cooling was present, and by 30% when active cooling was used, over the total processing time initially seen when the CPU was thermally throttled.
Passive cooling is insufficient thermal management for heavy loads which extend beyond ~200 seconds of duration, and active cooling is necessary to prevent thermal throttling from occurring. It is likely additional cooling will be necessary if the Raspberry Pi 4 is used inside a case.
UPDATE: Some cool imagery from Gareth Halfacree showing thermal imaging illustrating the difference between active and passive cooling.
UPDATE: The number in this article was measured after the recent firmware update, yet they are not significantly different to those taken before the update, and I don’t believe the update changed the thermal behaviour of the Raspberry Pi 4 that much.
The Fan SHIM isn’t compatible with a passive heat sink, so I went ahead and removed the heat sink from the Raspberry Pi and attached the Fan SHIM.
$ git clone https://github.com/pimoroni/fanshim-python
$ cd fanshim-python
$ sudo ./install.sh
$ cd examples
$ sudo ./install-service.sh --threshold 75 --hysteresis 5 --delay 2
$ sudo reboot
After installing the Fan SHIM software, and starting the SHIM daemon with a maximum set temperature of 75°C, I then kicked off the same machine learning benchmark load as I used previously.
Due to the absence of a passive heatsink we see the same idle temperature of approximately 61°C, the operating temperature quickly rises to the maximum hysteresis temperature of 75°C before dropping back as the fan is activated by the SHIM daemon.
The SHIM uses a smaller 30mm fan, as opposed to the 40mm brushless fan in conjunction with a 20 × 20 mm heatsink, I had used previously. As can be seen from the graph, it therefore struggles more than the larger fan to maintain the set temperature. But, no thermal throttling was observed. Inferencing completes with an average inferencing time of 84.9ms, with a run time of 14.1 minutes. This is not statistically different from that seem with continuous and actively managed cooling.
You can pick up the Fan SHIM for £9.60 from Pimoroni.