In 2009, my good friend David Campeau proposed we should team up to make a Rubik's Cube solving robot. Being a cuber, and the engineering junkie I still am, I quickly accepted. We both dived in to work on the project that would eventually lead us to the 2010 Intel International Science and Engineering Fair in San Jose California, and would jump-start both of our high school Science Fair careers.
Our goal was to construct a robust and relatively simple robot that could solve a 3x3x3 Rubik’s Cube in less than one minute.
The robot was constructed using a Lego Mindstorms NXT set. Programming of the robot’s basic functions was performed using LabVIEW and the NXT Toolkit. Higher level programming was done primarily using Matlab. A Matlab graphical user interface (GUI), featuring a virtual cube mirroring the cube being solved, was programmed to launch and monitor the solution. The cube’s faces were systematically scanned using a robot mounted USB webcam. We developed an image processing algorithm that analyzed the webcam images and sent the initial cube orientation to a two-phased solving algorithm programmed in C. The solver was optimized to rapidly find a short (<30 moves), but not necessarily an optimal solution (<21 moves), which could require substantially more computing time. A Matlab routine then interfaced the solution to the LabVIEW routines on the NXT brick via a USB connection, and initiated execution of the robotic moves, controlled by the NXT brick.
The final cube solving process from initial scanning to final completion required less than one minute. This project necessitated several hundred hours of work; it took approximately six months to construct and program a functional robot. More than eight prototypes of the robot and ten prototypes of the GUI/solver were developed to reach our goal. Challenges overcome included inaccuracy of Lego servo motors, flimsy plastic Lego pieces, image processing under changing lighting conditions, and interfacing between system components.