Raspberry Pi + OpenClaw: Offline Voice AI Assistant Setup Guide

February 26, 2026

Difficulty: β­β­β­β˜†β˜† | Duration: 45 minutes | Gain: Mastering the complete setup of an embedded AI voice assistant

Today, we're diving into something hardcoreβ€”using a Raspberry Pi to create a voice-interactive AI assistant.

Press a button, ask your question, and the AI's response will stream live on the LCD screen. If you want it to speak, you can also enable TTS voice broadcasting.

This is pizero-openclaw, an open-source voice AI assistant running on a Raspberry Pi. We'll walk through getting it up and running step by step.


Target Audience

  • Developers with 1-5 years of experience interested in embedded systems and AI
  • Hobbyists looking to build AI hardware
  • Students with a basic understanding of Linux command line

TIP

If you haven't encountered OpenClaw yet, it's recommended to check the official documentation to understand the basic concepts, but we'll aim to make this content self-contained.


Core Dependencies and Environment

Before starting, make sure you have the following:

CategoryRequirementDescription
Development BoardRaspberry Pi Zero 2 W / Pi Zero WARM v6/v7 architecture
Voice BoardPiSugar WhisPlay1.54" LCD, buttons, microphone, speaker
Operating SystemRaspberry Pi OS Bookworm+Python 3.11+
NetworkNetwork environment with access to OpenAI APIFor speech-to-text and TTS
OpenClawGateway running in an accessible locationLocal or cloud-based

WARNING

The Raspberry Pi Zero series has limited performance and is not recommended for running overly complex tasks. Its strength lies in lightweight interactions in embedded scenarios.


Project Structure

pizero-openclaw/
β”œβ”€β”€ main.py                 # Entry file, main loop
β”œβ”€β”€ display.py              # LCD rendering (status, replies, clock)
β”œβ”€β”€ openclaw_client.py      # OpenClaw gateway HTTP client
β”œβ”€β”€ transcribe_openai.py    # Speech-to-text (OpenAI)
β”œβ”€β”€ tts_openai.py           # Text-to-speech (OpenAI)
β”œβ”€β”€ record_audio.py         # Audio recording (ALSA)
β”œβ”€β”€ button_ptt.py           # Button state machine (press to record, release to send)
β”œβ”€β”€ config.py               # Configuration management (.env loading)
β”œβ”€β”€ sync.sh                 # Deployment script (rsync + systemd)
β”œβ”€β”€ .env.example            # Configuration example
└── requirements.txt        # Python dependencies

Hardware Preparation

Let's gather all the necessary hardware.

Essential Hardware

HardwareModelNotes
Development BoardRaspberry Pi Zero 2 W / Pi Zero WRecommended Zero 2 W for better performance
Voice BoardPiSugar WhisPlayIncludes 240x240 LCD, buttons, microphone, and speaker
Storage Card16GB+ TF cardFor flashing the Raspberry Pi system
Power Supply5V 2A micro USBStable power supply is crucial

Optional Hardware

  • PiSugar Battery β€” Lithium battery module for use without power
  • Enclosure β€” 3D printed or acrylic cut

TIP

PiSugar WhisPlay is a voice AI expansion board specifically designed for the Raspberry Pi Zero series, available for purchase on Taobao/Xianyu.


System Flashing and Initialization

Flashing Raspberry Pi OS

  1. Download Raspberry Pi Imager
  2. Choose Raspberry Pi OS (Bookworm) 32-bit or 64-bit
  3. In advanced settings, enable:
    • SSH
    • Configure Wi-Fi SSID and password
    • Set username pi and password

WARNING

Pi Zero W / Zero 2 W runs on a 32-bit system, it's recommended to use a 32-bit image for better compatibility.

Once the flashing is complete, insert the TF card into the Raspberry Pi and power it on.

First Connection

# Find Raspberry Pi IP on your computer
arp -a | grep raspberry

# SSH connection (default password is raspberry)
ssh [email protected]

After your first login, it's recommended to update the system:

sudo raspi-config

Configure the following options:

  • Extend the file system to the entire TF card
  • Set the timezone (Localization β†’ Timezone)
  • Enable the SPI interface (Interface Options β†’ SPI)

Install Dependencies

Confirm Python Environment

# Check Python version
python3 --version
# Output should be Python 3.11+ 

# If the version is too low, upgrade it
sudo apt update
sudo apt install python3.11 python3.11-venv

Install System Dependencies

sudo apt install python3-numpy python3-pil python3-pip

Install Python Packages

# Clone the project
git clone https://github.com/your-repo/pizero-openclaw.git
cd pizero-openclaw

# Install dependencies
pip install -r requirements.txt

requirements.txt should look something like this:

requests
python-dotenv
numpy
Pillow

Install WhisPlay Drivers

This step is crucial as the LCD and buttons require drivers to function.

Install the drivers according to the official PiSugar documentation:

# The driver should be installed in /home/pi/Whisplay/Driver/
# For detailed steps, refer to: https://github.com/PiSugar/whisplay-ai-chatbot

After installation, test if the LCD displays correctly:

cd /home/pi/Whisplay/Driver/
python3 test_display.py

If the screen lights up and displays content, the driver installation is successful.

TIP

Different batches of WhisPlay drivers may vary slightly, refer to the official documentation. If there are issues with the driver, you can search for similar problems in GitHub Issues.


Configure Environment Variables

Copy Configuration Template

cd ~/pizero-openclaw
cp .env.example .env
nano .env

Fill in Necessary Configurations

# Required: OpenAI API Key (for speech-to-text and TTS)
export OPENAI_API_KEY="sk-your-openai-api-key"

# Required: OpenClaw Gateway Token
export OPENCLAW_TOKEN="your-openclaw-gateway-token"

# Optional: OpenClaw Gateway Address
export OPENCLAW_BASE_URL="http://192.168.1.100:18789"

Other Common Configurations

VariableDefault ValueDescription
ENABLE_TTSfalseWhether to enable voice broadcasting
OPENAI_TTS_VOICEalloyTTS voice (alloy, echo, fable, onyx, nova, shimmer)
OPENAI_TTS_SPEED2.0TTS speed (0.25-4.0)
CONVERSATION_HISTORY_LENGTH5Length of conversation context
SILENCE_RMS_THRESHOLD200Silence threshold, values below this will be ignored
LCD_BACKLIGHT70Screen brightness (0-100)

Set Up OpenClaw Gateway

The voice assistant needs to connect to the OpenClaw gateway for AI interaction.

# Install OpenClaw
npm install -g openclaw@latest
openclaw onboard --install-daemon

Run Gateway on Another Machine

If the performance of your other machine running the Raspberry Pi is limited, you can run the gateway on another computer:

# Run on Mac/server
npm install -g openclaw@latest
openclaw onboard --install-daemon

Configure the Gateway

Edit ~/.openclaw/openclaw.json:

{
  "gateway": {
    "bind": "0.0.0.0",
    "port": 18789,
    "auth": {
      "mode": "token",
      "token": "your-token"
    }
  }
}
# Restart the gateway
openclaw gateway restart

# Get Token
openclaw config get gateway.auth.token

Fill the obtained Token into the previously configured .env file.


Test Run

Local Start

With everything configured, it's time to test:

cd ~/pizero-openclaw
python3 main.py

Under normal circumstances, you should see:

  1. LCD displaying time, date, battery level, WiFi status
  2. The screen shows β€œReady” waiting for commands

Voice Interaction Test

  1. Long press the button on WhisPlay β€” start recording
  2. Release the button β€” send the recording
  3. Wait a few seconds, the screen will display:
    • Recognized text
    • AI's streaming response
  4. If TTS is enabled, you'll also hear the voice broadcasting

TIP

It’s advisable to start with simple test phrases, like

Updated February 26, 2026