Picture of Rubik's Cube Solver


So here is 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 Rubiks cube solver.

A lot of people have probably seen the tilted twister design by Hans Andersson:

I looked around at the existing Rubik's cube solvers, and I liked that design, so I built a similar version of it with (mostly) popsicle sticks, using an Arduino and 2 servos.

My robot takes 20 minutes to enter the cube state and solve.

Remove these adsRemove these ads by Signing Up

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


- 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

Step 2: Electronics

Picture of Electronics

Wiring up the servos to the Arduino was pretty simple.

- Connect the yellow (signal) wires for the push and rotation servo to pin 6 and 9, respectively.

- Connect the positive and negative wires to the 5v power source and ground. Sometimes the servos had jitters, so I think capacitors could have smoothed out the signals.

1-40 of 80Next »
splodgie made it!14 days ago

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, £1.00 2x 50 Garden marker sticks from Wilko's, Tube of Uhu glue from £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 £10.

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.

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).

Did a quick Video to show it working. Now it's time to get some sleep .

Thanks again for the Instructable.


matt2uy (author)  splodgie13 days ago
That's awesome!

I watched your video and I think your mechanical design is a lot more reliable and well constructed than the one I made.

It's really awesome to see someone actually use my instructable to help make their own robot!

When you're 100% done, I think you should make an instructable if you want.


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.
I tried to stay within the materials used and method of your design, (A evo design based on the master prototype).
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.

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.


matt2uy (author)  splodgie12 days ago

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.

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.

suchitmintu16 days ago

yes sir downloaded the file but not working

suchitmintu17 days ago

sir made adjustments but now the cursor is simply blinking, as the program says that alternations of y can be seen but nothing is coming so plz try to help me out

thank you

suchitmintu18 days ago

#ser = serial.Serial(COM0, 9600)

ser = serial.Serial(COM3, 9600)

...this is my modification on my windows and when i run send cube state .py file i get this error....

Traceback (most recent call last):

File "C:\Python27\", line 18, in <module>

ser = serial.Serial(COM3, 9600)

NameError: name 'COM3' is not defined

....and also should my arduino software stay open with python cause it keeps on telling me serial port already in use? ....plz help

i want to try this program in windows so please help

buddhikag19 days ago

How to fix this? Please,

i used 3.4 python.and after i got that prb iv installed its working fine.

#ser = serial.Serial(COM0, 9600)

ser = serial.Serial(COM3, 9600)

...this is my modification on my windows and when i run send cube state .py file i get this error....

Traceback (most recent call last):

File "C:\Python27\", line 18, in <module>

ser = serial.Serial(COM3, 9600)

NameError: name 'COM3' is not defined

....and also should my arduino software stay open with python cause it keeps on telling me serial port already in use? ....plz help

(removed by author or community request)

windows 7 64 was on com3 ....

Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32

Type "copyright", "credits" or "license()" for more information.

>>> ================================ RESTART ================================


Traceback (most recent call last):

File "C:\Users\......\Desktop\2", line 18, in <module>

ser = serial.Serial('/dev/ttyACM4', 9600)

File "C:\Python27\lib\site-packages\serial\", line 38, in __init__

SerialBase.__init__(self, *args, **kwargs)

File "C:\Python27\lib\site-packages\serial\", line 282, in __init__

File "C:\Python27\lib\site-packages\serial\", line 66, in open

raise SerialException("could not open port %r: %r" % (self.portstr, ctypes.WinError()))

SerialException: could not open port '/dev/ttyACM4': WindowsError(3, 'The system cannot find the path specified.')


How do i solve this??plz help!!!!

matt2uy (author)  shaditheman1231 month ago
Step 5 and 6 in the "how to use" step would probably help.
This is a very good for me I love the way it solves the problem and I can't even solve a Rubik's cube
You2133 months ago

i'm getting this error how do i fix it the arduino is plugged in.. both servos do the test thing when you do plug it in and I try to get the gui working and it does this

splodgie You2131 month ago
(removed by author or community request)
matt2uy (author)  splodgie1 month ago
If you're testing out the code, take a look at step 7 (probably step 4-9 within that step).
(removed by author or community request)
matt2uy (author)  splodgie1 month ago
Great! Make sure you post a video or make an instructable when you're done so we check it out.
diy_bloke3 months ago

My solution is always to just take a knife, pop out all the colored elements and rearrange them back in solid fields, but yr solution is pretty good too

You2133 months ago

this one is the real one the other one i screwed up a couple things

matt2uy (author)  You2133 months ago

I redid step 7, and within that step I think step 4 to 9 would help

This is genious. Not only it works, but it is elegant!
matt2uy (author)  pablo de paris4 months ago
Thank you! Though I don't think it's as elegant as some of the other solvers out there.
berq matt2uy3 months ago

There are dozens of other machines that do what yours does. But what makes your project SPECIAL is its significant LACK of elegance! It's the way you so wonderfully finessed the opposing forces of crude and sophisticated into working together that makes people smile when they look at it, whether out of appreciation or because it made their brains do a back-flip. After all, popsicle sticks and glue are supposed to be what 2nd graders use to make ugly picture frames for their parents to throw away; they aren't for making robots! And to make such lowly building materials do what you made them do... that takes an uncommon type of engineering and creative brilliance. Your mind is a gift. I hope it serves you well, whatever you end up doing.

matt2uy (author)  berq3 months ago

Thanks for the comment. I'll keep doing what I love to do!

stmaus3 months ago

I'm trying to make your software work and the serial monitor just keeps giving me "Cross". Is the orientation sensitive when entering each face, and if so what is the standard?

matt2uy (author)  stmaus3 months ago

Yes, the orientation is sensitive. When you enter the face, start with:

Colour in Front | Colour on Top

1. Yellow | Blue

2. White | Green

3. Blue | White

4. Red | White

5. Green | White

6. Orange | White

And when you put the cube inside, take a look at the video ( to see its orientation.

rblades3 months ago

Great build, and the choice of materials and electronics make this repeatable without great expensive. The popsicle sticks look thick in the pictures, I am guessing because of zooming in the picture? I would love to have more details like dimensions of each section on the mechanical part of the build if possible.

matt2uy (author)  rblades3 months ago

Here's a few pictures I took of the robot with a ruler:

EdmondUmolu4 months ago

Wow and I thought I was smart. Nice work man, you have a really bright future ahead and I am not sure I have much if anything to add yet since I have little or no experience with any of the techniques or programs you used. I will need to research a lot more stuff first. Still its amazing and thanks for giving me something to keep me busy this summer. Keep up the good work! Now on to learning how github works......

The only thing he could add was when you put in the rubix cube the arduino knows and then it reads the colours itself so no need for the input from the computer.

great instructable

many thanks

trgz Poppy Ann4 months ago

Sound idea I reckon

EdmondUmolu trgz4 months ago

Second that two but there is some on code on there that could be uptimized for a faster runtime.

I just have no idea how to do that yet :D

you need one of these:-

but don't ask me for the code i can not make head nor tail out of arduino code

Since you're running it tethered through USB, most likely your PC has a webcam, so for the time being it could be easy to code something to read the sides of the cube from there. (Tough first it may be necessary to do a simple check for left-right mirroring, which some webcams need)

matt2uy (author)  TodThanatos4 months ago

My laptop does have a webcam, and I actually tested out an OpenCV python script someone wrote ( that worked on my computer. But it was way in over my head and I couldn't figure out how to extract the outputted cube colours in the python script.

So I just resorted to manually inputting the cube colours in a user interface.

matt2uy (author)  EdmondUmolu4 months ago

Thanks Edmond!

1-40 of 80Next »