BrickPi3 Project
BricKuber – Rubik's Cube Solver
An open-source Rubik's cube solving robot built with BrickPi3, a Raspberry Pi camera, and LEGO Mindstorms. Scans all six faces and calculates the optimal solution in under 2 minutes.
BrickPi3 Project
An open-source Rubik's cube solving robot built with BrickPi3, a Raspberry Pi camera, and LEGO Mindstorms. Scans all six faces and calculates the optimal solution in under 2 minutes.
The Rubik's cube — invented in 1974 and the world's best-selling toy — requires thought, skill, and plenty of patience. So why not let a robot do it?
The BricKuber combines a Raspberry Pi, BrickPi3, and LEGO Mindstorms to build a fully automated Rubik's cube solver. Place an unsolved cube in the cradle, run the Python program, and watch as the robot scans each face, computes the optimal solution, and executes every move in under two minutes.
This project is inspired by the MindCub3r design for LEGO EV3, extended to use the Raspberry Pi Camera instead of the EV3 Color Sensor.
Start with the MindCub3r design. Full LEGO building instructions are available at mindcuber.com. The BricKuber has three major moving parts:
Follow the BrickPi3 assembly guide to put together the case. Attach the BrickPi3 board, Raspberry Pi, and the Pi Camera ribbon cable. Use the LEGO EV3 "wings" to support the BrickPi3 and keep it level with the BricKuber body.
Secure the Pi Camera between the two LEGO beam supports on the camera arm. Use a small strip of electrical tape to hold it in place. Verify the camera can see the entire top face of the cube:
raspistill -o cam.jpg
Open cam.jpg and confirm the cube is well-centred in the frame.
Adjust the camera position and focus before continuing.
If you're using Raspberry Pi OS Trixie for BrickPi3 the libraries are already installed. Otherwise, run:
sudo curl -kL dexterindustries.com/update_brickpi3 | bash
sudo curl https://raw.githubusercontent.com/DexterInd/BrickPi3/master/Projects/BricKuber/install_brickuber.sh | bash
The installer pulls in three key Python libraries:
Place an unsolved Rubik's cube in the cradle and run:
sudo python ~/Dexter/BrickPi3/Projects/BricKuber/BricKuber.py
The robot will rotate the cube to each of the six faces, take a photo of each, determine the configuration, calculate the solution, and then execute every move automatically.
All source code is open on GitHub: