emrp:ws2025:agv
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| emrp:ws2025:agv [2026/02/27 03:48] – 23553_students.hsrw | emrp:ws2025:agv [2026/02/27 21:39] (current) – [4.5.2 Automations] 23553_students.hsrw | ||
|---|---|---|---|
| Line 42: | Line 42: | ||
| Because the current scope uses fans only (no heating/ | Because the current scope uses fans only (no heating/ | ||
| + | |||
| + | Although the DHT11 sensors only measure air temperature and relative humidity, these values can be used to calculate the dew point. Dew point is helpful because it is a direct indicator of how close the air is to saturation and therefore to condensation on cold surfaces (e.g., glass), which can promote fungal diseases. In addition, dew point reflects the air’s moisture state more robustly than relative humidity alone, which is temperature-dependent and can appear “high” even when the absolute moisture content is not. This makes dew point a useful metric when deciding whether exchanging inside air with outside air is likely to reduce condensation risk and improve the greenhouse climate. | ||
| + | |||
| + | < | ||
| + | {{ : | ||
| + | </ | ||
| Definitions: | Definitions: | ||
| Line 53: | Line 59: | ||
| Start fans if: | Start fans if: | ||
| - | * T_in ≥ 29 °C AND T_out < T_in − ΔT | + | * T_in ≥ 29 °C AND T_out < T_in − 0.5% |
| - | + | ||
| - | Stop fans when: | + | |
| - | + | ||
| - | * T_in ≤ 28.5 °C for over 2 minutes | + | |
| No humidity/ | No humidity/ | ||
| Line 66: | Line 68: | ||
| Start fans if: | Start fans if: | ||
| * 27 °C < T_in < 29 °C | * 27 °C < T_in < 29 °C | ||
| - | * AND T_out < T_in − ΔT | + | * AND T_out < T_in − 0.5% |
| - | * AND DP_out ≤ DP_in + ΔDP_max | + | * AND DP_out ≤ DP_in + 1% |
| - | + | ||
| - | Stop fans when: | + | |
| - | * T_in ≤ 26.8 °C for 2 minutes OR outside is no longer favorable | + | |
| This allows cooling even if outside dew point is slightly higher, but blocks cases where outside air is much wetter. | This allows cooling even if outside dew point is slightly higher, but blocks cases where outside air is much wetter. | ||
| Line 80: | Line 79: | ||
| * RH_in > 70% | * RH_in > 70% | ||
| * AND T_out ≤ 27 °C | * AND T_out ≤ 27 °C | ||
| - | * AND outside air is truly drier: DP_out < DP_in − ΔDP (or equivalently: | + | * AND outside air is truly drier: DP_out < DP_in − 0.7% |
| - | + | ||
| - | Stop fans when: | + | |
| - | * RH_in < 68% for 2 minutes | + | |
| - | * OR T_out > 27 °C | + | |
| - | * OR DP_out ≥ DP_in − ΔDP (outside no longer helps) | + | |
| If outside dew point is lower, exchanging air will reduce moisture even if outside is warmer. | If outside dew point is lower, exchanging air will reduce moisture even if outside is warmer. | ||
| + | |||
| + | If one of these three conditions is true for 1 minute the fans start, if they are false fo 2 minutes the fans turn off. | ||
| ===== 3. Components ===== | ===== 3. Components ===== | ||
| Line 147: | Line 143: | ||
| * Relay | * Relay | ||
| * 2x DHT11 Sensors | * 2x DHT11 Sensors | ||
| - | < | + | < |
| {{ : | {{ : | ||
| </ | </ | ||
| Line 170: | Line 166: | ||
| * Relay controller | * Relay controller | ||
| - | < | + | < |
| {{ : | {{ : | ||
| </ | </ | ||
| - | < | + | < |
| {{ : | {{ : | ||
| </ | </ | ||
| Line 212: | Line 208: | ||
| All greenhouse-side electronics (PoE splitter, ESP32, buck converter, breadboard/ | All greenhouse-side electronics (PoE splitter, ESP32, buck converter, breadboard/ | ||
| - | < | + | < |
| {{ : | {{ : | ||
| </ | </ | ||
| - | < | + | < |
| {{ : | {{ : | ||
| </ | </ | ||
| - | < | + | < |
| {{ : | {{ : | ||
| </ | </ | ||
| Line 240: | Line 236: | ||
| * Installed near the top (remove warm, humid air that accumulates above) | * Installed near the top (remove warm, humid air that accumulates above) | ||
| - | < | + | < |
| {{ : | {{ : | ||
| </ | </ | ||
| - | Because the electronics enclosure is mounted on the greenhouse door while the Ethernet feed and the inside sensor cable are routed to fixed points, both cables are installed with sufficient slack to accommodate the door movement without putting strain on connectors or wiring. | + | The electronics enclosure is installed next to the greenhouse door (rather than on the door itself) and remains stationary. The Ethernet feed and the DHT11 sensors |
| ==== 4.4 Software setup ==== | ==== 4.4 Software setup ==== | ||
| Line 274: | Line 270: | ||
| The initial installation step can require internet access because ESPHome may download required build packages and platform dependencies. | The initial installation step can require internet access because ESPHome may download required build packages and platform dependencies. | ||
| - | < | + | < |
| {{ : | {{ : | ||
| </ | </ | ||
| Line 383: | Line 379: | ||
| - | < | + | < |
| {{ : | {{ : | ||
| </ | </ | ||
| Line 400: | Line 396: | ||
| These entities are visualized on a dedicated dashboard to monitor current conditions and to manually override ventilation if required. | These entities are visualized on a dedicated dashboard to monitor current conditions and to manually override ventilation if required. | ||
| - | < | + | To add automatic calculations of the dew points for inside and outside Templates are used. [S3] |
| + | |||
| + | Following the quick link in the Template Documentation or under '' | ||
| + | |||
| + | <file script inside_dew_point.txt> | ||
| + | {% set T = states(' | ||
| + | {% set RH = states(' | ||
| + | {% if T is not none and RH is not none and RH > 0 %} | ||
| + | {% set a = 17.62 %} | ||
| + | {% set b = 243.12 %} | ||
| + | {% set gamma = (a * T) / (b + T) + log(RH / 100) %} | ||
| + | {{ ((b * gamma) / (a - gamma)) | round(2) }} | ||
| + | {% else %} | ||
| + | {{ none }} | ||
| + | {% endif %} | ||
| + | </ | ||
| + | |||
| + | A second template is used for checking if the control condition for venting are met. Instead of a '' | ||
| + | |||
| + | <file script should_vent.txt> | ||
| + | {% set tin = states(' | ||
| + | {% set tout = states(' | ||
| + | {% set hin = states(' | ||
| + | {% set dpin = states(' | ||
| + | {% set dpout = states(' | ||
| + | |||
| + | {% if None in [tin, tout, hin, dpin, dpout] %} | ||
| + | false | ||
| + | {% else %} | ||
| + | {% set dT = 0.5 %} | ||
| + | {% set dp_max = 1.0 %} | ||
| + | {% set dp_margin = 0.7 %} | ||
| + | |||
| + | {% set extreme_temp = (tin >= 29 and tout < (tin - dT)) %} | ||
| + | {% set normal_temp | ||
| + | {% set humidity | ||
| + | |||
| + | {{ extreme_temp or normal_temp or humidity }} | ||
| + | {% endif %} | ||
| + | </ | ||
| + | |||
| + | < | ||
| {{ : | {{ : | ||
| </ | </ | ||
| - | |||
| === 4.5.2 Automations === | === 4.5.2 Automations === | ||
| - | The ventilation control logic is implemented using Home Assistant automations. This includes temperature-driven ventilation and humidity-driven ventilation rules based on comparing inside vs. outside conditions. | + | The ventilation control logic is implemented using Home Assistant automations |
| - | < | + | < |
| {{ : | {{ : | ||
| </ | </ | ||
| - | < | + | < |
| {{ : | {{ : | ||
| </ | </ | ||
| - | The following YAML file specifies the criteria that Home Assistant uses to determine when to activate the ventilation system. | + | The following YAML file specifies the criteria that Home Assistant uses to determine when to activate the ventilation system |
| <file yaml automation.yaml> | <file yaml automation.yaml> | ||
| - | alias: Greenhouse | + | alias: Greenhouse |
| + | description: | ||
| + | Vent switch follows binary_sensor.greenhouse_should_vent with anti-flip-flop | ||
| + | delays. | ||
| triggers: | triggers: | ||
| - | - id: vent_on | + | - entity_id: |
| - | | + | - binary_sensor.greenhouse_should_vent |
| - | | + | |
| - | | + | - "on" |
| - | states(' | + | |
| - | | + | |
| - | | + | |
| - | set hin = states(' | + | |
| - | %} {% set hout = | + | trigger: |
| - | states(' | + | - entity_id: |
| - | (tin > 27 and tout < 27) | + | - binary_sensor.greenhouse_should_vent |
| - | or | + | |
| - | (hin > 70 and hout < 70 and tout < 27) | + | - "off" |
| - | }} | + | |
| - | trigger: | + | |
| - | - id: vent_off | + | |
| - | | + | |
| - | | + | trigger: |
| - | | + | |
| - | states(' | + | |
| - | | + | |
| - | | + | |
| - | set hin = states(' | + | |
| - | %} {% set hout = | + | |
| - | states(' | + | |
| - | + | ||
| - | {% set temp_reason_gone = (tin < 26.8) or (tout >= 27) %} {% set | + | |
| - | hum_reason_gone | + | |
| - | + | ||
| - | {{ temp_reason_gone and hum_reason_gone }} | + | |
| - | trigger: | + | |
| actions: | actions: | ||
| - | - choose: | + | - target: |
| - | | + | entity_id: switch.agv_esp32_greenhouse_ventilation |
| - | - condition: trigger | + | action: switch.turn_{{ |
| - | id: vent_on | + | |
| - | sequence: | + | |
| - | - target: | + | |
| - | | + | |
| - | action: switch.turn_on | + | |
| - | - conditions: | + | |
| - | - condition: | + | |
| - | id: vent_off | + | |
| - | sequence: | + | |
| - | - target: | + | |
| - | entity_id: switch.agv_esp32_greenhouse_ventilation | + | |
| - | action: switch.turn_off | + | |
| mode: single | mode: single | ||
| + | |||
| </ | </ | ||
| - | This automation controls | + | To prevent |
| - | * The ventilation turns on when either of these conditions has been met for at least 30 seconds: | + | |
| - | - The inside temperature is above 27°C and the outside temperature is below 27°C (outside air can cool the greenhouse), | + | |
| - | - The inside humidity is above 70%, the outside humidity is below 70%, and the outside temperature is below 27°C (outside air can dehumidify without heating it up). | + | |
| - | * To avoid rapid toggling, it uses lower “off” thresholds: inside temperature must drop below 26.8°C and inside humidity below 68% (or outside conditions stop being favorable) before it will switch off. These conditions must be met for two minutes | + | |
| - | + | ||
| ===== 5. Testing & Validation ===== | ===== 5. Testing & Validation ===== | ||
| ==== 5.1 Test plan ==== | ==== 5.1 Test plan ==== | ||
| Line 508: | Line 518: | ||
| * Testing was performed in a bathroom rather than a real greenhouse, so airflow patterns, heat capacity, and leakage behavior differ significantly. | * Testing was performed in a bathroom rather than a real greenhouse, so airflow patterns, heat capacity, and leakage behavior differ significantly. | ||
| * The controlled tests mainly covered cases where the “inside” environment was hotter and/or more humid than the “outside” reference. Conditions such as rain events, strong solar radiation, and rapid outside fluctuations were not fully represented. | * The controlled tests mainly covered cases where the “inside” environment was hotter and/or more humid than the “outside” reference. Conditions such as rain events, strong solar radiation, and rapid outside fluctuations were not fully represented. | ||
| - | + | * DHT11 sensors are low accuracy, especially for humidity (often ±5% RH or worse, plus slow response). | |
| - | Sensor limitations: | + | |
| - | DHT11 sensors are low accuracy, especially for humidity (often ±5% RH or worse, plus slow response). | + | |
| ===== 7. Future Work Ideas ===== | ===== 7. Future Work Ideas ===== | ||
| Line 542: | Line 550: | ||
| * [S1] ESPHome Getting Started (Home Assistant add-on): https:// | * [S1] ESPHome Getting Started (Home Assistant add-on): https:// | ||
| * [S2] ESPHome DHT sensor component documentation: | * [S2] ESPHome DHT sensor component documentation: | ||
| + | * [S3] Home Assistant Template documentation: | ||
emrp/ws2025/agv.1772160510.txt.gz · Last modified: 2026/02/27 03:48 by 23553_students.hsrw