This weekend I put together a wee project I’d been thinking about for a while — a web-enabled weather station in my back garden.
Ever since I moved out of the city a few years ago I’ve taken a greater interest in the weather. When we moved into our new house in Elderslie I noticed the previous owner had an outdoor temperature sensor installed. She’d taken it away with her, but the bracket was still there. I bought the same model and installed it a couple of weeks after moving in. It’s been really handy, but my inner geek has always wanted more!
Last week I noticed Maplin had reduced the price of their touchscreen USB weather station to £80. It’s branded Watson W-8681, but I think it’s more commonly called the WH1080PC. It seemed to have everything I was looking for: wind, temperature and rain sensors, RF wireless connection and a USB PC interface. The only thing that was missing was a reliable way to mount it outdoors. I bought a suitable 20mm pole and TV aerial bracket from B&Q – total cost about £11.
Putting the weather station together was dead easy, but finding somewhere to install it outside wasn’t. I tried lots of options, but everywhere had problems – too low, too sheltered, too close to the neighbour’s dog, etc. I finally settled on the garage, which I had been trying to avoid on account of the solid concrete walls. An hour of drilling and two carbide-tipped drill bits later it was in place.
The rest of the installation was dead easy. The touchscreen receiver has excellent range, and I was able to get a signal from the outdoor station everywhere in the house. The PC connection was simple too — just run a small EXE file (no installer) and it starts picking up the signal.
Getting it online
I had a browse around for software to allow my weather station to publish directly to the web. I was really disappointed with what I found — options that people were recommending on forums were quite expensive ($70+) and seemed pretty amateur for the price. I installed a couple of freeware/trial options, but again these either didn’t work at all, or were really disappointing.
So there was nothing else for it: I had to build my own weather software from scratch. I set up a MySQL database and wrote a PHP script to extract data directly from the desktop software supplied with the weather station. It gets updates every 30 mins and writes them to the database. If the weather station receiver isn’t connected to the PC for any reason, it stores results in its internal memory. The extraction script automatically catches up when it’s next connected.
I then wrote a some display scripts to query the database and produce graphs over time. At the moment the graphs only show the last 24hrs worth of results. I’ll add more options in the future, but there’s no point at the moment as I only have a couple of days worth of data stored.