home weather solar projects about

Thalreit Logo   Thalreit/DE Lat: 47°46'41" N, Lon: 12°06'42" E

Graphs
Extended view by clicking on graph image
 
Temperature
 
Humidity
 
Rain
 
Wind Speed
 
Wind Direction
 
Air Pressure
 
 

 

Radio weatherstations in the UNIX environment


Overview

It is described howto interface low-cost radio weatherstations to the serial port in a Free Software environment. These radio weatherstations are sold as PC radio receivers plus external sensors by mailorder ELV or CONRAD. Further description of the weatherstations is given in the hardware section. Several types of environment sensors like temperature, humidity, air pressure, wind, rainfall or brightness transmit data to a radio receiver where it can be retrieved to a computer over the serial link. Depending on the type of receiver the communication with the computing equipment is either unidirectional or bidirectional. In the unidirectional case data is written to the serial line directly upon reception. The bidirectional stations use internal memory to store data which can be retrieved by issuing commands to the serialline. The communication software has been written and tested for the LINUX and FreeBSD operating systems. The wth project is hosted by Berlios.

Hardware

The WS2000 weatherstations

The actual WS2000 weatherstation is a radio weatherstation available from the German electronic reseller ELV by mailorder. The Profi Wetterstation weatherstation by CONRAD uses the same communication protocol as the WS2000 station. Both sensors and receivers of these two stations operate with each other flawlessly. The weatherstation sensors communicate wireless to a radio receiver which can be read by a computer over the serial link. The wireless link transmits data at 433.92 MHz with extrem low power (approximately 10mW).

WS2000 PC receiver

The PC receivers are either
bidirectional with integrated DCF77 time receiver, ring buffer for data storage (32kB) and serial interface
unidirectional without internal memory for serial connection. This unit is sold as a kit only
The receivers are connected thru a standard RS232 serial line with the computing equipment. Where the bidirectional unit is battery powered (4 AA batteries, haven't been replaced within one year of operation) the unidirectional receiver is powered by 5V DC which is taken by connecting to the PC power supply.

WS2000 sensors

The sensors include radio transmitters to send the weather data. The radiation power of these sensors is extremely low (10mW per sensor).
combined temperature, humidity (and air pressure) sensor for indoor use combined temperature, humidity sensor for outdoor use
wind sensor rainfall sensor
brightness sensor (supported only by unidirectional receiver)

It is possible to install up to 16 temperature/humidity sensors, 1 wind sensor and 1 rainfall sensor. The brightness sensor is only supported by the unidirectional receiver. The sensors have approximately 100m reach which can be extended by repeaters. They operate independently using a integrated solar module. The sensors are detected automagically by the receivers at power on.

For the software development a WS7000-13 bidirectional receiver by CONRAD, a WS2000 bidirectional receiver by ELV and the unidirectional PC weathersensor receiver by ELV have been used. All sensors but the brightness sensor have been tested. The weatherstation modules are available as a set or in parts thru mailorder electronic resellers like ELV or CONRAD.


Serial communication protocol

It seems appropriate to categorize the serial weatherstations mainly into two types according to their coomunication behaviour with the computing equipment. While the first type uses a bidirectional serial communication protocol the other type operates in an unidirectional manner.


Bidirectional communication

One type communicates with the computing equipment in a bidirectional mannner ie. data is sent to the computer only upon request. This could be depicted in ASCII art like:

                        request
      Computer             ->           PC-Interface
                        response
                           <-
It is the WS2000 weatherstations by ELV or CONRAD which work in this way. These stations use a high-level communication protocol which even uses checksums for data correction. There is also another type of stations which use an extra piece of hardware to connect to the weatherstation. The Davis weatherstations operate by bidirectional serial line communication with the WeatherLink, a piece of hardware which allows fast data transfer off the weatherstation. The WeatherLink is connected in between the computer and the weatherstation. Data in the weatherstatoin itself can also be accessed.

         request                 request                     
Computer   ->        Weather        ->      Weather Station  
         response    Link        response                    
           <-                       <-

Unidirectional operation

The other type of weatherstations operates unidirectional, ie. data is sent continuously or in certian periods to the serial line. The data typically consist of packets having a defined format.

      Computer          receives        PC-Interface
                           <-
                          data

Data protocol of specific weatherstations

At present time the protocol of the following stations has been reproduced in a compilation at http://thalreit.de/attic/project/station-protocol.txt

ELV/Conrad WS2000 PC-Interface
ELV PC Weather Sensor Receiver
Huger WMR918
Radioshack WX200
Davis weatherstations

It is emphasized, that this compilation does not include any new work what serial protocol analyzing is concerned, but is rather a collection of information available either on the internet or in other forms of publication. It should be noted however that for the communication protocol of the ELV PC weathersensor receiver a serial line snooper has been used for test purposes. It includes a little howto use the snooper tool for serial line snooping.


Software

At present time two modules are available which support the WS2000 type weatherstation receiver and the ELV PC weathersensor receiver, wth and pcwsr. The project homepage is hosted by the berlios project.

wth


Implementation

The wthc software is a full implementation of communication protocol of the wireless weatherstation. The client program is able to communicate either with a locally attached weatherstation or with a network service, which runs on another station with a locally attached weatherstation. The network service has been implemented as tcp server and must run on the remote machine in order for the client software to be able to connect. The data exchange with the client software is done with the same protocol which is used over the serial line. The tcp server is able to communicate with the serially attached weatherstation and then sends its data to the client software. Otherwise the tcpserver offers a telnet service with full functionality. The communication port with the client software is on port 3900, whereas telnet access is on port 3901.

Usage

This section contains manual pages for the client software wthc and the tcp server wthd.


wthc

wthc - control serial/network interface of weatherstation

SYNOPSIS

wthc [ -c command ] [ -s | -n ] [ -h hostname ] [ -i intervall ] [ -p portnumber]

DESCRIPTION

wthc controls the serial or network interface to a weath- erstation module. It is possible to read data like tem- perature, humidity, air pressure, wind speed, wind direc- tion and rain fall. The DCF77 receiver can be read as well as current status information. If the module is connected by a serial line, data is read directly from a 64kB ring buffer. For network access a server process must run on the system where the weatherstation module is locally attached.
OPTIONS
-c command
specifies the command to be executed, where command can take values as described in section COMMAND PARAMETERS.
-h hostname
hostname or IP address to connect to remote server, in case weatherstation is not locally connected to serial port.
-i intervall
intervall time of data sets collected by weather- station. This option is only needed in conjunction with command 6.
-p portnumber
use portnumber to connect to remote server, default is 3963.
-s
use local serial connection for readout
-n
use network connection for readout, this needs an extra parameter h.

COMMAND PARAMETERS

this section lists the command parameters available to set the values of command.

command
0
read current time of DCF 77 receiver. If the receiver is not synchronized with DCF77 sender, the user is notified appropriately.
1
read topmost dataset off the ringbuffer, if avail- able.
2
pop topmost dataset off the ringbuffer and advance to read next available dataset. The next dataset can be read by issuing command 1.
3
activate 9 temperature/humidity sensors.
4
activate 16 temperature/humidity sensors.
5
read status of weatherstation
6
set intervall time, this requires an extra parame- ter -i intervall time
12
read all datasets of the weatherstation interface. This is a recursive combination of command 1 and 2.

FILES

/etc/wth/wth.conf wthc configuration file

BUGS

Prototype version. Network code probably unreliable.

wthd

wthd - network service of weatherstation interface

SYNOPSIS

wthd [ -d ] [ -p portnumber]

DESCRIPTION

wthd serves incoming network requests to read data of weatherstation interface, like temperature, humidity, air pressure, wind speed, wind direction and rain fall. The DCF77 receiver can be read as well as current status information. To communicate with wthd a client program is needed, otherwise telnet access at full functionality is provided.
OPTIONS
-p portnumber
use portnumber to listen on, default is 3900.
-d
do not daemonize, stay in foreground

SEE ALSO

wthc(1), telnet(1)

BUGS

Prototype version. Network code probably unreliable.


pcwsr

Description

pcwsr is Free Software to read the PC weathersensor receiver sold by ELV (ELV Part No. 68-390-61). Different types of weather sensors like temperature, humidity, air pressure, wind, rain or brightness transmit measured values wireless (at 433MHz). The receiver is connected thru the serial port. The communication with the computing equipment is unidirectional, i.e. the receiver writes the sensor data to the serial port once they are received from the wireless sensors.

               radio transmission                            serial
      sensor <--------------------> weathersensor receiver  --------> computer
               at 433 MHz                                    comm.
                              computer

The communication protocol has been published by ELV (ELV Journal 6/2000). It has been reproduced here. The communication software pcwsr opens the serial port, sets the serial configuration right, then loops to receive data from the serial port.


pcwsr - screenshots

A typical screenshot of pcwsr looks like this:

volker@ikarus pcwsr-0.1.2 > ./pcwsr /dev/ttyS0
pcwsr 0.1 - experimental test version
Wed Nov 21 2001 19:54:49 |     wind (version 11 at address 0x07) | Speed[km/s] 1.5 | Direct
Wed Nov 21 2001 20:00:37 |   indoor (version 11 at address 0x07) | T[°C] 18.1 | H[% rel.hum

using the raw option the byte strings are dumped as received:

volker@ikarus pcwsr-0.1.2 > ./pcwsr -r /dev/ttyS0
pcwsr 0.1 - experimental test version
option: raw
Wed Nov 21 2001 20:13:32 : 8 bytes read |2|a7|8c|b4|80|80|80|3|
Wed Nov 21 2001 20:14:04 : 8 bytes read |2|c7|81|b5|ac|87|ce|3|
Wed Nov 21 2001 20:16:22 : 8 bytes read |2|a7|8c|b4|80|80|80|3|
Wed Nov 21 2001 20:16:46 : 8 bytes read |2|c7|81|b5|ac|87|ce|3|

Serial communication

A crucial point in the development of the code was to get the serial communication parameters right. In the first place, serial line snooping has been used to test the PC software which is distributed with the weathersensor receiver. The following settings for the serial port have been found useful:

speed 19200 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ;
eol2 = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 5;
parenb parodd cs8 hupcl cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel
-opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0
ff0
-isig -icanon iexten -echo -echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke

The serial has to be configured to 19200 Baud, 2 stop bits and odd parity. Also it has to be set to raw mode for input and output by turning off ICANON, ISIG, ECHO, ECHOE and OPOST. The data can most simply be received by

cat >/tmp/raus

Each read will return 8 characters in case everything has been configured right.


Types of sensors

The following sensors have been tested so far successfully:

S2000A outdoor temperature and humidity sensor
S2000W wind sensor for speed and direction detection
S2000R rain sensor
S2000I indoor sensor for temperature and humidity
S2000ID indoor sensor for temperature, humidity and air pressure

Unknown stuff

If the serialline is snooped using the WS-EMpfaenger.exe binary which is distributed with the receiver it is noted that the software sends two byte strings to the PC weathersensor receiver. The two strings are 9 bytes long

01 ff 00 00 00 00 00 80 04
01 ff 00 00 00 00 00 80 04

I don't know howto interpret this.


Licensing

The wth and pcwsr software have been written and are copyright Volker Jahns. It is Free Software and has been been put under the GNU General Public LicenseGPL. For further information look at the GNU website.

Download

The current versions for download are
wth 0.4
pcwsr 0.1.2
For further information also proceed to the wth project homepage which is hosted by Berlios.

References

Serial programming

This I found interesting what serial programming under UNIX is concerned.

Title Author Location
Serial Programming Guide for POSIX Operating Systems M.R.Sweet
Asynchronous Serial Port Programming in IRIX Anonymous SGI Pipeline Nov./Dec. 1998
The Linux Serial Programming HOWTO V.C. Hoxie
Anwendungen entwickeln unter Linux M.K. Johnson, E.W.Troan Bonn; Reading, Massachusetts: Addison-Wesley Longman 1998
Messwerterfassung mit LINUX A. Blücher Linux-Magazin 08/99 p.20
Information on BCD format Webopedia
Information on UNIX serial programming Stokely Consulting
The UPS Howto Harvey J.Stein Linux Documentation Project


Weather software

As time passes complexity increases. In the course of programming the wthc software I got to know several other places which are concerned with programming software for wireless weatherstations in the UNIX environment.

Weather software

As time passes complexity increases. In the course of programming the wthc software I got to know several other places which are concerned with programming software for wireless weatherstations in the UNIX environment. huh, this software is cool.

Title Author Description
wx2000 Friedrich Zabel wx2000 - Weather Data Logger Extraction Program (ws2000 model)
wx200d Timothy D.Withman wx200d is a weather station data collector and server daemon for the WX200 / WM918 weather station hardware.
gwx Timothy D.Whitman gwx is a graphical GTK+ client for the wx200d(8) weather station server.
wxreport Lukas Zimmermann Linux data logging and server daemon software for the WMR918(H) and WMR968 wireless weather station.
wxnet Rob Pinelli wx/net (weather net) is a free open-source networking application for the monitoring of weather conditions.
wmr918 etc Joe Jaworski network connect of WMR918.
wmr918d John Stanley Software to talk to the WMR-918 on UNIX.
kweather Juergen Hochwald use KDE for your personal weather report.
WeatherUpdate Scott Hassan Phyton version for use w/ Davis Monitorr II, WM-918, WMR-968.
Oww Simon J.Melhuish One-wire weather - Oww: RISC OS or Linux interface to the Dallas Semiconductor 1-wire weather station.
Perl the Ultimeter 2000 Jonathan Bradshaw PERL scripts for the Ultimeter 2000.
Weather Tools Alan Jackson Weather Tools: PERL scripts for the wmr918. Look how wonderful the windrose plots are.
ws2000 Wolfgang Bolien Software to read the ws2000 weatherstation.


Meteorology links

These websites contain information on meterological issues.

Site Location
Terry's BNL/Long Island Weather http://rolly.ccd.bnl.gov/~thealy/wxnew.shtml
Der Deutsche Wetterdienst http://www.dwd.de
Meteorologisches Institut der FU Berlin http://www.met.fu-berlin.de/de/wetter
Deutsches Klimarechenzentrum http://www.dkrz.de
Gemeinschaft Deutscher Hobbymeteorologen http://www.gdhm.de
Wetterstationsforum http://www.wetterstationsforum.de
Weather Underground http://www.wunderground.com
Weather Display Forum http://tokaanuskihire.co.nz/forums/Weather-Display


Further Information

Comments and questions to Volker.Jahns@thalreit.de, please.

© 2001, 2002, 2005 Volker Jahns, volker@thalreit.de