søndag 27. desember 2009

WMR200 weather station and Linux

Some time ago, we purchased a couple of Oregon Scientific WMR200 weather stations. We already had a WMR968 that did a good enough job at our weekend house, but we wanted to have a unit at home as well.

When the new units arrived, I was surprised to see that they had a USB interface instead of the serial interface on the '968. The serial protocol of the '968 is fairly well documented, but the '200 became a challenge. This posting attempts to document my findings.

USB interface
The '200 implements the USB HID profile, and to use it an initialization command has to be issued. Then, in a loop, a "ready for more data" command is sent, and we start waiting for USB "interrupts". A message from the '200 can consist of one or more interrupt frames. Each interrupt frame is 8 octets long, where the first octet says how many of the remaining octets are valid.

Protocol
The first octet of each message frame is the message type. The second is usually the frame length (including the type and length octets). The last two octets are usually a checksum.
Several of the frame types include date and time. These are coded in octet 2-6, with one octet each for minute, hour, day, month and year-2000 .


Frame type 0xD1
This is a one byte message (no length field or checksum)

Frame type 0xD2
Still unknown. May be for historical data.

Frame type 0xD3
Wind data
D3 - type
10 - length (0x10)
mm - minute
hh - hour
dd - day
MM - month
yy - year
d1 - wind direction in 22.5 degrees increments (0-15)
gs - gust wind (* 0.1 m/s)
xx - unknown ?
xx
xx
xx
xx
cs - checksum
cs - checksum

Frame type 0xD4
Rain data, length = 16 octets
0 - type (D4)
1 - length (0x10)
2-6 datetime
7-8 rate (0.01 inches/hour)
9-10 last hour (0.01 inches)
11-12 last 24 hours (0.01 inches)
13-14 accumulated (0.01 inches)


Frame type 0xD5
Unknown. length=10 octets

Frame type 0xD6
Barometric pressure and forecast. length=13 octets

0 - type (0xD6)
1 - length (13)
2-6 datetime
7 - unknown
8-9 pressure (in hPa)


Frame type 0xD7
Temperature. length=16 octets
0 - type (0xD7)
1 - length (10)
2-6 datetime
7 - sensor id (low nibble)
8-9 temperature (0.1°C)
10 - humidity (%)

Frame type 0xD8
Not seen

Frame type 0xD9
Unknown. length=8 octets

Ingen kommentarer:

Legg inn en kommentar