[rrd-users] help with NSLU2, OWFS and RRD for DS2423 counter
Rob Conway
rjconway at bigpond.com
Mon Feb 16 21:25:15 CET 2009
Here is my read script (started life in a NSLU2 -no runs under ubuntu), once
started it loops every 90 seconds and uses a simple bash script. Each
section has a description and you can see how to convert the counts into a
real number. See Accum_flow as the counts divided by 4100 = litres in my
case
#!/bin/bash
OWWRITE="/opt/owfs/bin/owwrite -s 3001"
OWREAD="/opt/owfs/bin/owread -s 3001"
AWK="/usr/bin/awk"
hwclock -s
echo "`date` -- 1Wire Data Collection Script Started -- "
>>/var/scripts/nohup.out
while true
do
### Force Simulataneous 1wire conversion ###
$OWWRITE simultaneous/voltage 1
$OWWRITE simultaneous/temperature 1
### Read 1wire data and convert into engineering units #ph was 2.6667
offset was .3##
PH=$($OWREAD 20.022408000000/volt.A | $AWK ' {printf
"%4.2f\n",(($0-0.0)-1)/1.6+5.5 }')
US=$($OWREAD 20.022408000000/volt.B | $AWK '{printf
"%3.0f\n",(($0-0.0)*100)}')
ORP=$($OWREAD 20.022408000000/volt.D | $AWK '{printf
"%3.0f\n",(($0-0.0)*99)}')
TempAqua=$($OWREAD 20.022408000000/volt.C | $AWK '{printf
"%3.1f\n",(((($0-0.0)-1)*5)+20)}')
LITRES=$($OWREAD 20.952A05000000/volt.D | $AWK '{printf
"%3.1f\n",(($0-2.94)*62)}')
TempOut=$($OWREAD 28.11BF97000000/temperature | $AWK '{printf
"%3.1f\n",($0)}')
TempAmb=$($OWREAD 28.D70598000000/temperature | $AWK '{printf
"%3.1f\n",($0)}')
TempRes=$($OWREAD 28.A6EE97000000/temperature | $AWK '{printf
"%3.1f\n",($0)}')
Accum_flow=$($OWREAD 1D.EBEF0900000034/counters.A | $AWK '{printf
"%g\n",($0/4100)}')
### Out of Range Error trap -Do not log data ###
PHtest=`echo $PH |cut -f1 -d'.'`
if [ -z $PHtest ] || [ $PHtest -gt 8 ]; then
echo "`date` PH reading error $PH" >>/var/scripts/nohup.out
PH="U"
fi
ORPtest=`echo $ORP |cut -f1 -d'.'`
if [ -z $ORPtest ] || [ $ORPtest -gt 600 ]; then
echo "`date` ORP reading error $ORP" >>/var/scripts/nohup.out
ORP="U"
fi
UStest=`echo $US |cut -f1 -d'.'`
if [ -z $UStest ] || [ $UStest -gt 500 ]; then
echo "`date` Conductivity reading error $US" >>/var/scripts/nohup.out
US="U"
fi
TEMPtest=`echo $TempAqua |cut -f1 -d'.'`
if [ -z $TEMPtest ] || [ $TEMPtest -gt 33 ] ; then
echo "`date` Aquarium Temp error $TempAqua" >>/var/scripts/nohup.out
TempAqua="U"
fi
### Calculations based upon Data ###
C12=$($AWK -v PH="$PH" '{printf "%3.1f\n",((3*$0)*(10^(7-PH)))}'
/var/scripts/kh_value.txt)
Todayflow=$($AWK -v AF="$Accum_flow" '{printf "%g\n",(AF-$0)}'
/var/scripts/lastflow.txt)
Weekflow=$($AWK -v AF="$Accum_flow" '{printf "%g\n",(AF-$0)}'
/var/scripts/weekflow.txt)
### Push Data into NEW Trend Files ###
rrdtool update /var/www/rrd/aqua_ph.rrd N:$PH
rrdtool update /var/www/rrd/aqua_orp.rrd N:$ORP
rrdtool update /var/www/rrd/aqua_temp.rrd N:$TempAqua:$TempRes
rrdtool update /var/www/rrd/aqua_co2.rrd N:$C12
rrdtool update /var/www/rrd/aqua_cond.rrd N:$US
rrdtool update /var/www/rrd/aqua_level.rrd N:$LITRES
rrdtool update /var/www/rrd/weather_temp.rrd N:$TempAmb:$TempOut
rrdtool update /var/www/rrd/aqua_waterchange.rrd N:$Todayflow:$Weekflow
sleep 90
done
-----Original Message-----
From: rrd-users-bounces at lists.oetiker.ch
[mailto:rrd-users-bounces at lists.oetiker.ch] On Behalf Of Eduard
Sent: Tuesday, February 17, 2009 7:00 AM
To: rrd-users at lists.oetiker.ch
Subject: [rrd-users] help with NSLU2, OWFS and RRD for DS2423 counter
Are there users who are using RRD and OWFS with a NSLU2 ?
I'm interested in how to update a RRD with data from a DS2423 counter.
Does anybody have some working examples for me?
Kind regards,
Eduard
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.0.237 / Virus Database: 270.10.24/1954 - Release Date: 02/15/09
18:09:00
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-users/attachments/20090217/f9a73d9e/attachment-0001.html
More information about the rrd-users
mailing list