XiaoZhi AI Budget Version - ESP32 Development Board Implementation

XiaoZhi AI Budget Version - ESP32 Development Board Implementation

The “budget version” means building XiaoZhi AI on an early ESP32 development board (not an ESP32-S3 or ESP32-C3). The typical board has 4 MB flash and no external PSRAM, for example NodeMCU-32S or ESP32-DevKitC. It matches the bread-compact-esp32 family of variants in the upstream firmware. It is cheap and good for a first try, but offers somewhat fewer capabilities than the ESP32-S3 version, see “1. Capability Differences” below.

1. Capability Differences

Upstream treats ESP32 differently from S3, so know this before you start:

ItemESP32 (budget)ESP32-S3
Audio input engineLiteAudioEngine, raw mono PCMAfeAudioEngine, with acoustic echo cancellation (AEC) and VAD
On-device wake wordOff by default; Wakenet model without AFE is selectable only with PSRAMAFE wake word enabled by default when PSRAM is present
Chat triggerButton chat; an external wake-up module can also trigger itWake word or button

Sources: upstream main/audio/README.md and main/Kconfig.projbuild. So an ESP32 board without PSRAM triggers a chat with a button by default, or through an external wake-up module on GPIO19.

2. Firmware Variants

The variant names of the prebuilt firmware match the directories under upstream main/boards/:

VariantScreen
bread-compact-esp32OLED SSD1306 128x64
bread-compact-esp32-128x32OLED SSD1306 128x32
bread-compact-esp32-lcdST7789 LCD (7-pin 240x240 configuration)

For the full list see Supported Boards, and for download and flashing see Firmware Download and Installation.

3. Hardware and Wiring

Besides the development board, the parts are the same as in the Hardware Build Guide: an INMP441 microphone, a MAX98357A amplifier, a speaker, a breadboard and jumper wires; the screen is optional. The pins below are taken from bread-compact-esp32/config.h.

Microphone (INMP441)

ESP32INMP441
GPIO25WS
GPIO26SCK
GPIO32SD
3V3VDD
GNDGND, and tie L/R to it

Amplifier (MAX98357A)

ESP32MAX98357A
GPIO33DIN
GPIO14BCLK
GPIO27LRC
3V3VIN
GNDGND

Handle the SD and GAIN pins as in the ESP32-S3 plan, see the amplifier wiring in the Hardware Build Guide.

OLED (SSD1306, optional)

ESP32OLED
GPIO4SDA
GPIO15SCL
3V3VCC
GNDGND

Buttons and other pins

PinFunction (from esp32_bread_board.cc)
GPIO0BOOT button: a click toggles the chat; during startup a click enters Wi-Fi provisioning mode
GPIO5Touch/button: hold to talk and release to finish (maps to StartListening / StopListening)
GPIO19Input from an external wake-up module: a click equals saying “你好小智”
GPIO2On-board LED
GPIO18MCP lamp control test pin (LAMP_GPIO)

LCD variant (bread-compact-esp32-lcd)

The screen switches to an SPI interface with the pins MOSI GPIO4, CLK GPIO15, DC GPIO21 and RST GPIO18. The 7-pin screen has no CS pin and its backlight is on GPIO22; other models use GPIO22 for CS and GPIO23 for the backlight. Audio and button wiring are the same as in the tables above.

4. Build and Flashing

Use the prebuilt firmware: download the matching variant from Firmware Download and Installation and write it at address 0x0 as described there. When flashing, connect the board to the computer on its own instead of leaving it plugged into the wired breadboard, so the download is not disturbed.

Build it yourself: prepare the environment as in ESP-IDF Development Environment Setup, then run the commands given by the upstream board README:

idf.py set-target esp32
idf.py menuconfig
# Xiaozhi Assistant -> Board Type -> 面包板 ESP32 DevKit
idf.py build

The menu entry is labeled in Chinese upstream: “面包板 ESP32 DevKit” means “breadboard ESP32 DevKit”.

5. FAQ

  • Flashing or erasing fails: take the board off the breadboard, connect it to the computer on its own and retry; for other flashing problems see the FAQ.
  • Networking and provisioning: the flow is the same as for the ESP32-S3 version, see First Boot and Network Configuration.
  • No wake word: this is the default behavior of an ESP32 without PSRAM; chat with the button or add an external wake-up module.

Related Documents

Sources: main/boards/bread-compact-esp32/ and main/boards/bread-compact-esp32-lcd/ of 78/xiaozhi-esp32 v2.5.2.