# rey004/fuel-monitoring-system-prototype architecture

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

- Interactive diagram: https://gitdiagram.com/rey004/fuel-monitoring-system-prototype
- Repository: https://github.com/rey004/fuel-monitoring-system-prototype

## Overview

##### Project type and purpose
- This is an IoT-based embedded monitoring system.
- Purpose: measure fuel or water level with an ultrasonic sensor, run on ESP32, send real-time data and alerts to a smartphone via the Blynk platform.

##### File structure
- Top-level files:
- README.md (project description, pin mapping, UI config)
- code/ (contains the firmware)
– code.ino (ESP32 Arduino sketch)
- No separate frontend/backend directories: firmware lives in code/, UI lives entirely in Blynk app.

##### README for additional insights
- Hardware components: ESP32, HC-SR04 ultrasonic, TP4056 charging, Li-ion battery
- Communication: ESP32 uses WiFi to push sensor data to Blynk cloud
- Mobile interface: Blynk smartphone app showing gauge, value displays, push notifications
- Alert logic and virtual pins are well documented

##### Elements
- Clear labels for each component (e.g., “HC-SR04 Ultrasonic Sensor”, “ESP32 w/ code.ino”)
- Sensor → ESP32 (trigger/echo signals)
- ESP32 → Blynk Cloud (WiFi data packet)
- Blynk Cloud → Mobile App (update & notifications)
- Hardware components: green rectangles
- Firmware/Edge logic: blue rectangle

##### Final advice
[Sensor + Power] → [ESP32 Firmware] → [WiFi/Network] → [Blynk Cloud] → [Mobile App]
- Under each block, note key libraries, protocols, or hardware specs.
- Both data‐push and alert‐trigger paths.
- Keep it detailed but uncluttered—focus on the five major layers and their interactions.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Hardware Layer
    subgraph "Hardware Layer"
        direction TB
        HC_SR04["HC-SR04 Ultrasonic Sensor"]:::hardware
        TP4056_Battery["TP4056 Charger + Li-ion Battery"]:::hardware
    end

    %% Firmware Layer
    subgraph "Firmware Layer"
        direction TB
        ESP32_Code["ESP32 w/ code.ino"]:::firmware
    end

    %% Network Layer
    WiFi_Network(["Local WiFi AP/Router"]):::network

    %% Cloud Layer
    Blynk_Cloud(["Blynk Cloud Server"]):::cloud

    %% Client Layer
    Mobile_App(["Blynk Mobile App"]):::client

    %% Documentation
    subgraph "Documentation"
        direction TB
        System_Report["System Report & Diagram"]:::doc
        README["Project Description & Configuration"]:::doc
    end

    %% Data Flows
    HC_SR04 -->|"Trigger/Echo Signals"| ESP32_Code
    TP4056_Battery -->|"Power Supply"| ESP32_Code
    ESP32_Code -->|"Sensor Data (V0–V4)"| WiFi_Network
    WiFi_Network -->|"HTTPS/WebSocket"| Blynk_Cloud
    Blynk_Cloud -->|"Real-time Updates & Notifications"| Mobile_App
    ESP32_Code -->|"Low-Fuel Alert"| Blynk_Cloud
    Blynk_Cloud -->|"Push Notification"| Mobile_App

    %% Click Events
    click ESP32_Code "https://github.com/rey004/fuel-monitoring-system-prototype/blob/main/code/code.ino"
    click System_Report "https://github.com/rey004/fuel-monitoring-system-prototype/blob/main/Fuel_Water_Monitoring_System.pdf"
    click README "https://github.com/rey004/fuel-monitoring-system-prototype/blob/main/README.md"

    %% Styles
    classDef hardware fill:#a8f0c6,stroke:#333,stroke-width:1px
    classDef firmware fill:#8ecae6,stroke:#333,stroke-width:1px
    classDef network fill:#ffd166,stroke:#333,stroke-width:1px,shape:ellipse
    classDef cloud fill:#f4a261,stroke:#333,stroke-width:1px,shape:cloud
    classDef client fill:#9d4edd,stroke:#333,stroke-width:1px
    classDef doc fill:#e0e0e0,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
```
