Basic mediaplayer ESP32-A1S V2.2 A520 no sound

922
Hello everyone, I’m new to this forum and may not be fully up to date on all the rules.
I’m trying to create a media player that can play sounds and TTS from HA. Unfortunately, I can’t get any sound out of the media player.

I’ve spent many hours on it but can’t get it to work.

This is what I have:
-) Home Assistant (2026.1.3.) running on an HP ThinClient.

-) Hardware media player Ai-Thinker ESP32-Audio-Kit V2.2 A520 (ESP32-A1S, ES8388 codec, and 2x NS4150 amplifier chips)

-) I flashed a basic configuration onto the ESP32-Audio-Kit.

-) I integrated the media player into HA via ESPhome and connected to the media player via Wi-Fi.

-) When I play an audio file, I see a small red LED flashing on the ESP32 Audio Kit and I hear some slight hiss coming from the speaker.

Unfortunately, I have no sound.

This is the YAML code I used for flashing:

esphome:
  name: esp32-a1s
  friendly_name: "ESP32-A1S Media"

esp32:
  board: esp32dev
  framework:
    type: arduino

wifi:
  ssid: "SSID"
  password: "password"

logger:
api:

ota:
  platform: esphome

# I2C voor ES8388
i2c:
  sda: 33
  scl: 32
  scan: true

# ES8388 codec (alleen init, geen koppeling nodig)
audio_dac:
  - platform: es8388

# I2S bus
i2s_audio:
  - id: audio_bus
    i2s_lrclk_pin: 26
    i2s_bclk_pin: 27
    i2s_mclk_pin: 0   # waarschuwing is normaal

media_player:
  - platform: i2s_audio
    name: "ESP32-A1S Player"
    i2s_audio_id: audio_bus
    dac_type: external
    i2s_dout_pin: 22
    mode: stereo

# NS4150 versterker aan
switch:
  - platform: gpio
    pin: 21
    name: "AMP Enable"
    restore_mode: ALWAYS_ON

Does anyone know how I could fix this?

Hi, I did a fair bit of playing around as I have the same problem on my new A1S Audio Kit. I could not get audio out of the HEADPHONES though - is that also your problem?

It turns out that there are a number of different A1S devices, some with PCM5102 based codec chips, and some with ES8388 codecs. Mine is the ES8388 type.

I found this code which works for me but it includes patches of pre-released code, so it’s a bit of a hack, I suppose.
After I compile it I just need to go into HA and enable the “AUX OUT” switch (to enable the headphones lines), and I get (choppy) audio:

You’ll see the switch: aux_output lambda in the code - that’s selecting the headphones output through the i2s bus, that’s not present in the example code which I think that you’ve based your code off (ES8388 - ESPHome - Smart Home Made Simple).
Plus, just check your i2s pins numbering as the number differ for the PCM5102 and ES8388 devices as I mentioned.

i2s_audio:
  - id: i2s_audio_bus
    i2s_lrclk_pin: GPIO25
    i2s_bclk_pin: GPIO27

It’s worth noting that RaceNJason published later code on github, but this does not work on my board.

I’ll dig into why later.

Keep an eye on this thread too as it mentions that Sendspin should be merged and released as A-rev next month:

That’s what mine is and what my code on the repository supports (haven’t seen the PCM5102 version). If you are using old code of mine, some people reported some crackling problems because the default I2C speed is 50kHz (since it wasn’t originally specified). I now specify 200kHz which seemed to resolve that problem (at least for the people that reported it).

I also updated the button press code to use events (and just now updated the repository with those changes). This is a better way to resolve the delay issue where too fast of a state change doesn’t register in HA. With events, button presses are always registered no matter how fast you press them.

If you want to specify exactly what problems you are having when using my latest code I’d be happy to look into any fixes that can be implemented…