Measurments on ADC of ESP32 fluctuating

Hi there,

I’m trying to get a accurate reading on a ESP32 GPIO port. I configured GPIO35 for ADC with a attenuation of -11db. This is the config:

sensor:
  - platform: adc
    pin: GPIO35
    name: ${Buiten} Soil Moisture Kasje
    id:  soil_moisture_aardbeien
    accuracy_decimals: 1
    update_interval: 5s
    icon: mdi:flower
    unit_of_measurement: 'V'
    attenuation: 11db

I supply 2 V from a good regulated powersupply. The powersupply is a test after several problems with a soil moisture sensor. After that I receive this in the log. Any ideas?

[13:16:29][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 2.03100 V with 1 decimals of accuracy
[13:16:34][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 1.47100 V with 1 decimals of accuracy
[13:16:39][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.90300 V with 1 decimals of accuracy
[13:16:44][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.14200 V with 1 decimals of accuracy
[13:16:49][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.15800 V with 1 decimals of accuracy
[13:16:54][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.14200 V with 1 decimals of accuracy
[13:16:59][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.79900 V with 1 decimals of accuracy
[13:17:04][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.89500 V with 1 decimals of accuracy
[13:17:09][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.58000 V with 1 decimals of accuracy
[13:17:14][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.14200 V with 1 decimals of accuracy
[13:17:19][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.25500 V with 1 decimals of accuracy
[13:17:24][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.14200 V with 1 decimals of accuracy
[13:17:29][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.57900 V with 1 decimals of accuracy
[13:17:34][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.74500 V with 1 decimals of accuracy
[13:17:39][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.97900 V with 1 decimals of accuracy
[13:17:44][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.69600 V with 1 decimals of accuracy
[13:17:49][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 1.72700 V with 1 decimals of accuracy
[13:17:54][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 1.76500 V with 1 decimals of accuracy
[13:17:59][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 1.53500 V with 1 decimals of accuracy
[13:18:04][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 1.31800 V with 1 decimals of accuracy
[13:18:09][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.25900 V with 1 decimals of accuracy
[13:18:14][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 1.32800 V with 1 decimals of accuracy

To rule out AC overlay on an unloaded power supply, can you try connecting it to a 1.5V battery?

Hi Troon,

Agree, but I was using a Lab supply.
Connected to a 1,5 volt battery (meter says 1,49 volt):

[15:42:39][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.85800 V with 1 decimals of accuracy
[15:42:44][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.14200 V with 1 decimals of accuracy
[15:42:49][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.14200 V with 1 decimals of accuracy
[15:42:54][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 1.89900 V with 1 decimals of accuracy
[15:42:59][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.14200 V with 1 decimals of accuracy
[15:43:04][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 2.26900 V with 1 decimals of accuracy
[15:43:09][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 1.28100 V with 1 decimals of accuracy
[15:43:14][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.20600 V with 1 decimals of accuracy
[15:43:19][D][sensor:094]: '${Buiten} Soil Moisture Kasje': Sending state 0.25800 V with 1 decimals of accurac
1 Like

Are you connecting the power supply or battery ground to the ESP ground as well as connecting the +(ve) to the ADC input?

How are you powering the ESP board?

Hi Tom_I

I’m powering with USB at the moment. The battery is connected to GND and the ADC input.

Extra question.

What is true. AZ delivery is specifing 3.3 V as powersupply for the V2 board. As far as I know VIN is 5 V because there is a regulater on the board. I have a board running with 5 V on VIN!!

what’s your question?

Anyway, did you try with another (ADC1) pin?

What are you using as the USB source of power?

I’m using a IPhone charger

Try powering it from the 5V pin.

It seems there is something wrong here. I think the voltage regulator is faulty. There is a current of 1 A flowing (max of my lab supply). Back to the drawing board.