Ready to program and customize your Xiaozhi ESp32 voice assistants? Find the steps here.
(Note: This article has gone through different revisions to reflect different Xiaozhi AI versions)
Introduction
Last time you were able to build your very own Xiaozhi ESP32 voice assistant. However, you were programming this using stock binary firmware. All is well that you are able to interact with your AI friend; however, there may be times you’d like to customize its features. Here, you’ll learn some Xiaozhi ESP32 programming customizations.
How to Add Customizations to your Xiaozhi ESP32 AI / Otto Robot Chatbot Friend
You will be downloading the original source code of Xiaozhi ESP32, so there are some software requirements before you can continue with the customizations. You can review two blog articles for this, namely:
With this, you can start customizing.
OPen the ESP-IDF 5.5 PowerShell
Start with PowerShell instead of Windows Command Prompt. You should be able to find the ESP-IDF PowerShell as a desktop icon or in the Windows search bar, too. Click on it and wait for the initializations to finish. Using the PowerShell version is convenient since important parameters in the ESP-IDF environment are already taken cared of, such as the PATH variable, for example.
Create a User Directory for your Xiaozhi Program
Create a directory where you can clone the original Xiaozhi source code.
mkdir
Perform a Git Clone on your Chosen Xiaozhi ESP32 Source code
There are several Xiaozhi ESP32 GitHub source code examples you can find on the net. Such examples as 78/xiaozhi-esp32 and txp666/xiaozhi-esp32. Git clone that into your working directory.
git clone https://github.com/txp666/xiaozhi-esp32.git
Set your ESP32 Target
:Set your target to ESP32-S3 through:
idf.py set-target esp32s3
Run a Clean or Fullclean to Have a Fresh Build Directory
It’s best to do a clean / fullclean build on a fresh project.
idf.py fullclean
Customization: configure your Project
This is where your customization begins. Type the command below to see the firmware configuration menu pop-up.
idf.py menuconfig
Customization Example - Set Default Langauge to English
Got to Xiaozhi Assistant -> Default Language and set it to English.
Customization Example - Set Correct Board type for a Bread Board Type AI
In Xiaozhi Assistant -> Board Type, you will see different kinds of boards that support Xiaozhi. Make sure you choose Bread Compact WiFi, as this represents the board you are using. Also set the correct OLED resolution type.
Customization Example - Set Correct Board Type and other Parameters for an Otto Robot Board
If you have an Otto Robot board, select this on the Board Type. Additionally, you have to set the WebSocket server support functionality in Component config -> HTTP Server. You need to set WebSocket functionality on an Otto robot–type board in Xiaozhi AI because it’s the communication layer that allows the robot to interact in real time with external clients (apps, web consoles, or AI services). Without WebSockets, the robot can’t maintain a continuous two-way connection for commands, sensor data, or voice/chat AI responses.
Customization Example - Set a Wake Word
Now it’s time to set the wake word. Here, built-in wake words will be used. Custom wake words require a bit of resources and learning, so this will be skipped for now. In Xiaozhi Assistant, make sure Wake Word is enabled by going to Wake Word Implementation Type and choosing the Wakenet model with AFE.
To be able to choose from a vast number of wake words, go to ESP Speech Recognition -> Load Multiple Wake Words (WakeNet9). Choose a wake word from the options given. Here, Hi Jason is used as a wake word.
Save your Settings and then do a Build
Press ESC and then choose to save the settings.
Flash the Code
Flash the code to your ESP32-S3 device.
Testing your Device
Here is the sample configuration with English language, correct OLED resolution, and a Hi Jason Wake Word. Remember to configure the Xiaozhi console app in xiaozhi.me as was done in Xiaozhi ESP32 voice assistant.