Raoouul
Posts: 1
Joined: Mon Dec 31, 2012 12:23 pm

Another weather station project (Oregon Scientific)

Mon Dec 31, 2012 1:24 pm

Weather stations seem like a popular type of project here! I've just got data logging working from my Oregon Scientific RMS300 data station on my Christmas Pi. There were a few difficulties involved in getting this working, so I thought I'd post the details here in case this can help anyone else out.

I'm using the open-source wmr100 program to log weather data to a text file. There was a problem with this program on Raspbian related to the asprintf function which I had to work around (more details below). Here are roughly the steps I used to get this working. Probably there are easier ways that I don't know about, for example, I couldn't find a libhid package so had to build it from source.

$ sudo apt-get install subversion git libusb-dev automake libtool
$ svn co svn://svn.debian.org/libhid/trunk libhid-svn
$ cd libhid-svn
$ ./autogen.sh
$ make -k
$ sudo make -k install
$ cd ..
$ git clone git://github.com/barnybug/wmr100.git
$ cd wmr100
$ make

At this stage you should have a program called wmr100 in the current directory. This should work already without any further steps, but only as the root user. Also, it has a shared-library dependency on /usr/local/lib (the default install location for libhid-svn), so you can run it, for example like this:

$ sudo bash -c 'LD_LIBRARY_PATH=/usr/local/lib ./wmr100'

This should start logging data like below:

DATA[20121231130314]:type=TEMP,sensor=0,smile=0,trend=,temp=21.7,humidity=49,dewpoint=0.0

What I actually noticed was more like this:

DATA[20121231111856]:type=TEMP,sensor=0,smile=0,trend=,temp=0.0,humidity=8162952,dewpoint=0.0

The temp and humidity were wrong, which turned out to be related to the asprintf problem mentioned earlier. Specifically, the wmr100 program uses asprintf but was not defining the _GNU_SOURCE macro before doing #include <stdio.h>. This meant that it was using the asprintf function without a prototype, so it did not handle floating-point values correctly. Interestingly, the asprintf man page on Raspbian mentions the _GNU_SOURCE macro, but the same man page on OS X does not - maybe this accounts for why wmr100 worked fine on other platforms. By coincidence, someone else very recently posted a suggested fix for this to the github site for wmr100 (see https://github.com/barnybug/wmr100/pull/8) and mentions other reports of asprintf not working on Raspbian for floating point values. Potentially that's all related to the missing prototype.

So now this is all working, I'm going to set up an init.d script to start this automatically at boot time, and I'll be able to retrieve the data periodically via ssh from another computer to generate charts, etc. One day I might set it up so the Raspberry Pi can plot graphs on the TV as well.

Note that the RMS300 and related weather stations are pretty old now - mine still does the job, but you might not be able to get one new any more.

cbocksta
Posts: 1
Joined: Sun Aug 11, 2013 10:59 pm

Re: Another weather station project (Oregon Scientific)

Sun Aug 11, 2013 11:03 pm

Hi i have a WMR100 & it work's fine for me :

Receive packet len 12: 00 42 00 fc 00 2c 82 00 00 20 0c 02
{"topic": "temp", "timestamp": "2013-08-11 22:59:53.821995", "sensor": 0, "smile": 0, "trend": -1, "temp": 25.2, "humidity": 44, "dewpoint": 13.0, "source": "wmr100.0", "origin": "wmr100"}
Receive packet len 12: 00 42 01 94 00 35 3c 00 00 20 68 01
{"topic": "temp", "timestamp": "2013-08-11 23:00:03.126495", "sensor": 1, "smile": 0, "trend": -1, "temp": 14.8, "humidity": 53, "dewpoint": 6.0, "source": "wmr100.1", "origin": "wmr100"}
Receive packet len 12: 00 42 00 fc 00 2c 82 00 00 20 0c 02
{"topic": "temp", "timestamp": "2013-08-11 23:00:03.821296", "sensor": 0, "smile": 0, "trend": -1, "temp": 25.2, "humidity": 44, "dewpoint": 13.0, "source": "wmr100.0", "origin": "wmr100"}
Receive packet len 8: 00 46 ea 03 ea 33 50 02
{"topic": "pressure", "timestamp": "2013-08-11 23:00:03.832059", "pressure": 1002, "forecast": 0, "altpressure": 1002, "altforecast": 3, "source": "wmr100", "origin": "wmr100"}
Receive packet len 12: 00 42 00 fc 00 2c 82 00 00 20 0c 02
{"topic": "temp", "timestamp": "2013-08-11 23:00:13.820259", "sensor": 0, "smile": 0, "trend": -1, "temp": 25.2, "humidity": 44, "dewpoint": 13.0, "source": "wmr100.0", "origin": "wmr100"}
Receive packet len 12: 00 42 00 fc 00 2c 82 00 00 20 0c 02
{"topic": "temp", "timestamp": "2013-08-11 23:00:23.821249", "sensor": 0, "smile": 0, "trend": -1, "temp": 25.2, "humidity": 44, "dewpoint": 13.0, "source": "wmr100.0", "origin": "wmr100"}
Receive packet len 12: 00 42 00 fc 00 2c 82 00 00 20 0c 02
{"topic": "temp", "timestamp": "2013-08-11 23:00:35.321364", "sensor": 0, "smile": 0, "trend": -1, "temp": 25.2, "humidity": 44, "dewpoint": 13.0, "source": "wmr100.0", "origin": "wmr100"}
Receive packet len 12: 00 42 00 fc 00 2c 82 00 00 20 0c 02
{"topic": "temp", "timestamp": "2013-08-11 23:00:43.821195", "sensor": 0, "smile": 0, "trend": -1, "temp": 25.2, "humidity": 44, "dewpoint": 13.0, "source": "wmr100.0", "origin": "wmr100"}



But i have some changes for make the WMR100 binary :

$ sudo apt-get install subversion git libusb-dev automake libtool
$ sudo apt-get install libzmq1
$ sudo apt-get install libzmq-dev
$ wget "https://alioth.debian.org/frs/download. ... .16.tar.gz"
$ gunzip libhid-0.2.16.tar.gz
$ tar xvf libhid-0.2.16.tar
$ cd libhid-svn
$ ./configure
$ make -k
$ sudo make -k install
$ cd ..
$ git clone git://github.com/barnybug/wmr100.git
$ cd wmr100
$ make

Return to “Automation, sensing and robotics”