How's The Weather?
May 6th, 2008 by Phil Hughes in
One of the items on the Geek Ranch agenda is a weather station. While we don't have one yet, we have learned a bit about weather stations and Linux.
First, why don't we have one? Well, there is no electricity at the Geek Ranch site yet for starters. But, more important, there is no Internet connection. So, let's just call this research.
I started my search for weather stations a few months ago. The criteria was simple:
- Reliable
- Inexpensive
- Works with Linux
The result was that I bought two different systems. The first is a La Crosse Technology, WS-2310TWC. The TWC in the model number means that it says "The Weather Channel" on it. I don't plan to use it with The Weather Channel but I paid $10 less to have that info on the box.
While it was the most inexpensive unit I found with a computer interface, I don't give it any awards for the "Works with Linux" test and, based on my experience with a different La Crosse model, I am not sure about the reliability. Talking to the La Cross tech support folks, they said there was no Linux software and they would not release the communications specifications.
A bit of searching and I found Open2300, software designed to talk to the 23xx series of weather stations. Clearly it is a bit of reverse engineering and, based on what I read, I understand why they don't want to release the specifications. The unit appears to be a 4-bit processor (can you still get those) with no API. That is, you just can read and write memory. Yuck.
The good news is that the software includes a Weather Underground interface routine. It doesn't work and I don't want to figure out why but it is there.
On the reliability issue, my previous La Crosse unit which didn't have a computer interface recently self-destructed. The wind speed and direction unit all but disintegrated after about two years in service. The good news is that the new unit has a totally different design that appears a bit sturdier.
Before I get into getting the 2300 to work, let me talk about what I really will use at the Geek Ranch. It is an Oregon Scientific WMR968. The one I have happens to be dark green and say "John Deere" on it. Much like The Weather Channel model of the other unit, I saved about $10 because of this ad. Whatever.
Both units are called wireless and communicate to the base station on 433MHz. The difference is that on the La Crosse unit wireless means that there are wires that run from the wind and rain sensors back to the outside temperature sensor which then wirelessly communicates with the base unit. With the Oregon Scientific, all the sensors, including the indoor temperature unit, are independent. All except the indoor temperature unit are solar powered.
Before you say "I need sun for the solar cells but I don't want the outside temperature sensor in the sun", don't panic. The sensors connect with cables to their own solar panel/transmitter unit. Clearly an easy to work with design. Comparing the two, I am glad I splurged for the extra money for the "real one".
Ok, back to getting the 2310 into operation. It boils down to the following:
- Download the software
- Modify the make file. (There is no configure script but the default setup is for Linux. I didn't have to make any changes.)
- Do a make install.
- Plug the cable from the base unit into a serial port and make sure you have read/write permission on the port.
- Run fetch2300 and you should see the info read from the unit.
If all went well, you are now up and running. In my case, all that worked fine so I decided to put myself on the map. That is, put Estelí, Nicaragua up on Weather Underground. (Note that the page you see there combines this weather station with some "airport" information. The airport actually shares little in common with Estelí as it is over 100km away and at a much different altitude. Clicking on the historical data link gets you the real information.)
To put the data up, all I had to do was log into Weather Underground and add the details of the station. That got me the station ID which is IESTELIE2.
That station ID and my password can then be added to the open2300.conf and then running wu2300 will poll the weather station and upload the information to Weather Underground. Easy. Unfortunately, it didn't work. No complaints but WU never got the data.
The next step was to turn on debugging. Setting DEBUG to non-zero in wu2300.c causes the program to echo the http request to standard output rather than send it. It looked just fine. I pasted it into a browser and got success back plus the page got updated.
After scratching my head a bit and realizing it was 3AM, I did what any real geek would do—glued the pieces together with a shell script. Here is the "quick hack" version.
data=D$$ ./wu2300 > $data wget -i $data rm $data updateweatherstation.php*
It just grabs the http request and sends it using wget. I then added a crontab entry to run the script and all is well. Ok, all works and I will clean up the mess someday. In the mean time, you can see that my weather here is better than your weather. Ok, maybe someone has better weather some of the year but I am guessing most people would prefer my weather to their weather most of the time.
__________________________Phil Hughes
__________________________Phil Hughes
Subscribe now!
Breaking News
| AMD Calls Out Intel...We Think. | 2 days 12 hours ago |
| Bye-Bye TorrentSpy, So Long MPAA's Money | 2 days 14 hours ago |
| Sun Finds the Keys to Unlock MySQL | 4 days 8 hours ago |
| New Powers on the Throne – or Heads on the Block – at OLPC | 5 days 8 hours ago |
Featured Video
Linux Journal Gadget Guy, Shawn Powers, takes us through installing Ubuntu on a machine running Windows with the Wubi installer.
Live From the Field
The latest posts from the Linux Journal team.
Delicious
Digg
Reddit
Newsvine
Technorati






Don't support those who refuse to publish specifications
On May 6th, 2008 Z1 (not verified) says:
Why not buy a product that releases specifications so you can develop your own software, rather than having to resort to a reverse engineered product?
I would recommend Davis Vantage Pro. I've had mine for 4 years and it has worked flawlessly. Davis don't provide Linux software, but they do publish full specifications of the protocol and several people, including myself, have implemented Linux versions.
I would also doubt the accuracy of many of these cheaper products (toys?), which is why I could not recommended anything other than Davis Instruments for anyone wanting reliability, accuracy and good support at a very reasonable price.
+1 on Davis
On May 7th, 2008 Anonymous (not verified) says:
I'm also using a Davis Vantage Pro with Linux. I've written a small daemon in C that collects the data and periodically fires off secondary processing (like web page generation and Weather Underground upload).
The only thing I've had to do with my system in the 2.5 years since I installed it is replace the backup battery in the sensor package and occasionally clean the leaves out of the rain collector.
I had one small glitch with one of my consoles when I initially set them up, but when I called Davis, the phone was answered by a human who actually dealt with my problem (!).
Davis weather
My weather data
BTW, the daemon is written so that it's relatively easy to add support for other weather stations (I did just that for the weather sensors at work). If anyone is interested in the code, contact me via the Weather Underground.
Link
On May 6th, 2008 Jeff Shantz (not verified) says:
The link to Lacrosse Technology is misspelled. It should be http://www.lacrossetechnology.com/.
Correct url
On May 6th, 2008 the1_ts says:
Hey, great article I've been looking at doing this for a while. Can you correct the url for Lacrosse Technology
Thanks
WMR-968
On May 6th, 2008 Andrew (not verified) says:
I've had an Oregon WMR-968 for some time now, and connected it to a small (8Mb RAM, 32Mb Flash disk) Linux embedded box using the WX200d software which has worked well for me. However my little Linux system is way too small to run the (python?) scripts that the wx200d software provides to upload data to Weather Underground, although the wx200d daemon that actually connects to the serial port is written in C and is small and extremely reliable.
I wrote my own data uploader that queries the wx200d daemon every 30 seconds and spawns a wget-clone program to upload the data. Note that the wget process can freeze if your network connection goes down, so the parent also needs to time out and kill the wget process if it takes too long to run. Initially this was coded as a couple of shell scripts, but more recently I converted it all to C which has been more reliable.
One other feature I included in the uploader was to calculate the actual dewpoint temperature myself from the %RH and the air temperature — if the dewpoint goes below freezing, the WMR-968 returns an error value. My uploaded data is found here.