XiaoZhi AI Hardware Assembly Guide
This guide covers the parts list, assembly steps, and wiring for building a XiaoZhi AI chatbot yourself. It suits DIY makers with some electronics experience.
bread-compact-wifi). If you would rather buy a finished board, start with Supported Boards. For flashing, see Firmware download.I. Hardware List for DIY
1.1 Core Components
- Development board: ESP32-S3-DevKitC-1 (the WROOM N16R8 module is recommended) or Waveshare ESP32-S3-Touch-LCD-3.49
- Digital microphone: INMP441
- Amplifier: MAX98357A
- Speaker: 8Ω 2-3W or 4Ω 2-3W
- Wires: a box of jumper wires and some Dupont wires
- Two 400-hole breadboards
- 128x32 I2C (IIC) LCD with SSD1306 driver (recommended)
- ML307R Cat.1 4G module, AT firmware version (optional)
- 6x6 mm vertical tactile switch (optional)
1.2 Auxiliary Tools
Besides the core components, you may also need:
- A multimeter
- A soldering iron kit
- A set of three pliers
- A Type-C data cable
- A PC for flashing the firmware
II. Hardware Details
2.1 Choosing a Development Board
For the ESP32-S3-DevKitC-1, use the MCUID pin map to match each GPIO in the wiring table to its position on the J1 or J3 header.
2.1.1 ESP32-S3-DevKitC-1 (Recommended)
Choose the N16R8 configuration, that is, 16 MB Flash and 8 MB PSRAM. The N8R2 configuration needs extra changes:
- Change the PSRAM mode from OCTAL to QUAD
- Change the Flash size to 8 MB
- Change the custom partition table to
partitions_8M.csv - Rebuild the firmware
Note: on some boards the RGB LED is not connected; you need to solder the two small pads next to the LED. When buying, pick a version whose RGB LED is already connected.
2.1.2 Waveshare ESP32-S3-Touch-LCD-3.49
An all-in-one board from Waveshare with a built-in 3.49-inch touch LCD:
- Advantage: the all-in-one design reduces wiring and includes the display
- Product page: https://www.waveshare.net/shop/ESP32-S3-Touch-LCD-3.49.htm
- Requirement: same as ESP32-S3-DevKitC-1; the N16R8 configuration is recommended
- Feature: touch operation and richer on-screen information
The matching firmware variant is waveshare-esp32-s3-touch-lcd-3.49; see Supported Boards.
2.2 MEMS Digital Microphone (INMP441)
This is the smallest component and is hard to solder. Beginners should buy a pre-soldered one. If you solder it yourself:
- Do not let the pins touch the half-ring metal wire
- With Dupont wires, never swap VDD and GND, or the part is easily burned (buy a spare)
2.3 Digital Amplifier (MAX98357A)
Buy one with header pins already soldered and connect it on the breadboard.
2.4 Speaker (8Ω 3W or 4Ω 3W)
Terminals are optional.
2.5 Wires
If you connect with Dupont wires instead of a breadboard, also buy a few 1-to-2 splitter wires (female). They let the microphone and the amplifier share the board’s 3V3 and GND headers, which are not enough otherwise.
2.6 Breadboard (Recommended)
Assembling on a breadboard is strongly recommended; otherwise the wiring gets messy as parts accumulate. Join two 400-hole breadboards and place the development board in the middle to use the space well.
Breadboard basics:
- The breadboard is split into blocks. In the two middle blocks, each row of the same number is connected horizontally (except across the central gap)
- The red and blue rails are connected vertically along each column (unless the rail is split)
2.7 OLED Display (Optional)
Make sure it uses the SSD1306 driver. A newer OLED whose pins start with GND is recommended.
2.8 Cat.1 4G Module (ML307R, Optional)
The ML307R is a Cat.1 IoT module from China Mobile IoT. The DC version adds OpenCPU SDK support compared with the DL version. Make sure you buy the AT firmware version.
Notes:
- The module connects to the 4G mobile data network so the AI can chat online
- It suits outdoor places without Wi-Fi
- Choose a module with a removable SIM slot; for frequent use, a secondary SIM from your phone works (the data plan that comes with the module may not last a month)
2.9 Microswitch / Button (Optional)
Use a 6x6 mm microswitch or tactile switch and insert it across the rows on the breadboard. Beginners should use a 2-pin through-hole button to avoid shorting pins.
III. Purchase Guide
3.1 Purchase Channels
When shopping on e-commerce platforms, keep in mind:
- Some components may come without soldered pins; ask the seller to solder them, or choose pre-soldered items
- Prefer shops with a good reputation, high sales, and good reviews
- For purchase questions and after-sales quality problems, talk to the seller yourself
3.2 Soldering Basics
If you are a beginner, buy the pre-soldered version, or watch a soldering tutorial first so you do not damage the components.
Recommended tutorial: Soldering Iron Usage for Beginners
IV. Wiring
4.1 ESP32-S3-DevKitC-1 Standard Version (44 IO Pins)
This wiring applies to XiaoZhi AI firmware version 0.3.0 and later.
Note: if you do not use a breadboard, use 1-to-2 splitter wires to solve the shortage of 3V3 and GND header pins.
Microphone Wiring (INMP441)
| ESP32-S3 board | Microphone (INMP441) |
|---|---|
| GPIO4 | WS (word select) |
| GPIO5 | SCK (bit clock) |
| GPIO6 | SD (data out) |
| 3V3 | VDD (3.3V power) |
| GND | GND, and short L/R (left/right channel) |
Amplifier Wiring (MAX98357A)
| ESP32-S3 board | Amplifier (MAX98357A) |
|---|---|
| GPIO7 | DIN (digital signal) |
| GPIO15 | BCLK (bit clock) |
| GPIO16 | LRC (left/right clock) |
| 3V3 | Vin/VCC (power), and short SD (shutdown/channel) |
| GND | GND, and short GAIN (gain and channel) |
Speaker Wiring
- Audio+ goes to the speaker’s positive terminal (usually the red wire)
- Audio- goes to the speaker’s negative terminal
OLED Wiring (Optional)
| ESP32-S3 board | OLED display |
|---|---|
| GPIO41 | SDA (data) |
| GPIO42 | SCK (clock) |
| 3V3 | VCC (power) |
| GND | GND |
4G Module Wiring (ML307R, Optional)
| ESP32-S3 board | 4G module (ML307R) |
|---|---|
| LDO positive (4.7V) | BAT (3.7-4.5V), and short EN (enable) |
| GND | GND |
| GPIO11 | TXD (module transmit) |
| GPIO12 | RXD (module receive) |
Button Wiring (Version 0.4.1 and Later)
| ESP32-S3 board | Button |
|---|---|
| GPIO39 | Volume-down button (other end to GND): short press lowers the volume, long press mutes |
| GPIO40 | Volume-up button (other end to GND): short press raises the volume |
Notes:
- With the smaller BGA package of the MAX98357A, the GAIN-to-GND jumper can be left out
- Follow the pin tables; preview images are for appearance only
- If the microphone was soldered the wrong way round (sound hole down, pins up), it has to be re-soldered
4.2 ESP32-S3-DevKitC-1 Gu Cloud Version (42 IO Pins)
Main differences from the standard version:
- Fewer pins, plus 4 fixed mounting holes
- In version 1, the 3V3 power pin at the upper left moves to the lower left
- Version 2 adds GPIO19 and GPIO20 on the left
- Version 1’s GPIO13, GPIO14, and 5VIN on the left move to the lower right in version 2
- Version 2 lacks the two bottom-most GND pins on the left and right
External modules are wired the same as on the standard version, and the same firmware is used.
V. Advanced Wiring
5.1 External Buttons
5.1.1 Volume Control
- Firmware 0.3.3 added a volume button: connect GPIO40 to a button with the other end to ground; pressing raises the volume and a long press mutes
- Firmware 0.4.1 added a volume-down button: GPIO39, long press mutes, and the earlier button’s long press becomes maximum volume
5.1.2 Wake / Interrupt
Firmware 0.3.1 and later support waking up and interrupting a conversation with a button:
- Use the BOOT button on the board
- Or connect GPIO0 with the other end to ground
- During a conversation, a press interrupts; pressing again wakes it up to resume
Note: when adding an external four-pin switch, do not plug it into a single row of the board; stagger it across two rows to avoid shorting pins.
5.2 Jumper Color Scheme
A suggested, consistent color scheme:
- VCC: red and brown
- GND: gray and black
- Digital signals: coffee and orange
This helps avoid reversed polarity.
5.3 Connection Modes
XiaoZhi AI supports two connection modes.
5.3.1 Duplex Mode
One I2S controller drives both the microphone and the amplifier, which suits boards with few GPIOs.
| Board | INMP441 | MAX98357A |
|---|---|---|
| GND | GND, L/R | GND, GAIN |
| 3.3V | VDD | SD, VIN |
| GPIO4 | WS | LRC |
| GPIO5 | SCK | BCLK |
| GPIO6 | SD | |
| GPIO7 | DIN |
5.3.2 Simplex Mode (Default)
I2S 0 connects the microphone and I2S 1 connects the amplifier. This uses two more GPIOs than Duplex mode.
| Board | INMP441 | MAX98357A |
|---|---|---|
| GND | GND, L/R | GND, GAIN |
| 3.3V | VDD | SD, VIN |
| GPIO4 | WS | |
| GPIO5 | SCK | |
| GPIO6 | SD | |
| GPIO7 | DIN | |
| GPIO15 | BCLK | |
| GPIO16 | LRC |
The default configuration uses Simplex mode. GPIOs map one-to-one to component pins, so wiring is easier. The VIN pin of the MAX98357A accepts 3.3V or 5V.
5.4 Adding an LCD
An added display can show the Wi-Fi or 4G signal strength:
| Board | SSD1306 |
|---|---|
| GND | GND |
| 3.3V | VCC |
| GPIO41 | SDA |
| GPIO42 | SCK |
5.5 Adding a 4G Module
Note: keep the 4G antenna away from the microphone (closer than 3 cm causes clear interference). The simplest fix is to stick the antenna onto the speaker’s analog signal wire, away from the microphone.
The 4G module needs a 5V supply. The board only has a 5V VIN input and no 5V output, so take the power from the LDO regulator’s roughly 5V pin.
VI. Troubleshooting
6.1 Common Issues
The RGB LED does not light Check whether the two pads next to the RGB LED are connected. If not, bridge them with a wire first, then restart and see whether it lights.
How to check the circuit
- Without power: use a multimeter to test continuity of wires, such as two distant GND pins or two 3.3V pins
- With power: check that the voltage between GND and the other pins is in the normal range
Safety check after wiring After wiring, use a multimeter to check for a short between GND and VCC (3.3V) on the board and the installed parts. Connect USB power only after confirming there is no short.
6.2 Hidden Wiring Hint
The bottoms of the MAX98357 and INMP441 have hidden connections; check them carefully.
VII. Related Documents
- ESP32 Budget Version - the low-cost build
- Supported Boards - finished boards and firmware variants
- Firmware download and flashing - get and install the firmware
- FAQ - common questions
- ESP-IDF setup - build custom firmware
Wiring checked against main/boards/bread-compact-wifi/config.h and bread-compact-ml307/config.h in 78/xiaozhi-esp32 v2.5.2.