ESP32-A1S Audio Kit Media Player

Hi Omri,
I’ve started working with the A1S but it’s a bit of a nightmare for lack of documentation.
Could you share some code so I can figure out how to access the LED’s, switches and audio parts? Anything could help a lot.
Best regards

My links …
ESP32 Audio Kit (ESP32-A1S) Info in a german forum
The ‘AI Thinker Audio Kit’ Arduino Challenge
Squeezelite-esp32-on-ESP32-Audio-Kit From squeezelite forums

@viniciusnbs This forum is an English language only forum, please read this post.

I just got my board and thank you so much for the Yaml code, providing all the details. This helped me A LOT setting things up.

Since there are microphones on the board, I was wondering if you can do a wake word detection on the device and then use HA as a server to receive the audio streams, decode them and send back the reply? Anyone tried this already?

Has anyone tried Resonate with this yet?

if anyone is interested how it can work with the new dac_audio stack
here is my working config

esphome:
  name: esp32-audio-kit

esp32:
  board: esp-wrover-kit
  framework:
    type: esp-idf

api:
ota:
  - platform: esphome
    port: 3232

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

logger:
  level: DEBUG

# New audio stack
audio_dac:
  - platform: es8388
    i2c_id: my_i2c_id
    id: es8388_dac
    # Optional codec settings (uncomment/tune if desired)
    # mic_gain_db: 0
    # dac_volume_db: -3
    # de_emphasis: none
    # swap_lr: false

i2c:
  id: my_i2c_id
  sda: GPIO33
  scl: GPIO32

i2s_audio:
  i2s_lrclk_pin: GPIO25
  i2s_bclk_pin: GPIO27
  i2s_mclk_pin: GPIO0
  id: i2s_output

media_player:
  - platform: speaker
    id: esp32_audio_kit_player
    name: "ESP32 Audio Kit"
    announcement_pipeline: 
      speaker: speaker_id

speaker:
  - platform: i2s_audio
    i2s_audio_id: i2s_output
    sample_rate: 48000
    id: speaker_id
    i2s_dout_pin: GPIO26
    bits_per_sample: 32bit
    dac_type: external
    channel: stereo
    buffer_duration: 100ms
    audio_dac: es8388_dac

switch:
  - platform: gpio
    pin: GPIO21
    name: "AMP Switch"
    restore_mode: ALWAYS_ON

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO39
      inverted: true
      mode:
        input: true
    name: "Jack Status"

  - platform: gpio
    pin:
      number: GPIO036
      inverted: true
    name: "Key 1"
    filters:
      - delayed_off: 10ms

  - platform: gpio
    pin:
      number: GPIO013
      inverted: true
    name: "Key 2"
    filters:
      - delayed_off: 10ms

  - platform: gpio
    pin:
      number: GPIO019
      inverted: true
    name: "Key 3"
    filters:
      - delayed_off: 10ms

  - platform: gpio
    pin:
      number: GPIO023
      inverted: true
      mode:
        input: true
        pullup: true
    name: "Key 4"
    filters:
      - delayed_off: 10ms

  - platform: gpio
    pin:
      number: GPIO018
      inverted: true
      mode:
        input: true
        pullup: true
    name: "Key 5"
    filters:
      - delayed_off: 10ms

  - platform: gpio
    pin:
      number: GPIO005
      inverted: true
      mode:
        input: true
        pullup: true
    name: "Key 6"
    filters:
      - delayed_off: 10ms

light:
  - platform: binary
    name: "Test LED 1"
    output: light_output_1

output:
  - id: light_output_1
    platform: gpio
    pin: GPIO22
    inverted: true
1 Like

Hi,

I’ve been trying to bring up a recently purchased ESP32-A1S V2.2 using the YAML found in @RaceNJason 's GITHUB project. So far, when I try to play internet radio stations, the HAOS Music application reverts back to pause shortly after I press play.

I can switch away from the ESP32-A1S to the local computer and play the radio station without issue.

I can see switch closures from the board in HAOS. And I can control an LED on the board from HAOS. So (some) communications is working.

I’ve looked at the logs for errors but did not find any. I started to look at the raw logs but did not get a change to really analyze it yet.

Any suggestions as to what to try next would be greatly appreciated!

Next, I tried @nep7un YAML. I heard a click sound when I first tried to play an internet radio station. But nothing after that. I still had the problem where the HAOS music app would switch back to pause soon after I pressed play. That same HAOS music app would work fine if I swiched away from the ESP32-A1S to the local computer as a playback device. So, I’m thinking the internet radio station, the HAOS music app and most of HAOS is working as expected.

If you’re having audio troubles, try adjusting the power save mode of your WiFi module. This will make streaming audio much smoother and fixed similar issues I was having:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  power_save_mode: none
1 Like

Any ideas on using the audio kit with the new sendspin?

You should be able to copy the sendspin code over from here. I’m going to try it later today.

1 Like

I hacked this together for Sendspin. I got it working, and syncing in a group with my browser. Unfortunately, the experimental setting for Google devices doesn’t seem to be working as it did in the beta version so I can’t try sync with other devices yet.

substitutions:
  name: esp32-sendspin-audio
  friendly_name: ESP32 Sendspin Audio Player

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  name_add_mac_suffix: true
  
  # Ensure the physical amplifier on the A1S is turned on at boot
  on_boot:
    priority: 600
    then:
      - switch.turn_on: amp_power

esp32:
  board: esp-wrover-kit
  framework:
    type: esp-idf

# Logging
logger:
  level: INFO

# API for Home Assistant
api:

ota:
  - platform: esphome

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  power_save_mode: NONE
  ap:
    ssid: "${friendly_name}"
    password: "fallback-password"

captive_portal:

i2c:
  sda: GPIO33
  scl: GPIO32
  frequency: 200kHz
  scan: true
  id: bus_a

audio_dac:
  - platform: es8388
    id: es8388_dac
    i2c_id: bus_a
    # These settings manage the hardware chip itself
    # mic_gain: 18dB
    # dac_volume: 75%

i2s_audio:
  - id: i2s_out
    i2s_lrclk_pin: GPIO25
    i2s_bclk_pin: GPIO27
    i2s_mclk_pin: GPIO0    # MCLK is critical for the A1S


switch:
  - platform: gpio
    pin: GPIO21
    id: amp_power
    name: "Amplifier Power"
    restore_mode: ALWAYS_ON

speaker:
  - platform: i2s_audio
    id: spk
    i2s_audio_id: i2s_out
    i2s_dout_pin: GPIO26
    audio_dac: es8388_dac
    dac_type: external
    channel: stereo
    sample_rate: 48000
    bits_per_sample: 32bit
    buffer_duration: 100ms

# --- SendSpin & Media Player Logic (Standard) ---

external_components:
  - source:
      # https://github.com/esphome/esphome/pull/12253
      type: git
      url: https://github.com/esphome/esphome
      ref: 0fe230114c80b6d3378f04c777baadee178e40ad
    components: [mixer]
  - source:
      # https://github.com/esphome/esphome/pull/12254
      type: git
      url: https://github.com/esphome/esphome
      ref: 1ab4b990092ae063a16cb1511a188c536fdb336e
    components: [resampler]
  - source:
      # https://github.com/esphome/esphome/pull/12256
      type: git
      url: https://github.com/esphome/esphome
      ref: 047ba60f01af84513f8d5aabaa2a53074facee8f
    components: [audio]
  - source:
      # https://github.com/esphome/esphome/pull/12258
      type: git
      url: https://github.com/esphome/esphome
      ref: bff22983a390352360796f8e1363127e0cd1f898
    components: [media_player]
  - source:
      # https://github.com/esphome/esphome/pull/12284
      type: git
      url: https://github.com/esphome/esphome
      ref: 9d2d2f6287a72af6397dfd93ee56fbab25c1d32f
    components: [mdns, sendspin]
  - source:
      # https://github.com/esphome/esphome/pull/12429
      type: git
      url: https://github.com/esphome/esphome
      ref: 72499eaed2ed54316aca90d368053aa2e1a54f5f
    refresh: 0s
    components: [file, http_request, media_source, speaker_source]

sendspin:
  id: sendspin_hub
  task_stack_in_psram: true
  kalman_process_error: 0.01

media_source:
  - platform: sendspin
    id: sendspin_source

media_player:
  # Optional. Only used for controlling a Sendspin group
  - platform: sendspin
    id: sendspin_media_player
    name: Sendspin Group Media Player
  
  # Required to play audio (part of #12429)
  - platform: speaker_source
    name: Sendspin Media Player
#    id: sendspin_media_player
    volume_min: 0.4
    volume_max: 0.85
    media_speaker: spk
    sources:
      - sendspin_source


status_led:
  pin:
    number: GPIO22
    inverted: true

I believe this will work. This is my complete ESP32-A1S config, which I modified to add Sendspin. I haven’t tested it myself, but I took my working Sendspin config from another device which did work, and merged it with my previously-worked ESP32-A1S config.

I’m away for Christmas at the moment or I would test it myself, but my board is at home!

esphome:
  name: esp32-a1s
  friendly_name: ESP32-A1S
  project:
    name: esphome.sendspin-metadata
    version: dev

esp32:
  board: esp-wrover-kit
  framework:
    type: esp-idf
  

# Enable logging
logger:


psram:

external_components:
  - source: github://pr#10212
    components: [runtime_image, online_image]
    refresh: 1h
  - source: github://pr#12258
    components: [ media_player ]
  - source: github://pr#12284
    components: [generic_image, mdns, sendspin]
    refresh: 0s

microphone:
  - platform: i2s_audio
    id: i2smic
    i2s_din_pin: GPIO35
    adc_type: external
    pdm: false

i2c:
  id: bus_a
  sda: GPIO33
  scl: GPIO32
  frequency: 100kHz

audio_dac:
  - platform: es8388
    i2c_id: bus_a
    id: es8388_dac

select:
  - platform: es8388
    es8388_id: es8388_dac
    dac_output:
      name: "DAC Output"
    adc_input_mic:
      name: "ADC Input MIC"

switch:
  - platform: gpio
    pin: GPIO21
    id: mute_switch
    name: "AMP Switch"
    restore_mode: ALWAYS_ON

i2s_audio:
  i2s_lrclk_pin: GPIO25
  i2s_bclk_pin: GPIO27
  i2s_mclk_pin: GPIO0
  id: i2s_output

sendspin:
  id: sendspin_hub
  task_stack_in_psram: true

media_player:
  - platform: sendspin
    id: sendspin_media_player
    name: Sendspin Player

speaker:
  - platform: i2s_audio
    i2s_audio_id: i2s_output
    sample_rate: 48000
    id: speaker_id
    i2s_dout_pin: GPIO26
    bits_per_sample: 32bit
    dac_type: external
    channel: stereo
    buffer_duration: 100ms
    audio_dac: es8388_dac

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO39
      inverted: true
      mode:
        input: true
    name: "Jack Status"

  - platform: gpio
    pin:
      number: GPIO036
      inverted: true
    name: "Key 1"
    filters:
      - delayed_off: 10ms

  - platform: gpio
    pin:
      number: GPIO013
      inverted: true
    name: "Key 2"
    filters:
      - delayed_off: 10ms

  - platform: gpio
    pin:
      number: GPIO019
      inverted: true
    name: "Key 3"
    filters:
      - delayed_off: 10ms

  - platform: gpio
    pin:
      number: GPIO023
      inverted: true
      mode:
        input: true
        pullup: true
    name: "Key 4"
    filters:
      - delayed_off: 10ms

  - platform: gpio
    pin:
      number: GPIO018
      inverted: true
      mode:
        input: true
        pullup: true
    name: "Key 5"
    filters:
      - delayed_off: 10ms

  - platform: gpio
    pin:
      number: GPIO005
      inverted: true
      mode:
        input: true
        pullup: true
    name: "Key 6"
    filters:
      - delayed_off: 10ms

output:
  - platform: ledc
    pin: 
      number: GPIO22
      inverted: true
    id: output_led

light:
  - platform: binary
    name: "Red LED"
    id: red_led
    output: output_led
    restore_mode: ALWAYS_OFF



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

ota:
  - platform: esphome
    password: "x"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp32-A1S Fallback Hotspot"
    password: "x"

captive_portal:
    

it is not working for me sadly no output

I also have no audio output and described the issue here No Output on Audio Kit V2.2 A541 · Issue #4 · RaceNJason/ESP32_A1S_Audio_Kit_Media_Player · GitHub

Hey everyone!

After some trial and error, I got Sendspin working on the AI-Thinker ESP32-A1S Audio Kit (with ES8388 codec) and wanted to share my configuration for anyone else trying to set this up.

What’s Working
:white_check_mark: Sendspin synchronized audio playback via Music Assistant
:white_check_mark: ES8388 DAC/ADC configuration
:white_check_mark: Track metadata (title, artist, album)
:white_check_mark: Hardware buttons and jack detection
:white_check_mark: Microphone input

GitHub Repository
I’ve published the complete working YAML configuration here:

The repo includes:

Full ESPHome configuration (esp32-a1s.yaml)
Pin mapping documentation
Troubleshooting tips
Secrets template
:warning: Important Notes for ESPHome 2026.1.x
Currently, this configuration requires several external components from open PRs because Sendspin hasn’t been merged yet:

PR #12284 - Sendspin protocol
PR #12253 - Mixer
PR #12254 - Resampler
PR #12258 - Media player
PR #12429 - Speaker source
There’s also a workaround needed for the audio component (using commit 9148832) to avoid the include_builtin_idf_component error on ESPHome 2026.1.x.

Future Simplification
Once PR #12284 and the related PRs are merged (expected in ESPHome 2026.2.0 - February release), the configuration will be much simpler - no external components needed!

Requirements
ESPHome 2026.1.x or later
Music Assistant 2.7.0 beta 19 or later
AI-Thinker ESP32-A1S Audio Kit

Tips
If you don’t hear audio, check the DAC Output setting in Home Assistant - try BOTH or LINE2
Make sure AMP Switch is ON
Clear .esphome/external_components/ folder if you encounter weird compilation errors
Hope this helps someone! Feel free to open issues on the GitHub repo if you run into problems.

6 Likes

There are a bunch of compilation errors being thrown up when this is compiled under either 2026.1 or 2026.2, they apparently relate to a bug in the upstream code.

Can I ask if you know whether we can work around these PR’s given that 2026.2 is out?

2026.2 is not out yet !

esphome current latest version is Release 2026.1.5 - February 11

these PR will not compile with current latest version

use prior build or Dev to compile

If trying to compile with sendspin you will need to compile in the dev branch until 2026.2 is released and then there is still no guarantee it will compile then. Sendspin is still in beta and changing almost weekly.

Hopefully by 2026.3 it should be merged, and stable.

See the Music assistant discord channel for latest info.

1 Like

Hey everyone
I just bought one of these esp32 audio kits, in the hope turning it into a media player for my workshop.
But I am having a hard time getting it to work. My best luck was with this GitHub - punxhonor/esp32_a1s_es8388-HA-Voice-Assistant-Media-Player-Working: I'm very new to all this, but this is my attempt at having a working Voice Assistant satellite with OpenWakeWord as well as media player ability. · GitHub
But that seemed to overload my board and made it not usable.
I am running the latest Home-assistant, how are others using the board?