# soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project architecture

> Architecture diagram of the GitHub repository soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project
- Repository: https://github.com/soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project

## Overview

The product is a two-controller water-level and soil-moisture monitoring system. Sensors feed the ATmega328P, which samples values, drives status LEDs, and sends readings over UART to the ESP32; the ESP32 hosts the dashboard for live visualization and browser-based relay control. The C firmware excerpt confirms ADC sampling, LED thresholds, and UART transmission. The ESP32 source is listed in the tree but was not excerpted, so dashboard internals and control wiring are represented only where the README documents them.

Main entry points: [`esp32_dashboard.ino`](https://github.com/soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project/blob/main/esp32_dashboard.ino) (Web Dashboard), [`water_moisture_system.c`](https://github.com/soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project/blob/main/water_moisture_system.c) (ATmega328P Firmware)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensing["Sensing and Firmware"]
  node_avr["ATmega328P Firmware"]
  node_adc["ADC Sampling"]
  node_status_leds["Status LEDs"]
  node_automatic_control["Automatic Power Control"]
end

subgraph group_connectivity["Device Connectivity"]
  node_uart["UART Telemetry"]
  node_esp32["ESP32 Server"]
end

subgraph group_interface["Dashboard and Control"]
  node_dashboard["Web Dashboard"]
  node_live_graph["Live Graph"]
end

node_water_sensor(("Water Sensor"))
node_moisture_sensor(("Moisture Sensor"))
node_browser_user(("Browser User"))
node_relay["Relay"]

node_water_sensor -->|"provides readings"| node_adc
node_moisture_sensor -->|"provides readings"| node_adc
node_avr -->|"samples channels"| node_adc
node_avr -->|"sets thresholds"| node_status_leds
node_avr -->|"sends readings"| node_uart
node_uart -->|"transfers readings"| node_esp32
node_esp32 -->|"hosts"| node_dashboard
node_dashboard -->|"plots readings"| node_live_graph
node_browser_user -->|"views data"| node_dashboard
node_browser_user -->|"requests relay control"| node_dashboard
node_dashboard -.->|"submits control"| node_esp32
node_esp32 -.->|"controls remotely"| node_relay
node_avr -.->|"applies conditions"| node_automatic_control
node_automatic_control -.->|"switches power"| node_relay

click node_avr "https://github.com/soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project/blob/main/water_moisture_system.c"
click node_adc "https://github.com/soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project/blob/main/water_moisture_system.c"
click node_status_leds "https://github.com/soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project/blob/main/water_moisture_system.c"
click node_uart "https://github.com/soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project/blob/main/water_moisture_system.c"
click node_esp32 "https://github.com/soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project/blob/main/esp32_dashboard.ino"
click node_dashboard "https://github.com/soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project/blob/main/esp32_dashboard.ino"
click node_live_graph "https://github.com/soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project/blob/main/esp32_dashboard.ino"
click node_automatic_control "https://github.com/soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project/blob/main/water_moisture_system.c"

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_avr,node_adc,node_status_leds,node_automatic_control,node_browser_user toneBlue
class node_uart,node_esp32 toneAmber
class node_dashboard,node_live_graph toneMint
class node_water_sensor,node_moisture_sensor,node_relay toneIndigo
```

## Components

### Sensing and Firmware

- [ATmega328P Firmware](https://github.com/soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project/blob/main/water_moisture_system.c): `water_moisture_system.c`
- [ADC Sampling](https://github.com/soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project/blob/main/water_moisture_system.c): `water_moisture_system.c`
- [Status LEDs](https://github.com/soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project/blob/main/water_moisture_system.c): `water_moisture_system.c`
- [Automatic Power Control](https://github.com/soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project/blob/main/water_moisture_system.c): `water_moisture_system.c`

### Device Connectivity

- [UART Telemetry](https://github.com/soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project/blob/main/water_moisture_system.c): `water_moisture_system.c`
- [ESP32 Server](https://github.com/soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project/blob/main/esp32_dashboard.ino): `esp32_dashboard.ino`

### Dashboard and Control

- [Web Dashboard](https://github.com/soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project/blob/main/esp32_dashboard.ino): `esp32_dashboard.ino`
- [Live Graph](https://github.com/soorjayan/electrical-appliance-safety-lock-during-floods-and-smart-monitoring-system-project/blob/main/esp32_dashboard.ino): `esp32_dashboard.ino`

### Other components

- **Water Sensor**
- **Moisture Sensor**
- **Browser User**
- **Relay**

## Connections

- Water Sensor → ADC Sampling: provides readings (evidence: `README.md`)
- Moisture Sensor → ADC Sampling: provides readings (evidence: `README.md`)
- ATmega328P Firmware → ADC Sampling: samples channels (evidence: `water_moisture_system.c`)
- ATmega328P Firmware → Status LEDs: sets thresholds (evidence: `water_moisture_system.c`)
- ATmega328P Firmware → UART Telemetry: sends readings (evidence: `water_moisture_system.c`)
- UART Telemetry → ESP32 Server: transfers readings (evidence: `README.md`)
- ESP32 Server → Web Dashboard: hosts (evidence: `README.md`)
- Web Dashboard → Live Graph: plots readings (evidence: `README.md`)
- Browser User → Web Dashboard: views data (evidence: `README.md`)
- Browser User → Web Dashboard: requests relay control (evidence: `README.md`)
- Web Dashboard → ESP32 Server: submits control
- ESP32 Server → Relay: controls remotely
- ATmega328P Firmware → Automatic Power Control: applies conditions (evidence: `water_moisture_system.c`)
- Automatic Power Control → Relay: switches power
