🛠 Surveillance thermique et bridage : le sprint-marathon

Raspberry Pi 3 Model B+ (2018) — Board Sheet · avance · Schéma : IMG-model-3b-plus-avance-2-model3bp-surveillance-thermique.svg — Carte avec dissipateur, sonde de température et graphique fréquence CPU passant de 1400 à 1200 MHz au seuil de 60 °C

Objectives

Instrument the specific thermal management of the 3B+: the default soft limit at 60 °C (temp_soft_limit, capped at 70 °C) which drops the CPU from 1.4 GHz to 1.2 GHz, followed by hard throttling between 80 and 85 °C. You will learn how to read temperature, frequency, and the throttling mask via vcgencmd, generate a test load, and log everything using systemd.

Hardware

Complete code

#!/usr/bin/env bash
# thermal-watch.sh — journalise temperature, frequence ARM et masque de bridage.
# vcgencmd parle au GPU : c'est la source exacte selon la doc officielle.
LOG=/var/log/thermal.csv
[ -f "$LOG" ] || echo "horodatage,temp_c,arm_mhz,throttled" > "$LOG"
while true; do
    temp=$(vcgencmd measure_temp | cut -d= -f2 | tr -d "'C")
    clk=$(( $(vcgencmd measure_clock arm | cut -d= -f2) / 1000000 ))
    # Masque : bit 0 sous-tension ; bit 3 (valeur 8) frequence bridsee ;
    # bit 5 (32) sous-tension subie ; bit 6 (64) limite douce ; bit 8 (256) limite dure.
    thr=$(vcgencmd get_throttled | cut -d= -f2)
    echo "$(date -Is),${temp},${clk},${thr}" >> "$LOG"
    printf "temp=%s C arm=%s MHz throttled=%s\r" "$temp" "$clk" "$thr"
    sleep 1
done
# Lancer la surveillance et la charge en parallele
sudo ./thermal-watch.sh &
sysbench cpu --cpu-max-prime=20000 --time=600 run   # 10 min de charge quad-core
# Attendu : 1400 MHz sous 60 C, puis 1200 MHz au-dessus (limite douce),
# puis bridage progressif 80-85 C. temp_soft_limit se regle dans config.txt.

Expected verification

Under load, the CSV shows the step: frequency stays at 1400 MHz as long as the sensor remains below 60 °C, then drops to 1200 MHz with the soft limit bit lighting up in get_throttled. At idle, everything returns to normal. An undervoltage bit (bit 0/5) lighting up indicates a power supply issue, not heat.

Common errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials