Xiaozhi AI Assistant

Table of Contents

  • Product Overview

  • Core Business Flow

  • Feature Module List

  • Data and State

  • Key Constraints and Boundaries

Product Overview

Xiaozhi AI is an ESP32-S3-based voice conversation AI assistant that provides capabilities such as wake-word detection, real-time translation, and responsive interaction, and supports switching the large model and voice timbre in the management backend. The project provides compilation-free firmware that can be flashed directly onto mPython Board 3.0 or mPython Core 2.0 for a quick smart-terminal experience. Its open-source project is developed on ESP-IDF, facilitating secondary development and deployment in educational scenarios.

  • Target users: makers, teachers and students, AI/IoT beginners and advanced developers

  • Core value: low-barrier access to cloud large models, combined with local audio capture and playback, delivering a closed-loop “speak-listen-answer” experience

  • Application scenarios: voice assistants, multilingual translation, classroom interaction, smart-home control prototypes, and edge-AI teaching demonstrations

Section Sources

Core Business Flow

The typical usage flow of Xiaozhi AI is as follows:

  • Device preparation: connect to a PC via USB-C, use the mPython software to select the corresponding board (mPython Board 3.0 or mPython Core 2.0), and flash the Xiaozhi firmware

  • Power-on and run: after booting, the device enters the Xiaozhi interface and displays the wake-word prompt

  • Voice interaction: speak the wake word to trigger recording; the recognition result is uploaded to the cloud large model; the returned text and speech-synthesis result are played on the device

  • Role and voice timbre: configure the role name, voice timbre, and large model in the management backend; this takes effect on the device’s next conversation

  • Extension capabilities: a higher-power amplifier speaker can be replaced, or third-party music platforms can be accessed via code

sequenceDiagram
participant User as "User"
participant Device as "ESP32-S3 device"
participant Cloud as "Cloud large model/TTS service"
participant UI as "LVGL interface"
participant Audio as "Audio subsystem"
User->>Device : Speak the wake word
Device->>Audio : Capture microphone audio
Device->>Cloud : Send the speech-recognition request
Cloud-->>Device : Return the recognized text
Device->>Cloud : Send the conversation context and question
Cloud-->>Device : Return the answer text
Device->>Audio : Call TTS to generate speech
Audio-->>Device : Play the reply speech
Device->>UI : Update the interface state and prompt
User-->>Device : Continue or end the conversation

Diagram Sources

Section Sources

Feature Module List

Section Sources

Data and State

  • Speech-recognition state

    • Initialization: set the wake-word and command-word collections and update the recognizer

    • Polling: read the latest recognition ID in the timer callback and perform the corresponding action (such as RGB LED control)

    • Reference paths: esp32s3/firmware/file_system/mpython_v3/ui/voice.py:20-26, esp32s3/firmware/file_system/labplus_Ledong_v2/ui/voice.py:20-26

  • Interface state

    • Container and canvas: create the LVGL container and background color

    • Labels and layout: display the “wake word” and “command word” prompts and the back button

    • Animation: loop-draw animation images to indicate the device is listening

    • Reference paths: esp32s3/firmware/file_system/mpython_v3/ui/voice.py:61-112, esp32s3/firmware/file_system/labplus_Ledong_v2/ui/voice.py:61-112

  • Role and voice timbre configuration

flowchart TD
Start(["Start"]) --> Init["Initialize speech recognition<br/>Set wake words and command words"]
Init --> Loop{"Timer callback"}
Loop --> Read["Read the latest recognition ID"]
Read --> HasResult{"Valid?"}
HasResult -- No --> Loop
HasResult -- Yes --> Action{"Perform the corresponding action"}
Action --> RGB["Control the RGB LED/other peripherals"]
Action --> Play["Play a prompt tone or music"]
RGB --> Loop
Play --> Loop

Diagram Sources

  • esp32s3/firmware/file_system/mpython_v3/ui/voice.py:20-26

  • esp32s3/firmware/file_system/labplus_Ledong_v2/ui/voice.py:20-26

Section Sources

Key Constraints and Boundaries

Section Sources