filmov
tv
Wi-fi Soil Moisture Sensor with ESPHome
Показать описание
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:
on_shutdown:
then:
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:
# 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 -> 100.00 #replace ">" with greater than symbol (YT doesn't allow angled brackets)
- 2.821 -> 0.00
- lambda: |
if (x < 0) return 0; #replace "<" with less than symbol (YT doesn't allow angled brackets)
else if (x > 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 -> 0.0
- 3.6 -> 8.43
- 3.81 -> 50.06
- 3.86 -> 57.63
- 3.92 -> 72.56
- 3.96 -> 90.96
- 4.05 -> 100
- lambda: |
if (x < 0) return 0;
else if (x > 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
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:
on_shutdown:
then:
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:
# 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 -> 100.00 #replace ">" with greater than symbol (YT doesn't allow angled brackets)
- 2.821 -> 0.00
- lambda: |
if (x < 0) return 0; #replace "<" with less than symbol (YT doesn't allow angled brackets)
else if (x > 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 -> 0.0
- 3.6 -> 8.43
- 3.81 -> 50.06
- 3.86 -> 57.63
- 3.92 -> 72.56
- 3.96 -> 90.96
- 4.05 -> 100
- lambda: |
if (x < 0) return 0;
else if (x > 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
Комментарии