🌡 Why Monitor Temperature?
- Prevent overheating and thermal throttling
- Extend hardware lifespan
- Optimize performance for heavy loads
- Monitor in real-time for peace of mind
🧰 What You’ll Need
- A Raspberry Pi (any model)
- Raspberry Pi OS (Lite or Desktop)
- Terminal access (SSH or local)
🔎 Check CPU Temperature via Terminal
Use this simple command to read the Pi’s temperature:
vcgencmd measure_temp
Sample output:
temp=47.8'C
For more details, including GPU and clock speed:
vcgencmd get_config int
vcgencmd measure_clock arm
vcgencmd measure_volts
📈 Monitor Continuously (Watch Command)
To monitor temperature in real-time:
watch -n 2 vcgencmd measure_temp
This refreshes the reading every 2 seconds.
📊 Using Desktop Tools
If you’re running the Raspberry Pi desktop, install the system monitor app:
sudo apt install psensor
Then launch it to visualize temperature trends, CPU load, and fan speeds (if supported).
⚠️ Set a Warning Temperature Threshold
To see if your Pi is throttling due to heat, use:
vcgencmd get_throttled
A value of 0x0
means all is good. Anything else means your Pi has experienced throttling.
🧊 How to Cool Down Your Pi
- Use a heatsink or cooling fan
- Place the Pi in a well-ventilated case
- Avoid overclocking unless well-cooled
- Lower the CPU load where possible
🔁 Bonus: Python Script for Monitoring
#!/usr/bin/env python3
import time
import os
while True:
temp = os.popen("vcgencmd measure_temp").readline()
print("Raspberry Pi CPU Temperature: " + temp.strip())
time.sleep(5)
Save as monitor_temp.py
and run it with:
python3 monitor_temp.py