Wednesday, July 4, 2018

117: Overheating: The Pi's Internal Temperature Sensor

I currently have a Pi Zero W mounted inside a farm hoophouse (i.e., one of the new plastic film greenhouses). Unless the sides get rolled-up it can get over 120F in a hoophouse on a summer day. Yesterday my Pi Zero reported 154F from inside it's sealed case -- very close to the max 70C/158F for the Arm processor spec. Anyway, I protect my Pis as folows:

In cputemp.sh
h=`hostname` # I have several Pis
while true ;
do
 a=`/opt/vc/bin/vcgencmd measure_temp`
 b=`expr "$a" : '.*=\([0-9][0-9]*\)'`
 if [ $b -gt "70" ] ;
 then
  echo $h HOT | mail -s 'Rpi-HOT HALTED' some@gmail.com
  sudo halt # must power off/on to restart
 fi
 if [ $b -lt "55" ] ;
 then
  sleep 300
 else
  sleep 60
 fi
done


And in crontab
@reboot bash ...(your path).../cputemp.sh

Which means the above shell file will be executed whenever the Pi restarts.

P.S.: About overheating -- while my Pi Zero seemed to be working up to 70C, it became erratic at 66C/150F. while it still sent data to a web page, it stopped being able to snap a new image with the PiCamera/raspistill.

No comments:

Post a Comment