# grigory2009/agrohomesystem architecture

> Architecture diagram of the GitHub repository grigory2009/agrohomesystem, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/grigory2009/agrohomesystem
- Repository: https://github.com/grigory2009/agrohomesystem

## Overview

AgroHomeSystem combines an ESP32-S3 incubator controller with a Raspberry Pi/host computer-vision hub. The documented workflow is camera imagery through cell tracking and plant-health analysis, then a bridge and dashboard; locally, the controller reads environmental sensors, operates the pump and ventilated dome, and presents telemetry and controls on its touch UI. The graph preserves major documented AI, calibration, OTA, and hydroponic capabilities. Python implementation details were not sampled, so those subsystem paths and connections rely only on README documentation.

Main entry points: [`firmware/src/main.cpp`](https://github.com/grigory2009/agrohomesystem/blob/main/firmware/src/main.cpp) (ESP32 Controller), [`demo/esp_bridge.py`](https://github.com/grigory2009/agrohomesystem/blob/main/demo/esp_bridge.py) (ESP Bridge), [`demo/cell_tracker.py`](https://github.com/grigory2009/agrohomesystem/blob/main/demo/cell_tracker.py) (Cell Grid Tracker), [`firmware/lib/XPT2046_Touchscreen/XPT2046_Touchscreen.cpp`](https://github.com/grigory2009/agrohomesystem/blob/main/firmware/lib/XPT2046_Touchscreen/XPT2046_Touchscreen.cpp) (Touchscreen Driver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["ESP32 Control"]
  node_controller["ESP32 Controller<br/>[main.cpp]"]
  node_touch["Touchscreen Driver"]
  node_control_logic["Climate and Flood Control<br/>[main.cpp]"]
  node_touch_ui["Touch UI and Telemetry<br/>[main.cpp]"]
  node_ota["Dual OTA<br/>[main.cpp]"]
end

subgraph group_vision["Edge Vision"]
  node_mobilenet["MobileNetV2 Diagnosis"]
  node_spectral["ExG and HSV Analysis"]
  node_tracker["Cell Grid Tracker<br/>[cell_tracker.py]"]
  node_grid_config["Grid Configuration"]
  node_bridge["ESP Bridge<br/>[esp_bridge.py]"]
end

subgraph group_interface["User Interfaces"]
  node_dashboard["Web Dashboard<br/>[web_dashboard.py]"]
  node_web_ui["ESP Web Interface<br/>[main.cpp]"]
end

subgraph group_physical["Incubator Hardware"]
  node_sensors{{"Environmental Sensors"}}
  node_actuators["Pump and Dome"]
  node_camera["Camera"]
  node_tray["24-Cell Tray"]
end

node_grower(("Grower"))

node_sensors -.->|"send readings"| node_controller
node_controller -.->|"runs control"| node_control_logic
node_control_logic -.->|"controls"| node_actuators
node_grower -->|"touches"| node_touch
node_touch -->|"provides touch input"| node_controller
node_controller -.->|"updates display"| node_touch_ui
node_touch_ui -.->|"accepts controls"| node_controller
node_grower -.->|"uses"| node_dashboard
node_camera -.->|"supplies images"| node_mobilenet
node_camera -.->|"supplies images"| node_spectral
node_camera -.->|"supplies images"| node_tracker
node_tray -.->|"tracked as grid"| node_tracker
node_tracker -.->|"reads and saves"| node_grid_config
node_mobilenet -.->|"sends diagnoses"| node_bridge
node_spectral -.->|"sends analysis"| node_bridge
node_tracker -.->|"sends cell data"| node_bridge
node_bridge -.->|"feeds dashboard"| node_dashboard
node_bridge -.->|"exchanges telemetry"| node_controller
node_grower -->|"uses"| node_web_ui
node_web_ui -->|"requests data and controls"| node_controller
node_grower -.->|"updates firmware"| node_ota

click node_tray "https://github.com/grigory2009/agrohomesystem/tree/main/hardware/cad/step"
click node_controller "https://github.com/grigory2009/agrohomesystem/blob/main/firmware/src/main.cpp"
click node_touch "https://github.com/grigory2009/agrohomesystem/blob/main/firmware/lib/XPT2046_Touchscreen/XPT2046_Touchscreen.cpp"
click node_control_logic "https://github.com/grigory2009/agrohomesystem/blob/main/firmware/src/main.cpp"
click node_touch_ui "https://github.com/grigory2009/agrohomesystem/blob/main/firmware/src/main.cpp"
click node_ota "https://github.com/grigory2009/agrohomesystem/blob/main/firmware/src/main.cpp"
click node_mobilenet "https://github.com/grigory2009/agrohomesystem/tree/main/demo"
click node_spectral "https://github.com/grigory2009/agrohomesystem/tree/main/demo"
click node_tracker "https://github.com/grigory2009/agrohomesystem/blob/main/demo/cell_tracker.py"
click node_grid_config "https://github.com/grigory2009/agrohomesystem/blob/main/demo/cell_grid_config.json"
click node_bridge "https://github.com/grigory2009/agrohomesystem/blob/main/demo/esp_bridge.py"
click node_dashboard "https://github.com/grigory2009/agrohomesystem/blob/main/demo/web_dashboard.py"
click node_web_ui "https://github.com/grigory2009/agrohomesystem/blob/main/firmware/src/main.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_controller,node_touch,node_control_logic,node_touch_ui,node_ota toneBlue
class node_mobilenet,node_spectral,node_tracker,node_grid_config,node_bridge toneAmber
class node_dashboard,node_web_ui toneMint
class node_sensors,node_actuators,node_camera,node_tray toneRose
class node_grower toneIndigo
```

## Components

### ESP32 Control

- [ESP32 Controller](https://github.com/grigory2009/agrohomesystem/blob/main/firmware/src/main.cpp): `firmware/src/main.cpp`
- [Touchscreen Driver](https://github.com/grigory2009/agrohomesystem/blob/main/firmware/lib/XPT2046_Touchscreen/XPT2046_Touchscreen.cpp): `firmware/lib/XPT2046_Touchscreen/XPT2046_Touchscreen.cpp`
- [Climate and Flood Control](https://github.com/grigory2009/agrohomesystem/blob/main/firmware/src/main.cpp): `firmware/src/main.cpp`
- [Touch UI and Telemetry](https://github.com/grigory2009/agrohomesystem/blob/main/firmware/src/main.cpp): `firmware/src/main.cpp`
- [Dual OTA](https://github.com/grigory2009/agrohomesystem/blob/main/firmware/src/main.cpp): `firmware/src/main.cpp`

### Edge Vision

- [MobileNetV2 Diagnosis](https://github.com/grigory2009/agrohomesystem/tree/main/demo): `demo`
- [ExG and HSV Analysis](https://github.com/grigory2009/agrohomesystem/tree/main/demo): `demo`
- [Cell Grid Tracker](https://github.com/grigory2009/agrohomesystem/blob/main/demo/cell_tracker.py): `demo/cell_tracker.py`
- [Grid Configuration](https://github.com/grigory2009/agrohomesystem/blob/main/demo/cell_grid_config.json): `demo/cell_grid_config.json`
- [ESP Bridge](https://github.com/grigory2009/agrohomesystem/blob/main/demo/esp_bridge.py): `demo/esp_bridge.py`

### User Interfaces

- [Web Dashboard](https://github.com/grigory2009/agrohomesystem/blob/main/demo/web_dashboard.py): `demo/web_dashboard.py`
- [ESP Web Interface](https://github.com/grigory2009/agrohomesystem/blob/main/firmware/src/main.cpp): `firmware/src/main.cpp`

### Incubator Hardware

- **Environmental Sensors**
- **Pump and Dome**
- **Camera**
- [24-Cell Tray](https://github.com/grigory2009/agrohomesystem/tree/main/hardware/cad/step): `hardware/cad/step`

### Other components

- **Grower**

## Connections

- Environmental Sensors → ESP32 Controller: send readings (evidence: `README.md`)
- ESP32 Controller → Climate and Flood Control: runs control (evidence: `README.md`)
- Climate and Flood Control → Pump and Dome: controls (evidence: `README.md`)
- Grower → Touchscreen Driver: touches
- Touchscreen Driver → ESP32 Controller: provides touch input (evidence: `firmware/src/main.cpp`)
- ESP32 Controller → Touch UI and Telemetry: updates display (evidence: `README.md`)
- Touch UI and Telemetry → ESP32 Controller: accepts controls (evidence: `README.md`)
- Grower → Web Dashboard: uses (evidence: `README.md`)
- Camera → MobileNetV2 Diagnosis: supplies images (evidence: `README.md`)
- Camera → ExG and HSV Analysis: supplies images (evidence: `README.md`)
- Camera → Cell Grid Tracker: supplies images (evidence: `README.md`)
- 24-Cell Tray → Cell Grid Tracker: tracked as grid (evidence: `README.md`)
- Cell Grid Tracker → Grid Configuration: reads and saves (evidence: `README.md`)
- MobileNetV2 Diagnosis → ESP Bridge: sends diagnoses (evidence: `README.md`)
- ExG and HSV Analysis → ESP Bridge: sends analysis (evidence: `README.md`)
- Cell Grid Tracker → ESP Bridge: sends cell data (evidence: `README.md`)
- ESP Bridge → Web Dashboard: feeds dashboard (evidence: `README.md`)
- ESP Bridge → ESP32 Controller: exchanges telemetry (evidence: `README.md`)
- Grower → ESP Web Interface: uses (evidence: `firmware/src/main.cpp`)
- ESP Web Interface → ESP32 Controller: requests data and controls (evidence: `firmware/src/main.cpp`)
- Grower → Dual OTA: updates firmware (evidence: `README.md`)
