Inverted Pendulum

John Stang


Abstract: The inverted pendulum is a classical control problem, which involves developing a
system to balance a pendulum. For visualization purposes, this is similar to trying to balance a
broomstick on a finger. To study this problem, this project incorporated a full system design
including all of the mechanical, hardware, and software design at minimal cost. There are three
main subsystems that compose this design: (1) the mechanical system, (2) the feedback network
which includes sensors and a method to read them, and (3) a controller and its interface to the
mechanical system. After determining sets of requirements between the subsystems, each one
can be designed independent of the other two, simplifying the design process. The mechanical
design involved building a track, cart, pendulum, and drive mechanism. The track, cart, and
pendulum were developed out of primarily aluminum and wood. The drive mechanism is a DC
motor with a sprocket mounted onto its shaft to pull a chain, which the cart connects to. The
feedback network consisted of rotational potentiometers, which were sampled by an analog-todigital
converter, to measure the angle of the pendulum and the displacement of the cart. The
controller was implemented by an Atmel Mega32 which varies the speed of motor by using pulse
width modulation. The final system results in a cart that could balance a pendulum for a limited
amount of time. This was due to many imperfections in the mechanical system and the inability
to model the dynamics of these imperfections along with the calculation limitations of the Atmel

Full Report in PDF format (You may need to download this and open it from the desktop)

Source Code

-controller.c : is the actual code for the Mega32 which controls the cart
-controller.m : determines the controller given certain performance constraints
-measurement.m : used for serial communication to get data from the pendulum and cart via the Mega32
-parameter.c : C source file which allows control over the cart using buttons such that the motor can be parameterized
-alpha_calc.m : used to determine the motor parameters once data is collected


mpeg1 (4 Mbytes)

mpeg2 (3 Mbytes)