How tsjakka/weatherstation works
Project type and purpose
• This is an embedded‐firmware/IoT project: an ESP32‐based outdoor sensor unit that reads multiple meteo sensors, aggregates data, and transmits RF packets to an Alecto display. It also supports OTA updates over Wi-Fi.
File structure
• Top level:
• LICENSE, README.md, Parts List, Photos (hardware documentation)
• Source/ – all firmware code:
– WeatherStation.ino (main Arduino sketch)
– SensorBase.{cpp,h} (abstract sensor driver layer)
– RFMxx.{cpp,h} (RF transceiver driver)
– Thies.{cpp,h}, WH1080.{cpp,h} (sensor‐specific drivers)
– Board and libraries.txt, project files for Visual Studio (.sln, .vcxproj)
Extract insights from the README
• Hardware components: ESP32, BME280 (I²C), DCF1 time receiver (digital input), RFM69HW RF transceiver (SPI or bit‐banged), Thiess anemometer (pulse/interrupt), original rain gauge (pulse).
• Software features: per‐sensor readers, WMO‐compliant wind aggregation, RF packet builder, 48 s transmission interval, Wi-Fi OTA updates (requires special GPIO considerations).
Main components and their relationships
a. Hardware layer
• Power supply (230 VAC → 3.3 V regulator, optional solar input)
• ESP32 microcontroller (central host)
• BME280 (I²C bus)
• DCF1 receiver (GPIO digital input, timestamp interrupts)
• Anemometer (GPIO pulse interrupt)
• Rain meter (GPIO pulse interrupt)
• RFM69HW transceiver (SPI or bit-banged serial interface)
• Original Alecto display (receives 433 MHz RF)
b. Firmware/software layer
• Sensor drivers (SensorBase subclasses: Thies, WH1080, BME280, DCF1)
• Data aggregation module (calculates wind speed/direction statistics)
• RF packet builder (formats according to Fine Offset protocol)
• RF transmission scheduler (sends every 48 s)
• OTA update manager (Wi-Fi initialization on double reboot)
• Arduino/FreeRTOS runtime
c. External services
• Wi-Fi network + OTA update server (could be over HTTP or ArduinoOTA)
• End‐user Alecto display (receives RF)
Architectural patterns and design principles
• Layered drivers: SensorBase abstract class → concrete sensor modules
• Separation of concerns: hardware drivers vs. data processing vs. communication
• Event/interrupt‐driven inputs for pulse sensors and time receiver
• Scheduler/timer for periodic transmission
• Fail‐safe OTA: gated Wi-Fi activation to not break anemometer GPIO