An educational Ball-Balancing Robot. This project introduces some of the core concepts of robotics: programming, inverse kinematics, computer vision, and PID control.
The 3D models and print profile for a Bambu A1 printer can be found here: https://makerworld.com/en/models/1197770-ball-balancing-robot#profileId-1210633
The materials needed are:
Part Name | Quantity |
---|---|
M2 x 8 Cap Head Socket Screw | 6 |
M2.5 x 10 Cap Head Socket Screw | 4 |
M3 x 5 Socket Head Screw | 18 |
M3 x 10 Socket Head Screw | 3 |
M3 x 15 Socket Head Screw | 1 |
M3 x 20 Socket Head Screw | 3 |
M4 x 20 Socket Head Screw | 6 |
M4 x 30 Socket Head Screw | 6 |
M5 x 30 Socket Head Screw | 3 |
M3 Hex Nut | 3 |
M4 Nylock Nut | 6 |
M4 Hex Nut | 12 |
M3 x 10 Standoff | 9 |
M3 x 15 Standoff | 6 |
M3 x 20 Standoff | 3 |
Standoff | 1 |
4-10 Bearing | 6 |
Rubber Foot 12x9x9 | 3 |
M5 Washer | 6 |
Each of the three motors must be calibrated. Follow these exact steps:
-
Set all motor offsets to
0
.
Incontroller.py
, inside theset_motor_angles
function under classRobotController
, make sure it looks like this:self.s1.angle = clamp(theta1) self.s2.angle = clamp(theta2) self.s3.angle = clamp(theta3)
-
Initialize the robot.
Power on the robot. Then, in your terminal (in correct directory), run:
python controller.py
This sets the initial motor positions. Once the robot has reached its position, do not touch it. Power it off, then use a level or measurement tool to check how flat the top plate is. -
Tune each motor's angle offset.
Based on how the plate is tilted, adjust each motor's angle by adding or subtracting an offset. Modify the code like this:self.s1.angle = clamp(theta1) + OFFSET_S1 self.s2.angle = clamp(theta2) + OFFSET_S2 self.s3.angle = clamp(theta3) + OFFSET_S3
Replace each
OFFSET_Sn
with the value needed to make the plate level. These values are specific to your hardware and may differ for each motor. -
Iterate until balanced.
Repeat steps 2 and 3. Re-run the controller, check the plate, and adjust the offsets as needed. Continue this process until the top plate is completely flat and stable.