Soil moisture with ESPHome


I would like to measure the soil moisture with ESPHome and an ESP8266 with the following soil moisture sensor.

my actual yaml code looks like that:

 name: esphome-web-255ca2
 friendly_name: Bodensensor 1

  board: esp01_1m

# Enable logging

# Enable Home Assistant API
    key: "lSBpIKAtnWLJ3yWeIQ/kZ3/GAkX7JN5uBSAspQ0R1KY="


  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
    ssid: "Esphome-Web-255Ca2"
    password: "ouzEhpSXLZXs"


  - platform: adc
    pin: A0
    name: "Bodenfeuchte"
    update_interval: 60s
    - multiply: 3.3

In Home Assistant it looks so:

If the sensor is not in the ground, I have approx. 1.8V, so that would be dry.
I think you should then water from 1.7V.

But I don’t like the way it looks, is there a better way?

Thank You

I am in the states, but I would love to get something that monitors soil moisture with my irrigation system…so I am certainly interested in this project. How do you keep them protected from the weather?

Welcome @Timo_76761. You might need to elaborate on this as it’s not so clear what you need help with to me.

Did you test the “wet” value in a glass of water? Then you should have the full range.

There’s lots of examples on the forum for converting the value to a percentage if you prefer it like that.

If you dig into this projects config you will find an example of that.

A better test would be a sample of soil from the yard that is saturated to the point of dripping through a colander. Different soil types have different water holding capacities.


Yeah I’ve been in the habit of glass of water during the build process (for initial hardware testing), and then setting my final 100% and 0% values from insitu saturation / dry tests a little later on.

1 Like

use after your Test a filter like:
my shows it in %

  - platform: ads1115
    multiplexer: 'A2_GND'
    gain: 4.096 #measures up to 4.096V default 6.144
    name: "ADS1115 Channel A2-GND DFRobot Prozent"
    update_interval: 10s
    unit_of_measurement: "%"
    state_class: "measurement"
    device_class: "moisture"
    accuracy_decimals: 0
    -  calibrate_linear:
       - 2.87 -> 0
       - 0.353 -> 100
    - lambda: |
       if (x < 0) return 0;
       else return (x);