# imih3/iot_nhom-5 architecture

> Architecture diagram of the GitHub repository imih3/iot_nhom-5, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/imih3/iot_nhom-5
- Repository: https://github.com/imih3/iot_nhom-5

## Overview

##### Project type and purpose
- From the file tree and README we see:
- An embedded‐firmware folder (he_thong_bao_chay/) containing an Arduino sketch (.ino) plus header files (config.h, def.h, mybutton.h).
- A Kotlin file (mobile_app.kt) for an Android mobile application.
- The project name (“nhom 5”) is generic, but the folder name “he_thong_bao_chay” (Vietnamese for “fire alarm system”) clearly indicates this is a simple fire‐alarm monitoring system built with Arduino plus a companion Android app.

##### File structure
- Top‐level:
- README.md
- he_thong_bao_chay/ (embedded code)
- mobile_app.kt (Android/Kotlin source)
- Inside he_thong_bao_chay/:
- he_thong_bao_chay.ino – main Arduino logic (reads sensors, drives alarms, communicates).
- config.h – configuration constants (pin assignments, thresholds).
- def.h – type definitions, macros.
- mybutton.h – button‐handling library.
- No explicit network or comm library is shown, but the Arduino code may include WiFi/Bluetooth routines within the .ino.

##### README
- Very minimal (“# nhom 5”). No architecture details, so we infer from file names and typical patterns.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Hardware Layer
    subgraph "Hardware Layer"
        Smoke["Smoke Sensor"]:::hardware
        ButtonHW["Reset Button"]:::hardware
        Buzzer["Buzzer/Lamp"]:::hardware
    end

    %% Firmware Layer
    subgraph "Firmware Layer"
        Config["config.h"]:::firmware
        Defs["def.h"]:::firmware
        ButtonLib["mybutton.h"]:::firmware
        Firmware["Arduino Firmware"]:::firmware
    end

    %% Communication Layer
    subgraph "Comm Layer"
        Comm["Bluetooth/WiFi Module"]:::comm
    end

    %% Mobile Layer
    subgraph "Mobile Layer"
        Mobile["Android App"]:::mobile
    end

    %% Data Flows
    Smoke -->|"sensor data"| Firmware
    ButtonHW -->|"button event"| Firmware
    Firmware -->|"uses definitions"| Config
    Firmware -->|"uses macros"| Defs
    Firmware -->|"handles button"| ButtonLib
    Firmware -->|"sends alert"| Comm
    Comm -->|"push notification"| Mobile
    Mobile -->|"reset command"| Comm

    %% Click Events
    click Firmware "https://github.com/imih3/iot_nhom-5/blob/main/he_thong_bao_chay/he_thong_bao_chay.ino"
    click Config "https://github.com/imih3/iot_nhom-5/blob/main/he_thong_bao_chay/config.h"
    click Defs "https://github.com/imih3/iot_nhom-5/blob/main/he_thong_bao_chay/def.h"
    click ButtonLib "https://github.com/imih3/iot_nhom-5/blob/main/he_thong_bao_chay/mybutton.h"
    click Mobile "https://github.com/imih3/iot_nhom-5/blob/main/mobile_app.kt"

    %% Styles
    classDef hardware fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef firmware fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef comm fill:#d4edda,stroke:#333,stroke-width:1px
    classDef mobile fill:#fff3cd,stroke:#333,stroke-width:1px
```
