YOU CAN 3D PRINT A PLATE THAT MAKES A BALL DANCE BY ITSELF
A camera watches a ball on a tilting plate and never lets it fall off, even when you push it.
by aaedmusa
RoboticsDisplays
- difficulty
- ●●●●○
- time
- a weekend-plus
- license
- MIT
- repo
- repo ACTIVE64 stars
●●●●○ · a weekend-plus · MIT · 64 stars · repo ACTIVE
WHAT YOU’LL NEED
- 3D printer + filament — printable parts — files are in the repo
- Electronic parts — full list with part numbers in the repo BOM
- Dev board / microcontroller — runs the project firmware
- Soldering kit + basic tools — one-time buy, serves every future build
Partner
COMPAREE VERDICT
This is a classic control systems demo: a ball rolls on a plate, a camera tracks it, and two servos tilt the plate to keep it balanced or make it follow patterns. It is mesmerising to watch and genuinely useful if you are learning PID control or computer vision on an embedded system. The CAD and code are all there, and the electronics are standard maker fare — ESP32, a camera module, two servos, and a handful of linkages. The hard part is not the build, it is the tuning. PID constants that work for one ball and one frame rate will not work for another, and the repo does not document the process. You will spend more time tweaking gains than soldering. If you have never tuned a PID loop before, this will teach you by trial and error, but it will not be quick. The other gotcha: the camera needs a clear unobstructed view from directly above, which means your desk setup matters as much as the print quality. If you want to understand closed-loop control and are comfortable iterating on parameters until it works, this is one of the best ways to learn. If you want a plug-and-play demo, you will be frustrated.
IN THE REPO
NOT IN THE REPO
- —STL files for the platform frame and camera mount are in the repo.
- —Arduino code is provided for the PID control loop and servo coordination.
- —Bill of materials lists servos, camera module, ESP32, and mechanical components.
- —No assembly guide or tuning documentation — the README is a parts list and a circuit diagram.
- —Licence is MIT, commercial use permitted.
- —The PID constants are hard-coded with no explanation of how to tune them for your build.
Can I build this?
Build at your own risk. Projects involve tools, electronics and sometimes mains voltage — follow the creator’s safety notes.
Partner · KickstarterHeyGears G1: 10M+ colors and transparent parts in one print, plus UV printing on flat objects. Figures, parts and labels — no painting.
Gallery
Start here
Navigation into the creator’s own docs — we don’t rewrite the guide, we route you to the source.
- 1.Print the frame and mounts(STLs are ready to print, no supports needed for most parts.)
- 2.Order the electronics (README lists exact servo model and camera module — match them to avoid re-tuning.)
- 3.Wire the servos and camera to the ESP32 (Diagram is clear but minimal — double-check servo power supply is adequate.)
- 4.Flash the Arduino code(Default PID constants are in the code — you will tune them later.)
KNOWN ISSUES
- The camera module matters. An OV7670 from one supplier may have different frame rates or lens distortion than another — and the PID loop is sensitive to both. Buy from a known source or budget time to recalibrate.
- PID tuning is not documented. The constants in the code worked for the original builder's setup, but your ball weight, servo response time, and frame rate will differ. Expect to spend several hours adjusting Kp, Ki, and Kd until it stabilises.
- Servo power supply must be separate from the ESP32. USB cannot supply enough current — the servos will stutter or reset the board. Use a bench supply or a dedicated 5V adapter rated for at least 3A.
- The camera mount must be rigid. Any flex in the arm will add latency and make the control loop oscillate. Print it in thick walls or add a support strut if your filament is flexible.
- Ball choice affects behaviour. A ping-pong ball is light and fast, a steel bearing is heavy and slow. The demo uses a ping-pong ball, and the PID constants assume that mass and drag.
- No assembly guide exists. The README assumes you can infer the mechanical linkage from the CAD and the circuit from the diagram. If you have never built a servo-driven mechanism, you will reverse-engineer it from the photos.
Can I use different servos?
You can, but the PID loop is tuned for the speed and torque of MG996R servos. Faster or slower servos will require re-tuning all three constants, and weaker servos may not have enough torque to tilt the platform smoothly under load.
What is the frame rate of the camera?
The OV7670 module runs at around 30fps in the default configuration. The control loop updates every frame, so latency is around 33ms. A faster camera would improve response but require code changes.
How do I tune the PID constants?
Start with Kp only, increase it until the ball oscillates, then back off 30%. Add Ki to eliminate steady-state error, then add Kd to damp overshoot. The repo does not document this — it is standard PID tuning, but you will learn it by doing.
Can it follow patterns or just balance?
The firmware includes setpoint tracking, so you can command it to trace circles, figure-eights, or any path. The demo video shows circle-following. The setpoint is hard-coded — there is no joystick or GUI.
Community builds
No community builds yet — be the first, we feature the best ones.
Discussion1
FROM THE COMPAREE TEAM
The whole trick is tuning the PID loop until it stops oscillating — and the repo does not document the process. How long did yours take to stabilise?
aaedmusa
A control systems project built to demonstrate PID tuning and real-time computer vision on an embedded platform. The builder shared the full design in 2023 and it remains one of the clearest examples of a ball-balancing system for makers.
DISCLAIMER
- Comparee is not the author of the projects featured here. All rights to each project belong to its creator — every page links to the original source, and we never host creators’ files.
- Information is provided without warranty and may become outdated as projects evolve. Prices are indicative bands only — always check the creator’s parts list for current costs.
- Building and operating any project is at your own responsibility. Protective equipment, safe workshop practice and compliance with local regulations are the builder’s responsibility.

CompareeTEAM1mo agoedited
Practical notes from our verification: the repository includes all the STLs, firmware, and a wiring diagram, but there is no step-by-step assembly guide or PID tuning documentation. The demonstration footage is hypnotic, but every builder will spend more time adjusting control constants than printing parts. The camera module and servo choice matter — mismatches in frame rate or torque will require complete re-tuning. This is one of the best open projects for learning closed-loop control, but it assumes you are comfortable iterating on parameters without a manual.