Connect a capacitive Soil moisture sensor to ESP32

I’m trying to connect a capacitive Soil moisture sensor to a ESP32 DEV4 board. If I configure a GPIO for ADC there is a voltage of arround 3,7 volt on the port. The sensor is not able to “lower” this. If I disconnect the sensor it gives a normal readout. I’ve done thsi before, but not on a DEV4.
Is there something I didn’t know?

  name: beluchting
  friendly_name: Beluchting

  board: az-delivery-devkit-v4
    type: arduino

# Enable logging

# Enable Home Assistant API
    key: "xx"

  password: "xxx"

  - ssid: "Nr20_300n"
    password: "xxxxxxxxx"
  - ssid: "Nr20_300n1"
    password: "xxxxxxxxx"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
    ssid: "Beluchting Fallback Hotspot"
    password: "01071958"


  - platform: dht
    model: dht11
    pin: GPIO32
      name: "Temperatuur Kasje"
      name: "Vochtigheid Kasje"
    update_interval: 5s
#Soil moisture sensor
  - platform: adc
    pin: GPIO35
    name: ${Buiten} Soil Moisture Kasje
    id:  soil_moisture
    accuracy_decimals: 1
    update_interval: 5s
    icon: mdi:flower
    unit_of_measurement: '%'
    attenuation: 0db
      - lambda: |-
          if (x > 2.4) { 				// if over 2.4 volts, we are dry
            return 0;
          } else if (x < 1.0) { 			// if under 0.264 volts, we are fully saturated
            return 100;
          } else {
            return (2.4-x) / (2.4-1.0) * 100.0; 	// use a linear fit for any values in between

  - platform: gpio
    name: "Ramen Op"
    pin: GPIO26
    inverted: "no"
  - platform: gpio
    name: "Ramen Neer"
    pin: GPIO27
    inverted: "no"

You show us ur passwords and encryption keys but keep details of the sensor secret. 3.7V may damage adc pin.

Sorry, forgot those keys. You are right.
It’s the popular capacitive soil moisture sensor v.2.0. I checked for know flaws. It has a voltage regulator, it has the 1 Mohm resistor between ground and data and the IC is the right one.
So that should be Ok. The 3,7 Volt is not from the sensor. It’s comming from the board. I already tried a new board with the same results.
Picture is the 1.2 variant. I have the 2.0. Seems to be only commercial.

People report a lot of these sensors are faulty or bad connections on the pins. I can only suggest to first try setting the attenuation: 11db

I’m using the same setup for our greenhouse. An ESPHome by a ESP32Dev board and same/similar sensors, both v1.2 and 2.0. The difference is that v1.2 uses 5v 555 timers at the local 3v3 onboard. Whilst the v2.0 uses a CMOS 555 which works better at 3v3. Described here:
[Arduino Capacitive Soil Moisture Sensor V1.0/V2.0 interfacing and programming]
What I found is that you need to set the attenuation on the ESP to 11dB. Then the input voltage can be measured up to appro 3.15v. Datasheet for ESP32 defines max VDD +0.6v so up to VDD should be safe.
I measured several sensors and found that v2.0 has a max of voltage of 2.4 to 2.5v in open air. And 0.75 to 0.95 when dipped in a mixture of water and 20% flower fertilizer. (4 sensors)
V2.1 has a bit narrower range, 2.1 to 2.25 for dry air and 0.9 to 1.3 in the fertilizer.
(5 sensors)
My experience is that these sensors corrodes less if they are not powered. Read this for an example of how to:
Trigger switch before taking sensor reading - #2 by tom_l

Hi Spiro, I have done taht, but no luck.