In agrometeorology and irrigation engineering, the industry standard for calculating crop water requirements is the FAO-56 Penman-Monteith model (or its simplified variants tailored for microcontrollers, such as the Hargreaves-Samani equation).
For the ESP32-S3 microcontroller, the irrigation coefficient \( K_{\text{irrig}} \) (run-time multiplier for each zone) is calculated as a water balance relative to evapotranspiration and precipitation:

Where:
- \( \text{ET}_c \) – actual crop evapotranspiration (water depleted from the soil via plant transpiration and surface evaporation).
- \( P_{\text{eff}} \) – effective precipitation (rainfall that actually infiltrates the root zone).
- \( \text{ET}_{\text{base}} \) – baseline daily water demand (the reference value for which the user set the default runtime in minutes, typically \( 4.0\text{ mm/day} \)).
- \( \text{clamp}(x, 0.0, 1.5) \) – saturation function restricting the coefficient within a safe operating range.
1. Formula Breakdown
A. Actual Crop Evapotranspiration (\( \text{ET}_c \))
- \( K_c \) – crop coefficient (e.g., turf grass = \( 0.8 \)–\( 0.9 \), shrubs = \( 0.6 \)).
- \( \text{ET}_0 \) – reference evapotranspiration [mm/day].
On the ESP32-S3 microcontroller, using data from Open-Meteo (temperature and relative humidity), reference evapotranspiration \( \text{ET}_0 \) is computed using the simplified Roman-Turc formula:

Under typical conditions, using only ambient temperature \( T \) [°C] and relative humidity \( RH \) [%]:

When the air is dry (\( RH < 40\% \)) and hot, the \( C_h \) coefficient automatically increases soil evaporation losses.
B. Effective Precipitation (\( P_{\text{eff}} \))
Plants cannot utilize all precipitation—heavy rainfall exceeding the soil infiltration capacity results in surface runoff or deep percolation below the root zone. According to USDA (Soil Conservation Service) guidelines:

Where:

2. Vector Implementation on ESP32-S3
The heuristic algorithm implemented in smart_irrigation.c is a first-order Taylor series expansion of the governing equations centered around the equilibrium point (\( T = 20^\circ\text{C} \), \( RH = 60\% \), \( P = 0\text{ mm} \)):
Linear sensitivity weights derived from differential evapotranspiration models:
Subject to hard safety thresholds:
3. Solenoid Valve Runtime Calculation
The target duration written to registers and hardware countdown routines in RAM (relay_countdown_timers[zone]) is determined by:
For a baseline schedule of \( t_{\text{base}} = 10\text{ minutes} \) and a calculated multiplier of \( K_{\text{irrig}} = 0.47 \):
Edge AI Implementation Summary
Deploying vector heuristics directly onto the ESP32-S3 microcontroller eliminates cloud dependencies by executing full microclimate analytics at the edge:
- Autonomous Decision-Making: The \( K_{\text{irrig}} \) factor is calculated entirely in RAM based on the real-time weather telemetry vector from Open-Meteo (\( T, RH, P \)).
- Resource Conservation: Dynamic zone runtime scaling prevents overwatering, while the hard rain interlock (\( P_{\text{tot}} \ge 5.0\text{ mm} \)) instantly closes all solenoid valves.
- Core Process Isolation: Mathematical modeling running on Core 1 does not affect GPIO hardware register operations or AES-128-GCM encrypted UDP communications handled by Core 0.
Architecture deployed on a Waveshare 6CH relay module within the ProPresta IT Home Automation platform.
English
Español
French
Italiano
日本語
Polski
Português