Context & Motivation
The Rubik's Cube is a classic puzzle with over 43 quintillion permutations. RUBI is an autonomous solving system designed to demystify robotic manipulation and computer vision. By integrating real-time object detection with a precision actuation mechanism, RUBI scans, solves, and physically executes the solution for a scrambled cube without human intervention.
System Architecture
The system operates on a master-slave architecture: A PC-based Vision & Computation subsystem handles the heavy lifting (AI/Solving), while a microcontroller handles the real-time motor control.
Engineering Implementation
Computer Vision Pipeline
Robustly identifying sticker colors under varying lighting is a notorious challenge. Instead of simple color thresholding, I implemented a robust AI-driven pipeline:
- YOLOv8 Object Detection: Trained a custom YOLOv8 model to detect and classify individual cube facelets (White, Yellow, Red, Orange, Green, Blue) with >99% confidence.
- State Reconstruction: The system captures 6 faces sequentially. A custom mapping algorithm reorders the raw detection stream into a flattened 54-element string compatible with the standard cube notation.
- Solving Algorithm: Integrated the
kociembaPython library, which implements the Two-Phase Algorithm to find near-optimal solutions (typically <20 moves) in milliseconds.
Mechatronics & Embedded Control
The physical solver requires precise, synchronized actuation of 6 faces. We iterated through multiple gearbox designs to ensure torque density.
- Wireless Communication: Utilized the Bleak library to establish a Bluetooth Low Energy (BLE) link between the Python backend and the robot's Seeed XIAO nRF52840 microcontroller. Move commands are serialized and written to a custom GATT characteristic.
- Actuation: 6x motors from SG90s drive the faces via custom 3D resin printed gearboxes.
Performance
- Solve Speed: Average total time of ~45 seconds (Scan: 15s, Compute: <1s, Actuation: 30s).
- Reliability: The YOLO-based vision system reduced color calibration issues common in HSV-based solvers, working robustly even in dim or warm lighting.