Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
esphome:
name: plant_moisture
platform: ESP32
board: esp32dev
wifi:
ssid: "spam"
password: "eggs"
# Enable logging
logger:
# Enable Home Assistant API
api:
password: "password"
ota:
password: "password"
sensor:
- platform: dht
pin: 22
model: DHt11
temperature:
name: "plant_0_temperature"
humidity:
name: "plant_0_humidity"
- platform: adc
pin: 32
name: "plant_0_soil_moisture"
attenuation: 11db
unit_of_measurement: '%'
filters:
# 1.1v = in water
# 2.94v = dry
lambda: |-
return (2.95 - x) * 100.0 / (2.95 - 1.1);
@gastonMM

This comment has been minimized.

Copy link

gastonMM commented Nov 20, 2019

Hello, could you tell me what sensor they use to measure the humidity in the soil?
I think I'm not getting the right humidity values

Thank you

@WoLpH

This comment has been minimized.

Copy link
Owner Author

WoLpH commented Nov 21, 2019

It's not really a sensor as far as I know. It's simply a resistor effectively so you need to measure it yourself. The 2.95 and 1.1 correspond to my values for dry and in a glass of water.

@PeterSek

This comment has been minimized.

Copy link

PeterSek commented Jan 20, 2020

Brilliant, thank you for sharing, I was trying to read adc and always getting 1.1v, I guess attenuation: 11db was the issue on my end

adding this saved the day
attenuation: 11db
unit_of_measurement: '%'
filters:
# 1.1v = in water
# 2.94v = dry
lambda: |-
return (2.95 - x) * 100.0 / (2.95 - 1.1);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.