Desktop Ball Balancer With Glo Rev 2




Introduction: Desktop Ball Balancer With Glo Rev 2

The PID controller is one of the first things taught to engineering students and designers. Its simplicity and versatility make it easy to understand and implement. This ball balancer uses the PID feedback loop to balance a marble perfectly on the center of a beam. Additionally, it contains interactive LEDs which gauge the relative position of the marble. It also utilizes one of the most well-known simple machines: the lever.

The device is driven by a prototype of Glo Rev 2, a new RGB LED strip controller. If you are interested in the project, check out the website for Glo Rev 2, which will launch on Kickstarter soon! The new chip is WiFi compatible, works with Amazon Echo/Google Home, and has plenty of I/O to add modifications.


  1. Polycarbonate Sheet
  2. Wooden Dowels
  3. Brass Rod
  4. LED Channel and Diffuser
  5. Glo Rev 2 Microcontroller (or other MCU)
  6. Servo
  7. Vl53L0X LIDAR
  8. Jumper Wires


  1. Hot Glue Gun
  2. Plastic Cutter
  3. Soldering Iron

Step 1: Prepare the Base

The base of the model is made of a 10x22 cm piece of polycarbonate. I used a plastic cutter to cut the material and a file to smooth the edges.

To reduce wire clutter I made three holes in the base where wires can be routed under the model. The image above shows the three holes to be drilled, as well as the location of the fulcrum of the lever.

Step 2: Attach the Fulcrum and Legs

Following the previous image, I drilled the wire holes and glued the fulcrum (Glo_Lever_Fulcrum.stl) to the baseplate. To make room for the wires, two "legs" using wooden dowels can be used. I glued two 10cm lengths of dowel to the underside of the baseplate.

Step 3: Build the Lever Arm

To make the lever arm, I used a piece of aluminum LED strip channel. The channel looks good, is easy to cut, and holds a regular-sized marble perfectly. I cut an 18cm piece of channel to form the main lever.

Since the lever needs a way to rest on the fulcrum, I glued a 4cm piece of brass rod to the center of the LED channel.

Step 4: Attach Lever Arm End Caps

To prevent the marble from rolling off the edges, I 3D printed and attached end-pieces (Glo_Lever_End1.stl & Glo_Lever_End2.stl) onto each side of the channel. It is important to glue the pieces exactly as shown. This will ensure that all the components fit properly and are oriented correctly on the base.

Step 5: Attach LIDAR Sensor

Since the ball balancer needs to know the position of the ball on the lever, we need some sort of sensor. As traditional ultrasonic and IR sensors are not as reliable, I chose to use a VL53L0X LIDAR sensor. This sensor is very accurate in the 1-20cm range and communicates via I2C, making it very easy to integrate with our project.

The sensor can be mounted as shown using some double stick tape or small dots of hot glue.

Step 6: Prepare and Mount LED Strips

Since Glo is designed to be a LED controller, the project wouldn't be complete without LEDs! I cut two 5-LED pieces of 5V-ARGB (Neopixel) strips and joined them with a small length of wire. I also soldered a long length (30cm) of wire from the end of the strip to connect to the MCU. After all the soldering is complete, I glued the LED strip to the side of the channel as shown, leaving some room on the top edge.

To diffuse the individual lights, I used the plastic diffuser that came with the LED channels. I cut two pieces of the plastic diffuser and glued them onto the lever arm.

Step 7: Mount Servo to Base

With both the lever and the baseplate completed, it's time to mount the main electronics. I bent a small paper clip into a 'Z' shaped piece and stuck one end into the hole on the lever's end cap. The other end was connected to the servo horn and bent in place. I then glued the servo to the base and tested it to check if moving the servo shifts the lever up and down properly.

I also added a servo cover (Glo_Lever_Servo_Cover.stl) to the baseplate (This doesn't do much, but makes the build look cooler :D)

Step 8: Attach Glo (or Other) Microcontroller

Now it's time to mount the brains of the system! As I am currently developing Glo Rev 2, an internet-connected, Arduino-compatible RGB LED controller, I have several prototypes lying around. Glo was a good choice for this project as it is a combination of external modules (servo and lidar) and RGB LEDs. While these new boards have not been released yet, never fear! This project can be made using an Arduino Uno, Nano, or ESP8266.

To attach the board, I first had to make some modifications. After desoldering the pin headers and resoldering them on the back, I used a small L-bracket to secure the board on the baseplate.

Step 9: Wire Up the Electronics

The wiring diagram above shows all the connections made. I have modified it to work with an Arduino Nano, but it can be used for MCUs such as Arduino UNO, Node-MCU etc.


VCC -> 5V


S -> Any PWM Pin


VCC -> 5V


SCL -> A5

SDA -> A4

LED Strip:

VCC -> 5V



Step 10: Software

The code used a PID loop to properly balance the ball on the lever. It is important to define the constants though!

Step 11: Tuning..Tuning..Tuning

This is the most tedious component of the project. To properly balance a marble, the PID constants must be very specific. While there are methods of deriving these constants through some advanced physical modeling and mathematics, we will use a trial and error approach.

To tune the model, follow these steps:

  1. With Kd and Ki set to zero, incrementally increase Kp until the lever starts to oscillate.
  2. Increase Kd until the oscillation stops or slows.
  3. Increase Ki if the marble is not balanced in the center of the beam.

Of course, this will take a lot longer than the steps outlined above. Tuning the model may take dozens of tweaks before the numbers work for the system.

Step 12: Conclusion

So there you have it! This project was a representation of a PID control loop using a simple machine. While I used one of my Glo boards for the project, it can be easily made using a regular Arduino or ESP8266.

If you enjoyed this project, please vote for it in the Simple Machines Contest!

If you are interested in the development of Glo Rev 2, check out its website com for more details about the next version launching on Kickstarter! This device will be able to connect to Wi-Fi, have an app interface, several GPIO, and be able to work with Google Home & Amazon Echo. Hope you like it!

Step 13: Additional Resources

Simple Machines Challenge

Runner Up in the
Simple Machines Challenge

Be the First to Share


    • Reclaimed Materials Contest

      Reclaimed Materials Contest
    • Unusual Uses Contest

      Unusual Uses Contest
    • Home Cooked Speed Challenge

      Home Cooked Speed Challenge



    7 months ago

    Well explained and documented :D