Welcome to RDK X5 Board repository
4. AI Pet
OpenClaw AI Pet Tutorial
Before starting, please complete [01-Peripheral hardware configuration], [02-openclaw API-KEY configuration], [03-openclaw switching model], [04-OpenClaw prompt words], [05-AI voice interaction configuration], [06-Three dialogue scheme configuration tests] in the
Preparation before usedirectory. If you are currently only using TUI/WhatsApp, you can skip05first. This article assumes that the basic environment has been prepared and only the AI pet project itself will be expanded.
1. Tutorial Objectives
This article demonstrates the interactive capabilities of OpenClaw as a desktop AI pet through a combination of "action + lighting + screen + dialogue". After completing this tutorial, readers will be able to:
- Learn how to use servos, RGB and OLED to make an AI pet with emotional feedback
- Converse with OpenClaw through WhatsApp, TUI, and voice code
- Complete four project scenarios: greeting, emotional expression, companion Q&A, and sleep wake-up
2. Hardware preparation
- OpenClaw main control board
- Servo
[recommended at least 1] - RGB light strip/RGB lamp bead module
- OLED display
[Optional] AI voice module + speaker- Wiring diagram

3. Software preparation
Code entry that will be used in the tutorial
- Servo control command:
/home/sunrise/hardware_hal_demo/cli/servo - Voice entrance:
/home/sunrise/voice_to_openclaw/src/main.py
This project does not have a fixed set of "pet scripts", but lets OpenClaw orchestrate several basic peripheral actions:
- The servo is responsible for nodding, shaking, and swinging
- RGB is responsible for expressing mood and status
- OLED is responsible for displaying names, emoticons or short text
- Voice dialogue is responsible for making the pet more like an interactive character
4. Test the basic capabilities of the project
Before starting the current project, please complete a basic dialogue self-test of openclaw tui; if you have not done so yet, please read [06-Three dialogue scheme configuration tests] first. After passing, you can enter the special test of the AI pet project.
Enter OpenClaw TUI:
openclaw tui
Then test several basic abilities:
- Let the servo nod
- Change the light to a pink breathing light
- Display "Hello" on OLED
5. Three options for talking to OpenClaw
| Solution | Suitable scenario | Advantages | Suggested positioning |
|---|---|---|---|
| Remote interaction, classroom demonstration | Suitable for demonstration of "remote pet raising" | Showcase character interaction capabilities | |
| TUI | Local debugging, action verification | The easiest way to check whether actions and feedback match | Run through the character action logic first |
| Voice code | The ultimate interactive experience | The most like desktop pet that can really chat | As the final demonstration solution |
If the AI voice module + speaker is optional, Feishu dialogue, tui, and WhatsApp dialogue need to broadcast the content of openclaw's reply. You can run the following program on the terminal. The AI voice module dialogue does not need to be run repeatedly
- Modify whether to open broadcast parameters
xxxxxxxxxx/home/sunrise/voice_to_openclaw/.env
xxxxxxxxxxENABLE_TTS=true #This parameter is to control whether to broadcast. After modification, save it and run the following program on the terminal.- Terminal input
xxxxxxxxxxcd ~/voice_to_openclawsource .venv/bin/activatepython -m src.openclaw_session_tts
5.1 WhatsApp solution
For WhatsApp access and robot creation steps, please refer directly to [05-Configuration Test of Three Dialogue Schemes]. Once created, you can remotely interact with the AI pet in WhatsApp, for example:
- Whether there is dog food at the moment when shooting, if there is, the OLED will display a smiling expression, the servo will dance, and the OLED will turn on the ambient light. If there is no dog food, the OLED will display a sad expression.

5.2 TUI scheme
If you have completed the TUI self-test in Part 6, enter the terminal text dialogue directly:
xxxxxxxxxxopenclaw tuiThen enter project-related instructions, such as:
- Whether there is dog food at the moment of shooting, if there is, the OLED will display a smiling expression, the servos will dance, and the OLED will turn on the ambient light. If there is no dog food, all the servos will shake their heads at the same time.

5.3 Voice code scheme
xxxxxxxxxxRequires optional ai voice interaction module + speaker
For voice module installation, environment configuration and basic wake-up process, please refer directly to [05-AI Voice Interaction Configuration]. After waking up, you can directly say the control content, such as:
- Take a photo to see if there is dog food. If there is dog food, the OLED will display a smiling expression. If there is no dog food, the OLED will display a sad expression.

6. Project implementation
Note: The following are all dialogue demonstrations in openclaw tui mode. You can also choose WhatsApp or voice mode to complete it.
6.1 Scene 1: Say hello
Experimental goals
Let the AI pet provide actions and text feedback when the user sends a greeting.
Effect description
The servo can make a simple nod or head shake, the OLED displays a welcome text, and the RGB lights up in soft colors so the pet's "appearance" is apparent.
Example instructions
- Let the little pet say hello to me
- Let the pet welcome me
6.2 Scenario 2: Emotional expression
Experimental goals
Let the AI pet use lights and screens to express happy, quiet, angry, sleepy and other states.
Effect description
This scene is best suited to embody the "feel of character". For example, it lights up a warm breathing light when you are happy, lights up a blue light when you are sleepy, and only displays a brief status when you are quiet.
Example instructions
- Put your pet into a happy state
- Draw simple expressions with OLED
6.3 Scene 3: Accompanying Q&A
Experimental goals
Let the AI pet not only move, but also respond to questions like a desktop companion character.
Effect description
OpenClaw can complete the dialogue first, and then combine the servo nodding, shaking the head and screen text to make "speech" and "action" happen simultaneously, making it look more like a character with personality.
Example instructions
- Answer my question first, then nod.
- If you agree, show it with action
- Tell me a few words about your mood today.
6.4 Scenario 4: Sleep and wake-up
Experimental goals
Let AI pets have the ability to switch between standby, sleep and wake-up states.
Effect description
In sleep mode, most of the lights can be turned off, leaving only the low-brightness state; when waking up, the lights, screen and motion feedback can be restored to make the project more complete.
Example instructions
- Put pets into sleep mode
- Wake up the pet