Replacing a smart speaker with an ESP32 and an I2S amplifier
My smart speaker does exactly one job in this house: it plays internet radio and the occasional text-to-speech announcement from Home Assistant. Everything else about it — the account, the cloud dependency, the app that keeps redesigning itself — is overhead. So I built the dumb version.
Parts
- ESP32-S3 development board
- MAX98357A I2S amplifier module (3 W, class D)
- 4 Ω, 3 W full-range speaker
- USB power, 5 V
Total cost was less than a pizza. The amplifier is the interesting part: the MAX98357A takes I2S directly, needs no MCLK, and has a handful of gain settings selected by a resistor. No DAC, no codec configuration, no I2C dance to bring it up.
Wiring
Three wires carry the audio:
| MAX98357A | ESP32-S3 |
|---|---|
| BCLK | GPIO 26 |
| WS (LRCK) | GPIO 25 |
| DIN | GPIO 22 |
| VIN | 5 V |
| GND | GND |
I soldered everything. I have been burned too many times by Dupont jumpers that work on the bench and then vibrate loose inside an enclosure — especially next to a speaker, which is a vibration source by definition. A dot of hot glue at each solder joint works as strain relief.
Software
The board runs ESPHome, which makes it a native Home Assistant
media_player entity. Volume, playback and TTS all go through Home
Assistant; the speaker itself knows nothing and holds no state worth
mentioning. The ESPHome i2s_audio component with the internal DAC
disabled and the external device declared is most of the configuration:
i2s_audio:
i2s_lrclk_pin: GPIO25
i2s_bclk_pin: GPIO26
media_player:
- platform: i2s_audio
name: "Bench Speaker"
dac_type: external
i2s_dout_pin: GPIO22
mode: mono
Result
Radio starts in about a second, announcements are clear at desk volume, and the whole thing draws a watt or two from a USB port. It survived the only test that matters: I stopped thinking about it.
Next step is a printed enclosure. The current version lives in the traditional cardboard box of shame that every “temporary” project seems to end up in.