m5Stack Mic Unit with Atom S3 Lite ESPHome

I have an m5Stack Atom S3 Lite that I want to use as a Voice Assistant receiver. It has a Mic unit attached with a Grove Connector that I want to use the i2s_audio platform with.
The problem is I can’t seem to get the microphone to work.

Has anyone had any success setting up a mic with the atom s3 lite?

Here is my config:

esphome:
  name: esphome-web-ceb528
  friendly_name: Bedroom Assist

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: REDACTED

ota:


wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

captive_portal:

external_components:
  - source: github://pr#5230
    components:
      - esp_adf

# Output that blinks the LED
output:
  - platform: template
    id: status_output
    type: binary
    write_action:
    - if:
        condition:
          lambda: return (state);
        then:
          - light.turn_on:
              id: led
              brightness: 70%
              red: 100%
              green: 0%
              blue: 0%
        else:
          - light.turn_off: led

#G4=IR
remote_transmitter:
  pin: GPIO4
  carrier_duty_percent: 50%

light:
  # Enable status LED
  - platform: status_led
    output: status_output
    name: "Status Led"
    internal: True

  #G35=RGB WS2812C-2020
  - platform: esp32_rmt_led_strip
    rgb_order: GRB
    pin: 35
    num_leds: 4
    # RMT 0 channels will be occupied by IR
    rmt_channel: 1
    chipset: ws2812
    id: led
    name: "Led"

button:
  - platform: factory_reset
    id: factory_reset_btn
    name: Factory reset

#G41=Button
binary_sensor:
  - platform: gpio
    name: Button
    disabled_by_default: true
    entity_category: diagnostic
    pin:
      number: GPIO41
      inverted: true
      mode:
        input: true
        pullup: true
    filters:
      - delayed_off: 10ms
    on_multi_click:
      - timing:
          - ON for at least 250ms
          - OFF for at least 50ms
        then:
          - if:
              condition:
                switch.is_off: use_wake_word
              then:
                - if:
                    condition: voice_assistant.is_running
                    then:
                      - voice_assistant.stop:
                      - script.execute: reset_led
                    else:
                      - voice_assistant.start:
              else:
                - voice_assistant.stop
                - delay: 1s
                - script.execute: reset_led
                - script.wait: reset_led
                - voice_assistant.start_continuous:
      - timing:
          - ON for at least 10s
        then:
          - button.press: factory_reset_btn


i2s_audio:
  i2s_lrclk_pin: GPIO2

microphone:
  - platform: i2s_audio
    id: external_mic
    adc_type: external
    i2s_din_pin: GPIO1
    pdm: false

voice_assistant:
  id: va
  microphone: external_mic
  noise_suppression_level: 2
  auto_gain: 31dBFS
  volume_multiplier: 2.0
  on_listening:
    - light.turn_on:
        id: led
        blue: 100%
        red: 0%
        green: 0%
        effect: "Slow Pulse"
  on_stt_vad_end:
    - light.turn_on:
        id: led
        blue: 100%
        red: 0%
        green: 0%
        effect: "Fast Pulse"
  on_tts_start:
    - light.turn_on:
        id: led
        blue: 100%
        red: 0%
        green: 0%
        brightness: 100%
        effect: none
  on_tts_end:
    - homeassistant.service:
        service: media_player.play_media
        data:
          entity_id: media_player.bedroom_speaker
          media_content_id: !lambda 'return x;'
          media_content_type: music
          announce: "true"
  on_end:
    - delay: 100ms
    - script.execute: reset_led
  on_error:
    - light.turn_on:
        id: led
        red: 100%
        green: 0%
        blue: 0%
        brightness: 100%
        effect: none
    - delay: 1s
    - script.execute: reset_led
  on_client_connected:
    - if:
        condition:
          switch.is_on: use_wake_word
        then:
          - voice_assistant.start_continuous:
          - script.execute: reset_led
  on_client_disconnected:
    - if:
        condition:
          switch.is_on: use_wake_word
        then:
          - voice_assistant.stop:
          - light.turn_off: led

script:
  - id: reset_led
    then:
      - if:
          condition:
            - switch.is_on: use_wake_word
            - switch.is_on: use_listen_light
          then:
            - light.turn_on:
                id: led
                red: 100%
                green: 89%
                blue: 71%
                brightness: 60%
                effect: none
          else:
            - light.turn_off: led

switch:
  - platform: template
    name: Use wake word
    id: use_wake_word
    optimistic: true
    restore_mode: RESTORE_DEFAULT_ON
    entity_category: config
    on_turn_on:
      - lambda: id(va).set_use_wake_word(true);
      - if:
          condition:
            not:
              - voice_assistant.is_running
          then:
            - voice_assistant.start_continuous
      - script.execute: reset_led
    on_turn_off:
      - voice_assistant.stop
      - lambda: id(va).set_use_wake_word(false);
      - script.execute: reset_led
  - platform: template
    name: Use Listen Light
    id: use_listen_light
    optimistic: true
    restore_mode: RESTORE_DEFAULT_ON
    entity_category: config
    on_turn_on:
      - script.execute: reset_led
    on_turn_off:
      - script.execute: reset_led

I skimmed the results of the following search and it appears that people have only had success with the Atom Echo model and can’t get the microphone working (using ESPHome) for other models.

https://community.home-assistant.io/search?q=Atom%20microphone%20

I may be wrong so I encourage you to review the search results.

I am using the PDM MEMS Microphone Unit (SPM1423) and the GPI ports align as follows:

AtomS3 Lite - Port A PDM Mic - PortI2S
G1 CLK
G2 DAT

I believe PDM should be set to true.
However, I’m uncertain if the ADC would be internal nor how to set the CLK pin.

Did you manage to get this working? I’m connecting the speaker base to my lites3 and a PDM mic also. The speaker works fine, but I cannot get the PDM mic to work at all.