David Cordero
Cooling the Raspberry Pi 4
Published on 27 Jul 2019
Some weeks ago the Raspberry Pi Foundation released the Raspberry Pi 4, a new version of their amazing board that will allow us to go even further in our projects.
This new model means a huge bump in terms of performance, being nowadays closer to be a mini-computer than the educational board that it was originally aiming to be.
But this improvement in performance is not free, and it comes with an important bump in the working temperature of the board. One of the main issues that the users of the Pi 4 are facing is definitely the high temperature that this new board reaches when doing demanding tasks.
In this post, I will summarize the process that I followed to reduce the temperature of my board significantly.
The problem in numbers
I would like to start showing the temperature of my board before applying any action. That means, using a Raspberry Pi 4 as it comes out of the box.
In order to measure the temperature, I created a simple script in bash that triggers a CPU benchmark 10 times in a row, checking the temperature of the board at the end of each benchmark.
Afterwards, to check how fast the Pi goes back its normal temperature, the script does nothing but monitoring the temperature 10 times in intervals of 10 seconds.
#!/bin/bash
measure_temperature() {
echo `vcgencmd measure_temp | sed 's/temp=//g' | sed "s/'.*//g"`
}
echo "Testing Raspberry Pi 4 temperature"
echo "Initial temperature: $(measure_temperature)"
echo "Heating...."
for run in {1..10}
do
sysbench --test=cpu --cpu-max-prime=25000 --num-threads=4 run > /dev/null 2>&1
measure_temperature
done
echo "Cooling..."
for run in {1..10}
do
sleep 10
measure_temperature
done
echo "Finished"
(As a disclaimer, all the tests were made in a room with an ambient temperature of 33℃)
You can see below the result of running the script:
Testing Raspberry Pi 4 temperature
Initial temperature: 49.0
Heating....
76.0
82.0
83.0
85.0
84.0
85.0
85.0
84.0
85.0
85.0
Cooling...
80.0
78.0
77.0
78.0
78.0
76.0
76.0
75.0
75.0
76.0
Finished
Passive cooling
My first attempt to reduce the temperature of the board was using passive cooling systems.
Because I bought the Pi 4 on the same day that it was launched, there was still no heatsinks for this model, so I opted to install one designed for the Pi 3 instead.
A few days later, and because I did not notice too much improvement in the temperature, I opted to install this bigger heatsink which is designed for the Pi 4.
Using this one, I could already see some improvements.
Here are the results, side by side, of running my script with these two heatsinks:
| Small heatsink results | Bigger heatsink results |
| ----------------------------------------|---------------------------------------|
| Testing Raspberry Pi 4 temperature | Testing Raspberry Pi 4 temperature |
| Initial temperature: 45.0 | Initial temperature: 44.0 |
| Heating.... | Heating.... |
| 70.0 | 65.0 |
| 77.0 | 74.0 |
| 81.0 | 77.0 |
| 81.0 | 77.0 |
| 83.0 | 78.0 |
| 82.0 | 79.0 |
| 83.0 | 78.0 |
| 84.0 | 80.0 |
| 85.0 | 79.0 |
| 83.0 | 79.0 |
| Cooling... | Cooling... |
| 81.0 | 78.0 |
| 79.0 | 78.0 |
| 77.0 | 78.0 |
| 77.0 | 76.0 |
| 76.0 | 76.0 |
| 75.0 | 76.0 |
| 74.0 | 75.0 |
| 74.0 | 75.0 |
| 74.0 | 75.0 |
| 73.0 | 75.0 |
| Finished | Finished |
Active cooling
As the temperature was still quite high using these passive cooling systems, my next step was using active cooling.
I opted for the Fan SHIM, which I knew is compatible with the huge heatsink that I was already using.
This fan is not active all the time, instead, it comes with a tool that allows you to define the threshold and hysteresis for it to turn on.
I configured mine with a threshold of 75℃ and a hysteresis of 5℃.
Here are the results of my script using this fan together with the big heatsink:
Testing Raspberry Pi 4 temperature
Initial temperature: 42.0
Heating....
63.0
57.0
56.0
56.0
55.0
55.0
55.0
63.0
57.0
56.0
Cooling...
49.0
50.0
50.0
51.0
51.0
53.0
52.0
54.0
54.0
54.0
Finished
Summary
Even though using passive cooling systems I noticed some small improvement, it is pretty clear that using active cooling systems has a much more clear impact.
Of course, active cooling systems are not valid for everybody, and it also means increasing the energy that your board will consume.
As a summary here you can find the maximum temperature that I got in my tests on each configuration that I tried.
| No action | Small heatsink | Bigger heatsink | Fan |
|-----------|----------------|-----------------|------|
| 85.0℃ | 84℃ | 80℃ | 63℃ |