Follow up on TwitterFollow up on Facebook Home
Home  •  Tutorials  •  Calculators  •  3D Models  •  About  •  Contact
3D Model 12: 3D-Printable Rubik's Cube Solving Robot

1. General Information
2. Introduction Video
3. Licensing
4. List of 3D-Printed Parts
5. Hardware Shopping List
6. Assembly Instructions
7. Connecting Electronics
8. Servo Calibration with Pololu Maestro Control Center
9. Software Installation and Configuration
      9.1 The App: Introduction
      9.2 App Download Links
      9.3 What's New in Version 3.0 vs. 2.0
      9.4 Installing the App on Raspberry PI
      9.5 Installing the App on a Regular Windows 10
      9.6 Calibrating and Running the App
      9.7 Configuring & Troubleshooting the App
10. Frequently Asked Questions

1. General Information

This 3D-printed Raspberry Pi-powered Rubik's Cube solving robot has everything any serious robot does -- arms, servos, gears, vision, artificial intelligence and a task to complete. If you want to introduce robotics to your kids or your students, this is the perfect machine for it.

This one-eyed four-armed giant stands 35cm (14") tall. 70 hours of print time and an entire spool of filament are needed to print it, not to mention over $200 worth of hardware, but once fully operational, it will surely wow your friends and neighbors. Scramble your Rubik's cube, place it in the robot's grippers, press a button, and then sit back and watch this amazingly smart and stunningly beautiful machine put it back together. Watch the video below!

This robot is fully 3D-printable. Other that the servos, servo horns, camera, electronics and a few dozen bolts and nuts, it has no traditionally manufactured parts. Absolutely no soldering or breadboarding is required.

Click to download these .STL files

Download Link
Size:3.60 MB
Last Updated:2018-03-14

2. Introduction Video

3. Licensing

This product is distributed under the following license:

Creative Commons - Attribution - Non-Commercial - No Derivatives

For educational and commercial licensing, please contact us.

4. List of 3D-Printed Parts

ItemQuantityPrint Time (min.)Total Time (min.)Filament (gr.)Total Filament(gr.)

Total Print Time: 4,028 min. (67 hours 08 min.)
Total Filament Required: 882 gr.


  • To use the servo motor TowerPro MG996R instead of Hitec HS-311 (see hardware list below), print rcr_pinion2.stl instead of rcr_pinion.stl.
  • For the "wide" camera (see hardware list below), print rcr_camera_holder2.stl instead of rcr_camera_holder.stl.
  • For the "wide" camera, print 4 of rcr_rod_short.stl and 4 of rcr_rod.stl instead of 8 of rcr_rod.stl.
  • If your 3D printer has a large enough print platform, print 2 of rcr_4corners.stl instead of 8 of rcr_corner.stl.

As of Jan 03, 2018, the 3D-printed parts for the robot are available for sale. The price for the entire set is $449.00. Shipping is extra. Hardware is not included. Contact us for details if you are interested.

5. Hardware Shopping List

QuantityItemPrice Per Item (approx.)
4 DS3218 Servo Motor with Horn
4 150 mm Servo Extension Lead, Male-to-Female
4 Hitec HS-311 Servo Motor


TowerPro MG996R Servo Motor

1 Raspberry Pi 3 Model B Quad-Core (optional)

This part is optional. The app can be run on a regular Windows 10 PC as well.
1 Pololu Mini Maestro 12-Channel USB Servo Controller (Assembled)
$24.00 - $30.00
1 UBS HD 12 Megapixel Webcam

As of December 11, 2017, we recommend the "wide" webcam shown here instead of the old "round" one shown below. The wide webcam has much better color reproduction than the old one, even in poor lighting conditions. Search on eBay, Amazon, etc. for Webcam and look for this distinctive shape. Print rcr_camera_holder2.stl instead of rcr_camera_holder.stl for this camera.

Old camera: USB 5 MP or 12 MP Webcam with 6 LEDs

Do NOT buy the TechNet brand, it does not seem to work with our app.

1 Wall-plugged 6V, 3A (3000 mA) charger

Our robot uses the SMAKN power supply adapter (shown here) together with a DC female adapter (see next item) and two male/female jumper cables to be plugged into the Pololu servo controller.
1 DC 5.5x2.5mm Female "Balun" Adapter

This very inexpensive little adapter will help you power your robot without soldering! Plug the wall charger into it, insert two jumper cables in the other end and tighten the screws. See Section 7 - Connecting Electronics for more info.
1 Standard-Size Rubik's Cube

Without this item, the robot is completely useless. We recommend the stickerless, smooth-operation variety. Our color recognition code was only tested with the standard (original) colors shown here. Please do NOT use a speed cube!
76 Metric M3-12 Phillips-head Countersunk Bolts $0.06
36 Metric M3 Nuts $0.06
10 Small 2mm Wood screws or Metric M2x8 Molts

These are to attach the HS-311 horns to the servos, and two more to attach the Pololu servo controller to the back side of the camera holder.

Total Cost of Hardware (approx.): $150.00 - $200.00.

6. Assembly Instructions

Step 1:

Attach the round horn that comes with the HS-311 servo to pinion with two small 2mm wood screws or two metric M2x8 bolts. If you are using the TowerPro MG996R servos, use rcr_pinion2.stl instead of rcr_pinion.stl as the black round servo horn that comes with the MG996R is smaller and has the mounting holes closer to the center.

Step 2:

Insert the single-armed horn that comes with the DS3218 servo into gripper. Secure with two metric bolts. Screw in the bolt closer to the center first.

Step 3:

Insert the DS3218 servo into slider. Secure with 4 metric bolts and nuts.

Step 4:

Insert rack into slider, have the servo cable run in the triangular recess in the bottom of the rack. Align holes. Secure with 6 metric bolts.

Step 5:

Insert the HS-311 servo into arm. The servo's shaft must be aligned with the round hole on the other side of the arm. Secure with 4 metric bolts and nuts.

Step 6:

To secure the slider in place, install the pinion onto the HS-311 servo's shaft and secure it with an axis bolt that came with the servo. Note that during the calibration phase the pinion may need to be removed, slider adjusted, and pinion replaced.
Repeat Steps 1 to 6 to assembly three other arms.

Step 7:

Using the 8 corners (rcr_corner.stl) or two 4-corner frames (rcr_4corners.stl), assemble the 4 arms into a single unit.

Step 8:

Set the assembly obtained in Step 7 onto the two legs, align holes. Insert the pair of long_bolts in the bottom holes, and short_bolts into the top holes. Secure all 4 bolts with nuts. The heads of the bolts must be on the same side as the HS-311 servos (far side on the picture below), while the nuts on the opposite side (near side on the picture below.)

Step 9:

Screw four rods into the heads of the long and short bolts tightly. For the "wide" camera, use rcr_rod_short.stl instead of rcr_rod.stl to bring the camera closer to the cube.

Step 10:

Screw four other rods (rcr_rod.stl) into the slots of the camera holder tightly. If you are using the new wide camera, use camera_holder2.stl:

If you are using the old round camera, use camera_holder.stl instead:

Step 11:

Position the camera holder in such a way that the ends of the rods attached to it are in close proximity to the ends of the rods attached to the main unit. The slit in the camera holder must point downwards. Using the clamp_halves, connect the 4 pairs of rod ends. Secure the clamp halves with the metric bolts and nuts.

Step 12:

New wide camera: Detach the camera body from the clip: remove two small round stickers covering a pivot bolt connecting the camera to the clip, and then unscrew the bolt with a screwdriver.
Old round camera: Remove the stand and semi-circular ring from the camera using a small screwdriver.

Insert the camera into the niche in the camera holder. Run the camera cable through the slit in the camera holder. Secure the old round camera with camera_cover. The new wide camera does not need a cover. Plug the camera into Raspbery PI's USB port.

Install the grippers onto the DS3218 servos, secure with axis bolts that came with the servos. Do not tighten the servo horn clamps just yet as the positions of the grippers may need to be adjusted during the calibration phase.

7. Connecting Electronics

Thanks to the Pololu Mini Maestro servo controller, there is absolutely no need for PCBs or breadboarding. You connect the 8 servos to the Maestro, and the Maestro to your PC via a USB cable for calibration (and later to the Raspberry PI for the actual cube solving.)

The servos can be connected to any of the 12 channels of the Mini Maestro arbitrarily. The image below shows the channel assignment used by our robot. A white number in a red circle next to a servo denotes the Maestro channel number for this servo. Even channels are used for the gripper servos, and odd channels for the rack-and-pinion servos. Channels 4 and 5 are skipped for spacing.

For the power supply for the Maestro, use a 6V, 3A (3000 mA) wall charger. Our robot is powered by this charger with the help of a DC female "balun" adapter and two male/female jumper cables, as shown below. The male ends of the jumper cables are inserted in the holes of the balun adapter and secured with the tightening screws. The female ends are connected to the power pins of the Maestro. We recommend using a red jumper cable for the "+" connector, and black or brown one for the "-" one. The use of the very inexpensive balun adapter makes soldering completely unnecessary.

The servo controller should be attached to the back of the camera holder using two small wood screws (camera_holder2.stl) or a single screw (camera_holder.stl). The image below shows the controller in its working position, with all the servo cables and power wires attached to it. The green and yellow wires in the lower-right corner of the image are power wires.

8. Servo Calibration with Pololu Maestro Control Center

The purpose of the servo calibration is to find two key target settings for each servo's channel. For the gripper servos, the two target signals are for the neutral position and the 90° position. For the rack-and-pinion servos, the two target signals are for the "near" position (hugging the cube) and the "far" position (releasing the cube.) These numbers are determined experimentally using the Maestro Control Center software available on the Pololu web site and installed on your PC.

After firing up the Maestro Control Center, select the controller from the "Connected to" drop-down box. Go to the Serial Settings tab and select USB Dual Port for the serial mode. Then press Apply Settings.

Then return to the main Status tab to calibrate your servos.

Also, for all the gripper servos (0, 2, 6 and 8 in our example) set the Acceleration value to 110, as follows:

Begin the calibration by putting the sliders in the "far" position in which the front of the slider is flush with the arm, and put the grippers in the "neutral" position, as shown on the image below. Write down the "far" target values of the rack-and-pinion servos, and "neutral" target values for the gripper servos.

Next, determine the target value for a 90° rotation for each gripper servo. On the image below, the right arm's gripper servo has been turned 90° relative to its neutral position. Do this for each gripper servo, and write down the target values for all four.

It is absolutely critical that all the gripper servos move from their neutral to 90° positions in the directions marked by red arrows on the image below:

Finally, put the gripper servos back in the neutral position, and insert a Rubik's cube in the bottom gripper. Determine the "near" positions of all four rack-and-pinion servos in which the cube is tightly hugged and centered, as shown on the image below. Write down these target values.

Once acceptable target values for all servos have been determined, they need to be transferred to our application via its own user interface. The values can later be adjusted, if necessary.

Note that during calibration, the gripper and slider positions may need to be adjusted to allow a proper movement range. To adjust the position of a gripper, it needs to be removed from the gripper servo's shaft and then re-attached in a different position. Once the final position is found, the servo horn's clamp needs to be tightened with an Allen hex key. To adjust the slider's position, the pinion needs to be removed, the slider shifted as necesary, and then the pinion re-attached.

For more information on using the Maestro servo controller and its Control Center software, please refer to the Pololu web site.

9. RubiksCubeRobot App: User Manual

9.1 The App: Introduction

The robot is driven by a Universal Windows Platform (UWP) application of our own creation called RubiksCubeRobot. By sending control signals to the robot's 8 servos and webcam, the application photographs the cube, performs the image and color recognition on the photos, determines the initial position of the cube, computes the sequence of rotations necessary to solve the cube, and then executes the sequence. The app can be used on Raspberry PI running Windows 10 IoT Core, or a regular PC running Windows 10.

The app can be evaluated for free for 30 days. The evaluation version is fully functional. Please contact us to obtain your evaluation key. Permanent keys are available for a small one-off fee. The license fees, which include life-time upgrades and maintenance, are as follows:

Personal use:$40.00
Educational use:$60.00
Commercial use:$120.00

9.2 App Download Links

Please download the Raspberry PI, x64 and x86 versions of the app from the links below:

Download Link for Raspberry PI
Size:13.3 MB
Last Updated:2018-02-23
Platform:ARM (Raspberry PI)

Download Link for x64
Size:13.4 MB
Last Updated:2018-02-23

Download Link for x86
Size:13.3 MB
Last Updated:2018-02-23

9.3 What's New in Version 3.0 vs. 2.0

Version offers an auto configuration mode of operation. In this mode, the app does not need any configuring whatsoever. The colors of the center squares are used as the samples for color recognition. This works well in a glare-free environment, so if your camera is equipped with LEDs, turn them off. To enable the auto configuration mode, turn it on with the Auto-Config toggle switch in the Configuration Center.

When the Auto-Config mode is enabled, the app also performs error correction. The cube's squares are subject to constraints: they must participate in certain unique combinations such as RED/BLUE, BLUE/ORANGE, etc. for the twelve edge cubies, and WHITE/BLUE/RED, WHITE/RED/GREEN, etc. for the eight corner cubies. These constraints make it possible to not only detect color mis-identification errors, but in many cases correct them as well.

Another important enhancement is that instead of taking static photos, the app now shoots short videos and uses the last frame for analysis. This artificial delay in image capturing allows the camera to adjust to the current lighting conditions and produce more vivid, easier-to-analyze images. To enable the video mode, specify a non-zero number (in milliseconds) in the Video Duration box, such as 1000.

9.4 Installing the App on Raspberry PI

The following instructions assume that you have already downloaded and installed Windows 10 IoT Core on your local PC, installed the Windows 10 IoT Core operating system on your Class-10 Micro SD card, booted your Raspberry PI from it, and connected the PI to your local network via WiFi and/or an Ethernet cable. Your Raspberry PI device should be showing in the My devices list of the IoT Dashboard:

To install the RubiksCubeRobot onto your PI, please follow these easy steps:

  • Download the .zip archive for RubiksCubeRobot from the link above. Unzip it to a temporary directory of your PC's hard drive, such as c:\tmp.
  • Select Open in Device Portal from the IoT Dashboard. In the Windows Device Portal, go to Apps, Apps manager.
  • Under Install app, for App package, select the file with the extension .appx in the temporary directory, and for Certificate, select the file with the extension .cer.
  • Click on Add dependency three times. For the three Dependency boxes, select the three files in the \Dependencies\ARM subfolder of the temporary directory.
  • Click on Go under Deploy.

That's it! RubiksCubeRobot should now appear under Apps. You can start the application by choosing "Start" in the Actions drop-down box, and mark it as startup by clicking on the radio button in the Startup column.

9.5 Installing the App on a Regular Windows 10 PC

Unzip the content of the download to a temporary directory such as "c:\temp". Prior to installing the app on your PC, you need to install the certificate in the Trusted Root Certification Authorities of both the Current User and Local Machine sections of the certificate store. This only needs to be done once.

Double-click on the .cer file in the temporary directory, click Install Certificate, select Current User, then select "Place all certificates in the following store", and select the Trusted Root Certificate Authorities folder. Repeat this procedure but this time select Local Machine instead of Current User.

Once the certificate is installed, double-click on the .appx file in the temporary directory to install the app on your PC.

9.6 Calibrating and Running the App

The main app screen looks as follows:

Photographing phase:

Assembling phase:

The blue and red buttons on the main page perform the following functions:

  • calibration -- takes you the Calibration Center where the servo target values are entered.
  • configuration -- takes you to the Configuration Center where the parameters responsible for image and color recognition can be viewed, and changed if necessary.
  • analysis -- performs image and color recognition of the most recent set of photographs stored in a PDF file on the device's hard drive. In the default Auto-Config mode, this feature is disabled.
  • key -- allows you to enter your registration key, and also activate your paid-for key permanently on the device.

  • OPEN -- brings the rack-and-pinion servos to the full-back position and gripper servos to the neutral position so that the cube can be inserted.
  • RUN -- starts the work sequence after the cube has been inserted.
  • STOP -- performs an emergency stop.
  • OFF -- switches all servos off. If this button is pressed and held down for 3 seconds, the operating system shuts down (Raspberry PI only).
  • 📷 -- puts the grippers in the "full-forward" position, takes a picture, displays it, and then retracts the grippers. This button is useful for adjusting camera position and focus.

The 1st required step is to click the key button and enter your registration key in the form XXXXX-XXXXX. Please contact us to obtain your free 30-day evaluation key. During evaluation, the application performs run-time key validation over the Internet, so your Raspberry PI (or PC) must be connected to the Internet for the application to function. Once the license has been purchased, the registration key can be activated on the device permanently. Afterwards, the application no longer needs an Internet connection.

The 2nd required step is to enter all the servo target values in the Calibration Center:

The screenshot above shows the settings for our robot, but you must obtain your own numbers during calibration using the Pololu Maestro Control Center software.

If your PC has more than one camera attached (laptops almost always have their own built-in camera), there is a 3rd required step: press the configuration button, and in the Configuration Center, select the robot's webcam via the Camera Name drop-down box. The other configuration parameters will be covered in detail in the next section. Go with the default parameters for your first test run.

Before clicking the RUN button, make sure all 8 servos are plugged into the Maestro servo controller, both the Maestro and webcam are plugged into the Raspberry PI's (or your PC's) USB ports, and the power source is connected to the Maestro.

Insert the cube and click the RUN button. Be prepared to hit STOP immediately if the cube slips out of the grippers, or some other malfunction occurs.

The robot will perform the necessary manipulations of the arms and grippers, and take 2 photographs for each face that are going to be displayed immediately. If image processing or color recognition fails, an error will be displayed, and the arms and grippers returned to the open position.

9.7 Configuring & Troubleshooting the App

This section describes the essential configuration parameters and provides troubleshooting tips.

9.7.1 Essential Configuration Parameters

Version 3.0 of the app requires almost no configuring at all. The essential configuration parameters are: Debugging, Camera Name, Video Duration and Auto-Config Mode.

  • Debugging - If enabled, this toggle switch makes the app create a debug PDF file on the device, which is essentially an illustrated log file in which every step of the app's code is documented. Debug PDF files are covered in detail below.
  • Camera Name - Use this drop-down box to select the robot's camera if your device has multiple cameras attached to it. Laptops almost always do.
  • Video Duration - If set to a non-zero value, enables the delayed image capturing mode in which the camera shoots short videos and uses the last frame for analysis instead of taking static photos. Delayed image capturing gives the camera enough time to self-adjust to the surrounding lighting conditions and produce more vivid, easier to analyze images. By default, this value is 1000 ms (1 second). Setting this value to 0 (not recommended) makes the camera take static pictures instead of shooting short videos.
  • Auto-Config Mode - When auto configuration mode is enabled, the app performs color recognition based solely on the twelve photographs it has taken, without the need for any user-supplied color-related parameters. This mode is on by default.

The numerous hue, saturation, brightness and glare-related parameters are still present for backwards compatibility, but disabled (grayed out) by default. They are only used when the Auto-Config mode is switched off (not recommended.)

The Area Cutoff, Squareness, Angle Deviation and Size Deviation parameters control the square zone recognition code. The default values have been chosen by trial and error and are generally considered optimal. Changing them is not recommended.

9.7.2 Debug PDF Files

The app is designed to provide an insight into its thinking process. When the Debugging toggle switch is on, the app creates a PDF file for every run containing the photographs it has taken, color recognition results, and other information. On Raspberry PI, the PDF files can be found in the folder \Data\Users\DefaultAccount\Pictures. On a regular PC, this folder is This PC\Pictures.

A typical page from the PDF file looks as follows:

The top of the page displays the two photographs taken per cube's face with the zone detection results superimposed over the images. The center square is marked with a dashed outline, the other squares with a solid outline.

The color diagram on the middle left displays the color zones with their hue, saturation and brightness values. This information is generated by the old legacy code and discarded in the Auto-Config mode.

The color diagram on the middle right is the output of the color recognition module in the Auto-Config mode, before error correction is applied. Right below it, error correction log entries may be displayed (not shown here). At the bottom right, the final result, with error correction applied, is displayed.

The debug PDF files are a valuable troubleshooting tool. For example, during a run, the app has generated the error ERROR_UNSOLVABLE_CUBE. The PDF file generated during that run offers an instant explanation for the failure: a mechanical problem caused the cube to be way off center during photographing (see image below). As a result, the color zones were not correctly identified as half of the cube's face was not even within the camera's view.

9.7.3 Troubleshooting Tips

Camera not Centered

If the camera is not properly mounted or not pointing at the middle of the cube, a photo may look like the image above . If the app can't see the entire face of the cube, it can't process it. Make sure the center of the cube is roughly in the middle of the photograph. Use the Camera button to take test photos before a run. Adjust the camera's position in the camera holder if necessary. Also make sure the grippers hug the cube tightly to avoid shifting while the cube is being photographed. Adjust servo calibration values if necessary.

Images Appear Upside-Down

It has been reported by several users that the camera may take upside-down photographs. Apparently, in some of the cameras, the sensor is mounted upside-down. Upside-down images are guaranteed to cause the error ERROR_UNSOLVABLE_CUBE accompanied by a plethora of error correction entries in the debug PDF file:

If your camera has this problem, the entire camera assembly needs to be carefully unscrewed, removed from the frame, flipped upside-down and re-inserted into the frame.

Not Enough Light

If the photographs are too dark, some squares may appear completely black, like the square marked with a red arrow on the image below. This will cause the app to generate the error ERROR_COLOR_COULD_NOT_BE_DETERMINED. Make sure the cube is reasonably well lit, while avoiding glare.


The occurrence of an error containing the word MISIDENT indicates the auto-config mode is not enabled. Go to the Configuration center, make sure the Auto-Config Mode switch is on, and press Save even if you did not make any changes to the parameters.

The Colors are Identified Correctly but the Cube is Not Being Resolved

It is critical that your robot photograph the cube's faces in a particular order. Please refer to our introduction video for the correct sequence or rotations during photographing. For example, if you insert the cube with the white center square pointing towards the camera and red center square pointing upwards, then the correct order in which the center squares should appear on the photographs is:

White -> Red -> Yellow ->Orange -> Blue -> Green

If some or all of the gripper servos are calibrated incorrectly and turn from the neutral to 90° position in the wrong direction, the app won't be able to correctly reconstruct the cube's initial position and therefore, won't be able to resolve it.

Grippers Retract in the Wrong Order

The app relies not only on a particular order in which the cube faces are photographed, but also on a particular order in which the grippers are retracted. The first photograph of a pair must have the top and bottom grippers retracted, and the second photograph - the left and right ones. If the retraction order is reversed due to an incorrect channel assignment of the servos (as on the photos below), the app won't be able to correctly identify the colors of the side cubies as the grippers will get in the way.

9.7.4 Still Having Problems?

Please do not hesitate to contact us if you continue having mis-identification or any other problems. We will do our best to help you resolve them.

10. Frequently Asked Questions

  • Is Raspberry PI required?
    No, any device with two USB ports can be used (one for the Maestro, the other for the webcam.) The software is currently available for Raspberry PI running Windows 10 IoT, as well as regular Windows 10 PCs.
  • Why was this particular webcam model chosen?
    This webcam was chosen because it produces small photos (640x480) which results in faster processing, works well in a variety of lighting conditions, has a wide lens, is easy to mount and inexpensive.
  • Why use a separate servo controller, why not control the servos directly with the Raspberry PI?
    Initially we tried to do just that, but have failed to achieve satisfactory results even with 4 servos. Breadboarding with 8 servos does not seem to be reliable enough. However, we admit it may still be doable.
  • Why does the robot take two pictures per cube face instead of just one?
    The grippers, when engaged, cover a significant portion of the cube's face, which makes it difficult to accurately identify the colors of the side cubies. As a workaround, the robot photographs each face first with the vertical grippers retracted, and then the horizontal ones.
  • Why does the robot make three clockwise 90° turns instead of a single counterclockwise 90° turn?
    Because of a slack between the gripper and cube, it takes a greater-than-90° turn of the gripper to perform a 90° turn of the cube's face. Therefore, a 180° servo such as the one we are using won't do both a 90° and -90° turns with proper precision. 270° servos would probably work better, and future versions of our app may support those.

Related: How to Model a Rack-and-Pinion in Blender