Categorie archief: Weather station

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