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:

1# echo "/opt/vc/lib" > /etc/ld.so.conf.d/raspberry-firmware.conf
2# ldconfig
3# /opt/vc/bin/vcgencmd measure_temp
4temp=51.9'C

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

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

Translations: