# mrqhere/restroom-intelligence architecture

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

- Interactive diagram: https://gitdiagram.com/mrqhere/restroom-intelligence
- Repository: https://github.com/mrqhere/restroom-intelligence

## Overview

Restroom Intelligence pairs an Arduino UNO sensor controller with an ESP8266 gateway. Sensor telemetry crosses a CRC-8 UART link; the gateway maintains rolling buckets, logs CSV data to MicroSD, and serves an offline dashboard for cleanliness status, trends, controls, calibration, verification, and hygiene insights. The tree contains firmware and a documentation page, but no clearly identified dashboard application source, so the UI node points to the available page and its detailed capabilities are based on README documentation. Relationships below are documented in the README; firmware internals were not sampled.

Main entry points: [`docs/index.html`](https://github.com/mrqhere/restroom-intelligence/blob/main/docs/index.html) (Offline dashboard), [`firmware/nodemcu_esp8266/Restroom_Intelligence_NodeMCU_FIXED_v3.ino`](https://github.com/mrqhere/restroom-intelligence/blob/main/firmware/nodemcu_esp8266/Restroom_Intelligence_NodeMCU_FIXED_v3.ino) (ESP8266 gateway), [`firmware/arduino_uno/Restroom_Intelligence_ATmega328.ino`](https://github.com/mrqhere/restroom-intelligence/blob/main/firmware/arduino_uno/Restroom_Intelligence_ATmega328.ino) (UNO sensor controller), [`data/restroom_data_last.csv`](https://github.com/mrqhere/restroom-intelligence/blob/main/data/restroom_data_last.csv) (Sample CSV datasets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensing["Sensing and Control"]
  node_sensors["Restroom sensors"]
  node_uno["UNO sensor controller"]
  node_uart["CRC-8 UART telemetry"]
end

subgraph group_gateway["Edge Gateway"]
  node_esp["ESP8266 gateway"]
  node_buckets[("Rolling buckets")]
  node_hygiene["Hygiene analytics"]
  node_wifi["Wi-Fi access point"]
end

subgraph group_persistence["Local Data"]
  node_sd[("MicroSD CSV logs")]
  node_samples["Sample CSV datasets"]
end

subgraph group_experience["Dashboard Experience"]
  node_dashboard["Offline dashboard<br/>[index.html]"]
  node_home["Status and controls<br/>[index.html]"]
  node_insights["Insights and reports<br/>[index.html]"]
  node_calibration["Calibration and checks<br/>[index.html]"]
end

node_operator(("Facility operator"))

node_sensors -->|"provide readings"| node_uno
node_uno -->|"sends telemetry"| node_uart
node_uart -->|"transfers readings"| node_esp
node_esp -->|"maintains buckets"| node_buckets
node_esp -->|"logs CSV"| node_sd
node_buckets -->|"supports analysis"| node_hygiene
node_operator -->|"joins network"| node_wifi
node_wifi -->|"serves interface"| node_dashboard
node_dashboard -->|"shows status"| node_home
node_dashboard -->|"presents analysis"| node_insights
node_dashboard -->|"guides checks"| node_calibration
node_sd -->|"supplies logged data"| node_insights
node_sd -->|"uses CSV format"| node_samples

click node_uno "https://github.com/mrqhere/restroom-intelligence/blob/main/firmware/arduino_uno/Restroom_Intelligence_ATmega328.ino"
click node_uart "https://github.com/mrqhere/restroom-intelligence/blob/main/firmware/arduino_uno/Restroom_Intelligence_ATmega328.ino"
click node_esp "https://github.com/mrqhere/restroom-intelligence/blob/main/firmware/nodemcu_esp8266/Restroom_Intelligence_NodeMCU_FIXED_v3.ino"
click node_buckets "https://github.com/mrqhere/restroom-intelligence/blob/main/firmware/nodemcu_esp8266/Restroom_Intelligence_NodeMCU_FIXED_v3.ino"
click node_hygiene "https://github.com/mrqhere/restroom-intelligence/blob/main/firmware/nodemcu_esp8266/Restroom_Intelligence_NodeMCU_FIXED_v3.ino"
click node_wifi "https://github.com/mrqhere/restroom-intelligence/blob/main/firmware/nodemcu_esp8266/Restroom_Intelligence_NodeMCU_FIXED_v3.ino"
click node_sd "https://github.com/mrqhere/restroom-intelligence/blob/main/firmware/nodemcu_esp8266/Restroom_Intelligence_NodeMCU_FIXED_v3.ino"
click node_samples "https://github.com/mrqhere/restroom-intelligence/blob/main/data/restroom_data_last.csv"
click node_dashboard "https://github.com/mrqhere/restroom-intelligence/blob/main/docs/index.html"
click node_home "https://github.com/mrqhere/restroom-intelligence/blob/main/docs/index.html"
click node_insights "https://github.com/mrqhere/restroom-intelligence/blob/main/docs/index.html"
click node_calibration "https://github.com/mrqhere/restroom-intelligence/blob/main/docs/index.html"

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_sensors,node_uno,node_uart toneBlue
class node_esp,node_buckets,node_hygiene,node_wifi toneAmber
class node_sd,node_samples toneMint
class node_dashboard,node_home,node_insights,node_calibration toneRose
class node_operator toneIndigo
```

## Components

### Sensing and Control

- **Restroom sensors**
- [UNO sensor controller](https://github.com/mrqhere/restroom-intelligence/blob/main/firmware/arduino_uno/Restroom_Intelligence_ATmega328.ino): `firmware/arduino_uno/Restroom_Intelligence_ATmega328.ino`
- [CRC-8 UART telemetry](https://github.com/mrqhere/restroom-intelligence/blob/main/firmware/arduino_uno/Restroom_Intelligence_ATmega328.ino): `firmware/arduino_uno/Restroom_Intelligence_ATmega328.ino`

### Edge Gateway

- [ESP8266 gateway](https://github.com/mrqhere/restroom-intelligence/blob/main/firmware/nodemcu_esp8266/Restroom_Intelligence_NodeMCU_FIXED_v3.ino): `firmware/nodemcu_esp8266/Restroom_Intelligence_NodeMCU_FIXED_v3.ino`
- [Rolling buckets](https://github.com/mrqhere/restroom-intelligence/blob/main/firmware/nodemcu_esp8266/Restroom_Intelligence_NodeMCU_FIXED_v3.ino): `firmware/nodemcu_esp8266/Restroom_Intelligence_NodeMCU_FIXED_v3.ino`
- [Hygiene analytics](https://github.com/mrqhere/restroom-intelligence/blob/main/firmware/nodemcu_esp8266/Restroom_Intelligence_NodeMCU_FIXED_v3.ino): `firmware/nodemcu_esp8266/Restroom_Intelligence_NodeMCU_FIXED_v3.ino`
- [Wi-Fi access point](https://github.com/mrqhere/restroom-intelligence/blob/main/firmware/nodemcu_esp8266/Restroom_Intelligence_NodeMCU_FIXED_v3.ino): `firmware/nodemcu_esp8266/Restroom_Intelligence_NodeMCU_FIXED_v3.ino`

### Local Data

- [MicroSD CSV logs](https://github.com/mrqhere/restroom-intelligence/blob/main/firmware/nodemcu_esp8266/Restroom_Intelligence_NodeMCU_FIXED_v3.ino): `firmware/nodemcu_esp8266/Restroom_Intelligence_NodeMCU_FIXED_v3.ino`
- [Sample CSV datasets](https://github.com/mrqhere/restroom-intelligence/blob/main/data/restroom_data_last.csv): `data/restroom_data_last.csv`

### Dashboard Experience

- [Offline dashboard](https://github.com/mrqhere/restroom-intelligence/blob/main/docs/index.html): `docs/index.html`
- [Status and controls](https://github.com/mrqhere/restroom-intelligence/blob/main/docs/index.html): `docs/index.html`
- [Insights and reports](https://github.com/mrqhere/restroom-intelligence/blob/main/docs/index.html): `docs/index.html`
- [Calibration and checks](https://github.com/mrqhere/restroom-intelligence/blob/main/docs/index.html): `docs/index.html`

### Other components

- **Facility operator**

## Connections

- Restroom sensors → UNO sensor controller: provide readings (evidence: `README.md`)
- UNO sensor controller → CRC-8 UART telemetry: sends telemetry (evidence: `README.md`)
- CRC-8 UART telemetry → ESP8266 gateway: transfers readings (evidence: `README.md`)
- ESP8266 gateway → Rolling buckets: maintains buckets (evidence: `README.md`)
- ESP8266 gateway → MicroSD CSV logs: logs CSV (evidence: `README.md`)
- Rolling buckets → Hygiene analytics: supports analysis (evidence: `README.md`)
- Facility operator → Wi-Fi access point: joins network (evidence: `README.md`)
- Wi-Fi access point → Offline dashboard: serves interface (evidence: `README.md`)
- Offline dashboard → Status and controls: shows status (evidence: `README.md`)
- Offline dashboard → Insights and reports: presents analysis (evidence: `README.md`)
- Offline dashboard → Calibration and checks: guides checks (evidence: `README.md`)
- MicroSD CSV logs → Insights and reports: supplies logged data (evidence: `README.md`)
- MicroSD CSV logs → Sample CSV datasets: uses CSV format (evidence: `README.md`)
