Weather monitor
The basic idea of the weathermon project is to obtain, record and monitor the weather at my home. All weather data sent from wireless sensors is to be stored in a database, from which different graphs are generated that can be monitored on a PC, over the Internet and on a smartphone.
Contents
System Overview
- Weather data is measured by sensors outside and inside the house. These sensors transmit all measured values via radio link.
- Transmitted values are received by a weather station and displayed for convenience.
- Transmitted values are also received by a small USB device which sends them to the PC connected.
- The PC reads received measurements and stores them in a database.
- From this database a web server serves all measurements to clients for display.
Sensors
The sensors and the weather station come as a set from ELV:
- Outdoor sensor: ELV Funk-Kombi-Wettersensor KS300-2
- Indoor sensor: Funk-Temperatur-/Luftfeuchteaußensensor S300 TH
- Weather station: WS300
Receiver
For receiving the 868,35 MHz signals the following device from ELV is used:
Database
Data from weather sensors is stored in a Round Robin Database (RRDB) at different resolutions. This means, while high-resolution data is stored for the last 90 days, it also gets accumulated into daily data which is then kept for 10 years.
The database used is called RRDtool by Tobi Oetiker. It handles storing data at fixed intervals while updates come randomly, accumulating data and creating graphs. The latter is not used, instead a browser-based charting API is used to create dynamic charts.
Server
The server's job is to run the database and web server, so that clients can connect with a browser and retrieve and display all weather data.
- The server is a standard Linux PC, but not a common desktop machine. Instead, a Raspberry PI is used.
- The server runs an Apache Tomcat web server.
Interfaces
Protocol between Receiver and Server
Protocol between Server and Clients
- REST with JSON
Software Components
Filling Database
Serial data coming from the receiver must be interpreted and then stored into the database.
REST Server
The web server implements a REST service which clients use to query data from the database. It is implemented in Java and uses the Jersey framework.
For fetching data from the database I decided to use the java-rrd library. In contrast to other Java implementations for interfacing an rrdtool database, this has the following advantages:
- It uses rrdtool itself, so it is 100% compatible with the database file format. Other implementations re-implement rrdtool but use a slightly different file format. As I use the original rrdtool to enter data into the database, the Java components must be compatible with it.
- It doesn't use JNI framework, which would cause the software to be not platform-independent any more. As I develop under Windows but run the server with Linux, this was no option either.
The java-rrd library is written by Peter Stamfest. The original announcement can be found here:
Very helpful is the brief introduction my Manuel Aldana: