Weather station software for Lacrosse WS-2300 - OpenJ2300 clone

Index


About

My weather station uses a clone of open-source OpenJ2300 ( link 1 link 2). It is based on OpenJ2300 version 0.21.

Differences from base OpenJ2300 0.21:

Application is tested on Windows XP and linux (Ubuntu server 10.04) with weather station connected by direct RS-232 (on Windows) and serial-over-ethernet (on both Windows and linux).


Download


Installation

1) Create a new database in MySQL. Create following tables and indexes:
CREATE TABLE OUTSIDE_TEMP(
TEMPERATURE DOUBLE,
HUMIDITY INTEGER,
TIME DATETIME
) 
;
CREATE  TABLE WIND(SPEED DOUBLE,DIRECTION DOUBLE,GUST DOUBLE,TIME DATETIME)
;
CREATE  TABLE RAIN(TOTAL DOUBLE,TIME DATETIME)
;
CREATE  TABLE PRESSURE(RELATIVE DOUBLE,TIME DATETIME)
;
CREATE INDEX WINDTIME ON WIND (TIME);
create index TEMPTIME on OUTSIDE_TEMP( TIME );
create index RAINTIME on RAIN( TIME );
create index PRESTIME on PRESSURE( TIME );

2) Copy librxtxSerial.so to %JAVA_HOME%/jre/lib/i386, (%JAVA_HOME% is the folder where JRE is installed on your system; e.g. /usr/local/j2sdk1.4.1_01)

3) Copy RXTXcomm.jar to %JAVA_HOME%/jre/lib/ext

4) Extract openj2300-0.21-pb-2.0-bin.zip into new empty directory, for example /opt/meteo. Change permissions on run.sh (chmod u+x run.sh). Change paths in run.sh for your environment. [Windows: change run.bat in the same way]

5) Change configuration in OpenJ2300.properties. You have to set the following fields:

6) Run "run.sh" [Windows: run.bat] and look for result in logfiles (in log/ directory). Does everything seems OK? Stop the running application.

7) Add the application into crontab:

  */10 * * * * /opt/meteo/run.sh >/opt/meteo/log/cron.log 2>&1
Yes, it is run every 10 minutes. It is for ensuring the application will run even if it encounters any problem (because the application is "fail-fast" - it ends after any problem).
The first thing the application does after start is checking, if there is any record in database written in the last 10 minutes (run.separation item in configuration). If there is some record, the application ends. So only one instance of application will stay alive. (Yes, it may be solved in some better ways, but this seem to be the simplest. And it works.)

8) Wait 15 minutes. Check logfiles and data in database.

9) Extract web application into your WWW server's directory. Change configuration in _lib/_config.php.

10) Enjoy.


Notes

1) Serial-over-ethernet adapter configuration is not set by application. You have to set it manually by your adapter's management console to: 2400, 8 bits, 1 stopbit, PARITY_NONE

2) As described in Open2300 wiki, DTR and RTS are not used for handshake by LaCrosse weather stations. They are steady DTR at negative voltage and RTS at positive voltage. Since there is no ground it seems that the WS2300 uses the DTR and RTS to define high and low. DTR must be low and RTS must be high for the communication to work.
BUT my Ethernet/Serial converter Lantronix MSS-100 doesn't allow user to control DTR/RTS wires and both signals were high (+12V) all the time. There is no wire with low (-12V) on connector. So I tried to connect DTR directly to GND... and it works.
In order to start communication with your weather station via serial-over-ethernet, you have to set DTR low and RTS high. If your serial-over-ethernet doesn't support setting this from management console, you have to change wiring weather station's cable as I did.

3) If you have some data in HSQLDB format from the original OpenJ2300 (open2300.script file), you may convert it to MySQL format:


Contact: petr (dot) brouzda (snake or whatewer you call it) gmail (dot) com