A Lightweight Embedded Desktop OS for Educational Robots
Raspberry Pi CM4 / CM5 ยท Qt C++ Launcher ยท PySide6 Apps ยท Linux Framebuffer
- Overview
- Screenshots
- Features
- Hardware
- Architecture
- Quick Start
- Project Structure
- Applications
- Development
- Contributing
- License
Luwu-OS is a purpose-built embedded operating system for educational robotics. Running on Raspberry Pi CM4 and CM5, it powers a suite of interactive applications โ from AI-powered voice chat and gesture recognition to Blockly-based visual programming and multi-robot group performances.
The system features a Qt C++ launcher that manages a fleet of PySide6 application processes, all rendering directly to a 240ร320 SPI LCD via the Linux framebuffer โ no X11, no Wayland, no display server overhead.
Mission: Give every student an intuitive, responsive, and delightful robotics experience โ right on the robot itself.
| Category | Capability |
|---|---|
| ๐ง AI Assistant | Voice conversation, emotion recognition & expression, real-time TTS/ASR |
| ๐ฎ Gamepad Control | Bluetooth & wired gamepad support with joystick calibration |
| ๐๏ธ Gesture Recognition | Real-time hand pose estimation via MediaPipe |
| ๐ค Face Tracking | Face detection & follow using onboard camera |
| โฝ Ball Tracking | Color-based ball detection, tracking & catching |
| ๐ก RC Mode | Remote control via mobile web interface with live camera feed |
| ๐บ๏ธ Radar Scan | LiDAR-based 360ยฐ environment scanning |
| ๐ญ Group Performance | MQTT-synchronized multi-robot choreography |
| ๐งฉ Blockly Coding | Visual programming with drag-and-drop blocks, generates Python on-device |
| ๐ WiFi Setup | QR code scan-to-connect, hotspot management |
| ๐ Sound Localization | Microphone-array based sound source detection |
| โ๏ธ System Settings | Language switching (EN/CN), volume control, device info |
| # | Component | Interface | Driver |
|---|---|---|---|
| 1 | SPI LCD (ST7789V, 240ร320) | SPI0 + GPIO 27/25/0 | fbtft kernel driver โ /dev/fb-spi |
| 2 | Camera (OV5647) | CSI | Picamera2 (per-app lifecycle) |
| 3 | 4 Physical Buttons (A/B/C/D) | GPIO 17/22/23/24 | gpio-keys โ /dev/input/eventX |
| 4 | Bluetooth (Cypress) | mini-UART / PL011 | bluetoothd via D-Bus |
| 5 | Audio + Microphone (WM8960) | I2S + I2C | ALSA dmix + dsnoop |
| 6 | Robot Dog UART | ttyAMA0 / UART5 | xgolib (auto-detect) |
| 7 | Servo / IMU / Battery | UART โ MCU | xgolib forwarding |
| 8 | Cooling Fan (4-wire PWM) | GPIO PWM + TACH | pwm-fan kernel driver (hwmon) |
| 9 | Power + Battery | VC voltage monitor + UART | vcgencmd + xgolib joint monitoring |
See HARDWARE_PLAN.md for the full hardware architecture, pinouts, and migration strategy.
Each hardware peripheral has exactly one owner โ the kernel driver or system service. Apps access hardware through standard interfaces, never by fighting over raw devices.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Qt C++ Launcher โ
โ โโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโ โโโโโโโโโโโโ โ
โ โ Gallery โ โ StatusBarโ โ KeyFilter โ โ QProcess โ โ
โ โ View โ โ (battery)โ โ (evdev) โ โ Manager โ โ
โ โโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโ โโโโโโฌโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโ
โ spawn
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโ
โ PySide6 Apps (LinuxFB) โ โ
โ โโโโโโโโ โโโโโโโโ โโโโโโโโ โโโโโโโโโโโ โ
โ โ AI โ โCodingโ โDemos โ โSettingsโโ ... โ
โ โ Chat โ โBlocklyโ โPage โ โ Page โโ โ
โ โโโโโโโโ โโโโโโโโ โโโโโโโโ โโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Linux Kernel Layer โ
โ fbtft โ gpio-keys โ ALSA dmix โ pwm-fan โ vcgencmd โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
| Layer | Technology | Role |
|---|---|---|
| Launcher | Qt 5.15 C++ (EGLFS / LinuxFB) | Process lifecycle, key routing, status bar |
| Applications | PySide6 Python (LinuxFB) | Feature apps, rendered to framebuffer |
| Hardware Abstraction | Kernel drivers + systemd services | Single-owner hardware access via standard Linux interfaces |
| IPC | FIFO (/tmp/luwu_keys.fifo), D-Bus, MQTT |
Inter-process communication |
- Raspberry Pi CM4 or CM5 with compatible carrier board
- SPI LCD (ST7789V) connected via SPI0
- Debian-based Linux OS
The easiest way to get started is to flash a pre-built system image using Luwu-Imager:
The imager handles OS installation, SD card partitioning, and initial configuration automatically.
Note:
install.shis still under active development and may not cover all hardware configurations yet. It is recommended to use the Luwu-Imager approach above for a complete setup.
git clone https://github.com/LuwuDynamics/luwu_os.git /opt/luwu-os
cd /opt/luwu-os
sudo bash configs/install.shThis single script handles everything:
- Kernel overlays (SPI LCD, gpio-keys, fan control)
- udev rules (
/dev/fb-spisymlink) - ALSA multi-app audio sharing (
dmix+dsnoop) - systemd services (launcher, undervolt monitor, hardware auto-detect)
- Python dependencies via
pip
Key Python packages installed:
xgolibโ Robot dog motion libraryxgoedu-luwuosโ Educational library (PySide6 QPainter)xgo-blockly-luwuosโ Blockly visual programming
The system starts automatically on boot via systemd:
sudo systemctl enable luwu-launcher
sudo systemctl start luwu-launcherRun individual apps directly for development:
# Navigate to the app directory
cd apps/ai
python main.py
# Or for the coding app
cd apps/coding
python main.pyLuwu-OS/
โโโ launcher/ # Qt C++ main launcher (Gallery, StatusBar, KeyFilter)
โ โโโ main.cpp # Entry point, QProcess management, key routing
โ โโโ galleryview.cpp # Card-based app gallery UI
โ โโโ statusbar.cpp # Battery + time status bar
โ โโโ ...
โโโ apps/ # PySide6 feature applications
โ โโโ ai/ # AI voice chat, emotion recognition, TTS/ASR
โ โโโ coding/ # Blockly visual programming
โ โโโ demo_page/ # Demo launcher page
โ โโโ ball_track/ # Color-based ball tracking
โ โโโ ball_catch/ # Ball catching with servo control
โ โโโ face_follow/ # Face detection & tracking
โ โโโ gesture/ # Hand gesture recognition
โ โโโ gamepad/ # Bluetooth/USB gamepad control
โ โโโ rc_mode/ # Remote control via web UI
โ โโโ radar/ # LiDAR 360ยฐ scanning
โ โโโ perform/ # Pre-programmed performance routines
โ โโโ group_perform/ # MQTT-synchronized multi-robot group performance
โ โโโ joystick/ # Joystick control interface
โ โโโ hotspot/ # WiFi hotspot management
โ โโโ network/ # Network configuration
โ โโโ settings/ # System settings (language, volume, device info)
โโโ configs/ # System configuration files
โ โโโ install.sh # One-click deployment script
โ โโโ boot-config.txt # Kernel config template (new hardware)
โ โโโ cm4-old.config # Kernel config template (legacy hardware)
โ โโโ luwu-keys.dts # gpio-keys device tree source
โ โโโ asound.conf # ALSA dmix/dsnoop configuration
โ โโโ asound.state # Mixer state (anti-feedback + safe volume)
โ โโโ *.service # systemd service unit files
โโโ libs/ # Shared Python libraries
โ โโโ xgolib/ # Robot dog motion library
โ โโโ xgoedu-luwuos/ # Educational library (PySide6 QPainter)
โ โโโ theme/ # UI theming
โ โโโ ui/ # Reusable UI components
โ โโโ i18n.py # Internationalization support
โโโ model/ # ONNX AI models
โ โโโ emotion.onnx # Emotion recognition
โ โโโ face_detection_*.onnx # Face detection (YuNet)
โ โโโ handpose_*.onnx # Hand pose estimation (MediaPipe)
โ โโโ person_detection_*.onnx # Person detection
โ โโโ pose_estimation_*.onnx # Pose estimation
โ โโโ yolo_coco.onnx # Object detection
โโโ assets/ # Static assets
โ โโโ expressions/ # Robot facial expression frames
โ โโโ images/ # UI images & backgrounds
โ โโโ music/ # Audio files (system sounds, music)
โโโ docs/ # Documentation
โ โโโ HARDWARE_PLAN.md # Detailed hardware architecture plan
โโโ scripts/ # Utility scripts
| App | Description | Key Tech |
|---|---|---|
| AI Chat | Voice conversation with emotion-aware responses | LLM, TTS, ASR, ONNX emotion detection |
| Blockly Coding | Visual drag-and-drop programming for robots | Blockly, Python code generation |
| Face Follow | Real-time face detection and tracking | MediaPipe Face Detection, Picamera2 |
| Ball Track | Color-based ball detection and following | OpenCV color filtering, PID control |
| Gesture Control | Hand gesture recognition for robot commands | MediaPipe Hands, ONNX |
| Gamepad | Bluetooth/USB gamepad robot control | evdev, Bluetooth HID, joystick calibration |
| RC Mode | Remote control via mobile web browser | Flask web server, MJPEG streaming |
| Radar | 360ยฐ environment scanning visualization | YDLiDAR SDK, real-time rendering |
| Group Perform | Synchronized multi-robot choreography | MQTT pub/sub, time-sync |
| Settings | System configuration and device info | Language switching, volume control |
All applications are built with PySide6 and render directly to the Linux framebuffer:
# apps/ball_track/main.py (simplified example)
import sys
from PySide6.QtWidgets import QApplication, QWidget
from PySide6.QtCore import QTimer
from picamera2 import Picamera2
import cv2
class BallTracker(QWidget):
def __init__(self):
super().__init__()
self.camera = Picamera2()
self.camera.start()
self.timer = QTimer()
self.timer.timeout.connect(self.process_frame)
self.timer.start(33) # ~30 FPSKey events are routed from the C++ launcher to Python apps via a FIFO (/tmp/luwu_keys.fifo):
| Physical Button | GPIO | Linux Key Code |
|---|---|---|
| A (top-left) | 17 | KEY_LEFT |
| B (top-right) | 22 | KEY_RIGHT |
| C (bottom-left) | 23 | KEY_BACK |
| D (bottom-right) | 24 | KEY_ENTER |
ONNX models are located in model/ and loaded via onnxruntime. Models include:
- Face detection (YuNet)
- Hand pose estimation (MediaPipe)
- Person detection (MediaPipe)
- Pose estimation (MediaPipe)
- Emotion recognition (custom)
- Object detection (YOLO COCO)
Contributions are welcome! Please feel free to submit issues and pull requests.
This project is licensed under the Apache License, Version 2.0.
Copyright ยฉ 2024โ2026 LuwuDynamics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This means you are free to:
- Use โ the software for any purpose
- Modify โ the source code and create derivative works
- Distribute โ copies of the original or modified software
- Commercialize โ use the software in commercial products
Under the following conditions:
- You must include a copy of the Apache 2.0 License in all distributions
- You must state significant changes made to the original code
- You must retain all copyright, patent, trademark, and attribution notices
- The project name "Luwu-OS" and associated trademarks are not licensed
For the full license text, see LICENSE.
Built with โค๏ธ by LuwuDynamics



















