4.Xiaozhi AI Tutorial
The Xiaozhi AI solution used in this project is open source and is based on xiaozhi-esp32. If you only want to use the device, follow the flashing steps in this tutorial. If you want to customize features or continue development, see Open Source and Secondary Development.
Backend Setup
First, Register a Xiaozhi Account
Visit the AI Chatbot Management System: Xiaozhi.me
Click the “Console” button on the page to enter the console
Fill in the registration form:
Select your country and enter your mobile phone number (for receiving verification code)
graphic verification code
Then click “Send Code”. The system will send a verification code to your phone. enter the verification code to complete registration
After registration, you can add a password in the account management in the upper right corner
Adding Devices to the Management Backend
Create an Agent:
Click the “Create Agent” button
Fill in the agent name and then click Confirm
In the agent card, click Configure Role
Configure Agent Parameters:
Assistant Name: Name your AI assistant
Voice Role: Select your preferred voice style
Language Preference: Set the conversation language
Role Introduction: Define the personality traits of the AI assistant
Language Model: Select the language model to use
Set the Role Prompt. It is recommended to use the following template, or you can create your own role prompt:
I am a virtual assistant called {{assistant_name}}. I communicate exclusively in English with a natural, friendly voice. I provide helpful, accurate information and assist users with their queries while maintaining a conversational tone. I adapt my speaking style to match the user's needs and always aim to deliver clear, concise responses in fluent English.
Click the “Save” button to save the role configuration
Firmware Upload
Online Flashing
You can also use an online flashing tool. The advantage of this method is that you simply open the webpage, select your device and firmware version, and it requires no configuration. Once flashing is complete, you can start using it right away.
Note
Online flashing is supported only in Chrome or Edge browsers.
Warning
Use a USB Type-C cable that supports data transfer. A charging-only cable may power the board but will not work for flashing.
Note
On Windows, connect the USB Type-C data cable to the ESP32-S3 UART port on the left side of the board before clicking Connect. On macOS, connect the cable to the ESP32-S3 USB port on the right side, then press and hold BOOT, press RESET while still holding BOOT, and enter download mode before clicking Connect. The screen will turn black after the device enters download mode; this is normal.
For detailed instructions on using the online flasher, see Online Flasher.
Follow these steps:
Open the LAFVIN Web Flasher
Select the following options:
Device:
ESP32S3 AI Chatbot KitFirmware:
Xiaozhi-esp32Version:
2.2.4Connect the development board to your computer using the correct USB Type-C port for your operating system, as described in the note above, before clicking
Connect.Click
Connect, then select your device in the browser pop-up window and clickConnectagain.Click
Flashto start flashing. Wait for the process to complete.After flashing is complete, restart the device by pressing the
RSTorRESETbutton on the ESP32-S3 board. You do not need to unplug the USB cable unless the device does not respond.
Local Flashing (Alternative)
Double-click to open Flash Download Tools, then select the options as shown below:
|
Follow these steps to upload the firmware:
Click the “Select File” button to choose your downloaded firmware file (.bin format)
In the address input box after the bin file selection box, enter
0 or 0x0(indicating that the firmware will be downloaded to the starting position of the development board’s memory)Select the COM port corresponding to ESP32-S3 from the port selection dropdown menu (refer to the Driver Installation section for how to check the device manager for the specific port number)
Set the baud rate (we use 460800 here)
Click the “START” button to begin downloading the firmware to the ESP32-S3 development board
Note
The ESP32-S3 supports only 2.4 GHz Wi-Fi networks. Make sure the Wi-Fi network you select is not 5 GHz only.
After the firmware is flashed, press the
RSTorRESETbutton on the development board. The board will restart and enter network configuration mode.Connect your phone to the hotspot named
Xiaozhi-XXXX. The configuration page should open automatically. If not, manually enterhttp://192.168.4.1in your browser to access the configuration interface.
Select your Wi-Fi network, enter the password, and click
Save. The device will save the settings and restart automatically.After restarting, the board will connect to your Wi-Fi and announce a 6-digit verification code. If it does not restart within about 30 seconds, press the
RSTorRESETbutton once.Go to the backend interface and add the device in the Agent you just created:
Click the “Add Device” button
Enter the 6-digit verification code announced by the device
After clicking “Confirm” and restarting the device, you’ll see this interface. At that point, just say “Hi, ESP,” and you can start the conversation.
For flashing help, driver troubleshooting, or alternative flashing methods, see Online Flasher.
