ESP32-S3 Adafruit PDM MEMS Microphone Breakout

Hi there,
I’m playing around with the Adafruit PDM MEMS Microphone Breakout and ESP32-S3, but can’t get it working. As far as I was able to find out, The i2s can be assignet to every avaible GPIO on the S3. But I can’t see anything in logs. Here is my yaml:

substitutions:
  board: esp32-s3-devkitc-1
  name: esp32-s3-mic
  friendly_name: ESP32 S3 Mic
  sclk_pin: GPIO41 # MP34DT01 SEL
  bclk_pin: GPIO40 # MP34DT01 CLK
  din_pin: GPIO39  # MP34DT01 DAT

esphome:
  name: ${name}
  friendly_name: ${friendly_name}

esp32:
  board: ${board}
  framework:
    type: arduino
#    type: esp-idf

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "ycJWxK4CJUtf722n4d0kunETziWAZp6rpObngZlx+XU="

ota:
  password: !secret wifi_password

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "${friendly_name} Fallback Hotspot"
    password: !secret wifi_password

captive_portal:


i2s_audio:
  i2s_lrclk_pin: ${sclk_pin} # MP34DT01  SEL
  i2s_bclk_pin: ${bclk_pin}  # MP34DT01  CLK

microphone:
  - platform: i2s_audio
    id: mic_i2s
    i2s_din_pin: ${din_pin} # MP34DT01  DAT
    adc_type: external
    pdm: true

voice_assistant:
  id: va
  microphone: mic_i2s
#  media_player: media_player_speaker
  noise_suppression_level: 2
  use_wake_word: false
  auto_gain: 31dBFS
  volume_multiplier: 4.0
  
  on_listening:
    - light.turn_on:
        id: led_light
        effect: "Scan"
        red: 0%
        green: 50%
        blue: 93%
  on_stt_vad_end:
    - light.turn_on:
        id: led_light
        effect: "Rainbow"
  on_wake_word_detected: 
    - light.turn_on:
        id: led_light
  
  on_stt_end:
    - light.turn_on:
        id: led_light
        effect: "Rainbow"

  on_end:
    - delay: 100ms
    - light.turn_off:
        id: led_light
  on_error:
    - light.turn_on:
        id: led_light
        red: 100%
        green: 0%
        blue: 0%
        brightness: 100%
        effect: "Fast Pulse"
    - if:
        condition:
          switch.is_on: use_wake_word
        then:

          - switch.turn_off: use_wake_word
          - delay: 1sec 
          - switch.turn_on: use_wake_word  
  on_client_connected:
    - if:
        condition:
          switch.is_on: use_wake_word
        then:
          - voice_assistant.start_continuous:

  on_client_disconnected:
    - if:
        condition:
          switch.is_on: use_wake_word
        then:
          - voice_assistant.stop:
 

binary_sensor:
  - platform: status
    name: API Connection
    id: api_connection
    filters:
      - delayed_on: 1s
    on_press:
      - if:
          condition:
            switch.is_on: use_wake_word
          then:
            - voice_assistant.start_continuous:
    on_release:
      - if:
          condition:
            switch.is_on: use_wake_word
          then:
            - voice_assistant.stop:


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

light:
  - platform: neopixelbus
    id: led_light
    type: grb
    pin: GPIO14      # DIN pin of the LED Strip
    num_leds: 8      # change the Number of LEDS according to your LED Strip.
    name: "Light"
    variant: ws2812x
    default_transition_length: 0.5s
      
    effects:
      - addressable_scan:
          name: Scan
          move_interval: 50ms
          scan_width: 2
      - addressable_rainbow:
          name: Rainbow
          speed: 10
          width: 50
      - pulse:
          name: "Fast Pulse"
          transition_length: 100ms
          update_interval: 100ms
          min_brightness: 50%
          max_brightness: 100%
          
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_light
                red: 100%
                green: 89%
                blue: 71%
                brightness: 60%
                effect: none
          else:
            - light.turn_off: led_light

Also The LED Ring doesn’t light up. Same code, on esp32-wroom works with diffrent Pin mapping:

substitutions:
  board: esp32dev
  name: esp32-mic-speaker
  friendly_name: esp32-mic-speaker
  sclk_pin: GPIO23 # MSM261S4030H0 WS
  bclk_pin: GPIO22 # MSM261S4030H0 CLK
  din_pin: GPIO21  # MSM261S4030H0 DAT

Where is my misstake and what’s the right mapping for S3 with MP34DT01?

Thank you for your help!

Hi, did you ever get the pdm microphone to work?

No, I dropped it and took some i2s Mics. :smiley:

Yes, that’s exactly what I ended up doing :smile: