Supervision Software
The BallCuber : 4x4x4 Rubik's Cube solving machine
- Introduction
- Grab images
- Resolution algorithm
- 3D real time display
- Embedded Arduino software
- Resolution sequences
- Machine maintenance
Introduction
The software that drives the BallCuber is mainly developed in .NET framework, with some additional javascript and java. But a part also runs in each of the two Arduino MEGA boards (C++ language).
Its sources are available on Github : https://github.com/ballcuber/ballcuber-source-code.
Grab images
This page describes the procedure to grab and process image in order to get the initial state of the 4x4x4 Rubik’s Cube.
Resolution algorithm
The resolution algorithm is, with the mechanical design, the most difficult part of the project.
Fortunately, the Github user cs0x7f has published a TPR-4x4x4-Solver that is based on a Three-Phase-Reduction Solver and a 3x3x3 Solver. You can find its sources here : https://github.com/cs0x7f/TPR-4x4x4-Solver.
The Ballcuber .NET software call the java solver and parse its output to identify the solving sequence. Then, geometric transformations are applied to make its movements compatible with the kinematics of the BallCuber, which has a fixed corner.
On average, this algorithm solves the cube in about 60 moves (quarter turns).
3D real time display
The supervision program has a real time 3D view of the 4x4x4 Rubik’s Cube. It is rendered by a chromium browser (cef sharp), that hosts a Twisty.js player : https://github.com/cubing/twisty.js. The .NET code remote execute javascript to animate the cube.
Embedded Arduino software
The embedded part has been designed to be simple and slave to the .NET program. The same code runs in both Arduino boards. Communication takes place via a serial link (RS232) and is facilitated by the Sharer library. The 9 stepper motors are controlled simultaneously by the AccelStepper and MultiStepper libraries.
- Sharer : https://github.com/Rufus31415/Sharer
- Stepper : https://www.airspayce.com/mikem/arduino/AccelStepper/
BallCuber embedded sources are available on Github : https://github.com/ballcuber/ballcuber-source-code/blob/master/Arduino/Arduino.ino.
Resolution sequences
The movements resulting from the resolution algorithm are converted into a motor movement sequence. A runner allows to see the progress of the execution of the instructions, but also to set breakpoints.
Machine maintenance
For maintenance and tuning purposes, setting screens allow to adjust the machine (calibration, COM port, camera, …), as well as to control each motor individually.