Q Learning robot snail
March 17, 2008
JohnNXT – Johnny 5 replica
June 1, 2008
Show all

The first NXT LEGO Rubik’s cube solver

Spring 2007: During February, March, April 2007, I’ve been very busy preparing University exams. The one which certainly caught my attention most was AI (artificial intelligence), that taught me about various aspects of Artificial Intelligence. This exam gave me the conscience that Artificial Intelligence has been invented to cure natural Idiocy, and has been an occasion to realize an impossible dream, or better an utopia! I wrote a software that can solve the famous Rubik’s cube puzzle, using IDA* heuristic search algorithm. In my mind that software was only a small part of the LEGO Rubik Utopia project, which aim was to make a LEGO Rubik’s cube solver robot.

This robot is quite famous. It’s been featured in many international TV shows, and its videos count more than 2 million hits on Youtube.

Check out its STORY!


This is the latest version of the robot, dated February 2008. It has been redesigned to be built only with the NXT retail set parts. It is really fast: It can solve any 3×3 cube in a minute maximum!

When I started to design a LEGO Rubik’s cube solver, I obviously had to collect the inheritance of a great robot of the RCX era, JP Brown’s Lego Rubik Solver. He used 2 RCX bricks, many motors and sensors, a webcam, a custom interface program on PC and already-done sub-optimal algorithm found on web at that time.


I studied the situation, having now the NXT, a more powerful hardware, and a self-made software that solves the cube optimally (the solution is the shortest possible), and I came up to the first design, showing right here. You can notice that is quite inspired by JP Brown’s robot. Even if it misses an arm, it can grab, rotate the cube and a single face. The overall impression is about a cool streamlined robot, but it do not work so well and it is very slow, it takes 2’10” to scan the entire cube. (this hardware solution has been used in the Cubestormer II robot). It uses 2 NXT bricks (communicating via Bluetooth), 4 servomotors and 2 light sensors.


I knew it can be done better. In this second version, the cube handling is more accurate and stable. The robot has 4 motors, hence 4 degrees of freedom: the nest that holds the cube can rotate and can go up and down, the portal over the cube can flip back and forth and grab the cube with a similar strategy of the first prototype. The finest feature is the lifter mechanism, smooth and solid. Again, here are involved 2 NXT bricks, while all the movements are monitored by 5 touch sensors. Better than before, but this prototype gains in precision but not in speed: it takes 2’00” to scan a cube.  Suddenly I realized that I forgot the basic rule in this kind of projects: I forgot to KISS! As many of you might already know, is not related to effusions with such machines, but means: ” KEEP IT SIMPLE, STUPID! “So I did. I started from scratch thought about how to get the movements needed with only 3 motors, and so with only one NXT brick. A motor actuates a prismatic joint that pushes the side of the cube (the red side in the photo) another rotates the cube’s support; the third one has the double function to help the pusher arm to accomodate the cube on the support and to hold the cube while the bottom face is rotated. The robot uses 2 touch sensors as limit switches for the arms and a light sensor to zero the rotating base. The final LEGO Rubik’s cube solver robot is shown in the first picture.


In 2009, I published a streamlined version of the original robot in my book LEGO MINDSTORMS NXT Thinking Robots. It’s called the One-armed Wonder, it uses just two motors, and a new software. It’s slower than the original robot born under the LEGO Rubik Utopia project, but it’s more robust, and easier to troubleshoot.

In 2007, My LEGO Rubik’s cube solver robot was the first NXT robot that could automatically solve a Rubik’s cube in less than a minute. Since then, it inspired dozens of people to create their own cube solver robots, including David Gilday and Mike Dobson, that realized the CubeStormer II, a robot that set a Guinness World Record of 5.270s for the fastest robot solving a Rubik’s Cube on 11th Nov 2011.