/balena-weather

Balena weather station

Primary LanguagePythonMIT LicenseMIT

Balena Weather

A weather station based on the Raspberry Pi project Build your own weather station, implemented as a Balena multi container application.

Grafana Dash

Raspberry Pi 3 Weather station
Raspberry Pi 3 Weather Station

Hardware

Components

The application is built using the following container and sensors:

Sensor containers

  • Anemometer - Anemometer (wind speed) sensor of the weather station.
  • Humidity - Humidity and temperature sensor SHT-30.
  • Raingauge - Raingauge sensor of the weather station.
  • Temperature - Additional DS18B20 temperature sensor.
  • Windvane - Windvane sensor of the weather station.

Message queue and database

  • Mqtt - Eclipse Mosquitto container which acts as message broker to which all sensors are sending their data. The Telegraf container reads from the Mosquitto queue and pushes the metrics into InfluxDB.
  • Telegraf - Part of the TIG stack to consume and display sensor data.
  • InfluxDB - Time series database storing the sensor data. This is the storage component of the TIG stack. It uses a default InfluxDB DockerHub image.

UI and API

  • NGINX
  • API - the simplest of all containers in the weather applications. A Ruby based Sinatra used for exposing REST APIs for the weather app. Also,one of the simplest Balena containers, since there is no sensor and no special configuration.
  • Grafana Dashboard - the Grafana dashboard displaying all weather data.

Wiring

The wiring of the main components of the weather station (anemometer, windvane and raingauge) is as per Build your own weather station.

Development

InfluxDB

In order to inspect or modify the data stored in the Influx database you can connect directly to the influxdb container and start the influx CLI:

$ balena ssh <app-name> influxdb
? Select a device amazing-smoke (a36de3)
root@265d8274d16b:/# influx
Connected to http://localhost:8086 version 1.8.0
InfluxDB shell version: 1.8.0

In order to get human-readable dates use the precision rfc3339 command:

> precision rfc3339
> use weather
Using database weather
> show measurements
name: measurements
name
----
humidity
rain
temperature
water-temperature
wind-direction
wind-speed

To select the entries of a measurement:

> SELECT * FROM "water-temperature"
2021-06-18T06:05:05Z DS18B20       22.0625            sensors
...

To delete entries from a measurement use te DROP SERIES query:

> DROP SERIES FROM "water-temperature"

Misc

Powering via 5V rail

Other