User Tools

Site Tools


emrp:ws2025:agv

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
emrp:ws2025:agv [2026/02/27 03:51] – [8. References / Sources] 23553_students.hsrwemrp: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/dehumidifier), the system can influence the greenhouse climate mainly by exchanging inside air with outside air. The automation therefore compares inside conditions against outside conditions and only ventilates when outside air is expected to improve the inside climate. Because the current scope uses fans only (no heating/dehumidifier), the system can influence the greenhouse climate mainly by exchanging inside air with outside air. The automation therefore compares inside conditions against outside conditions and only ventilates when outside air is expected to improve the inside climate.
 +
 +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.
 +
 +<imgcaption image1|>
 +{{ :emrp:ws2025:agvdewpoint.jpg?nolink&400 |Dew Point Formula. Source: Own illustration.}}
 +</imgcaption>
  
 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/dew point checks here. This is “save the plants” mode. No humidity/dew point checks here. This is “save the plants” mode.
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: absolute humidity outside < inside by a margin) +  * AND outside air is truly drier: DP_out < DP_in − 0.7%
- +
-Stop fans when: +
-  * RH_in < 68for 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
-<imgcaption image1|>+<imgcaption image2|>
 {{ :emrp:ws2025:gardentopdownview.png?nolink&600 |Top down view of garden. Source: Google Maps + Own illustration.}} {{ :emrp:ws2025:gardentopdownview.png?nolink&600 |Top down view of garden. Source: Google Maps + Own illustration.}}
 </imgcaption> </imgcaption>
Line 170: Line 166:
       * Relay controller       * Relay controller
  
-<imgcaption image2|>+<imgcaption image3|>
 {{ :emrp:ws2025:garden_overview.jpg?nolink&800 |Circuit Overview Diagram. Source: Own illustration.}} {{ :emrp:ws2025:garden_overview.jpg?nolink&800 |Circuit Overview Diagram. Source: Own illustration.}}
 </imgcaption> </imgcaption>
  
-<imgcaption image3|>+<imgcaption image4|>
 {{ :emrp:ws2025:greenhousecircuit.jpg?nolink&800 |Detailed Greenhouse Circuit Diagram. Source: Own illustration.}} {{ :emrp:ws2025:greenhousecircuit.jpg?nolink&800 |Detailed Greenhouse Circuit Diagram. Source: Own illustration.}}
 </imgcaption> </imgcaption>
Line 212: Line 208:
 All greenhouse-side electronics (PoE splitter, ESP32, buck converter, breadboard/power distribution, and relay module) are installed in a dedicated enclosure. All greenhouse-side electronics (PoE splitter, ESP32, buck converter, breadboard/power distribution, and relay module) are installed in a dedicated enclosure.
  
-<imgcaption image4|>+<imgcaption image5|>
 {{ :emrp:ws2025:greenhouseelectronicsfar.jpg?nolink&800 |Image of greenhouse electronics with descriptions. Source: Own image.}} {{ :emrp:ws2025:greenhouseelectronicsfar.jpg?nolink&800 |Image of greenhouse electronics with descriptions. Source: Own image.}}
 </imgcaption> </imgcaption>
  
-<imgcaption image5|>+<imgcaption image6|>
 {{ :emrp:ws2025:greenhouseelectronicsclose.jpg?nolink&800 |Close up image of greenhouse electronics with descriptions. Source: Own image.}} {{ :emrp:ws2025:greenhouseelectronicsclose.jpg?nolink&800 |Close up image of greenhouse electronics with descriptions. Source: Own image.}}
 </imgcaption> </imgcaption>
  
-<imgcaption image6|>+<imgcaption image7|>
 {{ :emrp:ws2025:greenhouseelectronicsclosed.jpg?nolink&800 |Image of greenhouse electronics enclosure closed. Source: Own image.}} {{ :emrp:ws2025:greenhouseelectronicsclosed.jpg?nolink&800 |Image of greenhouse electronics enclosure closed. Source: Own image.}}
 </imgcaption> </imgcaption>
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)
  
-<imgcaption image7|>+<imgcaption image8|>
 {{ :emrp:ws2025:greenhousesideview.jpg?nolink&800 |Side view greenhouse component placement. Source: Own illustration.}} {{ :emrp:ws2025:greenhousesideview.jpg?nolink&800 |Side view greenhouse component placement. Source: Own illustration.}}
 </imgcaption> </imgcaption>
  
-Because the electronics enclosure is mounted on the greenhouse door while the Ethernet feed and the inside sensor cable are routed to fixed pointsboth 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 are therefore routed to this fixed mounting pointwhile only the fan wiring requires sufficient slack to accommodate the door’s movement without putting strain on the connectors or cables.
  
 ==== 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.
  
-<imgcaption image8|>+<imgcaption image9|>
 {{ :emrp:ws2025:adddevice.jpg?nolink&800 |ESPHome Builder: Add New Device Steps. Source: Own illustration.}} {{ :emrp:ws2025:adddevice.jpg?nolink&800 |ESPHome Builder: Add New Device Steps. Source: Own illustration.}}
 </imgcaption> </imgcaption>
Line 383: Line 379:
  
  
-<imgcaption image9|>+<imgcaption image10|>
 {{ :emrp:ws2025:registerdevice.jpg?nolink&800 |Register Device Steps. Source: Own illustration.}} {{ :emrp:ws2025:registerdevice.jpg?nolink&800 |Register Device Steps. Source: Own illustration.}}
 </imgcaption> </imgcaption>
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.
  
-<imgcaption image10|>+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 ''Settings -> Devices & services -> Helpers -> + Create helper -> Template -> Sensor'' we fill in Name, State (shown below), Unit of measurement (°C), Device class (Temperature), State class (Measurement) and select our ESPHome as device. This adds a sensor we can access with ''sensor.<Name>'' that calculates the dew point. 
 + 
 +<file script inside_dew_point.txt> 
 +{% set T = states('sensor.agv_esp32_greenhouse_inside_temperature')|float(none) %} 
 +          {% set RH = states('sensor.agv_esp32_greenhouse_inside_humidity')|float(none) %} 
 +          {% 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 %} 
 +</file> 
 + 
 +A second template is used for checking if the control condition for venting are met. Instead of a ''Sensor'' this is a ''Binary Sensor'' with state: 
 + 
 +<file script should_vent.txt> 
 +{% set tin  = states('sensor.agv_esp32_greenhouse_inside_temperature') | float(none) %} 
 +          {% set tout = states('sensor.agv_esp32_greenhouse_outside_temperature') | float(none) %} 
 +          {% set hin  = states('sensor.agv_esp32_greenhouse_inside_humidity') | float(none) %} 
 +          {% set dpin  = states('sensor.greenhouse_dew_point_inside') | float(none) %} 
 +          {% set dpout = states('sensor.greenhouse_dew_point_outside') | float(none) %} 
 + 
 +          {% 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  = (tin > 27 and tin < 29 and tout < (tin - dT) and dpout <= (dpin + dp_max)) %} 
 +            {% set humidity     = (hin > 70 and tout <= 27 and dpout < (dpin - dp_margin)) %} 
 + 
 +            {{ extreme_temp or normal_temp or humidity }} 
 +          {% endif %} 
 +</file> 
 + 
 +<imgcaption image11|>
 {{ :emrp:ws2025:hascreenshot.png?nolink&600 |Home Assistant Dashboard Screenshot. Source: Own illustration.}} {{ :emrp:ws2025:hascreenshot.png?nolink&600 |Home Assistant Dashboard Screenshot. Source: Own illustration.}}
 </imgcaption> </imgcaption>
- 
 === 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 using the template created in the previous step.
  
-<imgcaption image11|>+<imgcaption image12|>
 {{ :emrp:ws2025:agvcreateautomation.jpg?nolink&800 |Create Automation 1/2. Source: Own illustration.}} {{ :emrp:ws2025:agvcreateautomation.jpg?nolink&800 |Create Automation 1/2. Source: Own illustration.}}
 </imgcaption> </imgcaption>
  
-<imgcaption image11|>+<imgcaption image13|>
 {{ :emrp:ws2025:agvcreateautomation2.jpg?nolink&800 |Create Automation 2/2. Source: Own illustration.}} {{ :emrp:ws2025:agvcreateautomation2.jpg?nolink&800 |Create Automation 2/2. Source: Own illustration.}}
 </imgcaption> </imgcaption>
  
-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 based on 2.2 Control concept. 
 <file yaml automation.yaml> <file yaml automation.yaml>
-alias: Greenhouse ventilation (temp+humidity instant on, delayed off)+alias: Greenhouse Ventilation 
 +description: >- 
 +  Vent switch follows binary_sensor.greenhouse_should_vent with anti-flip-flop 
 +  delays.
 triggers: triggers:
-  - idvent_on +  - entity_id: 
-    for: "00:00:30+      - binary_sensor.greenhouse_should_vent 
-    value_template> +    to: 
-      {% set tin = +      - "on
-      states('sensor.agv_esp32_greenhouse_inside_temperature')|float(0) %} {% +    for
-      set tout = +      hours: 
-      states('sensor.agv_esp32_greenhouse_outside_temperature')|float(0) %} {% +      minutes: 1 
-      set hin = states('sensor.agv_esp32_greenhouse_inside_humidity')|float(0) +      seconds: 
-      %} {% set hout = +    trigger: state 
-      states('sensor.agv_esp32_greenhouse_outside_humidity')|float(0) %} {{ +  - entity_id: 
-        (tin > 27 and tout < 27) +      - binary_sensor.greenhouse_should_vent 
-        or +    to: 
-        (hin > 70 and hout < 70 and tout < 27) +      - "off
-      }} +    for
-    trigger: template +      hours: 
-  - idvent_off +      minutes: 2 
-    for: "00:02:00+      seconds: 
-    value_template> +    trigger: state
-      {% set tin = +
-      states('sensor.agv_esp32_greenhouse_inside_temperature')|float(0) %} {% +
-      set tout = +
-      states('sensor.agv_esp32_greenhouse_outside_temperature')|float(0) %} {% +
-      set hin = states('sensor.agv_esp32_greenhouse_inside_humidity')|float(0) +
-      %} {% set hout = +
-      states('sensor.agv_esp32_greenhouse_outside_humidity')|float(0) %} +
- +
-      {% set temp_reason_gone = (tin < 26.8) or (tout >= 27) %} {% set +
-      hum_reason_gone  = (hin < 68) or (hout >= 70) or (tout >= 27) %} +
- +
-      {{ temp_reason_gone and hum_reason_gone }} +
-    trigger: template+
 actions: actions:
-  - choose+  - target
-      - conditions: +      entity_id: switch.agv_esp32_greenhouse_ventilation 
-          - condition: trigger +    action: switch.turn_{{ trigger.to_state.state }}
-            id: vent_on +
-        sequence: +
-          - target: +
-              entity_id: switch.agv_esp32_greenhouse_ventilation +
-            action: switch.turn_on +
-      - conditions: +
-          - condition: trigger +
-            id: vent_off +
-        sequence: +
-          - target: +
-              entity_id: switch.agv_esp32_greenhouse_ventilation +
-            action: switch.turn_off+
 mode: single mode: single
 +
 </file> </file>
  
-This automation controls the greenhouse ventilation based on inside vs. outside temperature and humidity. +To prevent the ventilation system from switching on or off due to brief sensor spikes or small fluctuations around the thresholds, the "on" conditions must be met for one minute and the "off" conditions for two minutes.
-  * 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), or +
-    - 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 in order to turn off the ventilation. +
- +
 ===== 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 =====
emrp/ws2025/agv.1772160676.txt.gz · Last modified: 2026/02/27 03:51 by 23553_students.hsrw