top of page

Lego Rubik's Cube Solver

This is my 3rd year project(dissertation) at University of East Anglia, Computer Graphics 2015.
The main idea of the project is to build a system that is able to solve a Rubik's Cube without any help.

Project consists of a few steps :


  • Constructing the robot out of Lego.

  • Coming up with an algorithm to solve the Rubik's Cube.

  •  Implementing the algorithm in a programming language that is compatible with the system.( Matlab )

  • Scanning the cube with the aid of the RGB sensor or the camera.

  •  Use the algorithm with the robot to use the motors to physically solve the cube.


The final product robot can scan a scrambled Rubik's cube with the RGB scanner or a camera.


The results showed that the RGB scanner is faster however is not as precise as the camera, the camera scan has a faster CPU time but the overall time it takes to switch the sides of the cube manually takes more time. The computer vision and machine learning  techniques used when scanning the cube with the webcam resulted in a 100% accurate scan under many different lighting scenarios.

After the cube is scanned an algorithm is used to come up with a solution with the human solution notation.

Thistlethwaite's 52-move algorithm is used to come up with a solution from the scanned cube. This solution has to be translated into robot movements as the robot movements are restricted by the two motors that can rotate the cube.

Finally, the robot solution notation has to be turned into rotation, power and duration motor commands.

Matlab library is used to create a toolkit to turn the notation into precise robot arm motor movements.

Source  Code

Project Report

bottom of page