Can't seem to get ESPHome Voice Assistant configuration right for Microphone with Internal ADC (ESP32). Moved to External ADC

I’m trying to make a device like a Star Trek Communicator for “communicating” with my Home Assistant.
I know most people use digital microphones, and I may try that too, but I have reasons to really want to use the internal ADC, for example for AGC. So this post is ONLY about using the internal ADC.
It’s strange (to me) that the only place the internal ADC is mentioned/configured is on the I2S page here:
https://esphome.io/components/microphone/i2s_audio.html.
AND that even when specifying “adc_type: internal” it’s still inside a “platform: i2s_audio” block which also requires another block specifying the I2S pins, but I thought I’d try it anyway; here is what I got:
Please note that I did wrap the code within but for some reason the format checker still states that I didn’t; I’m unsure what to do. I tried two browsers: Vivaldi and Edge. Edit: It seems that even though it complains, it formats it right… am I missing something?

i2s_audio:  #It seems I2S Audio is needed even for ADC Microphone and requires pins' setting
  i2s_lrclk_pin: GPIO33
  i2s_bclk_pin: GPIO19
microphone:
  - platform: i2s_audio
    id: adc_mic
    adc_type: internal
    adc_pin: GPIO35
voice_assistant:
  microphone: adc_mic
binary_sensor:
  - platform: gpio
    id: voice_switch
    pin:
      number: GPIO14
      inverted: true
      mode:
        input: true
        pullup: true
    on_press:
      - voice_assistant.start:
    on_release:
      - voice_assistant.stop:

Even without a microphone connected I would expect the “Assist in progress” indicator to turn ON and stay ON as long as I keep the button pressed.
Instead, when I press/hold the button the “Assist in progress” indicator flickers on then goes off imediately.
The only reason I can think of (barring having missed something entirely) is that the board tries to read the I2S port and there’s nothing there (clk) so it stops immediately.
I am unsure if at this point I should have configured anything in HA other than a “Card” in the Overview.
Should I have added some automations, scripts of any sort?
Thank you

I made good progress, and for a while it worked quite well.
Then I didn’t use it for a while; I concentrated on getting the speech recognition to work with GPU. That works well in one of the many ways I tried, but now when I try to use my ESP32 device, The Voice Assist does not start even though I can see (in HA GUI) that the switch is recognized as pressed.
What can be wrong?
Thanks.

Could you please share your progress and sample code for ADC mic in ESPHome? Or does it work with your previous code? I have several ADC mics to try now. Thanks. :slight_smile:

P.S. also, did you use S3 or regular WROOM?

Sorry, I just saw this. No S3, just regular.

# Info from: https://github.com/techdregs/Home-Assistant-Voice-Remote
# Some Speaker info from: https://community.home-assistant.io/t/strange-esphome-behavior-w-voice-and-esp32/642265
# Assist switch on GPIO14 (PTT)

esphome:
  name: espvoice1
  friendly_name: ESPvoice1
  on_boot:
    - priority: -100
      then:
        - wait_until: api.connected
        - delay: 5s
#        - media_player.play_media: 'http://192.168.0.xx:xxxx/AssistantOn.mp3' # I don't think this ever worked


esp32:
  board: esp32dev

logger:  # Enable logging
  baud_rate: 115200
  level: DEBUG

api:  # Enable Home Assistant API
  encryption:
    key: "xxx"

ota:
  password: "xxx"
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: on

  ap:  # Enable fallback hotspot (captive portal) in case wifi connection fails
    ssid: "sdsdsdvcvzcv"
    password: "sdsdfsdsdsd"
  manual_ip:
    static_ip: 192.168.0.xxx
    gateway: 192.168.0.1
    subnet: 255.255.255.0
    dns1: 1.1.1.1
    dns2: 8.8.8.8

i2s_audio:
    i2s_lrclk_pin: GPIO15 # MIC-WS  SPK- LRC
    i2s_bclk_pin: GPIO17   # MIC-SCK SPK- BCLK

microphone:
  - platform: i2s_audio
    i2s_din_pin: GPIO27 #sd
    id: inmp441_mic
    adc_type: external
    pdm: false

#speaker:
media_player:
  - platform: i2s_audio
    id: big_speaker
    name: ESPvoice1 Media Player
    dac_type: external
    i2s_dout_pin: GPIO16 #DIN
    mode: mono
    on_pause:
      - media_player.stop

voice_assistant:
  microphone: inmp441_mic
  media_player: big_speaker
  on_listening:
    - light.turn_on: response_light
  on_end:
    - light.turn_off: response_light

binary_sensor:
  - platform: gpio
    id: voice_switch
    name: Voice Switch
    pin:
      number: GPIO14
      inverted: true
      mode:
        input: true
        pullup: true
    on_press:
      - media_player.stop
      - voice_assistant.start:
    on_release:
      - voice_assistant.stop:

light:
  - platform: binary
    id: response_light
    name: "Assisting LED"
    output: onboard_led

output:
  - id: onboard_led
    platform: gpio
    pin: GPIO22
    inverted: true

captive_portal:

Well, your ADC is external. So you have proper i2s mics. I have them too, but also I got several mics with just VCC, gnd and analog out. I guess I need to use internal ADC for this, but I tried and didn’t get voice recognition, so thought maybe I did something wrong. That’s why I asked for your setup. :slight_smile: Sorry!

I sometimes get help from Bing; you should try. Give it the file for digital mic and ask it to change it for analog.
Of course, you need a mic with preamp.