How To fix a hardware problem with software!

 Ten years a go I installed a Fine Offset weatherstation and it's been running more or less continuously since then,  24/7 , feeding data to the internet to provide a Blakedown weather report.

The weatherstation itself is shown above. It links via radio link to a display panel in the sitting room, which shows current weather data. The panel also links to an old XP laptop running a piece of software called Cumulus, developed for free by a weather enthusiast and used worldwide. Cumulus takes readings every ten minutes and generates a monthly log file, as well as website pages that are available from my server at www.mecol.co.uk/weather/index.htm.

A few months ago the pressure reading stopped working and I finally decided to try to fix it. As it happens, for reasons I won't go into here, I have a spare station that I've used over the years for parts. So I swapped out the display unit (which is where the pressure sensor lives). To my surprise the pressure still didn't work. After exploring all the alternatives I was forced to accept the highly unlikely fact that both sensors had died, within a similar time period. They both have worked in the past and now they both don't. Amazing. This particular weatherstation is no longer available for sale - so what to do?

I hit on the idea of pulling the missing pressure data off the internet and somehow patching it in to the Cumulus software that the station interfaces to. A software fix for a hardware problem - the modern way!

After trawling the internet I found a US based organisation called Open Weather that makes weather data available for thousands of cities worldwide. And it has data for Kidderminster, only 3 miles away! So I started writing a simple utility to pull in this data, and decided on Javascript language as this can be run in any browser on any machine. It's also my favourite language. Basically it's a matter of setting up a free account with  https://openweathermap.org/api  and getting an access code so that the software can request the weather data.  It does this using an API request and the data bounces back in the blink of an eye. Readings are taken every ten minutes for storing away for later use. 

So having obtained the data, I decided to create a log file, compatible with the Cumulus log file that contains the duff pressure readings, with a view to patching in the pressure data. At that point I hit a major snag - Javascript, for very good security reasons is prohibited from writing anything to the computer's storage system! I knew this but had just forgotten. 

So I decided to write another piece of software, in PHP language, to run on my server and deal with the creation and regular ten minute update of the Kidderminster log file. This worked fine, after much digging and a learning curve on PHP. So the Javascript software does an API call to get the data from OpenWeather in the US and sends it on to my server for logging. This software has ended up running 24/7 on an old Raspberry Pi computer as this consumes negligible power and was doing nothing anyway stuffed away in a draw.

The next task was to merge the Cumulus log file with my own Kidderminster log file.

And so a third piece of software was born. Another Javascript program, whose job it is to

- pull down the latest Cumulus log file off my server

- pull down the latest Kidderminster log file off my server

- pick out the relevant bits from each and form an active web page of Blakedown weather. Example below.

 I didn't start out to generate an active web page - it just sort of evolved. The software  has grown to the stage where it is actually a lot more useful and interesting than the Cumulus web page that it was supposed to 'just correct'. On the Cumulus web page it's shown as a link to a log plotter page. Here's the link to that  page    http://www.mecol.co.uk/weather/logplotter.html  and a screengrab below from 20th May when a low swept in. Best viewed on a laptop as you can then choose what to display. You can see the pressure takes a dive, the wind gets up, and the rainfall builds, the temperature drops. While I sit comfortably indoors watching my laptop screen and feeling very smug knowing that my several weeks of software development has resulted in something so useful! And it gave me a nice lockdown project too.


So the weatherstation has finally been fixed! And without me leaving my armchair.

What strikes me now is that the original weatherstation has almost been rendered redundant. I say almost because unfortunately the OpenWeather data does not include rainfall. If it did I could dispense with the Cumulus software and the Fine Weather station completely and have a software  weatherstation that never breaks down. Unless of course the internet fails, but if that happens the weatherstation will be the least of my worries.

If anyone knows of an API that provides weather data that includes rainfall, please let me know.

And if anyone wants a copy of any of the software just contact me.







Comments