Measure the Core Temperature of Your Raspberry Pi

Hot pie is delicious, but a hot Pi is not.
John John (304)
5 minutes

The maximum operating temperature of your Raspberry Pi is 85° Celsius. If the temperature of your Pi rises above 85°, you risk permanently damaging the device. Because the Pi is designed to be small and low-cost, there is no fan! So we're going to learn how to measure the core temperature of the Raspberry Pi.

We'll use this method to monitor the Pi's temperature and turn on a fan when it gets too hot.

Raspberry PiRaspberry Pi ×1

Howchoo is reader-supported. As an Amazon Associate, we may earn a small affiliate commission at no cost to you when you buy through our links.

First log in to your Raspberry Pi. Then use the vcgencmd to get the temperature, like this:

$ vcgencmd measure_temp
temp=51.0'C

Well, that was easy enough 😀.

vcgencmd stands for "VideoCore general commands", and it allows the user to send commands to VideoCore. VideoCore is the low-power multimedia processor used on the Raspberry Pi. vcgencmd enables you to do various things like measure the clock speed, measure voltages, and of course, get the core temperature. To see all available commands you can run: vcgencmd commands.

If you're going to use this in a program, you can parse out the temperature using something like this:

$ vcgencmd measure_temp | sed -En "s/temp=(.*)'C/\1/p"
51.0
It's getting hot in here (so hot), so let's just write some code.
John John (304)
2 hours

Since the Raspberry Pi 4 was released, many have noticed that it can get pretty hot, especially when the CPU is under heavy load.