Hackster is hosting Impact Spotlights: Industrial Automation. Watch the stream live on Thursday!Hackster is hosting Impact Spotlights: Industrial Automation. Stream on Thursday!

Ball Balancing Robot

This Stewart platform uses an overhead Pixy 2 camera and a Teensy 4.1 for PID control.

Jeremy Cook
2 years ago

Ball balancing robots, also known as Stewart platforms, are able to dynamically maintain a ball in the center of a flat surface via the carefully calculated movements of linkage arms. Aaed Musa decided to build his own elegant version of this device, using a sextet of high speed servos for movement. A Teensy 4.1 along with a Polulu Maestro servo controller command the servos, while an overhead Pixy 2 camera tracks the ball’s position.

The project is outlined nicely in this write-up and in the first video below. It's first demonstrated by a rather impressive reaction when Musa throws the ball of the platform. It's able to keep the ball from falling off, using servo positions calculated using inverse kinematics. The servo’s quick and appropriate reaction if due to the system’s PID setup, which takes into account not just the position of the ball, but also how fast it’s moving.

Toward the end of this clip, Musa shows what happens when the PID algorithm is reversed, rather hilariously throwing the ball off as quickly as possible. He also illustrates what happens when things aren’t tuned correctly, resulting in a sort of swirling of the ball as it overreacts before eventually dumping it over the side.

A second video goes into more specifics on how a PID algorithm works, taking into account Proportional, Integral, and Derivative terms to keep things balanced. Notably, the integral term isn’t used for the platform, so one might call it “PD” control; however, this general concept is applicable in a wide variety of situations.

Jeremy Cook
Engineer, maker of random contraptions, love learning about tech. Write for various publications, including Hackster!
Latest articles
Sponsored articles
Related articles
Get our weekly newsletter when you join Hackster.
Latest articles
Read more
Related articles