# ahmed-saad-fayed/fire-control-system architecture

> Architecture diagram of the GitHub repository ahmed-saad-fayed/fire-control-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ahmed-saad-fayed/fire-control-system
- Repository: https://github.com/ahmed-saad-fayed/fire-control-system

## Overview

##### Project Type and Purpose
- Project Type: Embedded sensor-based safety system built around an Arduino Nano.
- Purpose: Continuously monitor ambient temperature via an NTC thermistor, classify temperature into three states (Normal, Warning, Critical), and drive real-time visual/audible alerts through an LCD, buzzer, and LED.

##### Main Components
a. Inputs (Sensors & User Controls)
– NTC Thermistor (voltage divider circuit)
– Potentiometer (LCD contrast adjustment)
b. Processing Unit
– Arduino Nano microcontroller (ATmega328P)
– Firmware (Fire Control System.ino) implementing
- ADC sampling
- Temperature conversion
- State machine (Normal, Warning, Critical)
c. Outputs (Actuators & Displays)
– 16×2 LCD Display
– Buzzer
– Red LED
d. Power & Wiring
– 5 V USB power or external supply
– Common GND rail on breadboard
– Jumper wires and resistors for voltage divider and current limit

##### Relationships & Data Flows
- Thermistor → Voltage Divider → Arduino A0 (analog reading)
- Arduino reads analog value → computes °C → evaluates thresholds →
– Normal: update LCD with temperature
– Warning: update LCD with warning text + buzzer beeps
– Critical: update LCD with urgent text + continuous buzzer tone + LED ON
- Potentiometer → Arduino → adjusts LCD contrast (optional analog input)

##### Architectural Patterns & Design Principles
– Simple real-time loop with blocking/non-blocking delays
– Threshold-based state machine for three discrete modes
– Separation of concerns:
- Sensor acquisition
- Data processing & decision logic
- Actuator/display control
– Modular code organization in the .ino file: setup(), loop(), helper functions

##### Final Checklist
– [ ] Clear, descriptive labels (component names, pin numbers).
– [ ] Annotations for threshold logic and voltage divider.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Sensors
    NTC["NTC Thermistor\n(Voltage Divider)"]:::input
    Pot["Potentiometer\n(LCD Contrast)"]:::input

    %% Processing Unit
    subgraph "Processing Unit"
        ArduinoBlock["Arduino Nano\n(ATmega328P)"]:::process
        FW["Firmware\nFire Control System.ino"]:::process
    end

    %% Outputs
    LCD["16×2 LCD\n(I²C Data)"]:::output
    Buzzer["Buzzer\n(D2)"]:::output
    LED["Red LED\n(D3)"]:::output

    %% Power Rails
    V5["5V Power Rail"]:::power
    GND["GND Rail"]:::power

    %% Documentation
    subgraph "Documentation"
        README["Project Docs\nREADME.md"]:::doc
        Report["Detailed Report\nReport.pdf"]:::doc
        Video["Demo Video\nFire Control System.mp4"]:::doc
    end

    %% Connections: Sensors to Arduino
    NTC -->|"A0" | ArduinoBlock
    Pot -->|"A1" | ArduinoBlock

    %% Processing internal
    ArduinoBlock --> FW

    %% Arduino to Outputs
    ArduinoBlock -->|"I2C SCL/SDA"| LCD
    ArduinoBlock -->|"D2"| Buzzer
    ArduinoBlock -->|"D3"| LED

    %% Power distribution
    V5 --> NTC
    V5 --> Pot
    V5 --> ArduinoBlock
    V5 --> LCD
    V5 --> Buzzer
    V5 --> LED

    GND --> NTC
    GND --> Pot
    GND --> ArduinoBlock
    GND --> LCD
    GND --> Buzzer
    GND --> LED

    %% Documentation click events
    click FW "https://github.com/ahmed-saad-fayed/fire-control-system/blob/main/Fire Control System.ino"
    click README "https://github.com/ahmed-saad-fayed/fire-control-system/blob/main/README.md"
    click Report "https://github.com/ahmed-saad-fayed/fire-control-system/blob/main/Report.pdf"
    click Video "https://github.com/ahmed-saad-fayed/fire-control-system/blob/main/Fire Control System.mp4"

    %% Styles
    classDef input fill:#a2f5a2,stroke:#333,stroke-width:1px;
    classDef process fill:#a2d1f5,stroke:#333,stroke-width:1px;
    classDef output fill:#f5a2a2,stroke:#333,stroke-width:1px;
    classDef power fill:#d3d3d3,stroke:#333,stroke-width:1px;
    classDef doc fill:#fff3a2,stroke:#333,stroke-width:1px;
```
