Solved: ESPHome Media Player with M5Stack SPK kit and AtomS3 Lite

I’m posting this here, hoping it might help someone one day. This post is just how I got things to work.

I wanted to create a tiny media player based on the M5Stack SPK kit. ESPHome Ready Made projects lists this device, but with a different controller than I had. I have an AtomS3 Lite.

The pinout on this Lite controller is different from all the examples I found online. As with all of these things, the solution is simple. Eventually.

The SPK kit neatly lists the pins associated with the required BCLK/DATA/LRCLK connections. These numbers are also printed on the PCB. Taking the AtomS3 Lite and lining the female pins up with the male SPK pins yields a mapping!
GPIO22 becomes GPIO5
GPIO21 becomes GPIO39
GPIO25 becomes GPIO38

Taking this mapping and the sample code from the Read Made projects yields this YAML:

substitutions:
  name: esphome-web-5ce3e0
  friendly_name: M5 SPK AtomS3 Lite

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  min_version: 2024.6.0
  name_add_mac_suffix: false
  platformio_options:
    board_build.flash_mode: dio
  project:
    name: esphome.web
    version: dev

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

# Enable logging
logger:

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:
- platform: esphome

# Allow provisioning Wi-Fi via serial
improv_serial:

wifi:
  # Set up a wifi access point
  ap: {}

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

i2s_audio:
  - id: i2s_audio_bus
    i2s_lrclk_pin: GPIO39
    i2s_bclk_pin: GPIO05

media_player:
  - platform: i2s_audio
    id: media_out
    name: None
    dac_type: external
    i2s_dout_pin: GPIO38
    mode: mono

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO41
      inverted: true
    id: top_button
    name: Button
    on_click:
      - media_player.toggle: media_out

light:
  - platform: esp32_rmt_led_strip
    rgb_order: GRB
    pin: 35
    num_leds: 1
    rmt_channel: 0
    chipset: ws2812
    id: status_led
    name: AtomS3 lite Light

button:
  - platform: safe_mode
    id: button_safe_mode
    name: Safe Mode Boot

  - platform: factory_reset
    id: factory_reset_btn
    name: Factory reset

I had to do something similar with the button GPIO.

The light was a bit more complex. But this issue in ESPHome had a solution that worked immediately.

I hope this helps someone!