Welcome to Raspberry Pi 5 repository
3. AI Rock Paper Scissors Game
OpenClaw AI Rock Paper Scissors Game Tutorial
Before starting, please complete [01-Peripheral Hardware Configuration], [02-OpenClaw API-KEY Configuration], [03-OpenClaw Model Switching], [04-AI Voice Interaction Configuration], and [05-Three Dialogue Configuration Tests] in the
Preparation Before Usedirectory. If you are only using TUI/WhatsApp, you can skip04. This article assumes the basic environment is ready and only covers the AI rock paper scissors project itself.
1. Tutorial Objectives
This article demonstrates OpenClaw's interactive game capability through "gesture recognition + AI referee + screen light feedback". After completing this tutorial, readers will be able to:
- Understand how to use cameras to recognize player gestures
- Communicate with OpenClaw via WhatsApp, TUI, and voice commands
- Complete four project scenarios: gesture recognition, AI move, result judgment, score feedback
2. Hardware Preparation
- OpenClaw main control board
- CSI camera module
- OLED display screen
- RGB light strip / RGB LED module
[Optional] AI voice module + speaker- Wiring diagram

3. Software Preparation
Code entry points used in this tutorial:
- Camera capture command:
/home/pi/hardware_hal_demo/camera - Visual analysis script:
/home/pi/.openclaw/workspace/skills/pi-vision/scripts/csi_describe - Voice entry:
/home/pi/voice_to_openclaw/src/main.py
The key capabilities of this project are mainly three parts:
- Camera is responsible for capturing player gestures
csi_describe gestureis responsible for recognizing gestures- OpenClaw is responsible for deciding AI moves and displaying results on OLED/RGB
4. Testing Project Basic Capabilities
Before starting this project, please complete an openclaw tui basic conversation self-check first; if you haven't done this yet, see [05-Three Dialogue Configuration Tests]. After passing, use TUI to separately verify the basic capabilities in the project.
Input in terminal:
openclaw tui
Then you can first do a few basic tests:
- Take a photo of my gesture for me
- Recognize if this is a scissors hand
- Display "Ready" on OLED
- Make RGB light up blue
5. Three Ways to Communicate with OpenClaw
| Method | Suitable Scenario | Advantages | Suggested Use |
|---|---|---|---|
| Remote demonstration, event interaction | Easy to share for multi-person experience | Demonstrate "visual interactive game" | |
| TUI | Local debugging, rule verification | Easiest to see recognition and judgment process | First to get the game logic working |
| Voice Code | Game interaction, classroom demonstration | More like a real AI game partner | As the complete demonstration solution |
If you have the optional AI voice module + speaker, the TUI and WhatsApp conversations need to broadcast OpenClaw's replies. You can run the following program in the terminal. This is not needed for AI voice module conversations.
- Modify the TTS enable parameter
xxxxxxxxxx/home/pi/voice_to_openclaw/.env
xxxxxxxxxxENABLE_TTS=true # This parameter controls whether to broadcast replies. After saving, run the program below in the terminal.- Terminal input
xxxxxxxxxxcd ~/voice_to_openclawsource .venv/bin/activatepython -m src.openclaw_session_tts
5.1 WhatsApp Solution
For WhatsApp integration and bot creation steps, please refer directly to [05-Three Dialogue Configuration Tests]. After creating, you can remotely trigger the rock paper scissors game in WhatsApp, for example:
- Let's play rock paper scissors. Take a photo to recognize my gesture. You can randomly make a gesture. Then judge whether you win or I win. OLED displays who won this round

Here you can add WhatsApp conversation screenshots yourself.
5.2 TUI Solution
If you have already completed the TUI self-check from chapter 0, directly enter terminal text dialogue:
xxxxxxxxxxopenclaw tuiThen input project-related commands, for example:
- Let's play rock paper scissors game. First you randomly make a gesture. Then take a photo to recognize my gesture. Finally judge whether you win or I win. OLED displays who won this round. If you win, light up the flowing light; if I win, make the servo dance

5.3 Voice Code Solution
xxxxxxxxxxRequires optional AI voice interaction module + speaker
For voice module installation, environment configuration, and basic wake-up flow, please refer directly to [04-AI Voice Interaction Configuration]. After waking up, you can directly speak control content, for example:
- Let's play rock paper scissors. Take a photo to recognize my gesture. You can randomly make a gesture. Then judge whether you win or I win. OLED displays who won this round

6. Project Implementation
Note: All demonstrations below use the openclaw tui method for conversation. You can also choose WhatsApp or voice to complete.
6.1 Scenario 1: Gesture Recognition
Experiment Objective
Recognize the player's current gesture, such as rock, scissors, or paper.
Effect Description
OpenClaw will first take a photo, then recognize the gesture type based on the image. This step is the input foundation of the entire game.
Example Commands
- Recognize my current gesture
- I've already made my move, help me check
- See if this is rock, scissors, or paper
6.2 Scenario 2: AI Move and Judgment
Experiment Objective
Have OpenClaw, after recognizing the player's gesture, give the AI's move result and determine win/loss.
Effect Description
This phase most reflects the characteristics of "visual input + dialogue reasoning". OpenClaw not only recognizes the player but also continues to participate in the game, giving its own move and result explanation.
Example Commands
- Let's play rock paper scissors. Take a photo to recognize my gesture. You can randomly make a gesture. Then judge whether you win or I win. OLED displays who won this round
6.3 Scenario 3: OLED Scoreboard
Experiment Objective
Have OLED display the current round result or cumulative score.
Effect Description
The screen can display Win, Lose, Draw, or also display simple scores like You 1 : 0 AI, making the project more like a complete mini-game.
Example Commands
- Display this round's result on OLED
- Write the score to the screen
- Display "Round 1 You Win"
6.4 Scenario 4: RGB Result Feedback
Experiment Objective
Quickly express win/loss results with RGB colors.
Effect Description
For example, light up green for win, red for loss, blue for draw. This way, even without looking at text, you can immediately know the result of this round.
Example Commands
- Light up green if I win
- Light up red if I lose
- If you win, light up the flowing light; if I win, make the servo dance