The MAX98357A I2S amp, by touch
The MAX98357A is a tiny mono Class-D amplifier that takes digital I2S audio straight from a microcontroller and drives a speaker directly. You don't need a DAC, an analog input, or even an MCLK pin. It just needs three wires of I2S, power, ground, and a speaker. These are my notes on it, written so you can wire one up without looking at it, because I can't.
I'm using the Adafruit board (product 3006), but most clones use the same 7-pin layout.
Buying one⌗
Most MAX98357A boards ship with the header pins loose in the bag, which means soldering before it'll go anywhere near a breadboard. Amazon listings that say "comes with headers" usually mean exactly that: they come with them, not attached to anything. On some boards the speaker screw terminal is loose too. Look for "pre-soldered" or "soldered" in the listing.
If you'd rather skip the soldering iron, there are boards with the headers already on, like this MAX98357A breakout with pre-soldered headers. The Adafruit version ($5.95) only half counts: the speaker terminal block comes soldered on, but the header is loose.
Pin order⌗
Hold the board chips up (pins down, if the headers were soldered the usual way), with the header pins closest to you and the speaker screw terminal away from you. Reading left to right:
| # | Pin | What it does | Typical connection |
|---|---|---|---|
| 1 | LRC | I2S left/right (word select) clock | MCU I2S WS/LRCLK pin |
| 2 | BCLK | I2S bit clock | MCU I2S BCLK pin |
| 3 | DIN | I2S audio data in | MCU I2S data-out pin |
| 4 | GAIN | Gain select; floating = 9 dB | Leave unconnected, or see Gain below |
| 5 | SD | Shutdown and channel select | Leave unconnected for stereo-average at 5 V |
| 6 | GND | Ground | Common ground with MCU and power |
| 7 | Vin | Power, 2.5–5.5 V | 5 V rail preferred |
How I remember it: the three I2S signals are on the left, power is on the far right, and ground is right next to it. The speaker goes to the screw terminal on the far edge, + and −.
Power⌗
Vin takes 2.5–5.5 V. Run it from 5 V even if your logic is 3.3 V, since the I2S pins are happy with 3.3–5 V logic. At 5 V, budget about 650 mA; Adafruit recommends a supply rated for 800 mA or more.
Speaker⌗
Use a moving-coil speaker of 4 Ω or more. Max output at 10% THD:
| Speaker | At 5 V | At 3.3 V |
|---|---|---|
| 4 Ω | 3 W | 1.3 W |
| 8 Ω | 1.8 W | 0.8 W |
Gain⌗
Set by what you hook the GAIN pin to. It may need a power cycle to take effect.
| GAIN connection | Gain |
|---|---|
| 100 kΩ to GND | 15 dB |
| Direct to GND | 12 dB |
| Unconnected (default) | 9 dB |
| Direct to Vin | 6 dB |
| 100 kΩ to Vin | 3 dB |
Shutdown and channel select⌗
The voltage on SD picks the mode:
| SD voltage | Result |
|---|---|
| Under 0.16 V | Shutdown (mute) |
| 0.16–0.77 V | (Left + Right) / 2 |
| 0.77–1.4 V | Right channel |
| Over 1.4 V | Left channel |
The board has a 1 MΩ pull-up from SD to Vin fighting an internal 100 kΩ pull-down, which lands you in stereo-average at 5 V. Pulling SD to GND from a GPIO is an easy software mute.
Gotchas⌗
- The speaker outputs are bridge-tied. Never connect either speaker terminal to ground, and don't feed this into another amp. It drives a speaker directly.
- It's I2S, not I2C. Different protocol, one letter apart, and search engines will cheerfully hand you the wrong one.
- Clone boards usually match this pin order, but check the silkscreen or a meter before you power up.