03 / 08 ⋆ Projects

Controls ⋆ MATLAB

Inverted Pendulum

Fig. 01 ⋆ Test rig

◦ Specifications

Hardware
Geared rotary motor, incremental encoders, weighted pendulum arm.
Software
MATLAB and Simulink.
Control system
State selector, PID loops, Jacobian-based balance function.

◦ Project

For this project I developed a control system for an inverted pendulum that self-balances and recovers when disturbed. Using MATLAB and Simulink, I combined Lagrangian and Hamiltonian dynamics to model motion and calculate system parameters, and Jacobian transformations to track positions. A state selector and PID loops enable seamless transitions between swing-up and balancing, ensuring precise and adaptive control.

This project showcases the practical application of control theory and serves as a foundation for more complex balancing systems in robotics — self-balancing rockets, drone stabilization, and beyond.

Demo

Swing-up + balance

Gallery

06 items

Fig. 01

Matrix transformations and frame rotations let us track the pendulum tip relative to the base.

Fig. 02

Applying Lagrangian dynamics (L = T − V) to the Euler-Lagrange equations of motion to simulate response.

Fig. 03

The work envelope of the 2-DOF system — plotted in MATLAB as a reachable surface.

Fig. 04

Hamiltonian approach used to calculate physical parameters via input torque, mechanical power, and losses.

Fig. 05

A MATLAB logic function paired with a Simulink multiport switch transitions between swing-up and balancing.

Fig. 06

The full Simulink system — state selector, PID loop for swing-up, and error-driven balancing.