How rakiz/rzdomo works
Project type and purpose
• Embedded IoT firmware for microcontrollers (ESP8266/ESP32 via PlatformIO).
• Gathers multiple calibrated sensor readings (pool temperature, pH, UV, greenhouse, hive, etc.).
• Hosts a built-in HTTP server serving static UI (HTML/JS) for live data graphs and calibration screens.
File structure
• platformio.ini & CMakeLists.txt → build & deployment scripts targeting MCU.
• src/
– main.cpp, RzLoop.h → primary control loop.
– RzFiles.* → file‐system abstraction (SPIFFS/LittleFS) for serving data/config pages.
– network/ → Wi-Fi (RzWifi), time sync (RzTime), HTTP server (RzServer).
– sensors/ → generic metrics (RzMetric), specific drivers (RzTemperature, etc.).
– tools/ → data‐processing utilities (MultiSampling, LinearCorrection).
• data/ → static assets (config.html/js, index.html/js) to be uploaded into embedded FS.
Key README insights
• Project started for pool temp, evolved to multi‐sensor IoT platform.
• Automatic configuration screens generated per available sensors.
• Aims to standardize IoT boilerplate.
Main components & interactions
a. Hardware & Sensors
– Microcontroller (ESPxx)
– External sensors (temperature, pH, UV, turbidity, etc.)
b. Firmware modules
– RzLoop (core event loop)
– Sensors layer → RzMetric + sensor drivers → raw data
– Tools layer → sampling, calibration → processed readings
– Files layer → embedded FS for static content & config persistence
– Network layer → RzWifi (Wi-Fi/AP mode), RzTime (NTP), RzServer (HTTP)
c. Client UI
– Browser on smartphone/PC connecting via Wi-Fi AP or station mode
– Serves index.html/js for real-time curves and config.html/js for settings
Architectural patterns & principles
• Layered architecture:
– Hardware abstraction (sensor drivers)
– Utility services (sampling, correction)
– Persistence (file system)
– Network/API (HTTP server)
– Presentation (static web assets)
• Modular design via separate directories (sensors, tools, network)
• Event‐driven loop for periodic sampling & serving requests
– Hardware: Microcontroller + sensor connectors
– Sensors Module (RzMetric + specific drivers)
– Processing Module (MultiSampling, LinearCorrection)
– File System Module (RzFiles + data/ assets)
– Network Module (Wi-Fi, Time sync, HTTP Server)
– Main Loop (event dispatcher)
– Sensors → Processing → File System (optional logging)
– Processing → Served in HTTP responses → Client
– Blue for hardware/sensors
– Green for firmware modules
– Orange for external systems (Client, NTP)