Rubik's Cube Solver Robot

Skills Used: C++, QtCreator, CAD/Fusion360, Algorithms, Arduino, Stepper Motors, 3D Printing, Machining

GitHub Repo

I've always enjoyed solving Rubik's cubes and with my interest in robotics, I decided to create a robot that could solve a Rubik's Cube. 


Software

First I created a GUI that could be used to manipulate a digital Rubik's Cube. For the solving algorithm, I used code from Stefan Pochman. I implemented my own GUI in QtCreator using C++. I included options to scramble, solve, and apply the solved moves so the user can see what happens. The user can also perform a turn just like on a real cube using FBUDLR notation to turn a side. There are also stats on how long a solve took and how many moves there are to solve. 

Scrambled Cube

Cube after clicking "APPLY SOLVE MOVES"

Hardware

My goal with this project was to create a piece of hardware that could solve a scrambled cube in less than 3 seconds. There are a few people that have done it in well under 1 second, but with much more investment. To achieve the 3 second mark I knew that I would need to be able to control each cube face independently. I created a CAD mock-up in Fusion360, including 3D printed motor mounts. I ordered the parts and everything fit together great. Part of the work was machining a key into the rod that was coupled to the motor shaft. 

To attach the motors to the cube I had to drill 3 holes into the center "cubie" of each face of the cube . I then had 3D printed grippers that attached to the coupled rod and inserted into the cube. This way I was able to achieve a tight fit on every face of the cube, which is essential to turn the faces quickly. This took a few iterations of designing the grippers, but the final product is fairly robust. 

Electronics

The next and last step is to get the electronics working. This would include two Arduinos that would be responsible for each controlling 3 faces of the cube. The stepper motors are rated for 12 V, 1.5 A so I also needed to purchase a beefy power supply. There are two Arduino with CNC shields that communicate with the six stepper motors to send commands. The GUI sends these commands one at a time and there is a delay between each motor turn.

Solving the Cube

Putting everything together the GUI sends commands to the Arduino which then commands each motor according to the solve. The main difficulty I had with integration was running the motors too quickly. This caused the cube to seize up as seen in the video at the beginning of the page. I experimented with different delays between motor turns and the fastest I was able to run the motors was with a 100 ms delay. 

I was able to achieve a 7.82 s solve on hardware (with a 200 ms solve). To make this faster than the 3 second goal in the future, I could try the following: