top of page

Rubik's Cube Solving Robot

File_000.jpeg

Version 1

After I came up with the idea for creating a Rubik’s cube solving robot, I immediately searched for videos of other people’s solutions. I liked a couple of the simpler Lego Mindstorm builds. My first version of the robot was heavily inspired by those. I would use two servos and one stepper motor. One servo would hold the top two layers of the cube as the stepper motor spun the bottom layer. Because the robot could only spin one side of the cube, I implemented another servo to flip the cube by pushing it. The base that held the cube was designed to allow for that pushing motion to flip the cube. After designing and 3D printing the robot, I ran into a few problems. First, the cube is difficult to turn, so some weak servos and a small low power stepper motor wouldn’t be able to do the job. Secondly, the algorithm that I was going to use was already going to take a large number of moves, so to only be able to twist one side without having to flip the cube was going to be a problem. Lastly, the servo motor used to flip the cube didn’t work as expected. I didn’t realize that the servo only had 180 degrees of freedom. With my design, the servo wouldn’t be able to reset without flipping the cube back over.

Version 2

For version 2 of my design, I knew I would have to look at more examples of Rubik’s cube solving robots. I saw a video from UC San Diego that intrigued me. They used a claw design I hadn’t seen before. I immediately opened Fusion 360 and starting on a new CAD, copying key features from their robot. I 3D printed for days, adjusting parts that didn’t work properly (wrong dimensions, doesn’t fit correctly, etc.). When everything was assembled, I knew it would all work. I then got straight to coding. I first working on the motor movements and wiring to make sure all the motors and drivers worked okay. This was early 2020, so every second I wasn’t in school or doing homework, I was working on this project. After confirming everything was working, I got started on programming the algorithm. It took many weeks, but eventually, I had finished. Although the algorithm was finished being programmed, I now needed to program a way for the camera to detect the cube colors and store them so the algorithm can function properly. After a few more weeks of programming, I did it. I had finished the coding. All I had left to do was to integrate the program with the assembly. I loaded the code and pressed play, but errors showed up, and I knew that the real project had just begun. From April to late June I worked on integration. There were many problems that I experienced, such as the cube not staying centered on the claws as it was moved around, the color detection not being accurate at times, and the screws loosening too often. I eventually took a break from my project. I had done all that work for nothing. After a couple of weeks, I decided to start a new version, something that wasn’t as care-intensive and delicate.

Version 3

Version 3 was carefully planned. I looked at more designs, especially the record-breaking solvers. I found that a designated claw to turn each side would not only increase the speed of the solve, but also increase reliability because the cube would stay stationary. I created a 3d model of my design, heavily inspired by others, and I 3d printed it.  After the three days it took to 3d print the models, I started designing claws that would grab the center of each face of the cube. After a little trial and error, my design was complete and assembled. There were two problems with this design. My version two used a camera to detect the colors on each face of the cube, but there is no way for a camera to see the faces of the cube because of the motors. Secondly, I didn’t have a way to flip the cube. The algorithm that I wrote requires the cube to be flipped, but with motors on all sides, it isn’t possible. The solution to the cube flipping problem was to virtually flip the cube. I wrote a section of code for tracking the cube’s position, so when it needed to be flipped, it would just change which side is the top and front. (For example, the yellow side is on the top, and the red side is in front, and the cube needs to be flipped on the x-axis clockwise. The program would just declare that the red is now the top and the yellow is now the back). After modifying the code a little to make the program working with one motor turning each face, I needed to find a solution to the color mapping of the cube’s faces. I quickly realized that I could just have the solver randomly scramble a fully solved cube, and then track all the pieces, so it knows the mixed cube’s colors. It took a lot of testing, speed adjustments, and small tweaks to the code, but it finally started working.

Algorithm

The algorithm that I used is called Old Pochmann. It is a good method for blind solving a Rubik’s cube. It is most certainly not the fastest, but there are a lot of good tutorials on how it works. There are plenty of options for good algorithms, but as this being my first large-scale project, I wasn’t going for speed. Old Pochmann is an algorithm where we solve the corner pieces and the edge pieces separately. We label each piece on the cube with its own letter to keep track of it. We can then create a string of letters for the movements of the pieces. For example, a red-blue-yellow corner piece is not in its correct position. It needs to go to the spot labeled X. We would add ‘X’ to the list. Now the piece that is in X’s spot needs to be moved as it will be replaced by the red-blue-yellow piece. Let’s say it needs to go-to spot R. We would add that to the list, and so on… When every corner is virtually in its correct spot (we haven’t physically turned the cube yet), we would look at the finished list; EX: [‘X’, ‘R’, ‘H’, ‘Y’]. Each letter in that list corresponds to its own set of moves. We would then use those moves in the sequence of the list to solve the corners. We would use the same process for the edges. This is a super simplified version of the algorithm, so for more information visit: Blind Solving Algorithms - SpeedCubeReview.com.

bottom of page