Categoriearchief: Weather station

Tweede leven voor een weerstation

Weerstation Alecto WS-3900

De meeste weerstations worden in een impuls gekocht, vaak omdat er een aanbieding is, en vol enthousiasme gemonteerd. Buiten komen de instrumenten zoals thermo- en hygrometer, windmeter en dergelijke en binnen komt het paneel. Binnen het jaar zijn de meeste buiten-onderdelen kapot of zelfs weggewaaid. Ook blijkt het voor die systemen vaak lastig om de communicatie tussen het buitenstation en het paneel goed te onderhouden. Na een tijd blijft dan ook een best aardig ogend weerstationspaneel over maar – omdat het buitenstation ontbreekt – zonder informatie over het weer buiten. De tijdaanduiding loopt ook steeds verder uit de pas.

Arduino-kloon op printplaatje met voeding links en rechts de 868 MHz zender en de klok.

Het is eigenlijk zonde om die weeerstations dan maar weg te doen. Hieronder volgt een beschrijving waarmee in ieder geval de panelen nog een nieuw leven kunnen krijgen. Hierboven een voorbeeld van een schakeling die bestaat uit een Arduino-kloon met wifi, de ESP-201, een 868 MHz zender om codes naar het weerstation te sturen en een “Real Time Clock” die de tijd bijhoudt.

Om precies te zijn, dit apparaatje is gemaakt voor Alecto weerstations en de twee panelen waarvoor het getest is zijn van modellen WS-3000 en WS-3900. Het protocol dat gebruikt wordt voor deze twee stations wordt ook voor andere Alecto weerstations gebruikt en bovendien voor modellen van andere makelij. Het protocol is op meerdere plaatsen op het internet besproken, zie bijvoorbeeld hier. Geschikte zendertjes zijn bij electronica-winkels te koop, maar deze is gesloopt uit het buitenstation. In het kastje zit een printje waarvan de bovenkant de zender bevat. Dat kan eenvoudig losgebroken worden. De lus in de printplaat vormt de antenne, dus die moet niet worden gebroken. Omdat de buitenstations in weer en wind staan raakt het printje vervuild maar na even schoonmaken is het goed bruikbaar.

De klok is nodig om voor langere periodes de tijd bij te houden. De tijd wordt namelijk eens per uur naar het paneel gestuurd terwijl het apparaatje maar eens per maand of minder de tijd zal hoeven ophalen van het internet. Hier is de DS3231 gebruikt die voor een paar euro te koop is. Een interessante beschrijving vind je hier.

De ESP-201 is een Arduino-kloon met wifi die ik al eerder hier beschreven heb. Deze is momenteel minder populair omdat het geheugen van 512 kB te beperkt wordt geacht. Goede alternatieven zijn ESP-12E of ESP-12F. Het programma dat hier gebruikt wordt is echter lang niet zo groot, dus alles past er prima in.

Het programmaatje dat in dit apparaatje gebruikt wordt krijgt via het MQTT-protocol de weersgesteldheid van mijn eigen weerstation. Wie niet over een eigen weerstation beschikt kan wellicht een in de buurt gebruiken. Automatische weerstations plaatsen vaak in een openbaar deel van de webstek van de eigenaar een bestand meteohub.dat dat het onderhavige programma ook gebruikt om het paneel van weersinformatie te voorzien. Tenslotte zijn er ook weerbericht-diensten zoals openweather.com die weersinformatie ter beschikking stellen van de lokatie van de vrager.

De werking van het apparaatje is verder eenvoudig. De weergegevens worden volgens het protocol omgezet in een reeks getallen die vervolgens in een vast tempo uitgezonden worden, elke 48 seconden twee keer kort achter elkaar. Om het uur wordt in plaats daarvan de actuele tijd gestuurd. Daar merkt de gebruiker alleen wat van na het vervangen van de batterijen van het paneel: het duurt even voordat de tijd weer goed wordt weergegeven.

Het geheel wordt voorzien van energie door een 5 Volt / 3 Watt voedinkje waarna een regelaar 3,3 Volt maakt voor de ESP-201 en andere printkaartjes. Het geheel moet nog een keer in een kastje en dan is het af.

MiSol weather station

The former hardware gave more and more problems. They were Alecto WS-4000 components that really had served their time. A serious problem with the weather station was that the temperature sensor heated up too fast in the sun light. Attempts to solve the problem with a solar operated fan failed so far.

The MiSol weather station has a fancy design and – as most models nowadays – has the thermometer mounted more in the shade of the case. It appears to be equivalent to the outdoor unit of Fine Offset models WH2300 and HP1003 as well as to the Buienradar weerstation BR-1800. The documentation was promised to be delivered with the unit but it was absent. Scanning the web did not yield immediate success but after a while I found one other amateur that used the same outdoor unit. On his web site he describes most of the soft features of the station. Upon request he sent me some more. With these I got the unit hooked to a Raspberry Pi computer using an RS485-USB stick.

The unit contains no pressure sensor, so the Raspberry Pi was equipped with a BME280 mounted on a small breakout board. The software to control the outdoor unit and the pressure sensor was – after all specifications were figured out – relatively simple. Interfacing to the USB-connector uses standard commands and the pressure sensor was interfaced using WiringPi. It is now working for a few days without problems and it is feeding Weather Underground, KNMI-WOW and maybe in the future to other organizations. The widget on the left bar should connect to the weather data.

Solar driven fan cooled thermometer

Already for some time one could notice a strong influence of sunlight on temperature readings. This is true for most “cheap” weather stations and has to do with the internal temperature of the outdoor housings used and the like. For instance, the central unit that is applied here originates from Alecto and is common to most of their current units. It consists of a Stevenson screen Lees verder Solar driven fan cooled thermometer

Interfacing to MeteoHub

Already for quite some time, the weather data from my RPi weather station are fed to Weather Underground (WU); the station name is Diamantbuurt. I am not unhappy with this service but it has its hickups from time to time. It would be nice to also feed the data to a Dutch or at least European weather service. Such a service is offered by Het Weer Actueel. In constrast to WU, it does not have a detailed web page describing how to feed the data to its service. Instead, it prefers to receive the data through standard weather logging software. One of these, MeteoHub, is running on a Raspberry Pi and my idea was to find out what it would offer.

Dowloading and installing MeteoHub on a RPi is relatively simple, the website provides ample detail. I stumbled across decoding the RAR-packed distribution. Initially, my unix-box did not want to do the job but then, after installing a later version, it did. Once an SD-card is loaded, booting goes as with normal fresh installations of other software.

Then, data from my weather station, a stand-alone, privately programmed RPi, needed to be fed to MeteoHub. I chose the option “User-defined plug in”. The manual gives quite some details on how to proceed. One should provide for a little program or script that gets the data from the weather station and shouts it to to the standard output (normally connected to a screen) in a particular format. That sounded relatively easy. To test this feature, I wrote a little C-program that reads the RPi core temperature from the operating system and shouts it to /dev/stdout, see below.

#include <stdio.h>
int main (int argc, char *argv[])
{
    FILE *temperatureFile;
    double T;
    temperatureFile = fopen 
      ("/sys/class/thermal/thermal_zone0/temp",
       "r");
    if (temperatureFile == NULL)
        return(-1);
    fscanf (temperatureFile, "%lf", &T);
    T /= 100;
    printf ("t1 %3.0f\n", T);
    fclose (temperatureFile);
return (0);
}

I put this little bit of C-code in the /home directory of the RPi and then compiled it and made it executable through

gcc -Wall -o pitmp pitemp.c
chmod +x pitemp

To run it simply type ./pitemp and the current core temperature will be printed on the screen albeit in a bit funny way but that is how MeteoHub wants it. Once one fills out in the weatherstation page of MeteoHub including the proper path to the above little program, and saves it, MeteoHub will start sampling the core temperature of its own RPi.

After this successful little exercise, interfacing my weather station to MeteoHub was peanuts. I added a routine to the software running my weather station that regularly prepares a file meteohub.dat in the /home/public_html directory of the RPi with the current weather data (I have ligttpd installed to provide web service and the like). In the MeteoHub-RPi  /home directory I added a script to download the data and to shout it to the standard output.

wget -q -O meteohub.dat 
   "http://10.0.0.22/~pi/meteohub.dat"
cat meteohub.dat

Note that 10.0.0.22 is the IP-address of my weather station and that if you use this script, your own address should replace this one. Following the documented installation process, one then obtains regular updates of weather data in MeteoHub.

Having this running for some time now, it turns out that MeteoHub is not offering a lot. It does provide for some dashboard that has the look of a screen that I would have made in the 80’s but is now way out of fashion. It does connect to other display services: WD live gives a nice looking screen but is way too crowded to my liking. Another option is Meteoware Live, but the screen is just a horrible image!

The conclusion is, that MeteoHub can provide an interface to Het Weer Actueel, I tested that too. However, the cost is steep, 59 euro only for a logging service with no reasonable display options. Apart from a RPi that one has to devote to this software as it will not run simultaneously with my private software.  One could use WD live for display on a web site, but then again one has to pay, 20 US dollar. I decided against buying.

Was the exercise for nothing then? Well, actually not because I now can find out how to produce the data file that is used by Het Weer Actueel and with this information, I could “fake” the presence of the MeteoHub software and just provide the proper data. Hence, to be continued …

It is not always what you think it is …

Last Sunday the local time changed from summer time to winter time. For the scheduler that I use in my weather station software this is a critical test. So, that morning I was watching the records sent to Weather Underground and to the log files I record myself. To my great suprise a serious hickup was signalled: temperature and pressure values about three times their normal value. Starting around 2 am and disappearing around 3 pm. After that, the station reported as if nothing had happened before.

I tried to look at the recordings in different ways but I could not find out what had gone wrong. Nothing in relation to the time change. In particular I was curious about the reason for temperature and pressure values being that high. I could not find anything peculiar and after restarting the station I left it alone. Of course more curious now to see if the hickup would repeat itself. Nothing of the kind though.

Suddenly, Wednesday morning it occurred to me that the solar radiation values remained zero: apparently these were no longer measured. There was no time to immediately take action and for the rest the weather station was working perfectly so I let be. I did realize that the sensor could have broken down and in that case I needed to replace it. Of many parts of the hardware I have a duplo but not of this one, so I ordered one. It only costs a few euros and the same amount on postage.

solar_radiometer

Friday afternoon, the new sensor arrived and there was time to take the instruments inside the house. Quickly it appeared what had happened, see photo. When I saw the device I remembered that I was worrying about the exposure to environmental conditions. It should be packed better. For the time being, I just put the new one in a little plastic bag. That should protect it for a few months. The former one survived for about half a year! Also, I noticed that the plastic lens that is put in front of the sensitive windonw (yellow on photo) was yellowing. Clearly, a better design is needed but for a while the replacement will work well. Winter time should not be too rough on the sensor albeit that temperatures might go a bit out of the acceptable range. We shall see!

RPi weather station: the construction

The original material used by Alecto was plastic and light-weight aluminium tubing of 20 mm diameter. Because I needed to mount both a wind velocity meter and a wind direction sensor, I needed some more material and I decided for the robust zinc-coated iron tubing as used for central heating systems. These come in 22 and 15 mm diameter versions with actually quite elegantly looking junctions. I chose for the main pole of the thicker diameter tubing with a parallel side branch of the thinner tubing. With this construction, I could also mount the rain gauge and the Stevenson screen which held the rest of the measurement system: temperature, pressure, humidity and solar radiation.

IMG_7710

The rain gauge is of the self-emptying tipping bucket type. Here the bucket is assumed to be measuring 0.3 mm rain per bucket. Every time a bucket is full, it empties  and causes one momentary reed contact closure which can be recorded by subsequent equipment. Lees verder RPi weather station: the construction

RPi weather station: an introduction

It all started with a surprisingly good offer from the mail order electronics shop that I frequently use. They offered an  Alecto DKW2012 wireless weather station for just about 25 euros. There was a but …  I had to spend over hundred euro. Usually  my mail orders are significantly less although I try to bundle them so that I could benefit from free postage for orders over 35 euro. But this time – I guess I ordered a gadget for my father – I did and I decided to buy the weather station.

It had been lying around for about a year before I tried it. It was working as far as I could see and nicely provided the weather information on a simple LED screen. I realized this was a relatively poor solution as I could not do anything with the information than just look at it. It would be nice to use it to control the settings for the central heating system. But then I should have access to the data. Since it was wireless there must be a possibility. I already used wireless controllers for the heat exchangers in the various rooms as well as control the lighting so why not integrate this station. Lees verder RPi weather station: an introduction