Benchmarking Different Methods to Cool the Raspberry Pi

The Raspberry Pi 4B runs hotter than any previous model. How should you handle it?

Gaven MacDonald
Oct 21, 2019 · 7 min read
Image for post
Image for post
All pictures © the author

When the Raspberry Pi Model 4B was released earlier this year, it introduced a 1.5 GHz quad core processor — the fastest ever used on a Pi. The speed upgrade has obvious benefits. For example, if you use the Raspberry Pi to build a video monitoring device, you’ll get a higher framerate with the Model 4B. But it also means the power-hungry processor needs cooling, especially if you plan to put it to work on a CPU-intensive task.

In this article, I’ll compare different ways I tried to cool my Model 4B on the cheap, and I’ll show how they performed when I profiled them with stressberry.

Assessing the problem

How hot does the latest Raspberry Pi get? The Raspberry Pi Foundation provides power usage data for the Model 4B and previous generations of the Raspberry Pi. They show that today’s Raspberry Pi, when put to work on a computationally difficult task, can use as much as five times the power.

Image for post
Image for post
Power consumption based on current measurements from the Raspberry Pi Foundation

Even when idling, the Model 4B becomes uncomfortably toasty. But heat is only part of the problem. The real question is how spiking temperatures affect performance.

To take a closer look, I monitored the temperature of the Model 4B while the CPU was under 100% load. After less than 3 minutes, the CPU began to throttle down to a lower clock rate, resulting in sluggish performance. You can expect even worse results if the Raspberry Pi is placed in a case.

Image for post
Image for post
Comparison of “naked” Raspberry Pi boards when idle (0–150s) and when under stress (150–700s)

For comparison, a Model 2B that is working its hardest (continuously under a 100% load) will probably remain cooler than an idling Model 4B. Clearly, if you plan on using the latest and greatest version of the Raspberry Pi, you can’t ignore cooling.

Where to find free heat sinks and fans

You can buy a variety of cooling products for the Raspberry Pi, such as dedicated fans and specialized cases. But you’ll feel more accomplished if you salvage something free and make it work, in true do-it-yourself fashion.

My favorite approach is to reclaim parts from old electronics hardware. As with any processor, you have two options for cooling the Raspberry Pi: a heat sink (a piece of metal that absorbs excess heat) or a fan (to blow away heated air). Fortunately, heat sinks and fans are easy to find in old electronics. Computer motherboards are a great place to find small heat sinks, as motherboards usually have chipsets that need passive cooling. Additionally, some IC (integrated circuit) components such as voltage regulators have aluminum heat sinks, though they are often soldered onto the board, making them harder to remove.

Once you’ve removed a heat sink from its former home, it’s time to attach it to the CPU on the Raspberry Pi. Whatever you use, make sure you put a coating of thermal paste between the heat sink and Raspberry Pi CPU. Then, push the heat sink firmly against the CPU to ensure there will be good thermal transfer between the two.

Salvaged fans can be trickier to use as they’re typically designed for 12-24 V. I found that it’s easiest to attach fans that are 6 cm wide, as they align almost perfectly with the mounting holes on the Raspberry Pi. Unfortunately, the Raspberry Pi GPIO header is only capable of delivering either 3.3 V or 5 V, which isn’t enough for the average fan. I used an XL6009 module — a step-up voltage converter which I had lying around (they cost a dollar or two).

Here’s my combination of Raspberry Pi, salvaged fan, and a step up converter:

Image for post
Image for post
The step-up converter is connected to the 5 V rail on the GPIO header

Of course, the greatest amount of cooling comes from using a heat sink and a fan. Here’s how I combined the two using some extra standoffs. It isn’t beautiful, but it works!

Image for post
Image for post
The fan is supported by standoffs salvaged from VGA ports

Using stressberry to record temperature data

The simplest way to benchmark the thermal properties of the Raspberry Pi is to use stressberry, a handy tool written by Nico Schlömer. It’s straightforward to download and install on a Raspbian distribution, and it’s easy to make simple adjustments to the stress-testing script.

First, install stress (the linux package used by stressberry), then stressberry itself, like this:

sudo apt-get update
sudo apt install stress
pip3 install stressberry --user

Once the installation is complete, you can modify the test script using nano:

nano .local/lib/python3.7/site-packages/stressberry/cli.py

The first modification that I made was to the length of time that the CPU was under stress during the test. I changed the default setting of 300 seconds to 600 seconds.

parser.add_argument(
"-d",
"--duration",
type=int,
default=600,
help="stress test duration in seconds (default: 300)",
)

Next, I changed the sampling rate from every 2 seconds to every 0.1 seconds, by changing the argument in the t.join() function.

while t.is_alive():
times.append(time.time())
temps.append(measure_temp(args.temperature_file))
freqs.append(measure_core_frequency(args.frequency_file))
print(
"Current temperature: {:4.1f}°C - Frequency:
{:4.0f}MHz".format(temps[-1], freqs[-1]
)
)
# Choose the sample interval such that we have a respectable
# number of data points
t.join(0.1)

When processing the data, I averaged it over 4 s intervals to smooth out some of the noise in the temperature measurements.

Once you’re happy with the script settings, it’s easy to run the script so that it outputs the measurements to a file:

python3 .local/bin/stressberry-run outputFileName.dat

Results: Passive cooling

I’m fortunate to have an electronics graveyard in my basement, so I was able to try out a number of different heat sinks. The heat sinks I used differed in shape, material, mass and surface area. They include two (A, B) that were attached to ICs, and four (C, D, E, F) that I found on old motherboards.

Image for post
Image for post
Image for post
Image for post
*The surface area measurement is an approximation and does not include the bottom surface of the heat sink

To my surprise, all of the heat sinks were able to keep the CPU from throttling during 10 minutes at 100% CPU usage, including heat sink A, which is really just a bent strip of aluminium. Here’s the comparison of how they did:

Image for post
Image for post
Passive cooling test of heat sinks A through F

The copper heat sink F was the most difficult to use due to its shape and size. I needed to place a 1 cm square copper spacer between the CPU and the heat sink. Without it, the heat sink’s pipe was pushing against one of the HDMI connectors.

Heat sink F is particularly useful if you need to enclose your Raspberry Pi to protect it from exposure to the environment, because you can put the radiator outside of the sealed enclosure.

Results: Active cooling

Heat sinks worked pretty well in my testing. But how do they compare to using a fan?

As a first test, I compared three cases: using heat sink E with a fan, using the heat sink on its own, and using the fan on its own. Unsurprisingly, the combination of the two was best, and the fan-only approach edged out the heat-sink-only approach. But that’s not the whole story.

Image for post
Image for post
Heat sink E, with and without a 12 V fan

When using the fan, the CPU stabilized at a constant temperature. But when using the heat sink on its own, the CPU temperature continued to climb as the test went on. This is probably because the warm air stays close to the heat sink, reducing the efficiency of the heat transfer.

Next, while still using heat sink E, I investigated the effect of changing the voltage applied to the fan. Increasing the voltage causes a greater current to pass through it, resulting in an increased power draw (power = voltage × current). With this in mind, I investigated the effects of the fan drawing between 0.24 W to 1.28 W, at roughly 0.15 W intervals.

Image for post
Image for post
Heat sink E, with a fan drawing between 0.24 -1.28 W

And here’s a 3D plot that shows a different look at the same data — the effect of fan power on CPU temperature. Click the image to load it up on the plot.ly website, where you can rotate the graph and examine the raw numbers.

Image for post
Image for post
Click on the image to manipulate the 3D plot

Clearly, the more power supplied to the fan the better the cooling, but above 0.6 W the temperature curves are tightly packed next to one another. This is likely because the air passing over the heat sink doesn’t have sufficient time to absorb heat from it. In other words, the fan reaches a point of diminishing returns, where a greater fan speed has minimal thermal improvement but has a cost of greater power draw and increased noise.

Final thoughts

Depending on the heat sink, fan, or even the thermal paste that you use, your results will be different from the ones that I profiled. That said, there’s no need to invest in fancy cases or fans. Salvaged parts work perfectly well, and almost any heat sink or fan provides enough cooling… at least until the Model 5B is released!

Young Coder

Hack. Code. Think. Stories about science, tech, and programming.

Gaven MacDonald

Written by

Raspberry Pi enthusiast, daytime high school science teacher. See videos at: www.youtube.com/user/updowndown

Young Coder

Hack. Code. Think. Stories about science, tech, and programming.

Gaven MacDonald

Written by

Raspberry Pi enthusiast, daytime high school science teacher. See videos at: www.youtube.com/user/updowndown

Young Coder

Hack. Code. Think. Stories about science, tech, and programming.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store