esp32.diy

Build an ESP32 Alexa Smart Speaker with I2S Audio

Oct 13, 2026 · 6 min read

Intermediate 275 stars 70 forks C MPL-2.0 Updated 2018-06-28
TL;DR ESP32_Alexa wires an ESP32 dev board to an I2S microphone and an I2S audio codec to create a push-to-talk Alexa client. Press the GPIO0 button, speak a command, and hear Alexa reply through a connected speaker.
What you need
  • ESP32 dev board
  • MAX98357A I2S amplifier/DAC breakout (Adafruit)
  • ICS-43434 I2S digital microphone
  • SPH0645LM4H I2S digital microphone (alternative)
  • 2× Neopixel LEDs
  • Potentiometer (recommended for volume control)
BoardESP32
FrameworkESP-IDF
LanguageC
LicenseMPL-2.0
DifficultyIntermediate
StatusWork in progress — voice recognition complete

What You Will Build

This project turns a standard ESP32 development board into a push-to-talk Alexa client. Wire up an I2S digital microphone to capture your voice, an I2S audio codec or amplifier to play back Alexa's response through a speaker, and two Neopixel LEDs to act as a status indicator. Once powered on, the device announces it is ready with a maniacal laugh. Press the GPIO0 button on your dev board and speak a command — Alexa replies through the speaker.

This is a meaningful project for anyone who wants to understand how voice assistants actually work at the hardware level. Instead of a sealed commercial device, you build every layer yourself: the microphone circuit, the I2S audio pipeline, the authentication flow, and the ESP-IDF firmware. It is also a practical starting point for embedding Alexa into a custom product, since you control the enclosure, the button placement, and the audio hardware.

Note that the project is explicitly described as a work in progress. Voice recognition is complete and working. The wakeword engine (always-on hotword detection), the audio player for music streaming, and alerts are listed as still to be done. Go in with that expectation and you will get a lot of value from it.

What You Need

Hardware

Alternatively, a purpose-built board called the ESP32 ADB Edge (available on Tindie from Microwavemont) is confirmed to work with this project out of the box.

Software

Typical use cases

Voice-Controlled Device Prototype

Use this as the audio and authentication foundation for any ESP32 project that needs Alexa voice control, from smart lamps to motorised blinds.

Learning I2S Audio on ESP32

The project is an end-to-end example of configuring dual I2S buses on the ESP32 — one for microphone input and one for DAC output — in bare-metal C with ESP-IDF.

Custom Smart Speaker Hardware

Pair the firmware with the purpose-built ESP32 ADB Edge board or your own PCB design to build a compact, permanent smart speaker without off-the-shelf enclosures.

AVS Integration Exploration

Study how a microcontroller authenticates with and streams audio to Amazon's Alexa Voice Service, providing a concrete reference for building AVS clients in embedded C.

How It Works

The ESP32 captures voice audio from the I2S microphone and streams it to Amazon's Alexa Voice Service (AVS) over Wi-Fi. AVS processes the speech, generates a response, and returns audio data that the ESP32 pipes out through the I2S codec to your speaker.

I2S (Inter-IC Sound) is a standard serial bus for moving digital audio between chips — similar in spirit to I2C but designed for audio sample rates. The ESP32 runs two separate I2S buses: one for the microphone input and one for the DAC/amplifier output.

Authentication with AVS requires a token tied to your device's MAC address. You generate this token once on the alexa.boeckling.net website, then store it in the firmware via the menuconfig configuration menu. The firmware prints the ESP32's MAC address to the serial console on startup so you can copy it easily.

Wiring

Wire the I2S audio output (codec/amplifier) to these ESP32 pins:

ESP pin   - I2S signal
----------------------
GPIO25/DAC1   - LRCK
GPIO26/DAC2   - BCLK
GPIO22        - DATA

If using the MAX98357A, connect its GND to ground and Vin to +5 V (or +3.3 V if +5 V is unavailable). The SD and GAIN pins can be left unconnected unless you want to adjust the gain.

Wire the I2S microphone to these pins:

ESP pin   - I2S signal
----------------------
GPIO18   - LRCK
GPIO17   - BCLK
GPIO05   - DATA

Chain the two Neopixel LEDs together and connect the data line to GPIO_NUM_4.

A potentiometer placed between the amplifier output and the speaker is recommended for volume control.

Build and Flash

1. Install the ESP-IDF SDK and toolchain

Clone ESP-IDF and initialise its submodules:

git clone https://github.com/espressif/esp-idf.git
cd esp-idf
git submodule update --init

Set the IDF_PATH environment variable to point at this directory:

export IDF_PATH=/path/to/esp-idf

Download the xtensa-esp32-elf toolchain version 5.2.0 from the ESP-IDF setup guide and add it to your PATH:

export PATH=/path/to/xtensa-esp32-elf/bin:$PATH

2. Clone the project

git clone https://github.com/MrBuddyCasino/ESP32_Alexa.git
cd ESP32_Alexa/
git submodule init && git submodule update

3. Get your Alexa authentication token

Plug in your ESP32 and open a serial monitor (115200 baud). Power cycle the board and note the MAC address printed to the console. Go to https://alexa.boeckling.net/, create a new authentication token for that MAC address, and copy it.

4. Configure the firmware

make menuconfig

In the serial port settings, select the correct port for your board. Open the Alexa config menu and paste in your authentication token. Leave all other settings at their defaults.

5. Build and flash

make flash

The project will compile and flash to your board. On the next boot you should hear the maniacal laugh confirmation sound, which means the device is ready. Press the GPIO0 button, speak a command, and Alexa should respond through the speaker.

Limitations and Ideas to Extend It

Current limitations

The wakeword engine is not yet implemented, so you must press a physical button every time you want to speak to Alexa. Continuous always-on listening — the way commercial Echo devices work — is listed as a future goal. Music streaming via the audio player and timer/alert support are also unfinished. This project is best understood as a working proof of concept for the core voice-capture-and-response loop, not a feature-complete smart speaker.

The project was last updated in 2018, so the authentication endpoint at alexa.boeckling.net may no longer be active. If that service is unavailable, you will need to register your own AVS device through Amazon's developer portal and adapt the authentication flow, which requires familiarity with OAuth 2.0 and HTTP client code in C.

Ideas to extend it

Verdict

ESP32_Alexa delivers a working push-to-talk Alexa client on bare ESP32 hardware, complete with I2S microphone input and I2S amplifier output — an impressive foundation given the hardware constraints. The wiring is clearly documented, the pin assignments are explicit, and the MAX98357A recommendation removes the tricky MCLK problem from the start. The project has not been updated since 2018 and several features remain unfinished, so treat it as a strong starting point for your own development rather than a drop-in product.

Sources

github.comMrBuddyCasino/ESP32_Alexa — repository & README

Facts in this article come from the project's public README and GitHub metadata at the time of writing. Images belong to their respective owners and link back to the original source.