Raspberry Pi Weather Station Features Wireless Sensor Nodes
Online weather services are great for providing generic area forecasts, but they don’t provide hyperlocal data specific to your location. Harald Kreuzer needed both and built a Raspberry Pi Weather Station that provides weather forecasts for the next 7 days as well as readings from local sensors. The project is completely open source and based on a Raspberry Pi base station which connects to ESP32 based sensor nodes and online services to nicely present the data on a 7″ touch screen display.
The architecture is quite straightforward. The ESP32 based sensor nodes publish their readings to an MQTT broker running on the Raspberry Pi. The Pi subscribes to these sensor node topics to pick up the relevant sensor data. This makes it easy to add additional sensor nodes in future. Weather forecast data is collected by connecting to the OpenWeatherMap API. All of the collected information is then displayed through an app built using the Kivy. Open source Python app development framework.
The hardware
The base station hardware is simple and housed in an elegant 3D printed enclosure supported on a 3D printed base support. The remote sensor node electronics are a little bit more involved. Harald’s design uses a simple custom PCB which is basically a carrier board for mounting the ESP32. A two way DIP switch for sensor node address setting. A voltage divider to measure battery voltage. A BME280 sensor that provides temperature, humidity and atmospheric pressure readings. And a TP4056 based battery charger for the 18650 lithium ion battery. The battery is charged via a solar cell that forms the top cover of the sensor node enclosure.
Remote sensor applications such as these work well when the battery life can be extended as long as possible. And this requires lowering power consumption to the bare minimum. Harald selects an ESP32 board with a low quiescent current voltage regulator. This results in about 20uA current drawn during deep sleep periods of 10 minutes. And 200mA over a 10s period for connecting to WiFi and transmitting the data. He reckons this will give him about a 25 day window before the battery loses charge. Hopefully, he will get enough hours of sunshine during the winter months to keep the battery topped up.
There are several bits of software that need to work in unison to make the weather station tick. And Harald walks us through the installation and configuration of each part in detail. From setting up the OS on the Raspberry Pi and the Kivy. Framework in which the weather station app is coded, to setting up the OpenWeather API, the Mosquitto MQTT broker. And flashing the code on the ESP32 sensor nodes. Harald has shared all the details for the hardware and software components of the weather station on Github repositories, making it easy to replicate his efforts.
Read More: Raspberry Pi Weather Station Features Wireless Sensor Nodes – Hackaday