Although billed as a balancing robot, [Aaed Musa’s] robot doesn’t balance itself. It balances a ball on a platform. You might recognize this as something called a Stewart platform, and they are great fun at parties if you happen to party with a bunch of automation-loving hackers, that is. Take a look at the video below to see the device in action.
If you want to duplicate the project, there’s a bit of expense, but the idea behind it is explained in the video. Much of the robot is 3D printed with threaded inserts. Even the ball is 3D printed in two parts along with a cubic connector to hold the two hemispheres together. The acrylic platform was cut with a water jet, although you could just as easily have cut it with hand tools.
This type of robot is an especially visual manifestation of PID control and that’s explained in the second video. Sure, most 3D printers use that to control their nozzle temperature, but that’s hardly as exciting as watching the ball roll around on the platform.
The key to the algorithm is the realization that you must simultaneously control the ball’s position and speed. You want the ball to reach the set point — the middle of the platform — just as its speed goes to zero. That means the algorithm has to adjust which way the platform tilts to change the direction of the ball’s travel, but also the amount of tilt to control the speed.