# qasim9937/iot-based-hazard-detection-system architecture

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

- Interactive diagram: https://gitdiagram.com/qasim9937/iot-based-hazard-detection-system
- Repository: https://github.com/qasim9937/iot-based-hazard-detection-system

## Overview

This Arduino system monitors environmental hazards and reports sensor readings to Firebase. Its documented workflow is sensor acquisition, flame-triggered local alarm, and periodic cloud logging, with WiFi and Firebase authentication supporting remote storage. The README describes these capabilities, but no source excerpts were provided, so the sketch’s internal call structure cannot be verified; edges below reflect only documented behavior.

Main entry points: [`node.ino`](https://github.com/qasim9937/iot-based-hazard-detection-system/blob/main/node.ino) (Sensor readings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensing["Sensing"]
  node_dht["DHT11 sensor"]
  node_pir["PIR sensor"]
  node_flame["Flame sensor"]
  node_water["Water sensor"]
  node_sampling["Sensor readings<br/>[node.ino]"]
end

subgraph group_device["Device responses"]
  node_hazard["Flame detection<br/>[node.ino]"]
  node_buzzer["Buzzer alarm"]
end

subgraph group_cloud["Cloud reporting"]
  node_wifi["WiFi connection<br/>[node.ino]"]
  node_auth["Firebase authentication<br/>[node.ino]"]
  node_logging["Data logging<br/>[node.ino]"]
  node_firebase[("Firebase Realtime Database")]
end

node_dht -->|"provides readings"| node_sampling
node_pir -->|"provides readings"| node_sampling
node_flame -->|"provides readings"| node_sampling
node_water -->|"provides readings"| node_sampling
node_sampling -->|"checks flame"| node_hazard
node_hazard -->|"activates alarm"| node_buzzer
node_sampling -->|"sends readings"| node_logging
node_logging -->|"uses connection"| node_wifi
node_wifi -->|"connects for"| node_auth
node_auth -->|"authenticates"| node_firebase
node_logging -->|"uploads and retrieves"| node_firebase

click node_sampling "https://github.com/qasim9937/iot-based-hazard-detection-system/blob/main/node.ino"
click node_hazard "https://github.com/qasim9937/iot-based-hazard-detection-system/blob/main/node.ino"
click node_wifi "https://github.com/qasim9937/iot-based-hazard-detection-system/blob/main/node.ino"
click node_auth "https://github.com/qasim9937/iot-based-hazard-detection-system/blob/main/node.ino"
click node_logging "https://github.com/qasim9937/iot-based-hazard-detection-system/blob/main/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_dht,node_pir,node_flame,node_water,node_sampling toneBlue
class node_hazard,node_buzzer toneAmber
class node_wifi,node_auth,node_logging,node_firebase toneMint
```

## Components

### Sensing

- **DHT11 sensor**
- **PIR sensor**
- **Flame sensor**
- **Water sensor**
- [Sensor readings](https://github.com/qasim9937/iot-based-hazard-detection-system/blob/main/node.ino): `node.ino`

### Device responses

- [Flame detection](https://github.com/qasim9937/iot-based-hazard-detection-system/blob/main/node.ino): `node.ino`
- **Buzzer alarm**

### Cloud reporting

- [WiFi connection](https://github.com/qasim9937/iot-based-hazard-detection-system/blob/main/node.ino): `node.ino`
- [Firebase authentication](https://github.com/qasim9937/iot-based-hazard-detection-system/blob/main/node.ino): `node.ino`
- [Data logging](https://github.com/qasim9937/iot-based-hazard-detection-system/blob/main/node.ino): `node.ino`
- **Firebase Realtime Database**

## Connections

- DHT11 sensor → Sensor readings: provides readings (evidence: `README.md`)
- PIR sensor → Sensor readings: provides readings (evidence: `README.md`)
- Flame sensor → Sensor readings: provides readings (evidence: `README.md`)
- Water sensor → Sensor readings: provides readings (evidence: `README.md`)
- Sensor readings → Flame detection: checks flame (evidence: `README.md`)
- Flame detection → Buzzer alarm: activates alarm (evidence: `README.md`)
- Sensor readings → Data logging: sends readings (evidence: `README.md`)
- Data logging → WiFi connection: uses connection (evidence: `README.md`)
- WiFi connection → Firebase authentication: connects for (evidence: `README.md`)
- Firebase authentication → Firebase Realtime Database: authenticates (evidence: `README.md`)
- Data logging → Firebase Realtime Database: uploads and retrieves (evidence: `README.md`)
