How kolbacer/smart-sauna-iot-project works
Project type and purpose
• This is a full‑stack IoT demo (“Smart Sauna”) showcasing end‑to‑end data flow from hardware sensors to a mobile UI.
• Key parts: NodeMCU ESP8266 microcontroller with temperature/humidity sensors, an MQTT‐based Gateway (Mosquitto broker + Node.js server), and a Flutter mobile app for configuration and monitoring.
File structure
• Top level:
• NodeMCU/ – Arduino sketch for the ESP8266 device
• gateway/ – Docker Compose definition, Mosquitto config under gateway/mosquitto, Node.js server under gateway/server
• flutter_app/ – Flutter cross‑platform application with data providers, models, UI pages
• Recognize patterns:
• Pub/Sub messaging (MQTT) between device and broker
• REST + SSE API between server and mobile
• Docker Compose for microservice orchestration
README for additional insights
• Hardware list and wiring (NodeMCU sketch variables: ssid, password, mqtt_server)
• Gateway exposes HTTP endpoints for configuration (GET /getconfig, POST /setconfig) and monitoring via Server‑Sent Events (GET /monitoring)
• Flutter app pages for connection, configuration, and statistics
a. Main components
• IoT Device (NodeMCU + DHT11, TMP36 sensors + LEDs/relays)
• MQTT Broker (Mosquitto container)
• Node.js Gateway Server (broker.js, server.js container)
• Flutter Mobile App (UI, REST client, SSE client)
• (Optionally) External MQTT Broker if configured
b. Relationships & interactions
1. Sensors → NodeMCU gathers readings → publishes MQTT topics (e.g. “sauna/temp”, “pool/temp”)
2. Node.js server subscribes to those topics, stores or forwards readings
3. Flutter app calls REST endpoints on Node.js server to get/set configuration
4. Flutter app opens SSE stream to receive live sensor updates
5. NodeMCU also subscribes to configuration topics (for target temperature/hysteresis)
c. Architectural patterns & design principles
• Pub/Sub messaging decouples device and server
• RESTful API + SSE for client‑server communication
• Containerized deployment with Docker Compose (broker + server)
• Single‑page mobile client with clearly separated data providers, models, and UI layers
d. Key technologies
• NodeMCU ESP8266 C++ (Arduino)
• MQTT (Mosquitto)
• Node.js + Express (server.js, broker.js)
• Docker & Docker Compose
• Flutter (Dart) with HTTP, SSE, state management
• JSON for payloads