post icon

Weather web, Ubuntu and Mac mini

Having your own weather station is fun. Making charts of rainfall, UV radiation and temperature is pure porno. But unless you’re kinky enough to consider the GUI below to be sexy, prepare for resistance.

weatherinfo.png

I hope no one takes offence, that software (Weather Display) does what it should, but in my eyes it’s just… uh, Windows 3.11. There is a web add-on you can buy which looks nicer, but that will cost you US$113 which is way off. So I have decided to write my own software where I control the colours.

There are several weather stations on the market for very reasonable prices. I first tried one from TFA, which is the same as LaCrosse 3600. That one was pure crap. The main unit had an ugly LCD so dim it barely could be read, and it kept crashing now and then. The sensors were interconnected with cables, creating a messy installation on the roof. So I returned it and got the WMR100N from Oregon Scientific instead. Much nicer; better looking, easier to set up, better built, no cables at all between the sensors and cheaper too! Installing it was a drop dead easy, except for the part where I was balancing on an Ikea stool, on the highest point of the roof, to reach the pole where the sensors was to be placed. But I didn’t drop dead.

Closed Software Is Better Says Clueless Swedish Lawyer

Yes, she, an ex-Microsoft employee, really did say that. The not so easy part comes when you want to communicate with the station and show status on The Net. After all, you buy this kind of stuff to know the weather when you’re not on site. All weather station makers seem to nurse a closed source attitude and jealously treat the communication protocols as state secrets. This has lead to overpriced, old fashioned software, usually designed for Windows with crappy or no ports to other platforms, made by a few that has an exclusive deal with the manufacturers of the hardware. But, there’s some hope. At Weather-Display you can download a donationware for Linux, called WDConsole or consolewd, that will smoothtalk your station and pull data from it. Download is easy, getting it to work is not. The authors admit they are no Linux gurus, but they are nice guys and try to help. Especially if you donate some money, which seems the right thing to do.

A Few Hints For A Lower Adrenaline Level

Here’s a few advice to make the process a little easier. First make sure that you have libc on your machine. So sudo apt-get install libc6 is a good idea. Then you must make sure that the software is allowed to write to the station through USB. In the forums at Weather-Watch someone recommended putting

# USB devices (usbfs replacement)
SUBSYSTEM=="usb_device",      MODE="0666"

in /etc/udev/rules.d/40-permissions.rules, but safer method (at least on Ubuntu) is to add rule for just this station. This is what it looks like in Ubuntu 8.10:

# USB serial converters
SUBSYSTEM=="usb_device", GOTO="usb_serial_start"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device",   GOTO="usb_serial_start"
GOTO="usb_serial_end"
LABEL="usb_serial_start"                         
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE="0660", GROUP="dialout"
ATTRS{idVendor}=="0fde", ATTRS{idProduct}=="ca01", MODE="0666"
LABEL="usb_serial_end"

The last ATTRS line identifies the WMR100N station from Oregon Scientific and sets proper permissions.

Now connect your station and try to run ./GoWdconsole.sh. If you’re lucky it will start reading and write a log to stdout every few seconds. If you’re unlucky like me there can be a variety of error messages. The one you really don’t want to see is

Inconsistency detected by ld.so: ...

because no one seems to know exactly what causing it and what to do. Having a modern libc is one recipe but not always the cure. On my machine it seems a bit random, sometimes its’ difficult to launch the software, sometimes it just works. The day I wrote this I could never launch the software in foreground with ./GoWdconsole.sh, but I could in background with nohup ./GoWdconsole.sh &. Strange, huh?

Other errors can refer to permissions, so recheck USB permissions and that WDConsole/consolewd can write to the file system.

Now, if you want logging to a database, there are a few things to consider. First find create a mySQL DB (yes, mySQL only) with this structure, and then make sure you have a mySQL client on your machine. You know, sudo apt-get install mysqlclient. Edit the config.txt file with your DB settings and you should be fine. But chance is that you, like me, have to do a little more. WDConsole/consolewd can’t always see that you have the required libs installed, so in the consolewdfiles/deploy dir (which seems to be there to cover for a not so good build and link setup) you must add a link to your installed mySQL client lib.

At this point at least my setup is running. To make my GUI-less Linux Mac mini autostart after power outages, which are quite common in rural Gotland, I googled for hours before finding the magic one-liner:

sudo setpci -s 0:1f.0 0xa4.b=0

Self-explaining indeed. Add this to some script so it’s always run as early as possible in the boot chain, because the setting is not preserved at restarts. Oh Mac OS X how I miss thee…

Now start logging data, write a nice web app and tell the world. My prototype for a nice web app will soon be live. I’m building with dashing Databinder and jolly smart JFreeChart. Code will soon be available too.

Enjoy!

6 Comments

Leave a comment
  1. Mathias
    2009/01/07 at 17:16 #

    Kul att se att du fortfarande är igång med dina roliga upptåg Per!

    Införskaffade mig ett par X10 enheter för ett tag sedan men har inte gjort något matnyttigt med dem ännu(tidsbrist). Funderar på att skaffa mig någon form av tablet pc med pekskärm som man kan styra diverse ting i hemmet med.

    Hörs Mathias

  2. Thrash Cardiom
    2009/02/28 at 21:08 #

    When is your software likely to be available?

  3. Per
    2009/05/12 at 16:17 #

    I now have a working Mac native driver for WMR100N and will complete it with db logging, then I’ll return to my web app for displaying weather info. Can’t give a schedule as I have my other daytime work stealing hours from me…

  4. Per
    2009/05/12 at 16:18 #

    Man får aldrig nog av att hacka! Berätta gärna om dina X10-grejer, jag är lite nyfiken på det.

  5. Tommy
    2009/08/11 at 17:38 #

    Jag har märkt att jag får “Inconsistency detected by ld.so” när jag har viss hårdvara ansluten till servern. Sedan start min Epox Bluetooth-dongle och nu min SonyEricsson C905 får inte vara anslutna när jag startar consolewd. Tar jag ur dem funkar det bra.

  6. Per
    2009/08/11 at 17:46 #

    Ok. Jag hat gett upp consolewd helt och kör nu min egna lösning för mac. Tipsa Brian så kanske han får fason på sitt program så småningom. :-)

Leave a Reply