Pin numbers on ESP32 for ADC

Hi,

I rebuilt my ESP32 powered water tank sensor and for some reason I can’t seem to get the ADC to work on any pin number supporting ADC any longer. I either get a 'ESP32 doesn’t support ADC on this pin" before installing the YAML or after installing it, i’ll get random voltage readings (i’m using a Gravity analog current to voltage converter connected to a pressure sensor).

this device was working on pin A0 and A4 previously. am i missing something?

- platform: adc
    pin: A4
    name: "tank sensor voltage"
    update_interval: 15s
    update_interval: 5s
    attenuation: auto
    filters:
    - median:
        window_size: 15
        send_every: 15
        send_first_at: 15

Use the GPIO number. e.g. GPIO32 .

Hey Tom, tried that. Even If i get a YAML to install, the ESPs are returning moderately fluctuating readings that don’t seem to correlate (increase or decrease) when the sensors are submerged. The problem started when i removed the devices from ESPHome, wiped them using the command line python tool, and re-provisioned them into ESPHome. Before connecting the lead/wire to the pin the voltage readings are 0.00v. The readings stay the same without the sensor attached. odd.

So had a lot of a look at the documentation, randomly chose another pin with ADC… that being A2 (GPIO34) - but as you suggested - as GPIO. Bingo. working.
thanks again!

Make sure your board definition is correct.

2 Likes

i have…

esp32:
  board: esp32dev
  framework:
    type: arduino

not sure if there is a more precise definition?

If t is the one shown in your image above:

esp32:
  board: esp32thing_plus
  framework:
    type: arduino
1 Like

Cheers, It is. I’ll add that now.

Q: where does one find this out?

https://docs.platformio.org/en/latest/boards/espressif32/esp32thing_plus.html

2 Likes