December 31

Temperature of Raspi core

I gambled around with the Raspberry Pi: installed the LAMP stack and gnuplot. For a first test I created a shell script which logs the temperature of the core, logs it into a file, and creates a graph:

#!/bin/bash
LOGFILE=/home/pi/logs/temp.log
OUTFILE=/home/pi/public_html/coretemp.png

T=$(/usr/bin/vcgencmd measure_temp | cut -d'=' -f2 | sed 's/..$//')
D=$(date '+%FT%T')
echo "$D $T" >> $LOGFILE

gnuplot << EOC
set term png small
set output "$OUTFILE"
set xdata time
set timefmt "%Y-%m-%dT%H:%M:%S"
set format x "%Y-%m-%dn%H:%M:%S"
set xlabel "date"
set ylabel 'temperature [C]'
set yrange [0:*]
set grid
set title "Raspberry Pi core tempreature"
plot "$LOGFILE" using 1:2 with lines notitle
EOC

The script is called every minute from cron. The resulting graph:

coretemp


Tags: ,
Copyright © 2014. All rights reserved.

Posted 2013-12-31 by Daniel LeMath in category "Raspberry Pi

Leave a Reply

Your email address will not be published. Required fields are marked *