Skip to main content

Raspberry Pi Keeps Ball From Falling Off Plate Using AI

Raspberry Pi
(Image credit: Parisiancyclist)

Finding the right angle to approach a Raspberry Pi project can be tricky. Still, maker and developer Parisiancyclist, as he’s known on Reddit, has found a happy balance with this mesmerizing ball on a plate project (opens in new tab). With the help of a Raspberry Pi, it automatically tilts a plate as needed to prevent a ball from falling over the edge.

According to Parisiancyclist, the project took roughly a week and a half to develop from scratch. He not only developed the physical plate tilting apparatus but also coded the project to use AI to evaluate the ball’s location and determine how much to angle the plate to keep it from falling off.

A quick glimpse at Parisiancyclist’s profile shows little in the ways of microelectronics projects beyond this ball-on-a-plate development. As his profile name suggests, he has experience with things that roll as he frequently shares content related to cycling. However, this Pi-based project proves to be an impressive first foray into the world of AI and microelectronics.

Thankfully, Parisiancyclist was kind enough to share plenty of juicy details regarding the project’s construction, including the hardware used to drive the plate. Three servos are used with three PID controllers to move the plate to the appropriate angle. In addition, a Raspberry Pi camera module works to observe the plate and help track the ball in real-time.

The primary tool used on the software side is OpenCV. It helps evaluate what to set the servo angles to using the X and Y coordinates of the ball and where it is to the edge of the plate. Parisiancyclist configures the angle using PWM often between 85 and 175 degrees, although you can set the servos anywhere between 0 and 180.

If you want to recreate this Raspberry Pi project, your best bet is to study the original thread shared on Reddit (opens in new tab) to get a better idea of how it all goes together. There you’ll also find a demo video of the project in action. Be sure to follow Parisiancyclist for future projects and updates on this one, as it’s still a work in progress.

Ash Hill
Ash Hill

Ash Hill is a Freelance News and Features Writer at Tom's Hardware US. She manages the Pi projects of the month and much of our daily Raspberry Pi reporting.