How to know the adc pins and how to address in ESPHOME in a Wemos_d1_mini32

You are best to use the GPIO label.

You did not try to define a pin:
pin: 27
The Last Chance

I cannot see how the pinout diagram in post one can be right. GPIO17 is not an ADC pin.

See also Configuration Types — ESPHome

Yes, you are right that GPIO17 is marked 2x.
Once as IO17 and the second time as IO27.
I assume that IO27 will be GPIO27 and that should be ADC.

I agree, a small but important typo.

So you have that for real?

This 16 adc pins are theoretical on the other hand because all adc_2 channels are not usable when wifi is active :signal_strength:

  • Since the ADC2 module is also used by the Wi-Fi, only one of them could get the preemption when using together, which means the adc2_get_raw() may get blocked until Wi-Fi stops, and vice versa.

https://web.archive.org/web/20220615125719/https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/adc.html#adc-limitations

In the end what’s left are the 8 channels with adc_1. For esphome you have to define the gpio pins which are written in the pin out you posted (including errors).

In case this post magically disappears you can always find it again in the waybackmachine

That is a good point @minnie (and is also mentioned in the random nerds page I pointed to). However I didn’t click to this issue in the thread. Thanks for pointing it out.

Not working also…:

INFO Reading configuration /config/esphome/toldo.yaml...
Failed config

sensor.adc: [source /config/esphome/toldo.yaml:59]
  platform: adc
  
  ESP32 doesn't support ADC on this pin.
  pin: 27

Well you shouldn’t use it anyway. See How to know the adc pins and how to address in ESPHOME in a Wemos_d1_mini32 - #9 by minnie

OK,

With your help my understand is that I only we can use the adc in channel 1 (because channel 2 is not working when WIFI is active), then, there are 6 adc pins, and these adc pins are the A0, A3, A4, A5, A6 and A7 and the code with ESPHOME is “pin: A0” directly, it’s the only code thhats works, code with “pin: GPIO36” or “pin: 36” dont’ works, only with the A before the pin number.

Thanks to all.

pin: GPIOxx is always supported in esphome.

ESPHome always uses the chip-internal GPIO numbers. These internal numbers are always integers like 16 and can be prefixed by GPIO. For example to use the pin with the internal GPIO number 16, you could type GPIO16 or just 16.

Most boards however have aliases for certain pins. For example the NodeMCU ESP8266 uses pin names D0 through D8 as aliases for the internal GPIO pin numbers. Each board (defined in ESPHome section) has their own aliases and so not all of them are supported yet. For example, for the D0 (as printed on the PCB silkscreen) pin on the NodeMCU ESP8266 has the internal GPIO name GPIO16, but also has an alias D0. So using either one of these names in your configuration will lead to the same result.

I implemented a project using a mini d1 ESP32 and ADCs yesterday.

My yaml file used pin 32, 33, 34 35

  - platform: adc
    pin: 35

Worked for me.
Was hoping to get more than 4 ADCs, but 4 was just enough for the project.

There is any way to turn off the internal LED?, it’s always ON (not blinking) and drain my bateries. In the log th info says:

[18:42:11][C][status_led:019]: Status LED:
[18:42:11][C][status_led:020]:   Pin: GPIO22

I tried to turn off with the following sentences, but don’t woks, continues always ON:

status_led:
  pin:
    number: GPIO22

and

status_led:
  pin:
    number: GPIO22
    inverted: true

and

status_led:
  pin:
    number: GPIO22
    inverted: false

Are you sure it’s the internal LED on GPIO22? You can disable it by just deleting the block with the status_led: or comment it out like this:

#status_led:
#  pin:
#    number: GPIO22

But depending on the model of your esp32 it might have a “always on” power led which only can be snipped off but not disabled by software.

Dear tabularasa,

Originally, the code don’t have this section, and the LED is always ON with the log with:

[18:42:11][C][status_led:019]: Status LED:
[18:42:11][C][status_led:020]:   Pin: GPIO22

If the log says GPIO22 I understand thay is this pin that control the LED, then, I put the codes with 3 variations in order to try if I can put the LED OFF, but nothing of the tree variations works.

Take out the whole status_led stanza.

Dear nickrout

Without this code is the same that in my first attempt, and always the LED is ON…

Very hard to find accurate and consistent info on that board, even assuming it is a genuine wemos.

But what makes you think that GPIO22 is the LED?

Because the log file says at start:

[18:42:11][C][status_led:019]: Status LED:
[18:42:11][C][status_led:020]:   Pin: GPIO22

That is because you set it that way!