# siradio7/iot architecture

> Architecture diagram of the GitHub repository siradio7/iot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/siradio7/iot
- Repository: https://github.com/siradio7/iot

## Overview

This is an ESP32 temperature-control and monitoring project. Its main workflow is: firmware samples temperature and light, applies regulation and fire-detection logic, drives actuators, and emits JSON; a serial/TCP bridge carries status to a Node-RED dashboard, which can send threshold changes back to the ESP32. The graph also preserves the separate JSON validator and firmware Wi-Fi and LittleFS utilities. Firmware orchestration and Node-RED flow details were not sampled, so those links rely on README documentation; unsampled internals are not inferred.

Main entry points: [`iot.ino`](https://github.com/siradio7/iot/blob/master/iot.ino) (Firmware loop), [`sensor_service.cpp`](https://github.com/siradio7/iot/blob/master/sensor_service.cpp) (Sensing and regulation), [`esp32-bridge/bridge.js`](https://github.com/siradio7/iot/blob/master/esp32-bridge/bridge.js) (Serial TCP bridge), [`command.cpp`](https://github.com/siradio7/iot/blob/master/command.cpp) (Serial commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_firmware["ESP32 firmware"]
  node_firmware_loop["Firmware loop<br/>[iot.ino]"]
  node_temperature["Temperature sensor"]
  node_light["Light sensor<br/>[light_sensor.cpp]"]
  node_service["Sensing and regulation<br/>[sensor_service.cpp]"]
  node_commands["Serial commands<br/>[command.cpp]"]
  node_json["Status JSON<br/>[make_json.cpp]"]
  node_fan["Fan control<br/>[fan.cpp]"]
  node_led["Indicator LEDs<br/>[led.cpp]"]
  node_strip["LED strip<br/>[led_strip.cpp]"]
  node_fire_alert["Fire alert<br/>[iot.ino]"]
end

subgraph group_dashboard["Bridge and dashboard"]
  node_bridge["Serial TCP bridge<br/>[bridge.js]"]
  node_flows["Node-RED dashboard<br/>[flows.json]"]
end

subgraph group_utilities["Firmware utilities"]
  node_wifi["Wi-Fi utilities<br/>[wifi_utils.cpp]"]
  node_filesystem["LittleFS utilities<br/>[littlefs_utils.cpp]"]
end

subgraph group_validation["JSON validation"]
  node_validator_cli["Validation CLI<br/>[validate.js]"]
  node_validator["JSON validator<br/>[validator.js]"]
  node_schema["JSON schema<br/>[schema.json]"]
end

node_user(("Dashboard user"))

node_firmware_loop -->|"reads and decides"| node_service
node_service -->|"reads"| node_temperature
node_service -->|"reads"| node_light
node_firmware_loop -->|"processes commands"| node_commands
node_commands -->|"sets thresholds"| node_service
node_firmware_loop -->|"builds status"| node_json
node_firmware_loop -->|"drives"| node_fan
node_firmware_loop -->|"drives"| node_led
node_firmware_loop -->|"sets color"| node_strip
node_firmware_loop -->|"signals fire"| node_fire_alert
node_firmware_loop -->|"sends serial status"| node_bridge
node_bridge -->|"forwards TCP status"| node_flows
node_user -->|"views and changes"| node_flows
node_flows -->|"sends thresholds"| node_bridge
node_bridge -->|"sends serial commands"| node_commands
node_validator_cli -->|"validates with"| node_validator
node_validator -->|"checks against"| node_schema

click node_firmware_loop "https://github.com/siradio7/iot/blob/master/iot.ino"
click node_temperature "https://github.com/siradio7/iot/blob/master/temperature_sensor.cpp"
click node_light "https://github.com/siradio7/iot/blob/master/light_sensor.cpp"
click node_service "https://github.com/siradio7/iot/blob/master/sensor_service.cpp"
click node_commands "https://github.com/siradio7/iot/blob/master/command.cpp"
click node_json "https://github.com/siradio7/iot/blob/master/make_json.cpp"
click node_fan "https://github.com/siradio7/iot/blob/master/fan.cpp"
click node_led "https://github.com/siradio7/iot/blob/master/led.cpp"
click node_strip "https://github.com/siradio7/iot/blob/master/led_strip.cpp"
click node_fire_alert "https://github.com/siradio7/iot/blob/master/iot.ino"
click node_bridge "https://github.com/siradio7/iot/blob/master/esp32-bridge/bridge.js"
click node_flows "https://github.com/siradio7/iot/blob/master/nodered/data/flows.json"
click node_wifi "https://github.com/siradio7/iot/blob/master/wifi_utils.cpp"
click node_filesystem "https://github.com/siradio7/iot/blob/master/littlefs_utils.cpp"
click node_validator_cli "https://github.com/siradio7/iot/blob/master/validator/validate.js"
click node_validator "https://github.com/siradio7/iot/blob/master/validator/validator.js"
click node_schema "https://github.com/siradio7/iot/blob/master/validator/schema.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_firmware_loop,node_temperature,node_light,node_service,node_commands,node_json,node_fan,node_led,node_strip,node_fire_alert,node_user toneBlue
class node_bridge,node_flows toneAmber
class node_wifi,node_filesystem toneMint
class node_validator_cli,node_validator,node_schema toneRose
```

## Components

### ESP32 firmware

- [Firmware loop](https://github.com/siradio7/iot/blob/master/iot.ino): `iot.ino`
- [Temperature sensor](https://github.com/siradio7/iot/blob/master/temperature_sensor.cpp): `temperature_sensor.cpp`
- [Light sensor](https://github.com/siradio7/iot/blob/master/light_sensor.cpp): `light_sensor.cpp`
- [Sensing and regulation](https://github.com/siradio7/iot/blob/master/sensor_service.cpp): `sensor_service.cpp`
- [Serial commands](https://github.com/siradio7/iot/blob/master/command.cpp): `command.cpp`
- [Status JSON](https://github.com/siradio7/iot/blob/master/make_json.cpp): `make_json.cpp`
- [Fan control](https://github.com/siradio7/iot/blob/master/fan.cpp): `fan.cpp`
- [Indicator LEDs](https://github.com/siradio7/iot/blob/master/led.cpp): `led.cpp`
- [LED strip](https://github.com/siradio7/iot/blob/master/led_strip.cpp): `led_strip.cpp`
- [Fire alert](https://github.com/siradio7/iot/blob/master/iot.ino): `iot.ino`

### Bridge and dashboard

- [Serial TCP bridge](https://github.com/siradio7/iot/blob/master/esp32-bridge/bridge.js): `esp32-bridge/bridge.js`
- [Node-RED dashboard](https://github.com/siradio7/iot/blob/master/nodered/data/flows.json): `nodered/data/flows.json`

### Firmware utilities

- [Wi-Fi utilities](https://github.com/siradio7/iot/blob/master/wifi_utils.cpp): `wifi_utils.cpp`
- [LittleFS utilities](https://github.com/siradio7/iot/blob/master/littlefs_utils.cpp): `littlefs_utils.cpp`

### JSON validation

- [Validation CLI](https://github.com/siradio7/iot/blob/master/validator/validate.js): `validator/validate.js`
- [JSON validator](https://github.com/siradio7/iot/blob/master/validator/validator.js): `validator/validator.js`
- [JSON schema](https://github.com/siradio7/iot/blob/master/validator/schema.json): `validator/schema.json`

### Other components

- **Dashboard user**

## Connections

- Firmware loop → Sensing and regulation: reads and decides (evidence: `README.md`)
- Sensing and regulation → Temperature sensor: reads (evidence: `sensor_service.cpp`)
- Sensing and regulation → Light sensor: reads (evidence: `sensor_service.cpp`)
- Firmware loop → Serial commands: processes commands (evidence: `README.md`)
- Serial commands → Sensing and regulation: sets thresholds (evidence: `command.cpp`)
- Firmware loop → Status JSON: builds status (evidence: `README.md`)
- Firmware loop → Fan control: drives (evidence: `README.md`)
- Firmware loop → Indicator LEDs: drives (evidence: `README.md`)
- Firmware loop → LED strip: sets color (evidence: `README.md`)
- Firmware loop → Fire alert: signals fire (evidence: `README.md`)
- Firmware loop → Serial TCP bridge: sends serial status (evidence: `README.md`)
- Serial TCP bridge → Node-RED dashboard: forwards TCP status (evidence: `README.md`)
- Dashboard user → Node-RED dashboard: views and changes (evidence: `README.md`)
- Node-RED dashboard → Serial TCP bridge: sends thresholds (evidence: `README.md`)
- Serial TCP bridge → Serial commands: sends serial commands (evidence: `README.md`)
- Validation CLI → JSON validator: validates with (evidence: `validator/validate.js`)
- JSON validator → JSON schema: checks against (evidence: `validator/validator.js`)
