This was one of my more lengthy projects split up into 3 stages.


Building

  • 6 stepper motors

  • 6 motor drivers

  • Large power supply

  • Arduino

  • 3D printed housing

This phase involved getting everything working at a mechanical level. This meant developing a system standard to control each motor with the appropriate signals coming from my computer (where I ran computer vision and solving algorithm), not the Arduino. I also had to design and print out a housing to hold all the different parts.

Rubik's Cube Color Recognition

I tried many ways to get this to work, and was arguably one of the harder parts of the project. I needed to maintain even lighting conditions to be able to detect color accurately. I tried multiple things, such as a blacked out shroud to decrease unwanted reflections, to making sure I ran the robot at similar times during the day.

I ended up just comparing the measured RBG values at pixel areas to hard-coded thresholds and it worked fine.

There was also the aspect of turning the faces so that the webcam that interfaced with my computer could see all the sides of the cube. Since I only had one camera, it was a little finicky to get the faces rotated and recorded before the algorithm even began solving. This also was the part with the greatest time cost in the end. I think most of the time was just manually turning the cube until every facelet was seen.

Algorithm and Connecting all the Parts

I used Herbert Kociemba's Two-phase solver (https://github.com/hkociemba/RubiksCube-TwophaseSolver) because I was sort of running out of time. However, there was still a few modifications I needed to make to the source code to make it work. I sort of black-boxed this component and just made sure that I knew exactly what to feed it from my color recognition software and parsed whatever it gave out correctly.

I also spent a lot of time with integrating all of the parts. It was the first major robotics project that I did. And although I had experience writing the serial communication system from previous projects, managing 6 motors was a little challenging and I definitely fried a couple of motor drivers from bad soldering jobs and overheating.