Balancing Ball & Beam System

As a part of my Biomechatronics course at the University of Delaware, I was assigned a final project mainly based on control theory. For this project, a classmate and I had to take the ball and beam system seen below and use a controller to close the loop and make the system stable. In other words, the goal was that no matter where the ball is pushed or placed on the beam (within reason) the beam would balance itself, keeping the ball on the beam, and returning the ball to its desired location of the center of the beam.

We started this project by deriving the equation of motion for our system using the Lagrangian method taking the following assumptions into account: no slipping between the ball and beam, no gearbox backlash, and no stiction. Using a state space model of our system, we then implemented our PID controller in simulation for testing. After tuning our constants and getting an acceptable time response, we implemented this with our actual hardware: ball, beam, force sensors along the beam, motor, and encoder. The connections between all the hardware elements can be seen above. The final controller used was a two-degrees-of-freedom PID controller, with inputs of ball position and beam angle, and an output of motor voltage.