Open2300 - Frequently Asked Questions
You are here: Foswiki>Open2300 Web>FrequentlyAskedQuestions (01 Dec 2009, DrLizAu)Edit Attach

Frequently Asked Questions about Open2300

How do I add a question and answer to this FAQ?

Just hit the edit button and add a question in the same format as this example question.

Please remember that this is not a place to ask questions. You only add a question here if you also have the answer.

Q: Is it possible to set my system/hardware clock using Open2300?

Yes, it is.

Using Linux and having your open2300 installed in /opt/open2300, just write a Bash script called e.g. "" like this:
 #!/bin/bash # Script by Ralph Beckmann (12.01.2006) SS_MM_HH=$(/opt/open2300/open2300 0200 r 3 | grep Data: | cut -c 28-) dd_mm_YY=$(/opt/open2300/open2300 0240 r 3 | grep Data: | cut -c 28-) if [ ${#SS_MM_HH} = 8 -a ${#dd_mm_YY} = 8 ] then # set system clock echo -n "Adjusting date from '$(date)' to: " date ${dd_mm_YY:3:2}${dd_mm_YY:0:2}${SS_MM_HH:6:2}${SS_MM_HH:3:2}${dd_mm_YY:6:2}.${SS_MM_HH:0:2}

# set hardware to value of system clock /sbin/hwclock -w fi 

You should call this script as 'root' within boot phase (e.g. somewhere in /etc/init.d/boot.clock) and setup a 'root' cronjob to invoke it once per day.

How do I handle the radio connection dropping and wu2300 sending bad data?

You eventually get an outside temp of 80 deg Celsius if the radio connection between your base station and your collector (main) unit gets blocked for a time. Why it's 80 deg is to do with bit shifting, and really not important right now. What is important is that, where I live anyway, it's never going to be 80 deg outside (unless that blasted meteor hits my house in which case it won't be high on my list of priorities) so we can use the 80 deg to identify whether the data is good or not.

This gets the 2300 available data in a space delimted line for me, Save it as and chmod it to allow execution:
 #!/bin/sh<br /><br />#author mccalni

#created 03-jan-08<br />#gets all available data from 2300 using fetch2300<br />#transforsm it to a single row of data, space delimited.<br />#Careful as a datum such as date may come back with a space<br />#in it, making the datum take up two columns. Yes, it is.<br />#Unnecessary to worry about it at this time, but trivial to<br />#quote the datum in line 42 awk statement or change the delimiter<br />#in the tr statement if required<br />#<br /># -h returns results with a header row<br /><br />#modified 26-jan-08<br />#removed all checks. Easier to control in calling script<br />#renamed from fetchcheck2300 to More accurate<br />#moved error checking to calling functions<br />#removed file creation and deletion - untidy, better now<br /><br />#modified 22-jan-08<br />#added wind check<br />#moved gusting reset to always as otherwise remains at 51m/s (114mph)<br /><br /><br />#get data into a file we can play with<br /><br />/usr/local/bin/fetch2300 &gt; $DATA<br /><br />#left in from previous iterations. may be useful at some point<br />NOTCONNECTED=`grep -wc -E 'To 80|WSmax 51\.0|WS 51\.0' $DATA`<br /><br />#reset for gusting<br />#need to do always otherwise end up with previous of 51m/s when wind sensor out<br />/usr/local/bin/minmax2300 wboth &gt;/dev/null 2&gt;&1<br /><br />#munge it up baby<br />RESULT=""<br />if [ "$1" = "-h" ]<br />then<br />RESULT=`cat $DATA | awk '{ print $1 }' | tr '\n' ' '`\\n<br />fi<br /><br />RESULT=$RESULT`cat $DATA | awk '{ print $2 }' | tr '\n' ' '`<br /><br />#tidy up<br />rm -f $DATA &gt;/dev/null 2&gt;&1<br /><br />#get out<br />echo ${RESULT}<br /><br />

There are various other avenues now open to you, you could use it in another script that calls wu2300 (or any of the others) if the return value is zero, or you could transform the data yourself in a perl script (call it and chmod it to allow execution):
 #!/usr/bin/perl -w<br />use strict;<br />use warnings;<br /><br />#fetch data from 2300, and transform to wu http request<br /><br />#param: directory where resides<br />#param: directory where open2300.conf resides<br /><br />#returns wu http request for submitting current 2300 data on stdout<br /><br />#author mccalni<br />#created 05-jan-08<br /><br />#modified 27-jan-08<br />#by mccalni<br />#changed the error handling to blow out if Temp 80 deg c and not<br />#include wind data if it is cac as the wind data seems to come on a

#different freq which gets blocked mroe often, weirdly<br />#added Log4perl stuff cos first time I heard of it.<br /><br />use Log::Log4perl qw(:easy);<br /><br />#constants<br />my($MPS_TO_MPH)=0.000621371192 * 60 * 60;<br />my($MMTOINCHES)=0.0393700787;<br />my($HPATOINCHESHG)=0.0295300;<br />#get the data<br />my($workingDir) = $ARGV[0];<br />my($confDir) = $ARGV[1];<br /><br />Log::Log4perl-&gt;easy_init(<br />{<br />level =&gt; DEBUG,<br />file =&gt; "&gt;&gt;$workingDir/../data/wuurl.log"<br />}<br />);<br /><br />DEBUG "Getting login and data";<br />chomp(my($wuId) = `grep WEATHER_UNDERGROUND_ID $confDir/open2300.conf | awk '{ print \$2 } '`);<br />chomp(my($wuPasswd) = `grep WEATHER_UNDERGROUND_PASSWORD $confDir/open2300.conf | awk '{ print \$2 } '`);<br />chomp(my(@dataset)=[`$workingDir/`]);<br /><br />#deal with duff data if sensors out or wireless interrupted<br />@dataset=split / /, $dataset[0][0] or die "Config incorrect. Failed to find source data or $?";<br />if ($dataset[9] eq "80") {<br />my($message) = "Bad data detected from outdoor sensors. Outdoor temp was 80 deg C\n";<br />FATAL $message;<br />die $message;<br />}<br /><br />#create the string<br />DEBUG "creating the string";<br />my($wuSubmit)="";<br />#header<br />chomp(my($today)=`date +%Y-%m-%d`);<br />$dataset[1] =~ s/\:/\%3A/g;<br />$wuSubmit .= "?ID=$wuId&PASSWORD=$wuPasswd&dateutc=$today+$dataset[1]";<br /><br />#wind<br />if ($dataset[37] != 51.0) {<br />my($windspeed) = $MPS_TO_MPH * $dataset[37];<br />$wuSubmit .= "&winddir=$dataset[39]&windspeedmph=$windspeed";<br />} else {<br />print STDERR "Windspeed invalid. Not submittted."<br />}<br />if ($dataset[53] != 51.0) {<br />my($windgust) = $MPS_TO_MPH * $dataset[53];<br />$wuSubmit .= "&windgustmph=$windgust";<br />} else {<br />print STDERR "Windgust invalid. Not submitted."<br />}<br /><br />#humidity, dewpoint<br />my($dewpoint)=&getTempF($dataset[16]);<br />$wuSubmit .= "&humidity=$dataset[30]&dewptf=$dewpoint";<br /><br />#temperature<br />$wuSubmit .= "&tempf=" . &getTempF($dataset[9]);<br /><br />#rain<br />$wuSubmit .= "&rainin=" . $dataset[58] * $MMTOINCHES . "&dailyrainin=" . $dataset[62] * $MMTOINCHES;<br /><br />#barometer<br />$wuSubmit .= "&baromin=" . $dataset[69] * $HPATOINCHESHG;<br /><br />#indoors<br />$wuSubmit .= "&indoortempf=" . &getTempF($dataset[2]) . "&indoorhumidity=" . $dataset[23];<br /><br />#static field footer<br />$wuSubmit .= "&softwaretype=open2300%20ver%201.11+";<br />$wuSubmit .= "&action=updateraw";<br /><br />print "$wuSubmit\n";<br /><br />#end main<br /><br />sub getTempF() {<br />my($celsius) = @_;<br /><br />return (($celsius *9)/5) + 32;<br />}<br />

This returns the url, so I put it in a call to curl with an email if there were any failures:

 # try to send the wu data up to three times and for up to 120 seconds in all # redirect curl stderr output to stdout otherwise you can miss errors # but have to grep out the upload counter header and values lines (-s eats the errors too, and we don't want that) # grep out wu success report if it's there # if anything's left of the output, something must have failed or behaved funnily so email it to me. curl --retry 3 -m 120 `/home/myhome/weather/station/scripts/ /home/myhome/weather/station/scripts /usr/local/etc` 2&gt;&1 | grep -v Total | grep -v ' 0 8' | grep -v success | mail -ne -s "WU Submit" 

I put the curl call in a script and call it from crontab every 20 minutes. Hasn't broken yet smile There's loads of room for making the scripts prettier, better error handling, and probably more succinct too. Feel free. Loving playing with open2300. Thanks all.

Q: Why do I get different values for rain?

The programs log2300 and mysql2300 read different values than histlog2300 and mysqlhistllog2300 do. E.g. log2300 and mysql2300 report the tendency and the other do not.

Major issue is that log2300 and mysql2300 read exactly what you see on the screen. mysqlhistlog2300 and histlog2300 read a different rain_total value. After having reset the WS23xx with minmax2300 the puffered value for rain_total is not reset. Reason is unknown and to be worked on.

You might added the offset value in the config file to correct this. See patches.

Note: Better don't use mysql2300 and mysqlhistlog2300 at the same time. Either use the one or the other.
  • Your computer has downtimes: use mysqlhistlog2300
  • Your computer is always on: use mysql2300

Q: Can anyone suggest a USB to Serial converter that works with the WS2300?

As noted elsewhere, the WS2300 has rather peculiar requirements of the RS232 interface. These mean that many USB to Serial converters will not work with the weather station. One device that has been shown to be successful is one from Nikkai, available from Maplin Electronics in the UK. The Maplin product code is ZP43W and the cost, at the time of writing, is 19.99 UK pounds. It uses the Prolific PL2303 chipset and worked out of the box with an Ubuntu 8.10 Linux system. Windows drivers are provided.

There is a list being compiled at USB-SerialConverters
Topic revision: r12 - 01 Dec 2009, DrLizAu
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.