🛠 Surveillance thermique et fréquence du RK3568B2

NanoPi R5S (FriendlyElec) · avance · Schéma : IMG-nanopi-r5s-avance-2-nanopir5s-surveillance-thermique.svg — NanoPi R5S dans son boîtier métal passif avec sondes : température thermal_zone, cpufreq des quatre Cortex-A55, courbe température/fréquence et seuils de throttling

Objectives

Set up continuous monitoring of the RK3568B2 temperature and frequency: read thermal zones and cpufreq policies, trigger script-based alerts, and understand the board's thermal behavior (FriendlyElec has never seen the CPU exceed 50 °C in a passive metal case; operating range 0-70 °C). You will write a systemd daemon that periodically logs and alerts above a threshold, useful before installing the board in a network enclosure without airflow.

Hardware

Complete Code

#!/bin/bash
# surveille_r5s.sh — journalise température + fréquences, alerte > 65 °C
# (seuil bas car la spec max est 70 °C ambiants 0-70)
LOG=/var/log/r5s-thermal.csv
THRESH=65000   # milli-°C
[ -f "$LOG" ] || echo "date,temp_mC,cpu0_kHz,cpu3_kHz" > "$LOG"

while :; do
  T=$(cat /sys/class/thermal/thermal_zone*/temp 2>/dev/null | head -1)
  T=${T:-0}
  F0=$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq)
  F3=$(cat /sys/devices/system/cpu/cpufreq/policy4/scaling_cur_freq 2>/dev/null || echo 0)
  echo "$(date -Is),$T,$F0,$F3" >> "$LOG"
  if [ "$T" -gt "$THRESH" ]; then
    logger -t r5s-thermal "ALERTE température ${T}m°C (seuil ${THRESH}m°C)"
  fi
  sleep 30
done
# Test de charge : stress-ng --cpu 4 --timeout 300
# Ordonnanceur/gouverneur : cat /sys/.../policy0/scaling_governor (schedutil)
# Installer en service :
# cp surveille_r5s.sh /usr/local/bin/ puis unit systemd Type=simple

Expected Verification

After running stress-ng --cpu 4 --timeout 300, the CSV shows the temperature rise (staying below ~50-55 °C in a metal case) and frequencies close to 2000 MHz as long as throttling does not kick in. cat /sys/class/thermal/thermal_zone*/type identifies the cpu zone. The systemd service starts at boot (systemctl status r5s-thermal). If the temperature approaches 65 °C, check the case (the metal acts as a heatsink), the confined location, or add the fan on the ZH1.5 connector.

Common Errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials