This project is presented for people who have experience with using an Arduino. Prior knowledge of using servos, OLED displays, pots, buttons, soldering, will be helpful. This project uses 3D printed parts.
Ball Balancer is a PID test rig for experimenting with PID tuning. PID Fiddler is a remote for adjusting PID tuning.
A PID is used when you need more control of movement. A good example is a balancing robot. The robot needs to make small adjustments to maintain balance, and quick response to catch itself if it encounters a bump or push. A PID can be used to tune the wheel motors response to maintain balance.
A PID requires feedback from a sensor. A balancing robot uses gyros and accelerometers to measure the absolute angle of the robot. The output of the sensor is used by the PID to control the motors to maintain balance.
So why did I make a boring ball balancer? Sure it’s cool, but balancing robots tip over when they are not tuned correctly. Balancing robots are not the best device for experimenting with PID tuning. The ball balancer is much more stable and is a good visual tool to see the effects of PID tuning. The knowledge gained from tuning the ball balancer can be applied to tuning a balancing robot.
The Ball Balancer is a rail on a pivot point. On the rail is a ball the moves back and forth on the rail when the rail is tipped. The rail is tipped with a servo. On the end of the rail is a sensor that measures the distance of the ball from the sensor. The input to the PID is the distance of the ball from the sensor, and the output of the PID is the servo that tips the rail and moves the ball.
I am using the Arduino PID library. https://playground.arduino.cc/Code/PIDLibrary
The PID Fiddler is what I use to tune the PID values. You don’t need one, but it helps. The PID Fiddler is remote from the Ball Balancer, it connects with only two wires, and it can be connected and disconnected while the Ball Balancer is running. Once you find the best values, the values can be hard coded in your project sketch.
The extra effort of making the PID Fiddler pays off in time it takes to make tuning changes to the PID. You can quickly see the results of your changes. And it can be reused on future projects that use PIDs. Not to mention it’s fun to building, and looks cool!”

Link