Balancing an Inverted Pendulum – PID control
For this project, me and my partner built a controller for an naturally unstable inverted pendulum system. The goal was to design a controller entirely from first principles: model the physics, derive the system transfer function, design a stabilizing compensator, and implement it in hardware.
I began by modeling the motor, cart, and pendulum dynamics using a combination of experimental system identification and analytical derivation. This included:
- Measuring motor current vs. voltage to characterize torque
- Calibrating an angle sensor
- Deriving the full nonlinear equations of motion and linearizing around the upright equilibrium
- Building the full transfer function from input voltage to pendulum angle
The modeling revealed that the plant is closed-loop unstable with a right-half-plane pole, meaning a controller is mandatory.
This project was a hands-on reminder that real systems rarely behave exactly like their models. The linearization, actuator limits, and sensor imperfections all created challenges that I had to address through iterative design and tuning. It strengthened my understanding of:
- Modeling nonlinear systems
- Compensation design
- Root locus intuition
- Noise and robustness
- Analog control circuitry
- The gap between theory and hardware
It also reinforced a valuable engineering lesson: a model is only useful if it helps you build something that works in real life.
Here is a video of it working:
And here is our final report:
PDF · 19 pages
