CUBOTino Autonomous: Small, 3D Printed, Rubik's Cube Robot (Raspberry Pi Zero 2, PiCamera)

by AndreaFavero in Circuits > Robots

55662 Views, 303 Favorites, 0 Comments

CUBOTino Autonomous: Small, 3D Printed, Rubik's Cube Robot (Raspberry Pi Zero 2, PiCamera)

CUBOTino autonomous: A small, 3D printed, Rubik's cube robot based on Raspberry pi and PiCamera
CUBOTino in action

This is the "Top version" of CUBOTino series, a Rubik's cube solver robot project meant to be very small, simple, fully 3D printed, and scalable.

This is clearly not a fast robot, as the targets are simplicity and cost effectiveness.


The "Base version", characterized by lower costs and lower complexity, is available at: https://www.instructables.com/CUBOTino-a-Small-Simple-3D-Printed-Inexpensive-Rub/

The "Micro version", fully autonomous yet using a smaller Rubik's cube (30mm), is available at: https://www.instructables.com/CUBOTtino-Micro-the-Worlds-Smallest-Rubiks-Cube-So/

The "Pocket version", characterized by using a 2x2x2 Rubik's cube and optimal solution, is available at: https://www.instructables.com/CUBOTino-Pocket-Optimal-Solver-Robot-for-Rubiks-Cu/


This instruction relates to the Top version; main characteristics are

  1. The robot is fully autonomous.
  2. PiCamera and Raspberry Pi Zero2W (or ZeroW) is used for the computer vision part.
  3. Kociemba solver is used, to get an almost optimal solution.
  4. All coded in Python.
  5. Display to feedback on the robot action and solving progress.
  6. Apart the PCB cover, all the other 3D printed parts are the same of the Base version, plus two new parts to support the camera.
  7. Solving time is tipically 90 seconds; 30 seconds are needed for the cube status detection, and 60 to solve the cube. This timing once the robot is optimized, as per posted movies

By excluding the self solving Rubik's cubes, and the robots requiring modified cubes for gripping, this is one of the smallest Rubik's cube robot I've seen so far.

The name of this robot is CUBOTino: Apart from the obvious CUbe+roBOT, "ino" is the italian suffix standing for small..... a "small" touch recalling my origins and the very small robot dimensions.


Tip: At Step2 of these Instructables it is embedded a pdf file "How_to_build_ ..._yyyymmdd.pdf", of about 150 pages, containing all the needed details to build, program, tune, troubbleshoot the robot.

Credits to:

  1. Mr. Kociemba, for his solver, and the python version he has made available to the comunity.
  2. Yheneaul for simplifying the installation and to Vanblok for designing the PCB.
  3. All of you who have provided feedback, making possible to improve the project.

Supplies

Comp_list_picture.PNG

The material cost has been about 100 Euro.

The more expensive parts are of the project are:

  1. Raspberry Pi Zero2WH (Raspberry Pi Zero2W is coming back available, after the severe shortage).
  2. microSD card 16Gb Class10
  3. Picamera (V1.3)
  4. Flex cable (PiCamera - Raspberry Pi Zero)
  5. Two servos ( TD-8325MG, 180deg 25Kg metal, with metal arm “25T” )
  6. Display (1.77" TFT, SPI)
  7. ca 500 grams of filament
  8. 3W led, with integrated driver
  9. Capcitive touch sensor
  10. Step-down Voltage regulator
  11. Micro-usb breakout boards (or USB-C breakout board)

Some little electronic components (prototype board, capacitors, connectors, etc), and screws.

For the power supply are needed two phone chargers (al least 1x1A and 1x2A), and related cables with microUSB connector. Alternatively, 1x3A power supply with USB-C connector (official Raspberry Pi is recommended).

In the instructions are listed possible servos alternatives.

On the annex Components_list_Cubotino_Top.pdf file the detailed list, included the link to the shops I've used ... and related cost.

Info and Advise

Despite this little robot looks simple, and for some aspects it really is, there still is some complexity.

Be prepared the robot won't magically work right after assembling it: Tuning is expected !

If you haven't built other "robots" before, I'd recommend you to start with the Base version, that has lower complexity.

Read First (embedded Pdf Instructions File)

The below attached pdf file "How_to_make_ ...._yyyymmdd.pdf" provides the needed info on how to build the robot, further than many other aspects.

The document has about 150 pages, providing detailed guidance to build the robot, and side informations (a bit of knowledge sharing).

I advise to read the document, in case you're interested to make this project.

My second advise is to read the document a second time :-)

This document will be periodically updated (filename ends with yyyymmdd), in particular during the first weeks; Please report eventual errors, unclear parts, tips, etc.

Make the Connection Board

IMG_20220522_115748.jpg
IMG_20220522_115711.jpg
IMG_20220522_115858.jpg
Connections_board2.png

The connections board connects all the devices (servos, display, touch button and led breakout board) to the Raspberry Pi.

It is not complex, but it requires more time and attention compared to the one for the Cubotino Base version; In case of mistakes, it will be difficult to de-solder the 2x20 header, perhaps better to buy few spares in advance.

The board is made out of a prototype board (two sides), mainly by connecting different connectors and few capacitors.

Better to use insulated wire, when crossing other lines, even if these are located on the other board side.

Differently, it is possible to order the pcb, therefore limiting the effort and possible mistakes; Components purchase and soldering still need to be done.


Gerber files made available by Chad; V1.6 version is stored at GitHub: https://github.com/AndreaFavero71/cubotino/tree/main/connections_board/gerber


There are Makers that have made avilable their spare PCBs: On top of mind I recall g2maurer and martinglass (UK); Check in the chat if this is still an option.


Additional info at "How_to_make_ .... .pdf" doc, also on how to download the Gerber files from GitHub

Setting Up Raspberri Pi

A simplified method is available (thanks to heneault) to setup the Raspberry Pi: https://github.com/AndreaFavero71/cubotino

This method takes also care to copy all the needed files to the right folders

Additional info at "How_to_make_ .... .pdf" doc

Set the Servos Angle for Correct Assembly

IMG_20220319_111513.jpg

Set both the servos to the mid angle; This can be done via below steps:

  1. connect the servos to the Connection board
  2. enter the robot code folder, by typing 'cd cubotino/src' from the root
  3. activate the virtual environment, by typing 'source .virtualenvs/bin/activate'
  4. set the servos to the mid angle, by typing 'python Cubotino_T_servos.py --set 0'

On the servo for the Top_cover: Connect the T25 arm oriented as per picture.

This also is a good moment to verify if the rotation range of the received servos, as well as the Pulse Width characteristics.


More info in the annex "How_to_make_ .... .pdf".

3D Prints

IMG_20220319_102208.jpg

There are a total of 13 parts to be 3D printed, for about 500 grams (when PETG is used).

All parts have been designed to be printed:

  • on printers with at least 200x200mm printing plate
  • without supporting the overhangs


More info, like the suggested print orientation, in the annex "How_to_make_ .... .pdf".

Note: If you want to upgrade Cubotino Base version, the 'old' PCB_cover won't be re-usable and few new more parts have to be printed.

In case you'd like to modify the parts/project, the step files at stored at GitHub: https://github.com/AndreaFavero71/cubotino/tree/main/stp

Assemble the Robot

Cubotino_automous.PNG

All parts are connected by screws.

Some little hot glue to keep the touch button in position.

Add four self-adhesive rubber feet underneath the base.

In the annex "How_to_make_ .... .pdf", the assembly steps and details are provided.

Tune the Robot

Servos_setting_GUI.PNG
Servos_setting_GUI_02.PNG

As mentioned above, be prepared the robot won't magically work right after assembling it.

From 18/04/2023 a graphic user interface (GUI) makes this process more intuitive.

Image cropping and warping can be tuned by same GUI.

In the annex "How_to_make_ .... .pdf", you'll find listed the foreseen parameters

Full Cycle No Editing

Cubotino Autonomous, full cycle

A full cycle, without editing

YOU MADE IT

Cubotino_Autonomous_YouMadeIt_20240810.PNG

If you have built your own Cubotino, add it to the "I MADE IT !" section: Search for the yellow-orange button "I MADE IT!" below.

Provide Feedback

Feedback.PNG

If you've enjoyed the project and/or you've suggestions, please feedback

Recent Update

Main latest updates


10/12/2023:

Added compatibility with OS 11 (Bullseye) while maintaining it with OS 10 (Buster); Short guide:

1) If your Cubotino is based on Buster and works correctly, there is no benefit in updating the scripts nor the operating system.

2) If your Cubotino is based on Raspberry Pi ZeroW (not Zero2W), the OS 11 slows down significantly: Stays on OS 10.

3) If your microSD stops working and you haven't saved an image of it, welcome to Bullseye OS.

4) If you are currently busy building Cubotino, my advice would be to start over and flash the microSD with Bullseye; In this case, I would suggest you copy your Cubotino settings (if already done) to a safe place before this action.

5) On Zero2W, I didn't notice any significant differences for Cubotino based on Bullseye rather than Buster.



01/23/2024:

1) Added exposure shift parameter to mitigate overexposure tendency with OS11 (picamera2 library). This parameter, as well as the PWM LED, have been added to the GUI.

2) Camera settings take 4 faces of the cube to determine the best AWB and gains (this approach was previously only used for exposure time).

3) Added fixed coordinate system (FCS), which allows facelets position estimation when edge detection is difficult (lighting conditions, frameless cubes, etc.)


01/04/2024:

Thanks to the great job of Paul, the servos solving time is ca 13% faster. Paul approch includes 180 degrees rotations, instead of two sets of 90degrees rotations.


31/05/2024:

1) Thanks to the great suggestion of Rene, the dominant colours analysis is now added. This improves the color interpretation for critic cubes (i.e. with text over the colored facets). This addition is not active by default and requires -D or --dominant argument to be added (python Cubotino_T.py -D); If you add this ardument in the Cubotino_T_bash.sh file, it become your default.

As reference: https://youtu.be/YV-g_3STsBo

2) PiCamera V2 (and V3) have now been finally tested. Some changes were necessary to the code as well as to the PiCamera_holder.stl file.

Updated files and instructions are available at GitHub and this webpage.

How to Solve the Cube

If you want to learn solving the cube, a great guide is available at https://ruwix.com/the-rubiks-cube/how-to-solve-the-rubiks-cube-beginners-method/

Ruwix is a popular website dedicated to Rubik’s Cube and other twisty puzzles. It serves as an excellent resource for both beginners and experienced cubers. Here’s what you can find on Ruwix:

  1. Online Solver: If you’re grappling with a scrambled Rubik’s Cube, and you haven't made you CUBOTino yet, the online solver can help you find a solution.
  2. Articles and Tutorials: Dive into informative articles and tutorials related to twisty puzzles.
  3. Cube Timer and Simulators: Test your speed and skills with the cube timer or explore virtual cube simulators.
  4. and many other topics..