So here's a project I've been working on for a while...

This robot that can solve a Rubik's cube using Arduino.

I learned how to solve a Rubiks cube last year, and I was also into Arduino, so eventually I ended up with an idea to make my own Rubik's cube solver.

Like many people searching for "Rubik's Cube Solver" on Google, one of the first robots I found was the Tilted Twister design by Hans Andersson:

I looked around at some other Rubik's cube solvers, but I liked that design because of it's (relative) simplicity, so I built a similar version of it with popsicle sticks, an Arduino and 2 servos.

In the end, my robot takes about 20 minutes to enter the cube state and solve.

Step 1: Materials


- Arduino UNO R3

- 2 servos (I used Hitec HS-311's)

- wires

- USB cable

You can get all of these parts from any robotics store. I got them from canadarobotix.com


- popsicle sticks

- wooden skewers

- thin plywood

- wooden wheel (skewer must fit inside the hole)

- hot glue

- paper towel roll


- Arduino IDE - (Algorithms in C++)

- Python 2.7+ and Tkinter - (GUI)

- Pyserial

<p>Will a micro servo motor do the job?</p>
<p>Hi, It tried Quality SG90 mini servos, and they struggle big time,pulling high mAh and not working. Of the 4 STD sizes, Micro/Tiny/Mini/Standard, you are better of using the standard size as Matt has listed for your first build, it hard enough on the to get it working correct with them, then you could swap them out for smaller ones at a later date. </p>
Oh thanks for the information.
<p>Thank you very much Matt for this amazing instructables, can't replicate exactly your version, mechanics was for me too complicated, so i choose this slightly different... </p><p>https://www.youtube.com/watch?v=NRRSYEWIQ_w</p>
hey man im having one problem with the rotating platform, its very glitchy.in some directions it rotates 90 degrees fine and alignes perfectly with the hand but in other directions it totally misses and the platform becomes not centered so the cube wont flip.ive tried a lot of thing but i couldnt fix it.hope anyone helps .<br>thanks!
<p>Same here. I'm almost done with my rubik' solver and i have a problem with the rotating platform. My platform does not align with the pushing arm unlike their work which works perfectly fine. I really need help with this problem too! I hope they could read our comments.</p>
How to chamge the angle that the push servo is pushing at?<br>Thanks in advance
<p>I have an Arduino MEGA 2560, is it compatible? Thanks!!</p>
Yes, you can use any arduino for the project.
<p>Maaaadeeeee!!! Thank you so much!!!!</p>
<p>Thanks, but when i'm uploading the program to the Arduino, it sends me a message avrdude: stk500v2_ReceiveMessage(): timeout. Never happened before. </p>
<p>Hi matt, why do you have so complicated rotation function?</p>
<p>is the rotate servo a full rotation one</p>
<p>I made one too!</p><p>I rewrote all the code from scratch (it uses m2/old pochman, so it's reeeeally slow, 300+ moves).</p><p>Main difference is you input your cube state with buttons and a lcd :)</p><p>Here's a video: <iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/ViafK5Dlph8" width="500"></iframe></p><p>Thank you for this instructable!</p><p>Nicola</p>
Hey nic please can you teach me completely that how did u made it cos i cannot afford arudino frm my pocket money
I used an arduino pro mini clone, you can find one for 4-5&euro; shipped online. The servos are a bit more expensive, I paid 20&euro; for both.<br>The ice lolly sticks are around .03&euro; each, you'll need about 100 of them I guess.<br>To build it I suggest you follow this awesome instructable, it's pretty straightforward :)
<p>Hi, Nice one looks like it works very good and seems to have some speed to it. The one I build had a massive change done to it when I put it on me computer chair, forgot it was there and sat on it. I will build another some time soon.</p>
<p>That looks great!</p><p>How did you construct the metal joints on the arm? They look pretty solid.</p>
M3 (16mm) hex bolts, 9mm washers and full nuts locked in position with hot glue :D
<p>Nice! </p><p>I'll keep those in mind for the next Rubik's cube solver i'm building.</p>
<p>i like your instructables</p>
<p>Hi, Well after waiting weeks for the servo to turn up I completed the the Project (98% ish, still needs a bit of cleaning up to call it finished). Used a Arduino Nano V3 as it was cheaper, $2.50, 2x Servo's $6.50 of eBay, &pound;1.00 2x 50 Garden marker sticks from Wilko's, Tube of Uhu glue from &pound;1 shop, (guess what it cost), and about 40Hrs work in total, Setting it up and working out the bugs was a bit of a pain but part of the fun as well, made it so it all pulls apart if needed, so in all it cost about &pound;10. </p><p>One things sure without the Instructable and Matt2uy ,I could never have worked it out, The best bit when it's working is the way it och's the cube into line so it's squared up for the next move, brilliant bit if coding Matt.</p><p>As you can see in the video I had a play with the GUI code to make it easy for me to use, (I know nothing about coding apart from look and see, and maybe that may work).</p><p>Did a quick Video to show it working. Now it's time to get some sleep .</p><p>Thanks again for the Instructable.</p><p>Dave</p>
<p>Hey <a href="http://www.instructables.com/member/splodgie/" rel="nofollow">splodgie</a>, can I see your GUI code?</p>
<p>Hi, When you have time upload a video so we can see it in action. </p>
Hi splodgie,<br>I have it running perfectly! I am trying to add a couple of more buttons on the GUI. I'd seen your GUI and want to do something close to it. I appreciate your reply! <br>
That's awesome!<br><br>I watched your video and I think your mechanical design is a lot more reliable and well constructed than the one I made.<br><br>It's really awesome to see someone actually use my instructable to help make their own robot!<br><br>When you're 100% done, I think you should make an instructable if you want.<br><br>Matthew
<p>Hi Matthew, Thanks for your comment and very happy you like my attempt at taking your design and hard work in trying to replicate it in the best way I could. <br>I tried to stay within the materials used and method of your design, (A evo design based on the master prototype).<br>As you know getting it to work after you have made your design is the hard part, or you are very lucky if it works first time.</p><p> I may try to show some of the design and the measurements I have in my copy at a later date. As some one said ' the way it works and the materials used to complete the mind bogeying complication of completing the Rubik's cube just has to makes you smile'. you should be on Dragons Den with it.<br><br>Dave</p>
<p>Yes, getting it to work probably took up more time than actually making it for me, but that was probably due to my build quality.</p><p>I probably won't be on Dragons Den, but I hope that this project is a stepping stone for some more projects I'll be making.</p>
<p>hi matt, i have got your reply.</p><p>but still i have big problem in step7 from points 6 to 9..</p><p>i am not able to understand these points. i a totally new to c++ and python. so could please ..........please tell me briefly the step 7 one by one</p><p>it's a humble request one again. thanks in advance.</p>
<p>So basically, point 6:</p><p>- open the file named Send_Cube_State.py and on line 18, replace the '0' with the correct address at the bottom right of the Arduino IDE. (see both pictures in step 7)</p><p>Point 7, 8 and 9:</p><p>- to open the command prompt, just enter 'cmd' in Start or Run.</p><p>- then use the 'cd' command to go to the right folder (where Send_Cube_State.py is)</p><p>- use the 'python' command to run the script</p><p>- you can learn more about command prompt stuff from here: <a href="http://dosprompt.info/folders.asp," rel="nofollow"> http://dosprompt.info/folders.asp, </a> or on google.</p>
<p>Hi Matt, can you provide me the link for the tic toe GUI you were using? Really appreciate your help! :)</p>
<p>I found it here: http://www.dzone.com/snippets/gui-tic-tac-toe-less-100-lines</p>
<p>this error is always coming.</p><p>please help and thanks in advance.</p>
<p>Install Python 2.7.8 </p><p><a href="https://www.python.org/downloads/release/python-278/" rel="nofollow">https://www.python.org/downloads/release/python-27...</a></p>
<p>Hi Matt, I have a question. I am currently building my robot and I keep getting a blank GUI every time I run the send_cube_state.py code on my terminal. I'm using a mac. What should I do to make the colors appear on the GUI? Here is a screenshot so you can see if there is a problem. Any help is much appreciated. Thanks in advance!</p>
<p>Sorry for the late reply, my email notifications didn't work.</p><p>Anyway, I'm not sure how to fix this problem because I don't use a mac. It might be a problem with tkinter, but i'm not totally sure.</p><p>Someone else had the same issue here: <a href="https://github.com/matt2uy/Cube-Solver/issues/4" rel="nofollow">https://github.com/matt2uy/Cube-Solver/issues/4</a> so it could still work if you memorized the order of the colours, or you could tinker with the python script.</p>
<p>I considered using different versions of mac OS and none of them worked. I switched to a windows PC and the GUI showed up! Complete with all set of colors! I will update you when I finish building my project. Thanks by the way!</p>
<p>hi matt, my python is not able to run the send_cube_state.py file.</p><p>could you please send me the exact code and method to upload, run and make the rubik's cube gui, to my email id ( helloiamparas@gmail.com).</p><p>it's a humble request. please send as soon as possible.</p>
<p>Everything you need is in step 7: &quot;How To Use&quot;.</p><p>BTW, you should run the script from the command prompt, not the python interpreter.</p><p>If step 7 is missing anything, just ask me.</p>
<p>Hi Matt, </p><p>Another question regarding the rotating servo, what is its range of motion? The one I got only rotates up to 180 degree but looking at your code it seems like it needs over 270 degrees range. Thanks in advance!</p>
I used servos with 180 degrees of motion.
<p>Cool! And going through the code &quot;void rotate_three()&quot; what is this function going to do? Thanks again!! :)</p>
rotate_three() rotates the cube to 180 degrees (clockwise)
<p>Ok! And rotate_two spins it 90 and what does rotate_one do? Thanks a ton!</p>
Yup, that's right. And rotate_one moves the servo's position to 0 degrees.
<p>Matt,</p><p>My pushing servo initially wants to go to zero degree, it starts from 180 degrees. I have my pushing servo in the same orientation as yours but yours does not seems to do that. Is there a way to correct that? Thanks !</p>
<p>Have you wired the Pushing servo power correctly, + - -+ ?</p>
<p>I have it with correct polarity. It just the initial movement. Then it seems to work from then on! Thanks Matt!</p>

About This Instructable


480 favorites


More by matt2uy: Rubik's Cube Solver How to make a vertical phone stand
Add instructable to: