esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 35 forks source link

GPIO05 ADC Not Available on seeed_xiao_esp32c3 #4136

Open nkgiovannivl opened 1 year ago

nkgiovannivl commented 1 year ago

The problem

Setting GPIO05 is showing "ESP32C3 doesn’t support ADC on this pin." , but the reference pins shows me that GPIO05 it’s available.

image

Which version of ESPHome has the issue?

2022.12.8

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2023.2.2

What platform are you using?

ESP32-IDF

Board

seeed_xiao_esp32c3

Component causing the issue

sensor platform: adc

Example YAML snippet

esphome:
  name: clamps-my
  platformio_options:
    board_build.flash_mode: dio  

esp32:
  board: seeed_xiao_esp32c3
  variant: esp32c3
  framework:
    type: esp-idf

sensor:                                      

  - platform: adc

    pin: GPIO5

    attenuation: auto

    accuracy_decimals: 5

    id: adc_sensor_ct5

Anything in the logs that might be useful for us?

No response

Additional information

The GPIO05 should be mapped on VARIANT_ESP32C3?

https://github.com/esphome/esphome/blob/034b47c23a08f9980bdae07bcafbcf22fc43dc2e/esphome/components/adc/sensor.py#L76

oxan commented 1 year ago

The problem is that GPIO5 is used by ADC2, which is also used by the WiFi module: https://docs.espressif.com/projects/esp-idf/en/v4.3/esp32c3/api-reference/peripherals/adc.html

There's an open PR to add support for ADC2 when WiFi is disabled: https://github.com/esphome/esphome/pull/4381

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.