Index
Introduction
In this project, we combine the INMP441 microphone and MAX98357A amplifier with a speaker to create a simple voice recording and playback system using the ESP32.
When you speak into the INMP441 microphone, it captures your voice and sends the digital audio data to the ESP32 through the I²S interface. The ESP32 then processes the recorded audio and sends it to the MAX98357A amplifier, which amplifies the audio signal and plays it through the connected speaker.
This project demonstrates how the ESP32 can be used to capture, process, and reproduce audio, making it a great starting point for more advanced projects such as voice assistants, audio recorders, and AI-based voice applications.
Wiring the INMP441 and MAX98357A to ESP32
Connect your microphone and speaker using the standard I²S pins for this project.
| Component | Pin | ESP32-S3 | ESP32 | Function |
|---|---|---|---|---|
| INMP441 | VDD | 3V3 | 3V3 | Power |
| GND | GND | GND | Ground | |
| SD | GPIO 42 | GPIO 35 | Serial Data (Audio In) | |
| SCK (BCLK) | GPIO 2 | GPIO 33 | Bit Clock | |
| WS (LRCK) | GPIO 1 | GPIO 32 | Word Select (Left/Right Clock) | |
| L/R | GND | GND | Channel Select (Ground = Left Channel) | |
| MAX98357A | VIN | 5V (or 3.3V) | 5V (or 3.3V) | Power (5V is louder) |
| GND | GND | GND | Ground | |
| DIN | GPIO 41 | GPIO 27 | Data In (Audio Out from ESP) | |
| BCLK | GPIO 14 | GPIO 26 | Bit Clock | |
| LRC | GPIO 46 | GPIO 25 | Left/Right Clock (Word Select) |
Critical Note: The L/R pin determines if the mic outputs to the Left or Right channel. Connecting it to GND selects the Left channel, which is required for our code configuration.
Note: The MAX98357A often has a “Gain” pin. You can usually leave this floating (unconnected) for default gain, or connect it to GND via a resistor to lower the volume if it’s too loud.
Flash Firmware (Browser-Based)
No Arduino IDE required — flash directly from your browser using Web Serial.
- Click “CONNECT” below according your board
- Hold BOOT button on ESP32 and connect USB
- Select the ESP32 port and click Connect
- Choose “MIC-DAC-TEST” and click Install
- Wait 2 minutes for completion