Balancing an Inverted Pendulum on a Cart

This is a project from a math and physics course my first semester in college. We were asked to model a second-order system. My group chose to model an inverted pendulum on a cart. After deriving and validating the equations of motion, we decided to implement a control system to keep the pendulum balanced.

After the class was over, I spent a weekend building a real version out of Legos to test our control system. It turned out that the 'best' parameters were not as good as the model predicted, but it did predict failure regions accurately.

This video shows working system. The pendulum itself has very little friction, both in the joint, and on the track. I used a potentiometer to sense angle, and I calculated angular velocity by having the pendulum back-drive a motor.

The control system was created in Simulink. The control circuit involved op-amps in negative feedback. The computer controlled the circuit using the very annoying Simulink Real-Time target and a flaky PCMCIA data acquisition card from Measurement Computing.