VDAOvideo

Wi-fi Soil Moisture Sensor with ESPHome

Tech Dregs · 37.4K views · 3 years ago
Description

A quick and easy solution to monitoring plant soil moisture. Integrates into Home Assistant with ESPHome. Board: Seeed Xiao ESP32-C3, I use a capacitive moisture sensor and 1200mAh battery available on Amazon. YAML (pay attention to the greater than/less than notes below): esphome: name: wifi-moisture-sensor friendly_name: WiFi Moisture Sensor on_boot: then: - switch.turn_on: sensor_power on_shutdown: then: - switch.turn_off: sensor_power esp32: board: esp32-c3-devkitm-1 framework: type: arduino # Enable logging logger: # Enable Home Assistant API api: encryption: key: "your_key" ota: password: "your_pwd" wifi: ssid: !secret wifi_ssid password: !secret wifi_password fast_connect: on power_save_mode: LIGHT manual_ip: static_ip: your.ip gateway: your.gateway subnet: your.subnet dns1: your.dns # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "your_fallback" password: "fallback_pwd" captive_portal: sensor: - platform: adc pin: 3 name: "Soil Moisture" unit_of_measurement: "%" device_class: MOISTURE update_interval: 2s attenuation: 11db #required filters: - calibrate_linear: #set your own values here - 1.45 -&gt 100.00 #replace "&gt" with greater than symbol (YT doesn't allow angled brackets) - 2.821 -&gt 0.00 - lambda: | if (x &lt 0) return 0; #replace "&lt" with less than symbol (YT doesn't allow angled brackets) else if (x &gt 100) return 100; else return (x); accuracy_decimals: 0 - platform: adc pin: 4 allow_other_uses: True name: "Battery Life" unit_of_measurement: "%" device_class: BATTERY update_interval: 2s attenuation: 11db #required filters: - multiply: 2.0 - calibrate_polynomial: #set your own values here degree: 4 datapoints: # Map 0.0 (from sensor) to 0.0 (true value) - 3.4 -&gt 0.0 - 3.6 -&gt 8.43 - 3.81 -&gt 50.06 - 3.86 -&gt 57.63 - 3.92 -&gt 72.56 - 3.96 -&gt 90.96 - 4.05 -&gt 100 - lambda: | if (x &lt 0) return 0; else if (x &gt 100) return 100; else return (x); - platform: adc pin: 4 allow_other_uses: True name: "Battery Voltage" update_interval: 2s attenuation: 11db #required filters: - multiply: 2.0 - platform: wifi_signal name: "WiFi Signal Sensor" update_interval: 2s switch: - platform: gpio pin: GPIO10 id: sensor_power internal: true deep_sleep: run_duration: 10s sleep_duration: '5:59:50' === Timestamps === 0:00 Introduction 0:44 Commercial Products... Fail 1:10 DIY Solution 3:54 YAML Configuration Overview 7:25 Conclusion

Why it’s here
  • Search: “soil moisture sensor sensors and automation”

Model note: ESPHome soil sensor build