It is said that solving a Rubik’s Cube is truly a relaxing activity! Although you may not be able to solve it like a master with a few swift moves, who doesn’t know the “return to position” method? But when someone hands you a mysterious Rubik’s Cube that has been scrambled, looking at you with anticipation, it’s time to reveal the engineer’s magical tool.
Today, I am excited to share@LittleHeWhoLovesRunning’s open-source masterpiece – the Rubik’s Cube Solving Robot.
Rubik’s Cube Solving Robot– Open Source Sharing –
This is a Rubik’s Cube solving robot designed based on the Raspberry Pi RP2040 microcontroller, where both control and cube solving are accomplished using the microcontroller. For a randomly scrambled Rubik’s Cube, the average number of steps for solving is about 21.
The current V2.0 version can solve the Rubik’s Cube in 7 seconds.
All materials are now open source, including schematics and PCB, microcontroller source code (C language), structural diagrams (openSCAD format/STL format), and main component BOM.
1
Project Implementation Principles
This project does not require a camera; it uses two color sensors to scan the colors of all edge and corner pieces, and employs a reduction method to find a solution within 22 steps, and then restores the cube according to the solved result.
Let’s take a slow-motion look:
Note: Rotate the cube in a specific pattern so that all sides pass through the color sensors at least once. In addition to the edge and corner pieces, the color information of the center pieces is also needed; the current project structure cannot scan the center pieces, so the orientation of the center pieces needs to be fixed when assembling the cube..
2
Key Points of Project Implementation
Hardware Design – Connect the GPIO of the RP2040 microcontroller to the stepper motor driver, color sensors, and Hall sensors. Other than SPI and UART, all other pins only use GPIO without any other multiplexed functions.
Note: The Hall sensors can only be powered by 5V, while the RP2040 microcontroller IO operates at 3.3V, requiring level conversion design. FLASH is optional; if not used, the average number of solving steps is about 32.

Structural Design – It is recommended to 3D print using ABS material with a 0.4mm nozzle, 0.2mm layer height, 5 top layers, 5 bottom layers, 4 shells, and 20%-40% infill, generating supports.
Firmware Compilation – It is recommended to use a Linux system for development, following the scripts in the official RP2040 documentation to set up the development environment. For relevant source code and files, refer to the latest open-source material link.
3
Project Cost Reference
Not counting processing costs, the material cost is about 200 yuan for one unit.
Main materials on the motherboard:
The PCB can be obtained for free in small quantities; in larger quantities, it is estimated to cost about one or two yuan; three heatsinks are about 1.5 yuan, the crystal oscillator is about 0.3 yuan, Type-C socket is 0.38 yuan, RP2040 microcontroller is 3.91 yuan, three HR4988 chips are 6.24 yuan, W25Q16 is 0.9 yuan, AMS1117 is 0.3 yuan, CH224K is 1.1 yuan, W25N01 is 5.5 yuan. Other materials are quite cheap, but cannot be bought in small quantities, so there will be a lot of leftovers.The total cost should be within 30 yuan.
Complete machine materials:
Three stepper motors cost about 72 yuan, a magnetic Rubik’s Cube costs around 20 yuan, two square pot magnets cost 9.4 yuan, a 4010 fan costs 7 yuan, three Hall sensors cost about one or two yuan, two color sensor modules cost 27 yuan, a flange coupling costs 2.8 yuan, aluminum strips cost a few yuan (if you can process them yourself, it’s very cheap; if you have to customize them, it might be very expensive, so printing a few more in 3D is a better deal). ABS material costs around 10 yuan for about 280g, and if you don’t have a 3D printer to customize, it’s about 0.2 yuan/g. Other small parts are hard to calculate, but not expensive.The total cost should be within 170 yuan.
Accessories: You can use any power supply between 12-20V, preferably above 2A, which most electronics enthusiasts have. If you have a PD-compatible Type-C charger, you can use it directly. Just be careful with the wiring when connecting the positive and negative terminals.
4
Latest Open Source Materials
All materials for the Rubik’s Cube Solving Robot project are open source – including mechanical structure diagrams, circuit diagrams, PCB, source code, complete BOM, and assembly and debugging video tutorials.
Open Source License: MIT
Open Source Material Link
https://gitee.com/hemn1990/rubiks-cube-robot
Assembly and Debugging Tutorial
Control board debugging: https://b23.tv/Xj93aZk
Rubik’s Cube purchase: https://b23.tv/2x8Be0n
Mechanical assembly: https://b23.tv/huJY1xt
Complete machine debugging: https://b23.tv/o8LBCXT
Special Thanks to @LittleHeWhoLovesRunning for the Open Source Sharing
The small microcontroller interprets countless possibilities
What kind of brilliance will our lives unfold?
2024, dare to speak and act
Send the keyword in the public account background
Hezhao RP2040 Lottery
Get the exclusive lottery link to participate
Randomly select 3 lucky friends to win Hezhao RP2040 development boards
2024-01-24 12:00 Automatic Lottery
Previous Recommendations
Open Source | DIY Creative Ornament with ESP32 Development Board + E-Ink Screen
Open Source | DIY Creative “Pixel Box” with ESP32
Open Source | DIY ESP32 Pixel Clock & Music Spectrum
Open Source | MicroPython Development, DIY ESP32 Bluetooth Remote Control CarOpen Source | Mini Music Spectrum Desktop OrnamentOpen Source | Hezhao Air001 DIY Cool “Earth Business Card”Open Source | DIY GNSS Locator & Time SynchronizerOpen Source | Mini RGB Light Ring based on Hezhao Air001Open Source | Around 100 Yuan, DIY Multi-Functional 4G Phone