Into the Weather – Part 2 – Fun with Raspberry Pi

This is a follow-up to “Into the Weather – Part 1 – Exploring weewx” . Sorry, still almost no geospatial content for now. To recap: I am trying to setup an infrastructure where measurements from a Davis Vantage Pro2 Weather Station are collected and exposed to web services, most notably OGC Services like WMS-Time and SOS, the Sensor Observation Service . The TLDR; /impatient can view results at , sources in the GitHub project and in general the documentation .

As this setup needs to be run from within my client’s local intranet with available servers “in the Cloud” there is a need for a “relaying middleman”.

The Raspberry Pi (RPi) was my first choice. The RPi is a credit-card sized computer that can run Linux-es like Raspbian , a Linux OS based on Debian . As the Davis weather station console has a USB-interface and weewx supports read-outs from Davis weather stations, choosing the RPi was obvious. The combination RPi, Raspbian, weewx (try this Google search ) is becoming more and more popular for setting up public and community-based weather stations.

By now it is time to depict the overall architecture as in the image below.

The Davis weather station will connect via USB to the RPi. The RPi will run weewx to gather and store weather data (in a SQLite DB) from the weather station. In addition the RPi will run ETL software based on Stetl to publish weather data to a PostgreSQL/PostGIS database in a cloud server. Using Geoserver and the 52North SOS the cloud server will expose the weather data via web services like WMS (Time), WFS and SOS and plain HTML using custom weather web templates like the fabulous steelseries gauges . I will expand on the software setup in the next post.

For now I will focus on acquiring and setting up the RPi, as this was a fun-exercise by itself. I ordered a kit with a Raspberry Pi Model B+ with power unit, casing, micro SD and WIFI USB adapter (WiPi ) at Kiwi Electronics . The whole package arrived the next day.

From unboxing to having everything installed with the weewx Simulator (see Part 1) went smooth. It would take too far to describe all the install steps and gotcha’s. I’ve summarized these here in the RPi installation doc . Apart from a standard Raspbian install, I paid in particular attention to two aspects:

  • running unattended as a headless server, i.e. monitoring and self-healing
  • having SSH access outside the LAN via reverse SSH-tunneling

Monitoring and self-healing are non-neglectable aspects, in particular the weewx server may go down for some reason, as well as the WIFI network and any of the SSH-tunnels. These aspects are described in the documentation .

All in all this step was to get weewx running, still in simulator mode, storing raw weather data in a SQLite database and publishing HTML reports.

So the final result is an RPi humming silently, weewx reporting regularly. In general having a stable system for the next steps: gathering and publishing the weather data to the OGC services like WMS, WFS and SOS. The Python-based Stetl framework , again proved to be instrumental to this effort, both on the RPi and on the Linux server in the Cloud. This will be a subject for my next post. See the architecture below.

Summarizing: A Stetl process (Stetl sync ) continuously gathers and publishes weather data to a remote PostgreSQL/PostGIS server. Through PostgreSQL-VIEWs refined weather data is immediately available to GeoServer as WMS(Time) and WFS sources, and via another Stetl process (Stetl SOS ) published via SOS-T (ala WFS-T) to the SOS. The weewx engine has a plugin to publish a flat HTML website via rsync using configurable templates.

There is much to expand still. I’m excited to see this whole infrastructure work in such a short time thanks to all these developers that produce all of the Open Source software involved here: from the core Debian/Raspbian OSs, the weewx weather software, PostgreSQL/PostGIS, GeoServer and the 52North SOS. The proverbial sentence is: I am just standing on the shoulders of you giants. This is the way humanity should evolve regarding soft/hardware-technology. Thanks again, and if you have read this far, I hope to see you in my next post !