# computeruncle/smart-plant-irrigation-system architecture

> Architecture diagram of the GitHub repository computeruncle/smart-plant-irrigation-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/computeruncle/smart-plant-irrigation-system
- Repository: https://github.com/computeruncle/smart-plant-irrigation-system

## Overview

#### Purpose and entry points
This repository is an embedded monitoring/control project centered on an ESP32, a DHT11 temperature/humidity sensor driver, and a PCF8574-backed 1602 LCD driver. The primary firmware entry point is `ESP32/MAPPESP32.ino`. Supporting device abstractions are in `DHT11/DHT11.h` and `PCF8574LCD/I2C1602.h`. `mapp.cpp` appears to be a separate top-level C++ source unit whose integration role is not evident from the tree alone.

#### ESP32 application orchestration
`ESP32/MAPPESP32.ino` is the system composition boundary: it is expected to initialize hardware, invoke sensor/LCD components, and serve or expose application state. It owns the embedded runtime lifecycle rather than the reusable drivers.
- `ESP32/MAPPESP32.ino`
- `DHT11/DHT11.h`
- `PCF8574LCD/I2C1602.h`

#### Sensor acquisition stage
The DHT11 module encapsulates communication with the temperature/humidity sensor. Its public interface is declared separately from its implementation, enabling the ESP32 application to consume readings without embedding protocol-level logic.
- `DHT11/DHT11.h`
- `DHT11/DHT11.cpp`

The boundary is between application-level measurement handling in the ESP32 sketch and sensor-specific timing/protocol behavior inside the DHT11 driver.

#### Display output stage
The LCD module provides an I2C-facing abstraction for a 1602 character display using a PCF8574 I/O expander. The ESP32 application can send formatted status or measurements through this driver rather than directly manipulating I2C LCD signals.
- `PCF8574LCD/I2C1602.h`
- `PCF8574LCD/I2C1602.cpp`

This establishes an output boundary: display transport and controller commands remain localized to the LCD component.

#### Browser/UI asset boundary
`ESP32/data/index.html` is a static web asset associated with the ESP32 firmware. Its placement under `ESP32/data` indicates a device-hosted or device-deployed UI payload, distinct from firmware source and hardware drivers.
- `ESP32/data/index.html`
- `ESP32/MAPPESP32.ino`

The expected flow is firmware-managed application state to a browser-facing HTML interface, although the exact transport/server implementation is not visible in the supplied tree.

#### Primary control and data flow
The architecture is organized around an embedded loop/lifecycle:
1. `ESP32/MAPPESP32.ino` initializes ESP32 runtime and connected peripherals.
2. The application requests environmental readings through the DHT11 module.
3. Measurement values are consumed by application logic.
4. The application sends status/readings to the I2C LCD module.
5. The ESP32-associated HTML asset provides a separate user-facing presentation surface.

#### Material runtime and infrastructure
The material runtime is ESP32/Arduino-style firmware, indicated by the `.ino` entry point. Hardware infrastructure includes a DHT11 sensor and an I2C LCD stack consisting of a PCF8574 expander and 1602 display. A browser is an external consumer of `ESP32/data/index.html`; no cloud service, database, or external API integration is evidenced by the repository tree.

Main entry points: [`ESP32/MAPPESP32.ino`](https://github.com/computeruncle/smart-plant-irrigation-system/blob/main/ESP32/MAPPESP32.ino) (Measurement handling), [`DHT11/DHT11.h`](https://github.com/computeruncle/smart-plant-irrigation-system/blob/main/DHT11/DHT11.h) (DHT11 interface), [`DHT11/DHT11.cpp`](https://github.com/computeruncle/smart-plant-irrigation-system/blob/main/DHT11/DHT11.cpp) (DHT11 driver), [`PCF8574LCD/I2C1602.h`](https://github.com/computeruncle/smart-plant-irrigation-system/blob/main/PCF8574LCD/I2C1602.h) (I2C1602 interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_firmware["ESP32 Firmware"]
  node_esp32_app["MAPPESP32<br/>firmware entry point<br/>[MAPPESP32.ino]"]
  node_measurement_logic["Measurement handling<br/>application logic<br/>[MAPPESP32.ino]"]
end

subgraph group_drivers["Device Drivers"]
  node_dht11_api["DHT11 interface<br/>driver API<br/>[DHT11.h]"]
  node_dht11_driver["DHT11 driver<br/>sensor protocol<br/>[DHT11.cpp]"]
  node_lcd_api["I2C1602 interface<br/>driver API<br/>[I2C1602.h]"]
  node_lcd_driver["PCF8574 LCD driver<br/>I2C display protocol<br/>[I2C1602.cpp]"]
end

subgraph group_hardware["Hardware"]
  node_dht11_sensor{{"DHT11 sensor<br/>sensor hardware"}}
  node_pcf8574{{"PCF8574 expander<br/>I2C hardware"}}
  node_lcd_1602{{"1602 LCD<br/>display hardware"}}
end

subgraph group_ui["Device UI"]
  node_web_asset["index.html<br/>static UI asset<br/>[index.html]"]
  node_browser["Browser<br/>external consumer"]
end

node_mapp_cpp["mapp.cpp<br/>C++ source unit<br/>[mapp.cpp]"]

node_esp32_app -->|"runs"| node_measurement_logic
node_measurement_logic -->|"requests readings"| node_dht11_api
node_dht11_api -->|"declares"| node_dht11_driver
node_dht11_driver -->|"reads"| node_dht11_sensor
node_measurement_logic -->|"sends status"| node_lcd_api
node_lcd_api -->|"declares"| node_lcd_driver
node_lcd_driver -->|"uses I2C"| node_pcf8574
node_pcf8574 -->|"drives"| node_lcd_1602
node_esp32_app -.->|"manages payload"| node_web_asset
node_web_asset -->|"presents in"| node_browser

click node_esp32_app "https://github.com/computeruncle/smart-plant-irrigation-system/blob/main/ESP32/MAPPESP32.ino"
click node_measurement_logic "https://github.com/computeruncle/smart-plant-irrigation-system/blob/main/ESP32/MAPPESP32.ino"
click node_dht11_api "https://github.com/computeruncle/smart-plant-irrigation-system/blob/main/DHT11/DHT11.h"
click node_dht11_driver "https://github.com/computeruncle/smart-plant-irrigation-system/blob/main/DHT11/DHT11.cpp"
click node_lcd_api "https://github.com/computeruncle/smart-plant-irrigation-system/blob/main/PCF8574LCD/I2C1602.h"
click node_lcd_driver "https://github.com/computeruncle/smart-plant-irrigation-system/blob/main/PCF8574LCD/I2C1602.cpp"
click node_web_asset "https://github.com/computeruncle/smart-plant-irrigation-system/blob/main/ESP32/data/index.html"
click node_mapp_cpp "https://github.com/computeruncle/smart-plant-irrigation-system/blob/main/mapp.cpp"

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_esp32_app,node_measurement_logic toneBlue
class node_dht11_api,node_dht11_driver,node_lcd_api,node_lcd_driver toneAmber
class node_dht11_sensor,node_pcf8574,node_lcd_1602 toneMint
class node_web_asset,node_browser toneRose
class node_mapp_cpp toneNeutral
```

## Components

### ESP32 Firmware

Arduino-style embedded application runtime.

- [MAPPESP32](https://github.com/computeruncle/smart-plant-irrigation-system/blob/main/ESP32/MAPPESP32.ino): firmware entry point · Composes runtime lifecycle, measurements, and presentation. · `ESP32/MAPPESP32.ino`
- [Measurement handling](https://github.com/computeruncle/smart-plant-irrigation-system/blob/main/ESP32/MAPPESP32.ino): application logic · Consumes environmental readings for status output. · `ESP32/MAPPESP32.ino`

### Device Drivers

Reusable hardware protocol abstractions.

- [DHT11 interface](https://github.com/computeruncle/smart-plant-irrigation-system/blob/main/DHT11/DHT11.h): driver API · Public sensor-reading abstraction. · `DHT11/DHT11.h`
- [DHT11 driver](https://github.com/computeruncle/smart-plant-irrigation-system/blob/main/DHT11/DHT11.cpp): sensor protocol · Implements DHT11 timing and communication. · `DHT11/DHT11.cpp`
- [I2C1602 interface](https://github.com/computeruncle/smart-plant-irrigation-system/blob/main/PCF8574LCD/I2C1602.h): driver API · Public character-display abstraction. · `PCF8574LCD/I2C1602.h`
- [PCF8574 LCD driver](https://github.com/computeruncle/smart-plant-irrigation-system/blob/main/PCF8574LCD/I2C1602.cpp): I2C display protocol · Implements expander and LCD controller commands. · `PCF8574LCD/I2C1602.cpp`

### Hardware

Connected monitoring and display peripherals.

- **DHT11 sensor**: sensor hardware · Provides temperature and humidity values.
- **PCF8574 expander**: I2C hardware · Expands I2C signals for the display.
- **1602 LCD**: display hardware · Shows formatted device status.

### Device UI

Browser-facing static payload.

- [index.html](https://github.com/computeruncle/smart-plant-irrigation-system/blob/main/ESP32/data/index.html): static UI asset · Device-hosted or deployed browser UI payload. · `ESP32/data/index.html`
- **Browser**: external consumer · Presents the device UI.

### Other components

- [mapp.cpp](https://github.com/computeruncle/smart-plant-irrigation-system/blob/main/mapp.cpp): C++ source unit · Top-level source with no evident integration role. · `mapp.cpp`

## Connections

- MAPPESP32 → Measurement handling: runs
- Measurement handling → DHT11 interface: requests readings
- DHT11 interface → DHT11 driver: declares
- DHT11 driver → DHT11 sensor: reads
- Measurement handling → I2C1602 interface: sends status
- I2C1602 interface → PCF8574 LCD driver: declares
- PCF8574 LCD driver → PCF8574 expander: uses I2C
- PCF8574 expander → 1602 LCD: drives
- MAPPESP32 → index.html: manages payload · Serving transport is not evidenced.
- index.html → Browser: presents in
