This cube manages to balance itself on a corner, and can simultaneously rotate around its axis in a controlled manner. It does so using clever controls and a set of three reaction wheels.

The original idea for this device comes from researchers at ETH Zürich, who demonstrate their “Cubli” in this video. Its design has been improved in some ways in later years. Notably, Bobrow et al (University of São Paulo) introduce an improved controls concept, reducing the number of required IMUs (inertial measurement units) to just one instead of six.

I decided to pursue the challenge of building one myself. Even though the idea isn’t new, previous works are largely closed-source. I plan to change that. This means that I had to reverse-engineer and draw everything from scratch. The result of my work, which is completely open source (GitHub), is shown in the video below.

You might think: ANOTHER USELESS MACHINE?! When I published my M&Ms sorting machine, I received lots of similar remarks. Indeed, it has no practical value, but similar applications such as sorting of fruits, vegetables and nuts based on colour do. For this cube, the situation is similar: while this is mostly a great learning experience and research project, reaction wheels are often used in satellites (such as the James Webb telescope) for attitude control purposes.

A spacebound reaction wheel. Source: Wikipedia.

Mechanical design

The mechanical design of this cube is mostly the same as that of the original Cubli, but it has some subtle differences. The main structure consists of eight “cornerstones” and six face plates. Three of these face plates have additional features to support a motor and reaction wheel assembly. All parts were drawn in (con)Fusion 360. My student days are over, so I had to say farewell to Siemens NX. The latter isn’t used much (if at all?) in the DIY community anyway, so I can share my designs with others more easily now.

Most structural parts are made of stainless steel for its excellent strength. The faceplates are made of aluminium to save weight. These don’t need to be made of steel since the assembled structure will be more than stiff enough when made of aluminium anyway.

All metal parts in this project have been manufactured by PCBWay. I’ve used their PCB prototyping service before and was interested in their CNC capabilities. Part of the cost for these parts was sponsored by PCBWay. The ordering process was straightforward and I like that a quote was automatically calculated directly after uploading the part and specifying the material type. I’m satisfied with the parts and their quality: a small production issue was quickly resolved and all parts fit together without issue. Pictures below: judge for yourself.

I had fun with the design of the motor and flywheel assembly. I was looking for a robust design – after all, the wheels can reach speeds up to 6000 rounds per minute – while also keeping it lightweight. Even though I’m a mechanical engineer by education, construction principles aren’t my main strength, but after all that’s the reason for projects like these: to learn! I finally came up with the following.

The motor is connected to a stainless steel bridge using three countersunk screws. The bridge eventually connects to one of the aluminium faceplates.

A small hub is mounted onto the shaft of the motor and secured using three set screws. This hub is critical: if the center hole is not perpendicular with respect to the flat triangular face, the wheel will not be aligned with the motor shaft, causing vibrations and wear.

A reaction wheel is mounted onto the hub using three countersunk screws. This step requires a bit of trial and error to correct for imperfections in the hub and wheel, which may cause the misalignments I mentioned earlier. I resolve these by placing tiny pieces of paper between the horizontal contact surface of the hub and wheel and this provides satisfactory results. After all, these parts aren’t taken apart very often.

A small radial ball bearing is inserted into one of the faceplates and secured using cyanoacrylate (“super”) glue. This ball bearing will support one end of the motor shaft. The other end of the shaft is also supported by a bearing within the motor itself.

Finally, the motor shaft is inserted into the bearing and the bridge is connected to the faceplate using four bolts. This process is repeated two more times.

This result in half a cube. The remaining faceplates don’t require any special assembly steps and can be directly assembled. Notice how one of the motors is oriented differently with respect to the bridge to which it attaches? That is done on purpose: it simplifies the cabling work later on.

The result is a strong yet relatively lightweight structure. The aluminium faceplates are relatively weak by themselves, but won’t budge when assembled together.

Electromechanical design

For the motor and motor controllers, other balancing cubes use Maxon motors from the “EC flat” series. While it’s possible to find cheaper alternatives, the motors and their controllers are critical parts and I don’t want to skimp on them. The cube will balance by applying torques to the motors. Many DC motors do not even come with datasheets that specify the torque constant (which defines the relationship between torque and current), and many brushless motor controllers such as ESCs only offer speed control, but not current control. Both are essential in making this project a reality, so the choice for components of high quality is obvious here.

I selected a 60 W motor and a compatible 4-quadrant motor controller which can deliver currents up to 6 A. At 24 V, this corresponds to almost 150 W. While this is well beyond the nominal power rating of the motor, it is no problem to briefly overload the motor. Moreover, the controller has a built-in I2t algorithm which limits current to the motor if the winding temperature is estimated to become too high. It is unlikely that the cube hits these limits in normal operation anyway, because currents are generally very low while balancing.

The software that comes with the Escon motor controllers is pretty great. There are motor commissioning and tuning tools and a nice dashboard showing the status of the motor and its inputs/outputs during operation (shown in the screenshot above).

For the battery, I chose a 6S1P lithium-polymer battery. The motors are rated for 24 V so a six-cell LiPo battery (nominal voltage 22.2 V) is a good fit here. The battery has a capacity of 1300 mAh (29 Wh) which is enough to run the cube for at least an hour, normally.

The motherboard is a custom design and integrates the three motor controllers, IMU (hidden), ESP32-S3 development board, and some supporting components such as protection circuits and voltage regulators. The board also anticipates adding mechanical brakes to the cube, by providing outputs for RC servo motors. Mechanical brakes will enable the cube to jump up to the balancing position by itself. I haven’t finished the development of the brake design yet.

Assembling the circuit board was fun. I started by applying solder paste and placing the surface-mount parts. After reflowing it in a small toaster oven (more details about how this works here), I soldered all the through hole parts by hand.

Later, during integration and testing of the various components, I found that I had made a few small routing errors which I quickly corrected using bodge wires. It turns out that only one digital input on the motor controller supports PWM and I routed the PWM signal to another (unsupported) input.

I also designed a board to mount the battery onto. It’s much simpler: it has two XT60 connectors and two switches (wired in parallel because of currents up to 18 A) to turn the cube on and off.

Read More