Run your_chat_bot on Raspberry Pi
Run the TuyaOpen your_chat_bot voice assistant on a Raspberry Pi. This guide covers the two supported build methods, the external sound card the board needs, and how to point the firmware at the wake-word model.
Prerequisitesโ
Read the Quick Start and its sub-sections first:
- Set up the TuyaOpen development environment.
- Obtain a TuyaOpen authorization code. The header-file method is recommended.
- Understand device network configuration.
your_chat_bot is a cloud-paired AI application. You need a valid authorization code (ๆๆ็ ) before the device can connect and respond.
Build methodsโ
Raspberry Pi supports two build methods:
- Cross-compilation: build on a PC, then transfer the binary to the Raspberry Pi and run it.
- Native build: build directly on the Raspberry Pi.
Cross-compilation is not supported on macOS. Use Linux, or build directly on the board.
External sound cardโ
The Raspberry Pi has no built-in microphone or speaker, so an external USB sound card is required. Recommended models:
- USB Audio Module YD1076 โ Taobao link
- Waveshare USB Sound Card โ link
Other compatible USB sound cards also work. The microphone must output raw audio data โ it must not apply built-in noise reduction, echo cancellation, or similar processing.
Configure the wake-word modelโ
The KWS (Keyword Spotting) wake-word model lets the device recognize the wake word. Obtain the model files, then point the firmware at them.
Obtain the model filesโ
Option 1: Automatic download
After you select the Raspberry Pi platform and build successfully, the model is downloaded automatically to platform/LINUX/tuyaos_adapter/src/tkl_audio/models.
Option 2: Manual download
Download mdtc_chunk_300ms.mnn and tokens.txt to the ~/tuyaopen_models directory:
wget -P ~/tuyaopen_models https://github.com/tuya/TuyaOpen-ubuntu/raw/platform_ubuntu/tuyaos_adapter/src/tkl_audio/models/mdtc_chunk_300ms.mnn
wget -P ~/tuyaopen_models https://github.com/tuya/TuyaOpen-ubuntu/raw/platform_ubuntu/tuyaos_adapter/src/tkl_audio/models/tokens.txt
The default path in the code is ~/tuyaopen_models. To use a different path, configure it as shown below.
Set the model pathโ
- Activate the
tos.pyenvironment and go to theapps/tuya.ai/your_chat_botdirectory. - Run
tos.py config choiceand select theRaspberryPi.configconfiguration. - Run
tos.py config menuand navigate to(Top) โ Choice a board โ LINUX โ TKL Board Configuration. - Set the following options to the actual locations of
mdtc_chunk_300ms.mnnandtokens.txt:KWS model file pathKWS model token file path
Place the model files on the Raspberry Pi filesystem and set the paths correctly. Otherwise the wake-word feature does not work.
Configuration exampleโ
When the model files are stored in ~/tuyaopen_models, configure the paths like this:

Transfer the binary (cross-compilation only)โ
If you cross-compile on a PC, copy the built executable to the Raspberry Pi with scp:
scp ./dist/your_chat_bot_1.0.1/your_chat_bot_QIO_1.0.1.bin username@192.168.1.xxx:~/
Parameters:
usernameโ username on the board192.168.1.xxxโ IP address of the board~/โ target directory on the board
Run the executableโ
./your_chat_bot_QIO_1.0.1.bin
your_chat_bot_QIO_1.0.1.bin is the executable file name.
On the first run, you must perform device network configuration (pairing). If pairing or network connection fails, delete the tuyadb folder and run the program again.
FAQโ
The voice wake word does not work.
Check that the model file paths are correct and the files are complete. Run ls -lh to confirm the files exist and their sizes are as expected.
The executable does not run.
Check that the executable has execute permission. Run chmod +x your_chat_bot_QIO_1.0.1.bin to grant it.
See alsoโ
- Raspberry Pi Provisioning Troubleshooting โ fix provisioning, Wi-Fi, and Bluetooth issues.
- Raspberry Pi Peripherals โ run GPIO, I2C, SPI, PWM, and UART examples.