Ping Pong Ball Clock (PPBC)

Clock built with ping pong balls, LED strips, and a Raspberry Pi, controlled through a web app
personal

Inspiration

A Reddit post first introduced me to this project. It linked to a Thingiverse build that used 3D-printed parts for a ping pong ball clock. After digging a little deeper, I found an Instructables design that skipped 3D printing altogether and improved the LED placement. I used that Instructables design as the basis for the hardware, but I knew from the start that I wanted to run it on a Raspberry Pi Zero and build on an earlier web-controlled LED project that I had written.

Design Concept

The firmware is written in Python because it is quick to iterate on and has two libraries that do the heavy lifting:

  • Neopixel libraries (LED drivers)
  • Flask (web server)

Because of the zig-zag layout of the LED strips behind the balls, I had to write custom font tables and character-rendering functions from scratch. The only code that carried over from earlier projects was basic code for lighting individual LEDs.

PPBC wiring design concept. Mapping LED indices to 2D grid coordinates made driver work much easier, using 999 for empty cells with no ball.

I also designed custom font libraries so that you are not stuck with the single digit font from the original build. Expanding beyond digits to full character sets made it possible to display weather readouts and custom messages.

PPBC font designs.

Implementation

The backend runs a continuous update loop alongside a threaded Flask server that handles both the web UI and the control API. API requests update state on a shared PingPongBoard object, which holds the LED driver helpers, color animations, and display modes (time, date, weather, and messages). Those updates take effect on the next pass of the loop. Both the frontend and backend run on the Raspberry Pi itself, so any device on the local network can control the clock from a browser.

I still tinker with this project occasionally. Recent updates added scheduled display presets and smoothed out the timing for the rainbow animation while scrolling text.

Video

At the time of this post, the video had 17K views! Thank you all for the support, and I hope that you have been able to build PPBCs of your own.

GitHub Repo

lancewilhelm/pingPongBallClock
Raspberry Pi code for the Ping Pong Ball Clock Project
Python
25
12

Future Work

Web App

The web UI could use a modern refresh with Vue or React, served as static assets straight out of Flask to keep deployment simple on a Pi Zero.

Drivers

Right now, a single tight loop handles everything, so full-board animations slow down polling and frame responsiveness. Separating API handling from rendering with cleaner async or threaded tasks would make transitions much smoother.