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/26 18:46] 23553_students.hsrwemrp:ws2025:agv [2026/02/27 21:39] (current) – [4.5.2 Automations] 23553_students.hsrw
Line 43: Line 43:
 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.
  
-The initial control rules are:+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.
  
-  Temperature-driven ventilation: Start fans if T_inside > 27 °C AND T_outside T_inside+<imgcaption image1|> 
-  * Humidity-driven ventilation: Start fans if RH_inside > 70% AND RH_outside RH_insideThis rule can still be beneficial even when T_outside ≥ T_insidebecause warmer air typically corresponds to a lower relative humidity at the same moisture content and can reduce indoor RH when exchanged.+{{ :emrp:ws2025:agvdewpoint.jpg?nolink&400 |Dew Point Formula. Source: Own illustration.}} 
 +</imgcaption> 
 + 
 +Definitions: 
 +  T_in, T_out = inside/outside temperature 
 +  * RH_in, RH_out = inside/outside relative humidity 
 +  * DP_in, DP_out = inside/outside dew point (calculated) 
 + 
 +1. Extreme temperature control (highest priority, ignores humidity): 
 +Goal: prevent heat stress fast. 
 + 
 +Start fans if: 
 + 
 +  * T_in ≥ 29 °C AND T_out < T_in − 0.5% 
 + 
 +No humidity/dew point checks here. This is “save the plants” mode. 
 + 
 +2. Normal temperature control (humidity-safe cooling) 
 +Goalcool only when it won’t significantly worsen moisture/mold risk. 
 + 
 +Start fans if
 +  * 27 °C < T_in < 29 °C 
 +  * AND T_out T_in − 0.5% 
 +  * AND DP_out ≤ DP_in + 1% 
 + 
 +This allows cooling even if outside dew point is slightly higher, but blocks cases where outside air is much wetter. 
 + 
 +3. Humidity-driven ventilation (dehumidification, can run even if outside is warmer) 
 +Goalkeep RH_in < 70% and reduce mold pressure. 
 + 
 +Start fans if
 +  * RH_in > 70% 
 +  * AND T_out ≤ 27 °C 
 +  * AND outside air is truly drier: DP_out DP_in − 0.7% 
 + 
 +If outside dew point is lowerexchanging 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 106: 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 129: 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 171: 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 199: 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 233: 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:esphome.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 242: Line 279:
 <file yaml greenhouseesp.yaml> <file yaml greenhouseesp.yaml>
 esphome: esphome:
-  name: olimex-poe-iso-dht11 +  name: agvesp32 
-  friendly_name: Olimex POE ISO DHT11+  friendly_name: AGV ESP32
  
 esp32: esp32:
Line 280: Line 317:
     humidity:     humidity:
       name: "Greenhouse Outside Humidity"       name: "Greenhouse Outside Humidity"
-    update_interval: 20s+    update_interval: 10s
  
   - platform: dht   - platform: dht
Line 289: Line 326:
     humidity:     humidity:
       name: "Greenhouse Inside Humidity"       name: "Greenhouse Inside Humidity"
-    update_interval: 20s+    update_interval: 10s
  
 # Relay outputs # Relay outputs
Line 314: Line 351:
     turn_on_action:     turn_on_action:
       - switch.turn_on: relay_1       - switch.turn_on: relay_1
-      - delay: 2s+      - delay: 1s
       - switch.turn_on: relay_2       - switch.turn_on: relay_2
     turn_off_action:     turn_off_action:
Line 339: Line 376:
 ==== 4.5 Home Assistant entities, dashboard, and automations ==== ==== 4.5 Home Assistant entities, dashboard, and automations ====
  
-In the Home Assistant overview, compatible devices can be discovered by scanning the local network. If the ESPHome firmware (YAML configuration) was installed successfully on the ESP32, a device with the configured name ''Olimex POE ISO DHT11'' should appear and can be added to Home Assistant.+In the Home Assistant overview, compatible devices can be discovered by scanning the local network. If the ESPHome firmware (YAML configuration) was installed successfully on the ESP32, a device with the configured name ''AGV ESP32'' should appear and can be added to Home Assistant. 
 + 
 + 
 +<imgcaption image10|> 
 +{{ :emrp:ws2025:registerdevice.jpg?nolink&800 |Register Device Steps. Source: Own illustration.}} 
 +</imgcaption>
  
 === 4.5.1 Entities and dashboard === === 4.5.1 Entities and dashboard ===
Line 354: 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 image9|>+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 vsoutside conditions.+The ventilation control logic is implemented using Home Assistant automations using the template created in the previous step. 
 + 
 +<imgcaption image12|> 
 +{{ :emrp:ws2025:agvcreateautomation.jpg?nolink&800 |Create Automation 1/2. Source: Own illustration.}} 
 +</imgcaption> 
 + 
 +<imgcaption image13|> 
 +{{ :emrp:ws2025:agvcreateautomation2.jpg?nolink&800 |Create Automation 2/2. Source: Own illustration.}} 
 +</imgcaption> 
 + 
 +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> 
 +alias: Greenhouse Ventilation 
 +description: >- 
 +  Vent switch follows binary_sensor.greenhouse_should_vent with anti-flip-flop 
 +  delays. 
 +triggers: 
 +  - entity_id: 
 +      - binary_sensor.greenhouse_should_vent 
 +    to: 
 +      - "on" 
 +    for: 
 +      hours: 0 
 +      minutes: 1 
 +      seconds: 0 
 +    trigger: state 
 +  - entity_id: 
 +      - binary_sensor.greenhouse_should_vent 
 +    to: 
 +      - "off" 
 +    for: 
 +      hours: 0 
 +      minutes: 2 
 +      seconds: 0 
 +    trigger: state 
 +actions: 
 +  - target: 
 +      entity_id: switch.agv_esp32_greenhouse_ventilation 
 +    action: switch.turn_{{ trigger.to_state.state }} 
 +mode: single 
 + 
 +</file>
  
 +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.
 ===== 5. Testing & Validation ===== ===== 5. Testing & Validation =====
 ==== 5.1 Test plan ==== ==== 5.1 Test plan ====
Line 393: 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).
  
 ===== 7. Future Work Ideas ===== ===== 7. Future Work Ideas =====
Line 424: Line 550:
   * [S1] ESPHome Getting Started (Home Assistant add-on): https://esphome.io/guides/getting_started_hassio/   * [S1] ESPHome Getting Started (Home Assistant add-on): https://esphome.io/guides/getting_started_hassio/
   * [S2] ESPHome DHT sensor component documentation: https://esphome.io/components/sensor/dht/   * [S2] ESPHome DHT sensor component documentation: https://esphome.io/components/sensor/dht/
 +  * [S3] Home Assistant Template documentation: https://www.home-assistant.io/integrations/template/
  
  
emrp/ws2025/agv.1772128002.txt.gz · Last modified: 2026/02/26 18:46 by 23553_students.hsrw