Rubik’s Cube Solving Robot 2.0
About
Rubik’s cubes are awesome little puzzles to play around with. In 2022 I learned how to solve one and immediately built Rubik’s cube robot 1.0 which used 6x stepper motors and the CFOP algorithm which I programmed myself. The fastest solve on that robot was about 4.56s. Considering that Max Park holds the current world record at 3.13s and two MIT students built this contraption to solve a cube in 0.38s my time is extremely slow. About a year later I decided to take another stab at making a Rubik’s cube robot. Pretty much all of the solvers that I have seen use stepper motors which is why I used them in my first solver. Having just finished building my robot dog using 12x brushless motors I decided to try a different approach. I wanted to see how fast a Rubik’s cube could be solved with brushless motors.
GitHub (For CAD and Code)
Results
Fastest Solve: 1.071s (17 moves)
Slowest Solve: 1.418s (21 moves)
Average Camera Vision and Algorithm Solve Time = 0.663s
Average # of Moves: 20.4
Average Solve time: 1.285s
Average Moves/sec: 15.89
Cameras, Algorithms, and Motors
In order to solve the cube, the robot needs to know what the cube looks like. It does this by using 2x Pixy2 Cams. With my previous solver, I had to manually enter the cube configuration which was a very laborious process. The cameras are strategically placed so that each can view 3 faces of the cube. I got this idea from the MIT guys. The great thing about these cameras is that they can read the RGB values of a pixel which means that I didn’t have to program the camera vision from scratch.
While it may seem like a simple puzzle, there are 43,252,003,274,489,856,000 (43 quintillion) different ways to scramble a Rubik’s cube which means that everyone in the world could have about 5 million different cubes without a single one being the same. So how exactly do you make an algorithm to solve any one of those scrambles? I still don’t know the answer to that. What I do know is that researchers have spent decades exploring this very question. Most notable among them is Herbert Kociemba who helped discover God’s Number. If God were to solve a Rubik’s cube, he would solve it in the least amount of moves as possible. As it turns out, God’s number is 20. Any Rubik’s cube can be solved in 20 moves or less. The Kociemba algorithm is a common algorithm used with Rubik’s cube robots and is the algorithm that I used for this project. At the heart of Kociemba is the idea of God’s number. While the algorithm may not solve every cube in 20 moves, it gets pretty close. The most moves that my robot ever used was 22. Most solves were done in 21 moves.
The Kociemba Algorithm that I used
I used 6x Eagle Power 8308 90KV brushless motors for the robot. To control them, I used 6x ODrive S1s which are FOC controllers. FOC or Field Oriented Control is a control approach that allows a brushless motor to be controlled like a servo but with many more settings. With FOC Controllers you can control the position, velocity, and torque of a brushless motor. I like to think of these controllers as a way to turn a BLDC motor into a virtual spring that you can dampen or stiffen. These controllers are what allow each axis of the solver to turn precisely.