1

I'm trying to measure my Raspberry Pi's temperature using vcgencmd measure_temp but it only works whenever it feels like it:

pi@raspberrypi ~ $ sudo /opt/vc/bin/vcgencmd measure_temp
vc_gencmd_send returned -1
vchi_msg_dequeue -> -1(22)

Any idea what might be going on? It just hangs there, I need to use Ctrl+C to get out of there.

0
2

This appears to do the trick:

pi@raspberrypi  $ cat /sys/class/thermal/thermal_zone0/temp
57838
1
  • 1
    I guess that's why hwmon isn't in the stock kernel. This one is from the ACPI interface, which is probably newer but seems a little strange since the pi doesn't have any power management features; presumably it's used because it standardizes /sys better. So I might have been hasty in calling it "daft" ;) – goldilocks Mar 12 '14 at 16:34
0

Any idea what might be going on?

No, but the information is available from the kernel via /sys.

> cat /sys/class/thermal/thermal_zone0/temp
52996

That's thousandths of a degree Celcius (i.e., 52.996 °C).

If your kernel has the hardware monitoring module available (try sudo modprobe -v hwmon; if it says insmod and a path, you do), and you want something more formal, install apt-get lm-sensors and try:

> sensors
bcm2835_hwmon-isa-0000
Adapter: ISA adapter
temp1:        +53.0°C  (high = +85.0°C)

Unfortunately this only seems to work on the single core models.

8
  • Hmmm temp1_input does not exist. The "bcm2835_hwmon.0" folder has: modalias power/ subsystem/ uevent – João Pereira Mar 12 '14 at 15:25
  • lm-sensors can't find any sensors by the way, and sensor-detect returns: "/sys/bus/pci/devices: No such file or directory at /usr/sbin/sensors-detect line 3003." – João Pereira Mar 12 '14 at 15:36
  • 1
    Huh -- I use a custom kernel, which probably accounts for that. Raspbian should have a hwmon or bcm2835-hwmon module available, but looking through a copy of a recent image, I don't see it. The max temp is the "high =" number, btw (85.0°C), but the pi does not significantly change temperature even when maxed out (I just did this for 5 min, it got up to 57 °C); I think the only way to truly heat it up is to overclock it... – goldilocks Mar 12 '14 at 15:51
  • Very interesting. I'll ask another question straight away. In any case, I think i've nailed it with: "cat /sys/class/thermal/thermal_zone0/temp" – João Pereira Mar 12 '14 at 16:05
  • 1
    That presumes the python vcgencmd lib isn't going to fall prey to the problem in the original question, whereas the kernel interface is distinct from that. Anyway, this one is a bit like that Paul Simon song about leaving your lover: echo "scale=1; $(cat /sys/class/thermal/thermal_zone0/temp) / 1000" | bc -l (I'm a Canuck so Celsius is fine by me.) – goldilocks Jun 24 '18 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.