# g-raj-k/arduino-smoke-detector-monitor architecture

> Architecture diagram of the GitHub repository g-raj-k/arduino-smoke-detector-monitor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/g-raj-k/arduino-smoke-detector-monitor
- Repository: https://github.com/g-raj-k/arduino-smoke-detector-monitor

## Overview

This is a browser-based firefighter smoke-and-fire decision-support dashboard paired with Arduino Nano hardware. The main workflow is USB sensor telemetry into the browser, conversion to calibrated PPM, then presentation as tactical metrics, rolling graphs, and a color-coded 3D building view; calibration and buzzer thresholds support response. A demo simulator and configurable floorplans are also documented. The graph follows the sampled orchestrator and module references; some UI wiring and simulator integration are documented but not directly shown in the excerpts.

Main entry points: [`src/js/app.js`](https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/js/app.js) (App Orchestrator), [`src/js/calibration.js`](https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/js/calibration.js) (Calibration & Status Math), [`src/js/serialManager.js`](https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/js/serialManager.js) (Web Serial Manager), [`firmware/arduino_node/arduino_node.ino`](https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/firmware/arduino_node/arduino_node.ino) (Arduino Nano)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_delivery["Local Web App"]
  node_server["Static HTTP Server<br/>[server.js]"]
  node_dashboard["Dashboard Page<br/>[index.html]"]
  node_app["App Orchestrator<br/>[app.js]"]
  node_styles["Dashboard Styling<br/>[main.css]"]
end

subgraph group_telemetry["Telemetry &amp; Calibration"]
  node_config["Tactical Configuration<br/>[config.js]"]
  node_calibration["Calibration &amp; Status Math<br/>[calibration.js]"]
  node_serial["Web Serial Manager<br/>[serialManager.js]"]
  node_simulator["Hardware Simulator<br/>[simulator.js]"]
end

subgraph group_decision["Tactical Displays"]
  node_cards["Sensor Metrics Cards<br/>[sensorCards.js]"]
  node_graphs["Rolling Graphs<br/>[graphManager.js]"]
  node_building["3D Building Viewer<br/>[building3d.js]"]
end

subgraph group_hardware["Sensor Hardware"]
  node_arduino["Arduino Nano<br/>[arduino_node.ino]"]
  node_mq2["Dual MQ-2 Sensors"]
  node_buzzer["Piezo Buzzer"]
end

node_user(("Firefighter"))

node_user -->|"opens dashboard"| node_server
node_server -->|"serves page"| node_dashboard
node_dashboard -->|"runs application"| node_app
node_dashboard -->|"uses styling"| node_styles
node_app -->|"connects device"| node_serial
node_app -->|"converts readings"| node_calibration
node_app -->|"loads settings"| node_config
node_app -->|"updates metrics"| node_cards
node_app -->|"updates model"| node_building
node_serial -->|"delivers readings"| node_app
node_calibration -->|"uses constants"| node_config
node_cards -->|"pushes readings"| node_graphs
node_cards -->|"derives status"| node_calibration
node_graphs -->|"colors readings"| node_calibration
node_building -->|"colors sensors"| node_calibration
node_arduino -->|"streams telemetry"| node_serial
node_serial -->|"sends alarm commands"| node_arduino
node_mq2 -->|"feeds analog inputs"| node_arduino
node_arduino -->|"drives alarm"| node_buzzer
node_app -.->|"offers demo mode"| node_simulator

click node_server "https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/server.js"
click node_dashboard "https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/index.html"
click node_app "https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/js/app.js"
click node_config "https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/js/config.js"
click node_calibration "https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/js/calibration.js"
click node_serial "https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/js/serialManager.js"
click node_simulator "https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/js/simulator.js"
click node_cards "https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/js/sensorCards.js"
click node_graphs "https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/js/graphManager.js"
click node_building "https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/js/building3d.js"
click node_styles "https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/styles/main.css"
click node_arduino "https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/firmware/arduino_node/arduino_node.ino"

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_server,node_dashboard,node_app,node_styles toneBlue
class node_config,node_calibration,node_serial,node_simulator toneAmber
class node_cards,node_graphs,node_building toneMint
class node_arduino,node_mq2,node_buzzer toneRose
class node_user toneIndigo
```

## Components

### Local Web App

- [Static HTTP Server](https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/server.js): `server.js`
- [Dashboard Page](https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/index.html): `src/index.html`
- [App Orchestrator](https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/js/app.js): `src/js/app.js`
- [Dashboard Styling](https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/styles/main.css): `src/styles/main.css`

### Telemetry & Calibration

- [Tactical Configuration](https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/js/config.js): `src/js/config.js`
- [Calibration & Status Math](https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/js/calibration.js): `src/js/calibration.js`
- [Web Serial Manager](https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/js/serialManager.js): `src/js/serialManager.js`
- [Hardware Simulator](https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/js/simulator.js): `src/js/simulator.js`

### Tactical Displays

- [Sensor Metrics Cards](https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/js/sensorCards.js): `src/js/sensorCards.js`
- [Rolling Graphs](https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/js/graphManager.js): `src/js/graphManager.js`
- [3D Building Viewer](https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/src/js/building3d.js): `src/js/building3d.js`

### Sensor Hardware

- [Arduino Nano](https://github.com/g-raj-k/arduino-smoke-detector-monitor/blob/main/firmware/arduino_node/arduino_node.ino): `firmware/arduino_node/arduino_node.ino`
- **Dual MQ-2 Sensors**
- **Piezo Buzzer**

### Other components

- **Firefighter**

## Connections

- Firefighter → Static HTTP Server: opens dashboard (evidence: `README.md`)
- Static HTTP Server → Dashboard Page: serves page (evidence: `server.js`)
- Dashboard Page → App Orchestrator: runs application (evidence: `README.md`)
- Dashboard Page → Dashboard Styling: uses styling (evidence: `README.md`)
- App Orchestrator → Web Serial Manager: connects device (evidence: `src/js/app.js`)
- App Orchestrator → Calibration & Status Math: converts readings (evidence: `src/js/app.js`)
- App Orchestrator → Tactical Configuration: loads settings (evidence: `src/js/app.js`)
- App Orchestrator → Sensor Metrics Cards: updates metrics (evidence: `src/js/app.js`)
- App Orchestrator → 3D Building Viewer: updates model (evidence: `src/js/app.js`)
- Web Serial Manager → App Orchestrator: delivers readings (evidence: `README.md`)
- Calibration & Status Math → Tactical Configuration: uses constants (evidence: `src/js/calibration.js`)
- Sensor Metrics Cards → Rolling Graphs: pushes readings (evidence: `src/js/sensorCards.js`)
- Sensor Metrics Cards → Calibration & Status Math: derives status (evidence: `src/js/sensorCards.js`)
- Rolling Graphs → Calibration & Status Math: colors readings (evidence: `src/js/graphManager.js`)
- 3D Building Viewer → Calibration & Status Math: colors sensors (evidence: `src/js/building3d.js`)
- Arduino Nano → Web Serial Manager: streams telemetry (evidence: `README.md`)
- Web Serial Manager → Arduino Nano: sends alarm commands (evidence: `README.md`)
- Dual MQ-2 Sensors → Arduino Nano: feeds analog inputs (evidence: `README.md`)
- Arduino Nano → Piezo Buzzer: drives alarm (evidence: `README.md`)
- App Orchestrator → Hardware Simulator: offers demo mode (evidence: `README.md`)
