Python · Raspberry Pi · Real-time

Real-Time System Monitor
for Raspberry Pi

A lightweight desktop dashboard built with Python and ttkbootstrap that displays live CPU & RAM usage, temperatures, clock frequency, and power throttling status — refreshed every second.

Python 3.7+ ttkbootstrap psutil vcgencmd Tkinter Raspberry Pi 5
Raspberry Pi Monitor
Pi Monitor Dashboard
CPU Usage:
1.2%
RAM Usage:
21.5%
CPU Temp:
54.0 °C
GPU Temp:
53.8 °C
Frequency:
1500/2400 MHz
Power:
Normal
Status:
✅ Cool

01

Key Features

Live CPU Usage

Polls psutil.cpu_percent() every second. Color-coded: green (<50%), amber (50–75%), red (>75%).

🧠

RAM Monitoring

Reads psutil.virtual_memory().percent in real-time with the same three-tier color status system.

🌡️

CPU Temperature

Reads directly from /sys/class/thermal/thermal_zone0/temp — no extra tools required.

🎮

GPU Temperature

Uses vcgencmd measure_temp to fetch the VideoCore GPU temperature specific to Raspberry Pi hardware.

📶

CPU Frequency

Shows current / max frequency in MHz via psutil.cpu_freq() — useful for detecting throttling.

🔋

Power Throttle Detection

Decodes vcgencmd get_throttled hex flags to report: Under-voltage, Freq capped, Throttled, Temp limit, or Normal.

🟢

Thermal Status

Summarises overall health: ✅ Cool (<60°C), 🟡 Warm (60–70°C), 🟠 Hot (70–80°C), 🔴 Throttling (>80°C).

🖥️

Desktop App Entry

Supports a .desktop file to add Pi Monitor to the application menu — launches like a native system utility.


02

In Action

Pi Monitor showing installation and app menu entry on Raspberry Pi desktop
📌 Installing ttkbootstrap and adding Pi Monitor to the Accessories menu
Pi Monitor Dashboard showing CPU 1.2%, RAM 21.5%, CPU Temp 54°C, GPU Temp 53.8°C
📊 Live dashboard — CPU 1.2% · RAM 21.5% · Temp 54°C · Status: Cool

03

Metric Reference

Metric Source Normal Warning Critical
CPU Usage psutil.cpu_percent() < 50% 50 – 75% > 75%
RAM Usage psutil.virtual_memory() < 50% 50 – 75% > 75%
CPU Temp /sys/class/thermal/thermal_zone0/temp < 60 °C 60 – 70 °C > 70 °C
GPU Temp vcgencmd measure_temp < 60 °C 60 – 70 °C > 70 °C
Frequency psutil.cpu_freq() Displayed as current / max MHz · amber colour
Power Status vcgencmd get_throttled Normal (0x0) Freq capped / Under-voltage Throttled / Temp limit

04

Getting Started

1

Install Dependencies

Python 3 is pre-installed on Raspberry Pi OS. Install the required packages:

terminal
pip install psutil ttkbootstrap
2

Clone the Repository

Download the project from GitHub:

terminal
git clone https://github.com/ZiaUrRehman-bit/Pi5PowerMonitoringTool
cd Raspberry-Pi-5-Power-Monitor
3

Run the Dashboard

Launch the GUI with a single command:

terminal
python GUI3.py
4

Optional: Add to Application Menu

Create a .desktop entry to access Pi Monitor from the Accessories menu like a native app:

~/.local/share/applications/pimonitor.desktop
[Desktop Entry]
Type=Application
Name=Pi Monitor
Exec=python3 /home/pi/your_folder/GUI3.py
Icon=/home/pi/your_folder/icon.png
Terminal=false
Categories=Utility;

Replace /home/pi/your_folder/ with your actual path.


05

Source Code

The entire dashboard is a single Python file — GUI3.py — built with Tkinter + ttkbootstrap for the UI and psutil + vcgencmd for system metrics. The root.after(1000, ...) loop ensures live 1-second updates.

GUI3.py
import psutil, os
import ttkbootstrap as tb
from ttkbootstrap.constants import *

def get_cpu_temperature():
    with open("/sys/class/thermal/thermal_zone0/temp") as f:
        return round(int(f.read()) / 1000.0, 2)

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

def decode_throttled(hex_str):
    flags = int(hex_str.split('=')[-1], 16)
    reasons = []
    if flags & 0x1: reasons.append("Under-voltage")
    if flags & 0x4: reasons.append("Throttled")
    if flags & 0x8: reasons.append("Temp limit")
    return ", ".join(reasons) if reasons else "Normal"

def get_temp_status(temp):
    if temp < 60:  return "✅ Cool"
    elif temp < 70: return "🟡 Warm"
    elif temp < 80: return "🟠 Hot"
    else:           return "🔴 Throttling"

class SystemMonitorGUI:
    def __init__(self, root):
        self.root = root
        self.root.title("Raspberry Pi Monitor")
        self.root.geometry("260x240")
        self.style = tb.Style("superhero")   # dark theme
        self.frame = tb.Frame(root, padding=10)
        self.frame.pack(fill=BOTH, expand=YES)
        # ... build labels for each metric ...
        self.update_data()

    def update_data(self):
        cpu  = psutil.cpu_percent()
        ram  = psutil.virtual_memory().percent
        ct   = get_cpu_temperature()
        gt   = get_gpu_temperature()
        freq = psutil.cpu_freq()
        pwr  = decode_throttled(os.popen("vcgencmd get_throttled").read())
        # update all labels with colour styles...
        self.root.after(1000, self.update_data)   # refresh every 1 s

if __name__ == "__main__":
    root = tb.Window(themename="superhero")
    SystemMonitorGUI(root)
    root.mainloop()

06

About the Author

Zia Ur Rehman — PhD Researcher at the University of Limerick, Ireland (Lero, BDS Group).

This project was built as part of research into energy-efficient AI and hardware monitoring on edge devices. The Raspberry Pi 5 Power Monitor is also available as a PyPI libraryEnergyEfficientAI — for real-time CPU, memory, and power analysis during ML model training.

Research interests include Federated Learning, Explainable AI, Green AI, Evolutionary Algorithms, and parallel computing on distributed hardware.

GitHub LinkedIn PyPI Library Lero Profile
Related Projects
EnergyEfficientAI — PyPI library for ML energy monitoring
MPI Parallel Programming — Python MPI4Py examples
COGs-FL — Federated learning with GAN augmentation
AI Workshop — ML, CV & deep learning tutorials
Learn Evolutionary Algorithms — DEAP-based tutorials