MAX98357A I2S audio amplifier with ESP32
Supply 3.3-5 V
Bus GPIO
Pins and ESP32 wiring
| Pin | Role | ESP32 pin | Notes |
|---|---|---|---|
| LRC | SPI chip select | D25 | I2S word select (LRCLK), not SPI |
| BCLK | SPI clock | D26 | I2S bit clock, not SPI |
| DIN | Input (the ESP32 drives it) | D27 | I2S audio data from the ESP32 |
| GAIN | Not wired to the ESP32 | — | Leave unconnected for 9 dB |
| SD | Not wired to the ESP32 | — | Shutdown / channel select. Leave unconnected |
| GND | Ground | GND | |
| VIN | Power | 3V3 | 2.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
- Maxim MAX98357A datasheet, I2S inputs BCLK, LRCLK, DIN; supply 2.5 to 5.5 V
Try it in 3D in BoardPilot
Related parts
18650 Li-ion cell in holder28BYJ-48 stepper + ULN2003 driver433 MHz transmitter (FS1000A)74HC595 shift registerA4988 stepper driverActive buzzer
Part data: CC BY 4.0, free to reuse with credit to BoardPilot.