Short tip: Get Raspberry Pi temperature

There is no standard sensor that can be used with lm_sensors to get the temperature of the Raspberry Pi embedded board – what a pity! Fortunately for this function there is a dedicated command called vcgencmd which is already included in the Raspbian image. To make it work you will need to customize the LD library paths:

# echo "/opt/vc/lib" > /etc/
# ldconfig
# /opt/vc/bin/vcgencmd measure_temp

There is also an appropriate file underneath /sys/class to get the temperature:

# cat /sys/class/thermal/thermal_zone0/temp
# awk '{printf "%3.1f°Cn", $1/1000}' /sys/class/thermal/thermal_zone0/temp

Sharing is caring

Leave a Reply