Skip to content

Instantly share code, notes, and snippets.

@labbots
Last active September 11, 2020 20:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save labbots/78443cea9f42cbbb4af2e4ea44bf0568 to your computer and use it in GitHub Desktop.
Save labbots/78443cea9f42cbbb4af2e4ea44bf0568 to your computer and use it in GitHub Desktop.
Script to measure CPU and GPU temperature of Raspberry PI Model 2/3/3B+ (https://labbots.com/rpi-measure-cpu-gpu-temperature/)
#!/usr/bin/env bash
# Script: pi-temp-measure.sh
# Display the ARM CPU and GPU temperature of Raspberry Pi 2/3B/3B+
# -------------------------------------------------------
echo "-------------------------------------------"
echo "$(date) @ $(hostname)"
echo "-------------------------------------------"
gpu="$(/opt/vc/bin/vcgencmd measure_temp)"
echo "GPU => ${gpu##*=}"
cpu=$(</sys/class/thermal/thermal_zone0/temp)
cpuTemp1=$(($cpu/1000))
cpuTemp2=$(($cpu/100))
cpuTempM=$(($cpuTemp2 % $cpuTemp1))
echo "CPU => ${cpuTemp1}.${cpuTempM}'C"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment