MAX98357A I2S audio amplifier with ESP32

Supply 3.3-5 V Bus GPIO
LRCBCLKDINGAINSDGNDVIN

Pins and ESP32 wiring

PinRoleESP32 pinNotes
LRCSPI chip selectD25I2S word select (LRCLK), not SPI
BCLKSPI clockD26I2S bit clock, not SPI
DINInput (the ESP32 drives it)D27I2S audio data from the ESP32
GAINNot wired to the ESP32—Leave unconnected for 9 dB
SDNot wired to the ESP32—Shutdown / channel select. Leave unconnected
GNDGroundGND
VINPower3V32.5 to 5.5 V; 5 V gives more volume

Suggested wiring for the 30-pin ESP32 DevKit, avoiding flash, input-only and strapping pins. BoardPilot checks it for you as you wire.

Starter code (Arduino)

void setup() { pinMode(27, OUTPUT); }  // DIN

void loop() {
  digitalWrite(27, HIGH);
  delay(500);
  digitalWrite(27, LOW);
  delay(500);
}

Sources

Try it in 3D in BoardPilot

BoardPilot Part data (JSON)

Related parts

Part data: CC BY 4.0, free to reuse with credit to BoardPilot.