Temperature Sensor Setup LM35 take one

From Federal Burro of Information
Jump to navigationJump to search

k8055 connected to an lm35 with a1k resistor at 5v.

here's how I get the data into an rrd and graphed:

rrdtool create 1k_5v.rrd           \
            --start `date +%s`     \
            DS:speed:GAUGE:600:U:U \
            RRA:AVERAGE:0.5:1:24   \

new more robust rrd:

rrdtool create 1k_5v.rrd --step 300 \
  DS:temp:GAUGE:600:0:256 \
  RRA:AVERAGE:0.5:1:2592000 \ # Two months of 5 minute average data
  RRA:MIN:0.5:12:2400 \ # 100 days of 1 hour MAX data
  RRA:MAX:0.5:12:2400 \ # 100 days of 1 hour MIN data
  RRA:AVERAGE:0.5:12:2400 # 100 days of 1 hour AVERAGE data

drop this in a 5 minute while loop:

rrdtool update 1k_5v.rrd `date +%s`:`/usr/local/projects/k8055/src/k8055 -q -num:10 -delay:1000 2>/dev/null | cut -d ";" -f 3 | awk '{sum=sum+$1}END{print sum/NR}'`
rrdtool fetch 1k_5v.rrd AVERAGE --start `date --date='1 hour ago' +%s` --end `date +%s`

while true;
rrdtool update 1k_5v.rrd `date +%s`:`/usr/local/projects/k8055/src/k8055 -q -num:10 -delay:1000 2>/dev/null | cut -d ";" -f 3 | awk '{sum=sum+$1}END{print sum/NR}'`;
sleep 300;
rrdtool graph 1k_5v.png                                          \
         --start `date --date='7 days ago' +%s` --end `date +%s` \
         DEF:myavg=1k_5v.rrd:temp:AVERAGE                      \
         LINE2:myavg#FF0000                                      \
         DEF:mymin=1k_5v.rrd:temp:MIN                      \
         LINE2:mymin#00FF00                                   \
         DEF:mymax=1k_5v.rrd:temp:MAX                      \

After collecting data for a bit:

1k 5v 001.png

Note that the variable resistor on the k8055 is set right to middle.

Compared to system temp of server which is a loose aproximation of ambient local temperature ( the lm35 is sitting right beside the server's system temperature sensor.


I have moved the variable resistor to the right by one quarter so it's now half way between the halfway and all the way clockwise.

Initial investigation shows that where before it was reading 6 it's now reading 9. We shall see how it effects collection.