ProPresta IT - Virtual Commissioning & PLC Programming
  • Index
    • Smart Irrigation Engineering – ESP32-S3 Waveshare 6CH Relay
    • High-End Automation & Smart Home
    • Security and mmWave Radars
    • Artificial Intelligence (Edge AI)
  • Technology
  • Contact Us

Select your language

  • English
  • Español
  • French
  • Italiano
  • 日本語
  • Polski
  • Português

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:

Main irrigation water balance formula

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 \))

$$\text{ET}_c = \text{ET}_0 \times K_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:

Reference evapotranspiration formula

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

Humidity factor Ch

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:

Effective precipitation formula Peff

Where:

Total precipitation Ptot

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} \)):

$$K_{\text{irrig}} = 1.0 + \Delta T + \Delta RH - \Delta P$$

Linear sensitivity weights derived from differential evapotranspiration models:

$$K_{\text{irrig}} = 1.0 + 0.03 \cdot (T - 20) + 0.008 \cdot (60 - RH) - 0.20 \cdot P_{\text{eff}}$$

Subject to hard safety thresholds:

$$\text{If } \left( P_{\text{now}} > 0.5\text{ mm} \quad \text{or} \quad P_{\text{tot}} \ge 5.0\text{ mm} \right) \implies K_{\text{irrig}} = 0.0$$

3. Solenoid Valve Runtime Calculation

The target duration written to registers and hardware countdown routines in RAM (relay_countdown_timers[zone]) is determined by:

$$t_{\text{runtime}} = \lfloor t_{\text{base}} \times 60 \times K_{\text{irrig}} \rfloor \quad [\text{seconds}]$$

For a baseline schedule of \( t_{\text{base}} = 10\text{ minutes} \) and a calculated multiplier of \( K_{\text{irrig}} = 0.47 \):

$$t_{\text{runtime}} = 10 \times 60 \times 0.47 = 282\text{ seconds}$$

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.

Hello, I'm Andre Stepniewski

I'm an Automation Engineer passionate about bridging the gap between virtual design and physical reality.

I specialize in developing PLC logic with a heavy focus on Virtual Commissioning. My goal is simple: to deliver code that is 100% tested and ready for action before it even reaches the factory floor. By using Factory I/O as a digital twin for CODESYS and TIA Portal, I save my clients time and protect their hardware from unexpected errors.

As a Junior Engineer, I bring a fresh, tech-forward perspective to every project. I don't just "write code" – I build simulated environments to ensure every sensor, motor, and safety interlock works perfectly.

© 2026 ProPresta IT | Automation & Virtual Commissioning
contact@proprestait.com