Malvern Vale Weather: Technical Information
Update August 2024
After 20 years of faithful service, the rain gauge has packed up, and I can't find a spare unit. Also, the wind speed gauge is still at my old house. So now we just have temperature, humidity and pressure data.
Hardware
The weatherstation hardware used for this website consists of a collection of discrete wireless sensors from the WS2000 series at www.elv.de, dating from approx 2004. There are lots of weatherstation bits on sale at the Elv.de website, but as of 2018, they do not appear to be compatible with the WS2000 range. So I'll be stuck once any of my present hardware fails.
The ELV / WS2000 sensors send data back to a tiny radio box with an RS232 serial output. The weather data also appears on a portable LCD display. This system is fairly low in cost, and has the advantage of not needing power or signal cables running to the sensors. The sensors are mostly solar-powered but one or two of them use standard alkaline AA batteries. Being quite cheap, the sensors are not of the quality that you would need if you wanted to feed your reports into the Met Office.
This system is easily interfaced to your Linux, Unix or MacOS X computer using free open-source software (see Software section below). The software could also be made to work on Windows with only a bit of effort. However, the radio transmission protocol seems to lack checksums, so you do need to put some checks into your software so that wild values are thrown out. My software doesn't do as much checking as it probably ought to, but I do make some checks. In particular I don't trust rainfall data if it seems to be changing rapidly, so during really big sustained downpours it can take time for my software to catch up.
If you don't mind paying rather more, then much higher-quality kit is available. Make sure you get a documented, RS232-compatible output signal - and make sure there's some error detection in the radio protocol. At the top end, you might look for an "aspirated" outdoor temperature sensor. This means there's a fan that draws air through the device, so that you get to measure true air temperature without the device itself getting warm due to sunlight falling on it. This makes siting of the sensor less crucial. However, it's worth pointing out from the outset that most domestic stations will not return Met Office quality data anyway, because it's very rare that your house and garden are big enough (and sufficiently free of sheltering trees, land or buildings) to let your sensors get a really accurate picture. Most of my own sensors aren't too bad, but the wind readings are impaired by tall trees etc nearby.
Software
In my installlation, everything is done using free and open source software. This is a good solution provided that you aren't scared of working at the Linux command line shell. It might also help if you have some knowledge of an SQL database.
A Raspberry Pi 3B+ running Raspbian Linux (a port of Debian) receives weather data from the WS2000 wireless sensors via an RS232 serial port using the PCWSR program. The Pi recently replaced a Soekris NET5501 that had done sterling service for some years. It remains to be seen whether the Pi will be as robust - although it's certainly cheaper, faster and easier to load a modern OS onto.
Documentation for the PCWSR program, along with information on the use of WS2000 weatherstations under Unix,
can be found at Thalreit.de while the official source code is
part of the wth weatherstation project hosted by Berlios. Feb 2016: The Thalreit and Berlios sites seem to have gone now. There is an archived copy of the WTH project over on Sourceforge.net:
http://sourceforge.net/projects/wth.berlios/.
For backup purposes, I've copied the last two releases of the WTH software onto my web server in case the Sourceforge archive goes. My local download links for the software are here: pcwsr-0.1.4.tar.gz and here: pcwsr-0.1.5.tar.gz.
The PCWSR program decodes the binary data transmissions into readable ASCII data, with one line of text being output for each data update. This then is ideally suited for a classic Unix pipeline, so the data is simply piped into a second program called pcwsr_to_postgresql which reads the data, does some error checking, and then stores the readings into an SQL database, which is powered by Postgresql.
Every 15 minutes, a shell script is kicked off from a cron job. The shell script calls a small set of quick and dirty PHP scripts to query the SQL database, build the web page and graph images for the last 7 days, and upload them to the web server. A nightly cron job does a similar job for the last 12 months of data, building a web page showing the long-term view. The graphs themselves are plotted using an excellent open source graphing program called Ploticus. My shell scripts and PHP scripts can be downloaded here but be warned, they are pretty klunky!
The software versions currently in use are:
pcwsr version 0.1.5 (From www.Berlios.de WTH project) ploticus - web graphing package postgresql-client - PostgreSQL database (client) postgresql-libpqxx - A C++ interface for PostgreSQL postgresql-server - "The most advanced open-source database available anywhere" php8-cli - PHP interpreter php-pgsql - The pgsql extension for PHPFreeBSD 6.1-RELEASE-p10 i386Raspbian GNU/Linux 9.4 (Debian stretch) on armv7l (Pi 3B+).Oracle Linux 9.x on Pi 4.
I hope this is useful. The weak points of this system are the tacky shell/PHP scripts used for building the web display code. This display code could really do with some improvement. Also, a more rigorous pipeline filter could be used to make a noise filter to drop erroneous radio data more cleanly.
Martin Johnson
May 2018