Raspberry Pi: A Temperature Monitor That Tells You When To Worry

Why You Care

A Pi that throttles is a Pi that quietly performs at half speed. The default behaviour when the SoC gets too hot is to reduce clock speed — no error, no warning, just a machine that has become slow. If you are running a kiosk, a sensor logger or anything else you do not look at daily, you will never notice.

Checking the temperature takes one command. Watching it over time is what tells you whether you need a fan, a better case, or a heatsink.

A photorealistic shot of a Raspberry Pi with a small fan shim mounted on top, thermal pad visible, a thermometer-style readout on a monitor behind it, workshop lighting, realistic photography, no legible text.

The One-Liners

vcgencmd measure_temp

Output: temp=48.3'C

And on any kernel with the thermal zone exposed (all current Pi models):

cat /sys/class/thermal/thermal_zone0/temp

That returns millidegrees — 48296 means 48.296°C. Divide by 1000.

Either works. vcgencmd is the Pi-specific tool and gives a clean number; the thermal zone file is standard Linux and works on non-Pi boards too.

The Throttling Check, Which Is The Important One

vcgencmd get_throttled

Output: throttled=0x0

0x0 means nothing has happened. Anything else is a bitmask of things that have happened, including currently, and it persists until you clear it with a reboot:

Bit Meaning
0x1 under-voltage detected now
0x2 ARM frequency capped now
0x4 currently throttled
0x8 soft temperature limit active
0x10000 under-voltage has occurred
0x20000 frequency capping has occurred
0x40000 throttling has occurred
0x80000 soft temperature limit has occurred

The high bits are history. 0x50000 is the classic "this Pi has been struggling" value — throttled and frequency-capped at some point since boot. If you see that on a machine you thought was healthy, it has been running below capability and you did not know.

Under-voltage (0x1 / 0x10000) is worth separating from heat: it means the power supply cannot deliver enough current, which shows up as instability and SD card corruption rather than slowness. A different PSU is the fix, not a fan.

A Script That Logs It

The one-shot commands are fine interactively. To see a trend, log to a file:

#!/usr/bin/env python3
import os, time, datetime, csv, pathlib

LOGFILE = pathlib.Path.home() / "pi-temp.csv"

def read_temp():
    out = os.popen("vcgencmd measure_temp").readline()
    return float(out.replace("temp=", "").replace("'C", "").strip())

def read_throttled():
    return os.popen("vcgencmd get_throttled").readline().strip().split("=")[1]

if not LOGFILE.exists():
    with open(LOGFILE, "w", newline="") as f:
        csv.writer(f).writerow(["timestamp", "temp_c", "throttled"])

while True:
    now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    with open(LOGFILE, "a", newline="") as f:
        csv.writer(f).writerow([now, read_temp(), read_throttled()])
    time.sleep(60)

A CSV with a header row opens in a spreadsheet and charts directly, which is far more useful than scrolling a terminal.

For a permanent install, run it under systemd rather than leaving a terminal open:

[Unit]
Description=Pi temperature logger
After=multi-user.target

[Service]
ExecStart=/usr/bin/python3 /home/pi/pi-temperature_monitor/temperature_monitor.py
Restart=always

[Install]
WantedBy=multi-user.target

An SD-card write every minute is not ideal for card longevity — the same trade as any logger here. If you care, write to a tmpfs and flush to disk hourly, or point the log at a USB stick.

A photorealistic close-up of a laptop screen showing a CSV spreadsheet with temperature readings and a line chart trending upward, a Pi on the desk with a fan attached, daylight, realistic photography, no legible text.

What The Numbers Mean

Rough guidance for a Pi 3 or 4 under sustained load:

  • Under 50°C — idle in open air. Nothing to do.
  • 50–70°C — normal under load. Fine indefinitely.
  • 70–80°C — heavy load, approaching the soft limit. A heatsink or fan will buy you clock speed.
  • Over 80°C — the SoC is throttling. You are losing performance you paid for.

A Pi 5 runs warmer by design and its throttle point is higher; treat the thresholds as a rough shape rather than gospel and watch for throttling flags instead of a specific number.

The practical test is not "is it hot" but "does it throttle under my actual workload". Run your real job, watch get_throttled, and only buy a fan if the flags appear. A Pi sitting at 68°C with throttled=0x0 does not need anything.

A photorealistic shot of a Raspberry Pi inside a ventilated case with a small heatsink fitted, a temperature probe beside it, workbench with tools, realistic photography, no legible text.

Common Causes Of Overheating

A closed case with no airflow. The official case is adequate for idle and marginal under load. A cheap case with no vents is worse than no case.

Sitting on a soft surface. Fabric blocks the vents. Obvious, and extremely common on a shelf or a cushion.

The Pi in direct sun, which sounds unlikely until you have a Pi in a window logging plant data.

Overclocking without a heatsink. If you set arm_freq above stock, you need cooling first.

The code for the logger is at github.com/LukeKeam/pi-temperature_monitor.

Don't trust the download button. Trust the hash.

If this was useful, More hands-on tech guides at TechGeek. No pressure — read it whenever it's useful.


Luke Keam
Spot a bug or want a custom utility built? I'd love to hear from you. Get in touch
Luke Keam | techgeek.biz