Outdoor soil moisture sensor

After trying a home waterproofed Miflora, then some Zigbee moisture sensors given the same treatment, I now use one of these: Soil Moisture Sensor - VH400

Good topic on reliable ESP32 boards:

ESPHome sensor calibration:

sensor:

  - platform: adc
    pin: GPIO36
    name: "Lawn Moisture Raw Voltage"
    id: raw_v
    unit_of_measurement: "V"
    device_class: voltage
    attenuation: 11db
    update_interval: 10s

  - platform: template
    name: "Lawn Moisture"
    unit_of_measurement: "%"
    device_class: humidity
    state_class: measurement
    lambda: |-
      return (id(raw_v).state);
    filters:
      - calibrate_polynomial:
          degree: 5
          datapoints:
          # Map from sensor -> true value
          - 0.1 -> 0
          - 0.2 -> 1
          - 0.3 -> 2
          - 0.4 -> 3
          - 0.5 -> 4
          - 0.6 -> 5
          - 0.7 -> 6
          - 0.8 -> 7
          - 0.9 -> 8
          - 1 -> 9
          - 1.1 -> 10
          - 1.2 -> 12.5
          - 1.3 -> 15.004
          - 1.4 -> 19.812
          - 1.5 -> 24.62
          - 1.6 -> 29.428
          - 1.7 -> 34.236
          - 1.8 -> 39.044
          - 1.9 -> 42.118
          - 2 -> 44.75
          - 2.1 -> 47.382
          - 2.2 -> 50.014
          - 2.3 -> 52.646
          - 2.4 -> 55.278
          - 2.5 -> 57.91
          - 2.6 -> 60.542
          - 2.7 -> 63.174
          - 2.8 -> 65.806
          - 2.9 -> 68.438
          - 3 -> 71.07
      - sliding_window_moving_average:
          window_size: 12
          send_every: 12
          send_first_at: 12

The raw voltage was just a sanity check I used to confirm my % moisture readings. You can omit it if you wish and just use:

sensor:

  - platform: adc
    pin: GPIO36
    name: "Lawn Moisture"
    attenuation: 11db
    update_interval: 10s
    device_class: humidity
    state_class: measurement
    filters:
      - calibrate_polynomial:
          degree: 5
          datapoints:
          # Map from sensor -> true value
          - 0.1 -> 0
          - 0.2 -> 1
          - 0.3 -> 2
          - 0.4 -> 3
          - 0.5 -> 4
          - 0.6 -> 5
          - 0.7 -> 6
          - 0.8 -> 7
          - 0.9 -> 8
          - 1 -> 9
          - 1.1 -> 10
          - 1.2 -> 12.5
          - 1.3 -> 15.004
          - 1.4 -> 19.812
          - 1.5 -> 24.62
          - 1.6 -> 29.428
          - 1.7 -> 34.236
          - 1.8 -> 39.044
          - 1.9 -> 42.118
          - 2 -> 44.75
          - 2.1 -> 47.382
          - 2.2 -> 50.014
          - 2.3 -> 52.646
          - 2.4 -> 55.278
          - 2.5 -> 57.91
          - 2.6 -> 60.542
          - 2.7 -> 63.174
          - 2.8 -> 65.806
          - 2.9 -> 68.438
          - 3 -> 71.07
      - sliding_window_moving_average:
          window_size: 12
          send_every: 12
          send_first_at: 12
3 Likes