Cant get MAX98357A to work with my esp32-s3-devkitc-1

Hello,
i am trying to get my MAX98357A to work with my ESP32-S3. I tried several different ports, different MAX98357As but it just wont work.

I just try to make the speakers work but i never get any output.

Here is my YAML:

esphome:
  name: alexa-klon
  friendly_name: Alexa-Klon

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf

ota:
  platform: esphome

# ---------------------------
# I2S AUDIO
# ---------------------------

i2s_audio:
  - id: i2s_bus
    i2s_lrclk_pin: GPIO18
    i2s_bclk_pin: GPIO17

speaker:
  - platform: i2s_audio
    id: speaker_out
    i2s_audio_id: i2s_bus
    i2s_dout_pin: GPIO16
    dac_type: external
    channel: mono
    sample_rate: 16000
    bits_per_sample: 16bit
    buffer_duration: 500ms

media_player:
  - platform: speaker
    name: "ESP Speaker"
    id: esp_speaker
    announcement_pipeline:
      speaker: speaker_out
      format: WAV
      sample_rate: 16000
      num_channels: 1

I checked the voltages, i exchanged the wires, i tried different speakers and stuff, nothing works
Here is the Setup

Can anyone help me?

Why do you have scl connected to 5v? I assume you have shorted out the link marked out, on the esp32? Its not easy to tell from the pic.

Try this. Connections are in the top of the yaml. I have been using this since Sendspin got announced with no issues.

Hello,
it says sometimes you either need to connect the SD of the AMP to 3.3 or 5V to make it work... I removed it now.

So do i need to but the substitutions on top to make it easer to change when a GPIO switches?

I now tried different speakers, the different amps, different ports, external 5V-Supply, different codes but nothing seams to work... I am gonna order a different type of ESP32 and try again

Have you linked the out pads you didn't say? The 5v pin does not supply 5v unless you short those pads. If you are powering the amp from a second supply the grounds on the esp and the amp will need to be connected

As a last resort ditch the boards and solder the wires.

Instead of trying this and that, pick your multimeter and verify voltages. If your board is knockoff, your issue is likely what @Arh pointed above.

Yes i did that, there is a solder-point on top that i brigded... The Amp gets around 4.8V from the connected 5V-Pin, that should be enough.

The only thing i find weird, that usually where the speakers are connected, there should be at least a few mV but it showes me 0V... Maybe i am just stupid, i literally started like 3 Days ago

Well, not exactly 5V but it should still work according to the imprint on the MAX98357A

That voltage is normal, there is small drop caused by diode between usb and 5V pin.
Are your pins soldered properly? Power off your esp, and check continuity between esp and max pin by pin.

I used my multimeter again and i can confirm that all off the pins are connected the right way...
Maybe i shorted out the ESP32 or something, is there a way how i can check this?

Like does the ESP32 have a check for the pins to see, if they still work?

The logs will tell you what is happening.

For anyone wondering:
I figured it out... The logs in ESPHome always shows you the logs after you pressed the button for the logs... I always wondered why the logs are so empty...

Well after i found the glorious technology of "Opening a 2nd Tab in Edge", my ESP32 was just lacking the Ram, so i configured the PSRAM and boom, now it works...

I feel so stupid, after 3 Days of trying it was literally just 3 Lines of code

Just a tip - you can throw in a small capacitor right in front of the DAC between vin and gnd. Adding the capacitor will help smooth out any spikes/valleys you get if your speaker tries to pull more power as it plays various sounds.

If you hear slight static or clicking when it plays, try a capacitor.

Yeah i read about that a few times... What size should that be?
And where on the board should i place it?

You want it to be between the leads bringing the vin/gnd to the DAC and the DAC itself. I would move your vin/gnd lines to the 1st row on your tiny breadboard, then put the cap on the 2nd row, and then have your DAC leads plugged into the 3rd row. Wire it like you're powering the capacitor, and the capacitor is providing the power to the DAC.

In my project (basically the same) I used a 16v 470u capacitor. Tiny enough that you could easily have it in whatever you're building with enough juice to help the DAC out for those very brief moments. The 16v is plenty of room if powered by 5v.

Capacitor or not, sound quality will not really improve (it varies, from almost acceptable (still worse than a cheap FM radio) to just bad, with low volume all over). Maybe there are better DACs for the esp32-s3 around, but the max98357a is not among them.

To be fair a £3 dac is never going to be HiFi quality and if that's what you want it's never going to the answer for you.

The capacitor isn't to improve the audio quality; that will depend on the DAC and the speaker. We're not making stereo systems here :slight_smile: In my situation, it's just a doorbell/simple announcement speaker. The capacitor only helps with the crackling audio.

I'm aware of that (ideally even two capacitors, one small directly at the pin, a larger electrolytic one a little mroe away), but the quality sadly still remains pretty bad. I'm not looking for HiFi either, but would have been happy with "kitchen radio" quality (and better volume, without additional amplifiers).

I use them extensively to convert my vintage radios to a more modern radio signaal than short wave. I have no quality issues, no crackling or dropping out issues with these boards and the quality is fine, and perfectly acceptable. I don't mess about with decoupling caps or stuff.

I have at least one radio in each room of the house, all in sync using sendspin and never have an issue, or at least not had any issues with the esp32 s3 boards. Non s3 boards do cause issues though, but that's another story many are working on.