How's The Weather?
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:
- 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.
Free DevOps eBooks, Videos, and more!
Regardless of where you are in your DevOps process, Linux Journal can help!
We offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, and advice & help from the expert sources like:
- Linux Journal
- New Products
- Users, Permissions and Multitenant Sites
- Flexible Access Control with Squid Proxy
- Security in Three Ds: Detect, Decide and Deny
- High-Availability Storage with HA-LVM
- Tighten Up SSH
- DevOps: Everything You Need to Know
- Solving ODEs on Linux
- Non-Linux FOSS: MenuMeters
- diff -u: What's New in Kernel Development