← BACK

RUBI - Self Solving Cube

Archived
Timeline

Oct 2024 - Dec 2024

Role & Context

Mechatronics & Computer Vision

Core Tech
PythonYOLOv8OpenCVBLE

Project Summary

Autonomous Rubik's Cube solving system integrating real-time computer vision with precision mechatronics to scan, solve, and execute maneuvers.

Key Features

  • Custom YOLOv8 Object Detection pipeline for robust facelet classification
  • Master-Slave architecture: PC (Vision/Kociemba) + Seeed XIAO nRF52840 (Control)
  • 6x stripped SG90 servo motors with custom 3D-printed gearboxes
  • Bluetooth Low Energy (BLE) using Bleak for wireless command serialization

Impact & Takeaways

  • Achieved average solve time of ~45 seconds (15s scan, <1s compute)
  • Eliminated lighting sensitivity issues common in HSV solvers via AI approach
  • Demonstrated effective reliable actuation of 6 independent faces

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.

PC Vision Subsystem YOLOv8 + Kociemba
BLE UART
Embedded Control Seeed XIAO nRF52840
Step/Dir Pulses
Actuation 6x Motors

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 kociemba Python library, which implements the Two-Phase Algorithm to find near-optimal solutions (typically <20 moves) in milliseconds.
CV Training Pipeline YOLOv8 Cube Detection

Mechatronics & Embedded Control

The physical solver requires precise, synchronized actuation of 6 faces. We iterated through multiple gearbox designs to ensure torque density.

RUBI System Overview Prototyping Iterations
  • 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.
Internal Mechanism
Wiring Schematic Physical Wiring

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.
BACKEnd of File