ESPHome I2S media_player internal DAC

Hi guys,

I’m looking for an sample configuration using the new esphome I2S Media Player with internal DAC. Does anyone have the pinouts and wiring required?

Thanks

for the “classic” esp32

    DAC1 (GPIO25)
    DAC2 (GPIO26)

as written on: ESP32 Pinout Reference: Which GPIO pins should you use? | Random Nerd Tutorials

2 Likes
-snip-

media_player:
  - platform: i2s_audio
    name: ESPHome I2S Media Player
    dac_type: internal
    mode: stereo

output:
  - platform: esp32_dac
    pin: GPIO26
    id: left
  - platform: esp32_dac
    pin: GPIO25
    id: right

Working - BUT the 8 bit DACs are very noisy

5 Likes

Thank you.

Thats really helpful

I need a bit of help. I want to the below but with ESPHome, any idea what I would need to add so it will work? The thing is instead of compiling the wav file I just want to play a media file. I connected the speaker but all i get is a little static.

I added this to the yaml, so I just want to know what to do

media_player:
  - platform: i2s_audio
    name: ESPHome I2S Media Player
    dac_type: internal
    mode: stereo

output:
  - platform: esp32_dac
    pin: GPIO25
    id: right
1 Like

Hi, you can leave out the output, the media_player works for internal dac_type without it.
The only thing is that it makes a lot of crackling noise. I tested it on multiple esp32’s. When I use an external I2S DAC there is no noise.

Anybody have the same issues with the internal DAC?

I have the same problem as yours… Static sound, but using the external dac (UDA1334ATS) on the sound board.

Have you found a solution to it ?

I am trying to use the SPK2 HAT, which should be able to leverage the I2S internal DAC (Speaker is GPIO26)

However attempts to setup the output of the DAC results in an error for being ambiguous.

i2s_audio:
#   Audio for Speaker
  - id: spk_adc
    i2s_lrclk_pin: GPIO0

media_player:
  - platform: i2s_audio
    id: media_out
    name: ${device_friendly_name}
    i2s_audio_id: spk_adc
    dac_type: internal
    mode: stereo

output:
# Digital to Analog Convertor --- Used because SPK2 HAT is directly connected to the speaker wire
  - platform: esp32_dac
    pin: GPIO26
    id: right    

If I comment out the esp32_dac the code compiles but I am unable to get audio from the speaker. This is very odd because the speaker works using the external DAC. I am going to see if I can get the microphone and speaker to leverage the same i2s_lrclk_pin successfully as an alternative.

I know this is a one and a half year old topic, but I have a LM386 myself as well. Did you get any sound out of this? Can you post your complete configuration?

Can you provide more example?
I’m using:


i2s_audio:
  i2s_lrclk_pin: GPIO22
  i2s_bclk_pin: GPIO23
    
media_player:
  - platform: i2s_audio
    name: ESPHome I2S Media Player
    dac_type: internal
    mode: stereo

And connect GND/gpio25 to headphone jack,
But there is no sound when playing any wav file.
Not sure what is wrong.