A few of my Raspberry PI projects have been based on Pi Zeroes put in small glass jars showing pretty LEDs. There isn't much airflow or room for cooling in there, so it's worth checking how hot they are getting.

Spoilers - they are fine. Temperatures don't get above 50C, which is no problem for them at all. In this post I'll show how to check this and explain a bit about why the projects work fine without any cooling.

The main reason for this post is to help those who just want to check their own projects. The commands you want to run are shown below.

The commands and results come from SSHing into my Pi Zero with a Unicorn pHat with about 15 LEDs lit at about 25% brightness, running for about 15 days, sealed inside a small glass spice jar.

# ask the Pi what temperature the CPU is running at
$ /opt/vc/bin/vcgencmd measure_temp 

As long as the temperature is under 50C, the thing is perfectly happy. Pi CPUs start to slow themselves down if they are running too hot.

The exact value a Pi uses for "too hot" can be lowered if you want, but by default it's either 70C or 85C depending on your firmware.

# ask the Pi what CPU frequency it is running now
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

This shows the Pi hasn't started to slow itself down to reduce its temperature. If you've overclocked your Pi or are using a different model you'll get a different figure, 700MHz is the default for this Pi Zero.

# ask the Pi if it has throttled itself back since it was last rebooted
$ /opt/vc/bin/vcgencmd get_throttled 

This shows a set of flags indicating whether the Pi has throttled itself at any point. A response of zero (0x0 = zero, more on this below) means it hasn't throttled itself since it booted. Which for me means it hasn't overheated at any point in the last few weeks.

Temperatures and throttling

This Raspberry Foundation article on frequency management gives a fuller explanation, but basically there's a sensor in the Pi that checks if it's getting too hot and if so, it slows its internal clock (aka underclocking).

This, combined with the fact that Pi chips tend to run fairly cool anyway, is why you won't damage a Pi by letting it get too hot during normal use. It slows down if it starts to overheat.

The final command above is interesting; the returned value is a set of bit flags giving information about any active or historical CPU throttling the Pi has done. There's a handy reference doc on GitHub (various Raspberry Pi forum threads have the same info). Roughly, the flags could be read as:

Value Meaning
0 all ok
last digit is 4 to 7 currently throttled
last digit is 8 to F currently throttled due to temperature
first digit is 4 to 7 was throttled in the past
first digit is 8 to F was throttled in the past due to temperature

So a value like C00C from the get_throttled command means your Pi has been feeling the heat and is currently slowing itself down.

Something like C000 means it has been feeling too hot in the past, but it's feeling better now.

It's a fair bet that non-zeroes on the left means a historical problem and non-zeroes on the right means a problem at the moment.

Heatsinks and cooling

While most PCs and laptops need some kind of active cooling (fans and/or heatsinks or fancy liquid systems) Raspberry Pis usually don't. Apart from the latest Pi 4 they were all designed to run just fine for most purposes without any extra cooling.

Unless you're either overclocking them, putting them somewhere really hot, or adding some other sources of heat (maybe a massive motor controller?) you can pretty much ignore any cooling problems and just get on with your project. Especially if you're using a Pi Zero - they run slow and cool.

Having said that, heatsinks and fans are available for Pis and you will occasionally see various cooling systems used on Pi based projects.

In some situations there are good reasons for including some system cooling. The builder may have checked the thermals for their project and know that they need cooling to avoid their Pi throttling itself and going too slow. Or maybe they're using a Pi 4, which has a faster, meatier CPU that is more likely to hit its thermal limits.

However, it's also possible they are used to slapping cooling on every computer they use, "for safety" (without really going into what safety they are trying to gain).

Or maybe they just like building cooling systems for some reason (pretty lights, shiny metal, and wirring blades, what's not to like?)

What I'm trying to say is that if cooling things is what you like doing, by all means go for it.

But don't feel you need to faff with such stuff any time you use a Pi. It'll probably fine without any extra fiddling.

Final Caveat: If you're using a Pi 4 or something with a faster clock and you plan to run it hard continuously, or with other hot components, do your own temperature testing.

Previous Post

© Me. Best viewed with a sense of humour and a beer in hand.