Skip to content
esp-labsESP32-S3 bench guide
ESP32-S3 DevKitC pinoutThis lesson uses: VCC on 3V3, MICS + on 3V3, AO on 6, BLK on 7, RES on 8, DC on 9, CS on 10, SDA on 11, SCL on 12, AMP VIN on 5V, GND on GND, BTN on 5, MICS G on GND, SD on 42, WS on 41, SCK on 40, BCLK on 39, LRC on 38, BOOT on 0, DIN on 47, DO on 21, AMP G on GND.ESP32-S3WROOM-1 N16R8BOOTRSTRGBUSBCOM3V3VCC3V3MICS +RST45BTN6AO7BLK151617188RES3469DC10CS11SDA12SCL13145VAMP VINGNDGNDGNDMICS GTX 43RX 441242SD41WS40SCK39BCLK38LRC3736350BOOT454847DIN21DO2019GNDAMP GGND
  • used in this lesson
  • safe GPIO
  • avoid
  • power
  • ground
  • button input
  • RC522
Between lessons
  1. Ctrl+C closes the monitor on the Mac only. The board keeps running.
  2. Unplug USB: this is what stops the program and the screen
  3. Rewire while off
  4. Check VCC is on 3V3, no loose ends
  5. Plug in, flash the next lesson

Never unplug during Writing at 0x…. Pin changing from output to input? Flash first, then wire.

Lesson S4

Sound · lesson 4 of 8

A voice-activated recorder

built, not flashed

KY-037 or INMP441Wi-Fi (W1) (optional)MAX98357A + speaker (optional)Armed, the board waits for a sound louder than the trigger, then records into PSRAM, starting half a second before the trigger (the ring buffer still has it), until 1.2 s of quiet. Up to 12 clips, 6 MB, gone on reset. Listen on your phone at http://bench.local (the Wi-Fi network W1 saved, plus the admin token), or pull a WAV over USB with tools/sound_pull.py, or play it on the board's own speaker (play 3 0.7: slower and deeper). The board always shows REC and a red LED while it records, whoever started it.

Goal

Record a sentence hands-free, see the pre-roll, play it on your phone, and pull one clip to your Mac as a WAV file.

You're done when

  • arm, then talk: the recorder view goes ARMED → REC → ARMED and clips lists a voice clip.
  • A door slam or a single clap starts a recording but is dropped (too short).
  • The phone page at http://bench.local unlocks with the token, draws the clip and plays it.
  • tools/sound_pull.py wrote a .wav that plays on the Mac.
  • play (or a double-click on clips) plays the picked clip on the board's speaker; play 1 2 is a chipmunk.

You will learn

  • pre-roll from a ring
  • trigger + hold
  • PSRAM clip store
  • WAV format
  • streaming responses
  • base64 + CRC-32
  • playback speed = pitch
  • tokens & visible recording
uv run pio run -d labs/sound-lab-s4 -e sound-lab-s4 -t upload
Open this lab's code on GitHubesp-labs / labs / sound-lab-s4 (opens in a new tab)

Parts required

Parts library
  • ESP32-S3-DevKitC-1 + USB-C data cable
  • 1.9″ ST7789 screen
  • KY-037 analog microphone
  • INMP441 I²S microphone
  • Optional: MAX98357A amp + speaker
  • Optional: 2.4 GHz Wi-Fi network

Voice-activated recording, step by step

Nine seconds: a door bang, then a sentence with a pause in it. Step through or play, move the trigger and the hold. Amber = the pre-roll taken from the ring, red = recorded, grey = dropped.

Voice-activated recorder timeline showing pre-roll ring buffers, silence timeout, and HTTP streaming. Nine seconds: a door bang, then a sentence with a pause in it. Step through or play, move the trigger and the hold. Amber = the pre-roll taken from the ring, red = recorded, grey = dropped.

  • Key concepts: pre-roll from a ring, trigger + hold, PSRAM clip store, WAV format, streaming responses, base64 + CRC-32, playback speed = pitch, tokens & visible recording.
  • Signals & pins: 3V3 (VCC), 3V3 (MICS +), GPIO6 (AO), GPIO7 (BLK), GPIO8 (RES).

Interactive diagram loads after page initialization.

Getting the audio out

Three paths: the phone over Wi-Fi, the Mac over the USB serial port, or the board's own speaker. Below: the 44 bytes every WAV file starts with (for a 3.2 s clip at 16 000 Hz).

Audio-driven breakout and pitch game mechanics mapped to live microphone input. Three paths: the phone over Wi-Fi, the Mac over the USB serial port, or the board's own speaker. Below: the 44 bytes every WAV file starts with (for a 3.2 s clip at 16 000 Hz).

  • Key concepts: pre-roll from a ring, trigger + hold, PSRAM clip store, WAV format, streaming responses, base64 + CRC-32, playback speed = pitch, tokens & visible recording.
  • Signals & pins: 3V3 (VCC), 3V3 (MICS +), GPIO6 (AO), GPIO7 (BLK), GPIO8 (RES).

Interactive diagram loads after page initialization.

What the screen shows

Three views. Click = next, double-click = the action at the bottom left (arm, next, wifi), long press = rec / stop.

Gallery of ST7789 audio visualizers rendered across the Sound track. Three views. Click = next, double-click = the action at the bottom left (arm, next, wifi), long press = rec / stop.

  • Key concepts: pre-roll from a ring, trigger + hold, PSRAM clip store, WAV format, streaming responses, base64 + CRC-32, playback speed = pitch, tokens & visible recording.
  • Signals & pins: 3V3 (VCC), 3V3 (MICS +), GPIO6 (AO), GPIO7 (BLK), GPIO8 (RES).

Interactive diagram loads after page initialization.

Wiring: the microphones and the speaker (wire what the lab needs; the screen stays as in lesson 03)

Module pinESP32-S3Notes
KY-037 + · G3V3The analog mic. + on the second 3V3 pin (the screen has the first), G on GND. Never 5 V: AO and DO swing up to the module's supply, and the ESP32-S3's pins take 3.3 V at most.
KY-037 AOGPIO 6Analog out: the microphone's voltage. GPIO 6 is ADC1 channel 5: ADC1 keeps working while Wi-Fi is on, ADC2 doesn't.
KY-037 DOGPIO 21Digital out: the LM393 comparator says high when the sound is louder than the blue trim pot's setting.
INMP441 VDD · GND3V3The digital mic (I2S). VDD on 3V3 (share the breadboard rail with the KY-037), GND on GND. 3.3 V only.
INMP441 L/RGNDLow = it talks in the left slot, the one the board reads.
INMP441 SCKGPIO 40The bit clock. The ESP32 drives it: 16 000 × 64 = 1.024 MHz.
INMP441 WSGPIO 41Word select: left slot / right slot, flips every 32 clock ticks.
INMP441 SDGPIO 42The data, most significant bit first. Pulled down, so a missing mic reads as zeros.
MAX98357A VIN · GND5VThe speaker amplifier. 5V gives the most (about 3 W into 4 Ω); 3V3 works, quieter.
MAX98357A BCLKGPIO 39Bit clock of the second I2S port (I2S1; the mic uses I2S0, so both run at once).
MAX98357A LRCGPIO 38Word select (left/right).
MAX98357A DINGPIO 47The samples, 16-bit.
MAX98357A GAIN · SDnothingLeave both unconnected: 9 dB gain, and it plays (left + right) / 2.
speaker (4 Ω, 3 W)amp + / −On the amplifier's screw terminal: the JST-PH2.0 lead's two wires, red to +.
screen (8 wires)as lesson 03Unchanged. The push button on GPIO 5 is optional: it does what BOOT does.

Commands, in order

Type these in the serial monitor (uv run pio device monitor) unless the grey tag says otherwise. The coloured tag says what should be near the board while it runs.

  1. uv run pio run -d labs/sound-lab-s4 -e sound-lab-s4 -t uploadMac terminalroom quiet
    Does
    Builds lab S4 and writes it to the board, then open the monitor with uv run pio device monitor.
    You should see
    Listening for an INMP441 on the I2S pins..., Microphone: INMP441 (I2S, digital) (mic setting: auto) (or KY-037), then Sound lab S4 …, the command list and a three-note hello from the speaker. Stay quiet for half a second: - learning the quiet...
    If not
    Wrong mic picked: mic inmp441 or mic ky037 (saved, restarts). No hello: the speaker is optional; check VIN and DIN. “Failed to connect”: hold BOOT, tap RST, release BOOT, run it again.
  2. armserial monitorroom quiet
    Does
    Voice-activated: louder than trigger (15 dB above the quiet) starts a clip.
    You should see
    - armed: talk and it records; the recorder view says ARMED (teal ring).
  3. (say a sentence, then wait)with your handsmake some noise
    Does
    Records from half a second before your first word until 1.2 s after the last loud moment.
    You should see
    x REC clip 1 (voice); REC 2.4 s in red, the header's red dot, the RGB LED red; then + clip 1: 3.1 s.
    If not
    Never starts: speak closer, or trigger 10.
  4. play 1 0.7serial monitorsound: doesn't matter
    Does
    Plays clip 1 on the board's speaker at 0.7× speed (deeper, slower). Without a number: the clip picked on the clips view. Made louder like the download, but at most ×16. stop stops it; rec stops it before recording; it is refused while recording.
    You should see
    + playing clip 1 (4.4 s) at x0.70, then - clip 1 played; waves in the header.
    If not
    recording: stop first (the microphone would hear the speaker).
  5. clipsserial monitorsound: doesn't matter
    Does
    Lists the clips: number, length, voice or hand, loudest, how much louder it is sent, when.
    You should see
    1 3.1s voice -38.2 dBFS x23.4 2026-10-14 14:02:31
  6. tokenserial monitorsound: doesn't matter
    Does
    Prints the admin token the phone page asks for (shared with W2/R7/R8).
    You should see
    Admin token: 3f… and where to paste it.
    If not
    Keep it out of chats and git; token new replaces it.
  7. http://bench.localon your phonesound: doesn't matter
    Does
    The board's own page: live level, arm / rec / stop, the clip list with each waveform, play and download, a speed choice and Play on board / Stop on board per clip. The token stays in that tab only.
    You should see
    A clip card with its shape; play moves a playhead.
    If not
    “no Wi-Fi saved”: flash wifi-lab-w1 once and join. Page unreachable: same network? Try the IP from wifi.
  8. uv run python tools/sound_pull.py /dev/cu.usbserial-A5069RR4 1Mac terminalsound: doesn't matter
    Does
    Close the monitor first. Types send 1, reads the base64 WAV, checks the CRC-32 and the size, writes the file.
    You should see
    Receiving clip 1: 99244 bytes as …, then Saved … (3.1 s at 16000 Hz, 99244 bytes, CRC ok).
    If not
    Could not open … (is the serial monitor still open?): close it.

Steps

0 of 6 ticked. Ticks are saved in this browser.

Privacy is built in, not optional: recording always shows on the board (REC, red dot, red LED) whoever starts it; every audio route on the page needs the admin token; clips live in RAM only and vanish on reset. The sound will be thin and hissy: the clips are normalised (made up to 64 times louder) on the way out, and that lifts the hiss with the voice. This module is a loudness sensor first, a microphone second.

Preview: what you should see

Interactive audio lab simulator displaying live waveforms, dBFS loudness, FFT bins, and synthesized tones.

  • Key concepts: pre-roll from a ring, trigger + hold, PSRAM clip store, WAV format, streaming responses, base64 + CRC-32, playback speed = pitch, tokens & visible recording.
  • Signals & pins: 3V3 (VCC), 3V3 (MICS +), GPIO6 (AO), GPIO7 (BLK), GPIO8 (RES).

Interactive diagram loads after page initialization.

ESP32-S3 peripherals used in this lab

Open interactive GPIO pinout

Explore the hardware blocks, pin rules, and registers behind this experiment.

  • GPIO and IO MUX

    45 pins, and a matrix that routes almost any signal to almost any pin

  • I2S

    Digital audio in and out: microphones, amplifiers, codecs

  • SPI

    Fast four-wire bus for screens, card readers and flash

  • RMT

    Plays and records exact pulse trains: IR remotes, RGB LEDs

  • SAR ADC

    Two 12-bit converters that turn a voltage into a number

  • Wi-Fi

    2.4 GHz 802.11b/g/n, as a station, an access point or both

Troubleshooting & hardware gotchas

See all 17 ESP32-S3 hardware gotchas
What if it does not work or behaves unexpectedly?
Privacy is built in, not optional: recording always shows on the board (REC, red dot, red LED) whoever starts it; every audio route on the page needs the admin token; clips live in RAM only and vanish on reset. The sound will be thin and hissy: the clips are normalised (made up to 64 times louder) on the way out, and that lifts the hiss with the voice. This module is a loudness sensor first, a microphone second.
If “uv run pio run -d labs/sound-lab-s4 -e sound-lab-s4 -t upload” does not work
Wrong mic picked: mic inmp441 or mic ky037 (saved, restarts). No hello: the speaker is optional; check VIN and DIN. “Failed to connect”: hold BOOT, tap RST, release BOOT, run it again.
If “(say a sentence, then wait)” does not work
Never starts: speak closer, or trigger 10.
If “play 1 0.7” does not work
recording: stop first (the microphone would hear the speaker).
If “token” does not work
Keep it out of chats and git; token new replaces it.
If “http://bench.local” does not work
“no Wi-Fi saved”: flash wifi-lab-w1 once and join. Page unreachable: same network? Try the IP from wifi.
If “uv run python tools/sound_pull.py /dev/cu.usbserial-A5069RR4 1” does not work
Could not open … (is the serial monitor still open?): close it.
Four pins are read at reset
GPIO0, GPIO3, GPIO45 and GPIO46 are sampled the moment the chip comes out of reset: they pick the boot mode, the flash voltage, the ROM log and the JTAG source. Anything wired to them must not pull them the wrong way at power-up. After reset they are normal pins again.
GPIO3 has no pull resistor at reset
GPIO0 has a weak pull-up and GPIO45/46 weak pull-downs, but GPIO3 floats. When the eFuses make it choose the JTAG source, an outside circuit has to hold it at a clear level.
ADC2 stops working while Wi-Fi is on
The ADC2 channels (GPIO11-20) cannot be used at the same time as Wi-Fi: the radio shares ADC2 through an arbiter. Put analog sensors on ADC1 (GPIO1-10), as the sound labs do with GPIO6.
GPIO47 and 48 run at 1.8 V on R16V modules
Modules with the ESP32-S3R16V chip set the flash voltage to 1.8 V, and GPIO47/48 share that supply. A 3.3 V part on those pins sees the wrong levels.