ADC steps on big increments on ESP32

I am reading a sensor whose current output is 2.4V. I connected it to a Wroom ESP32 dev board. I set the configuration to show me raw values (0 - 4095). and this is my configuration file:

sensor:

# TANK
  - platform: adc
    pin: GPIO35
    attenuation: 11db #ESP32 defaults to 0db measuring 0-1V, 11db = 0-3.9V
    update_interval: 5s
    id: water
    # accuracy_decimals: 1
    unit_of_measurement: "%"
    icon: "mdi:water-percent"
    name: "Water Tank"
    state_class: "measurement"
    raw: true

And these are the result readings:

My question is, why are the readings 512 points or 256 points apart? Why am I not getting the full 4095 points of detail?

Because your signal is noisy?

Because you are not putting in 3.9V from your sensor.

a mean why are the increments exaclty 256? If its noise why don’t I get lets say 113 points of difference or any other random number?

On the ESP32 the voltage measured with the ADC caps out at ~1.1V

it’s 4095 at 1.1v, the attenuation extends it up to 3.9v. 256 is probably the min step. Now since the adc component has been updated a few months ago, auto is recommended for attenuation. Although the max reading is 3.12v it may be worth trying. Read this for more detail.

Why would 256 be the minimum? These are 12 bit ADCs. 2^12=4096.

Maybe I am getting this wrong but @ 0 - 1.1v you get 12 bit resolution. If it’s stretched now to measure 0 - 3.9v wouldn’t the resolution be less and then the steps larger?

There should still be 4096 steps between 0 and 3.9v

1 Like

That would be my understanding that you should get the full resolution between 0 and 3.9V. With 256 points per step its equivalent to a 4bit resolution.