top of page

Inverted Pendulum

ENGS 026: Control Theory // Professor Laura Ray

Partner: Amanda Roberts

Project Objective

 

The objective of this project was to design and implement the analog control system to stabilize an inverted pendulum on a four-wheeled moving cart.

I performed sensor calibration and motor characterization using a multi-meter, a function generator, and an oscilloscope. I implemented the control system using both passive and active electrical components on a bread board. 

The video on the left shows a demonstration of the controlled system when a disturbance is introduced (tapping the pendulum).

 

The cart will always drift in one direction or the other because the friction at the wheels could not be perfectly characterized and compensated for.

Design Process

In order to design a control system for the cart the transfer functions for the motor, pendulum-cart system, and the sensor needed to first be determined.

Once the system was characterized a controller was designed using root locus and frequency response analysis in MatLab. The controller circuit was then implemented and tested on a breadboard.

Figure 1 - Upper-level block diagram of the full control loop

Sensor Calibration

To calibrate the infrared sensor, the output voltage from the sensor for a range of pendulum angles was measured. These values were plotted against each other, and the slope of the linear region corresponds to the gain of the sensor.

Figure 2 - Sensor voltage plotted against pendulum angle from vertical

Motor Characterization

To control the position of the pendulum above the car, the system needed to be able to accurately control the output torque of the motor. The transfer function for the motor (Figure 4) was determined using the block diagram in Figure 3. K, T1, and T2 in Figure 4 correspond to the gain and two time constant of the motor.  

Figure 5 - The current response (green) of the motor from a step voltage input (yellow). The time constant (T2) was determined using the graph above and the gain (K) and and time constant (T1) were found using the initial and final value theorems respectively

Figure 3 - Motor block diagram used to determine the motor's transfer function

Figure 4 - Simplified motor transfer function for the motor current to the input voltage. The current (I) can be easily converted to torque with the motor constant Kt found from motor specification sheets

Pendulum-Cart Characterization

Finally, a dynamic system analysis was performed to determine the ideal output force at the car wheels to keep the pendulum vertical. The images and example analysis were taken from the  "Modern Control Engineering" textbook by Katsuhiko Ogata.

Figure 7 - Transfer function for the relationship between the output angle of the pendulum from the input force from the wheels. "M" is the mass of the cart, "m" is the mass of the pendulum, "g" is the gravitational constant, and "l" is the length of the pendulum

Figure 6 - Simplified diagram of the pendulum-cart system used to find the systems transfer function

Full System Diagram

Once each piece of the system was characterized, a complete block diagram and transfer function was developed so that a final controller could be implemented

Figure 8 - Full block diagram of the controlled inverted pendulum system. The diagram includes the gear ratio between the motor an the wheels, the motor's toque constant (Kt), and the radius of the cart's wheels to convert torque to a force.

Final Controller Design and Circuit Implementation

Once the system was characterized, a controller was designed and optimized using root locus and frequency domain analysis with MatLab and the iterative testing of the actual system.  

 

The controller was designed to meet criteria on stability, settling time, frequency response, steady state error, disturbance response, and other frequency and transient response characteristics. In order to meet both steady state error and response speed criteria while also avoiding saturating the circuit op-amps, a PID (proportional integral derivative) controller was implemented. The final circuit consisting of a voltage divider, buffer, summing junction, inverting op-amp, and the controller circuit can be seen in Figures 11 and 12 below.

Figure 9 - The root locus (top left) and the open (right) and closed (bottom left) loop bode plots of the controller

Figure 10 - the final transfer function for the implemented control system

Figure 12 - Diagram of the PID compensator circuit used to control the pendulum system 

Figure 11 - The final circuit used to control the inverted pendulum system

bottom of page