Go Down

Topic: Rubik's cube Robot solver (Read 198321 times) previous topic - next topic


Oct 10, 2014, 07:37 pm Last Edit: Mar 05, 2017, 08:41 am by kas
There are 100+ robots cube solver on the Web
Most of them are Lego Mindstorm based, some others use very expensive hardware
Few Arduino based robots in fact

I plan to build something like this:

  >> Video <<
but... cheaper  :)

or more likely

  >> Video <<
but with better gripping

The robot will be semi-autonomous
Color recognition and solving to be made at PC level
Cube movements performed under Arduino control, at robot level
(USB cable could be disconnected at this stage)

Solving will be done through already existing software, Cube Explorer appears to be a good candidate
A middleware will be developped  (using Processing or Python) to convey information back and forth
between Arduino and cube solver software

Road map:
- design a suitable gripper
- robot construction (2 grippers + frame), test and tuning
- develop Arduino code for moving the Cube
- develop the software link between solving and moving
- final integration

I will use this thread as a blog, to share success and failure
and possibly obtain ideas an advices from our community

Not sure to reach destination but the route itself is promising and definitely exciting

Stay tuned  ;)


Oct 10, 2014, 07:39 pm Last Edit: Jul 28, 2018, 10:37 am by kas
Reserved for additional information, photos and videos

Parts list     (PC/webcam version)

- Plywood 10mm


- Plywood 5mm (plexiglass, or PVC)
- 4 standard servo's
- M3 screws 10, 16, 20 and 24mm
- 3mm washers
- M3 nuts
- M3 Nylock nuts
- 14mm brass standoff spacers

For Imperial people, use 1/8" hardware

Assembly video

EDIT (feb 2018)
The grippers 3D printed version has been released on Thingiverse

This is the Fusion 360 final assembly, including the wrist servo:

the embedded horns are designed for Futaba 25 teeth spline geometry (Futaba/TowerPro/Orion/Savox/ProTekAce/Bluebird...)
I will release the two specific parts for Hitech servo's family (24T) if required
Discussion starts at post #428

I use a Dayan GuHong (57 mm), the DaYan ZhanChi is also very good
Do not use the not so smooth genuine Rubik's Cube(tm)
The reference site in China for cubes: http://lightake.com/c/DaYan_001001005

Other parts:
- Flexible mini 28 LED USB lamp  (4 bucks shipped)
- Custom shield with 4 servo's sockets
- Webcam with optional manual White Balance

Power supply: 6V, 2000mA
I use two 18650 LiFePO4 batteries for powering both Servo's and Arduino

Arduino:    CubeMover V1.3  NEW          VarSpeedServo Library
Python (PC):   RubikKasBot V1.3
Solving (PC):   Cube Explorer

Make sure you test your hardware according to post #6 and post #13

Android version

Autonomous design w/o PC

Robotic hardware is unchanged, webcam is replaced by an Android smarphone

This version works this way:

Smartphone   - take a picture from face #1 and perform color recognition for the 9 facelets
Smartphone   - send a Bluetooth command to Arduino to rotate cube to next face
Arduino           - rotate Cube to next face
Smartphone   - same for all 6 faces
Smartphone   - build and send via WiFi a query to a dedicated Rubik's solving server (MontrĂ©al, Canada)
Smartphone   - receive solution from server (Singmaster notation)
Smartphone   - send Bluetooth command to Arduino (Singmaster notation format)
Arduino            - move Cube according to command and put the cube in the right order

Typical query to server:

Corresponding answer from server:     OK     F U F D'
Clic the query and see for yourself  ;)

Aditional hardware:
HC-05 or HC-06 Bluetooth board for smartphone/Arduino communication (3$ shipped on eBay)

or a very convenient Arduino/HC-05 combo

Arduino:    CubeMover V1.3  NEW         VarSpeedServo Library
Smartphone: Rubik's App is available on request (free)

You should understand smartphone connection with HC-05 / HC-06 Bluetooth board
The best approach is to have Joystick BT Commander up and running (same protocol)

EDIT  July 28th, 2018

End of technical support

I have been supporting this project for nearly four years, this was an exciting experience
I have since moved to other projects and it's now time for me to retire

All possible questions have been answered in this thread, just read it  ;)
The Android App is here
Feel free to use this thread on a peer to peer basis to share your experience
Please no more PM's

Thanks again for your interest and good luck for your projects


Oct 17, 2014, 09:26 pm Last Edit: Oct 27, 2014, 10:02 pm by kas Reason: 1
Week one progress & report  ;)

I choosed the Dagu claw MK1 design as a starting point

The final claw should grip the cube (55mm) and open sufficiently (55 X 1.414, thanks pythagoras  ;)  ) to allow cube rotation

Here is a first working prototype made with plywood

  >> Video <<

During testing, the gripper is controlled with an Android smartphone, using   Joystick BT Commander


That gripper may not have the strength and rigidly to grip and twist a Rubik's cube.
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0


Hi zoomkat, happy to see you here  ;)

This gripper is definitely not rigid enough
I just built three new prototypes with 5mm plywood (was 3mm)
the last one has four rods (versus two) and is now strong enough to twist the cube


Oct 28, 2014, 10:12 am Last Edit: Nov 01, 2014, 12:41 pm by kas
OK, new Forum bugs are slowly desappearing, time to post again   :)

This is the (probably) final design

  >> Video <<

Time to start testing with a Rubik's cube


Nov 01, 2014, 12:28 pm Last Edit: Mar 07, 2017, 08:10 am by kas
First test with a real Rubik's cube

>> Video <<

Here is the demo code

Code: [Select]
#define VERSION     "\n\nGripper demo V1.2- @kas2014\n"

// V1.2  use VarSpeedServo library
// V1.1  2 servo's
// V1.0  1 servo

#include <VarSpeedServo.h>

#define    rot_pin              10                  // Green
#define    pinch_pin             9                  // Yellow

#define    CLOSE                85                  // servo's limits
#define    OPEN                132
#define    CW                    0
#define    MID                  87
#define    CCW                 171

#define    SLOW                 30
#define    FAST                 80

VarSpeedServo pinch_servo;                          // create servo objects
VarSpeedServo rot_servo;

void setup()  {
  rot_servo.attach(rot_pin, 580, 2570);

void loop() {
  for(int i=0; i<3; i++)  {

  for(int i=0; i<3; i++)  {

  for(int i=0; i<2; i++)  {

void armRight(int speed)    { rot_servo.write(CW, speed, true); }
void armLeft(int speed)     { rot_servo.write(CCW, speed, true); }
void armCenter(int speed)   { rot_servo.write(MID, speed, true); }
void gripOpen(int speed)    { pinch_servo.write(OPEN, speed, true); }
void gripClose(int speed)   { pinch_servo.write(CLOSE, speed, true); }

For this project I chose the "VarSpeedServo" library which has some definite advantages
compared to the standard Servo library:
- adjustable servo's speed (see video)
- optional code pause until move is complete

Next stop: build a second gripper and assemble the final robot

** EDIT: see post #111 **


Nice looking setup. I'm assuming that the code actually makes the arm do what you claim. But, how is that going to be sufficient to solve a rubik's cube? How is the robot/Arduino going to know what moves to make to solve the cube? How is it going to know where to start? How is it going to know when to stop?


Nov 03, 2014, 08:29 am Last Edit: Nov 03, 2014, 09:17 pm by kas
Hi Paul,

Nice looking setup

how is that going to be sufficient to solve a rubik's cube?
How is the robot/Arduino going to know what moves to make to solve the cube?
Please refer to post#1, the solving itself will be performed using Cube Explorer
Solution will be passed to Arduino using  Singmaster notation
(look here for a visual approach)

Arduino will convert notation into real world moves


Nov 07, 2014, 06:15 pm Last Edit: Nov 07, 2014, 06:16 pm by kas
The Rubik's cube Robot solver, together with my assistant   ;)

The hardware side is finished, let's produce some code to make it alive


together with my assistant
Your assistant does not look impressed. You need another groupie.


Nicely laid out and good fit.
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0


Nov 08, 2014, 07:00 am Last Edit: Nov 08, 2014, 08:49 pm by kas
Your assistant does not look impressed
She is just a bit jealous of this time consuming project  ;)

Nicely laid out and good fit
Thanks zoomkat


Nov 15, 2014, 07:05 am Last Edit: Apr 15, 2017, 12:17 pm by kas
First cube moves according to Singmaster notation (see post #8)
    < D,  B,  B',  D' >
This sequence will finally bring back the cube to its initial position

>> Video <<

Those 4 moves are hard coded in the Arduino sketch

I will now prepare a sketch with all possible moves:
F (Front),  B (Back),  U (Up),  D (Down),  L (Left),  R (Right),  plus the  " ' "  and  " 2 "  variants

For debugging purpose, moves will be entered through Arduino's serial monitor

EDIT: see post #242 (code)


Hi Looking for something to build. I am a relative newbie to Arduino and have made a finished a robot car using a uno board and Robot Shield. I found this quite easy and want to make the rubixcube solver. How hard was this build on a scale of 1-10? Looks good. Need one as I can complete a rubixcude in a couple of days.

Go Up