2

I have been looking on the internet and found nothing for getting readings of the temperatures of the CPU on the Raspberry Pi.

Im using Raspbian (Wheezy).

Any help would be great for everyone!

  • asked and answered multiple times: raspberrypi.stackexchange.com/a/8690/7274 – lenik Aug 20 '13 at 6:55
  • i didnt want to do jQuery or graphs. – Alex Aug 20 '13 at 7:37
  • 2
    reading /sys/class/thermal_zone0/temp does not require no graphs nor jquery – lenik Aug 20 '13 at 8:03
  • but the 2 answers in the question you linked talked about using jQuery or output with graphs. and python. – Alex Aug 20 '13 at 8:04
  • 1
    please, read the question, the quote starting from "# read the temperature and convert..." and the next 2 lines. – lenik Aug 20 '13 at 8:06
15

I found an answer at http://www.raspberrypi.org forums. You can read the CPU temp via bash script. Save this script as getTemp.sh in /usr/local/bin folder and give execute permission with chmod +x /usr/local/bin/getTemp.sh command. Then run it, you will get temp values.

#!/bin/bash
cpuTemp0=$(cat /sys/class/thermal/thermal_zone0/temp)
cpuTemp1=$(($cpuTemp0/1000))
cpuTemp2=$(($cpuTemp0/100))
cpuTempM=$(($cpuTemp2 % $cpuTemp1))

echo CPU temp"="$cpuTemp1"."$cpuTempM"'C"
echo GPU $(/opt/vc/bin/vcgencmd measure_temp)

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