This research is adopting methods approach involving development and improvement to enhance the overall process of project implementation. The project’s Gantt chart is given in Appendix A. The research is conducting in three phase’s basis. This phase will make sure that the work will be organized based on the scheduled task.
This project is divided into two parts which is hardware and software. Therefore, this chapter will discuss about the process for each parts includes designing, testing, troubleshooting and integrating in order to create one whole system of LQR and PID Controller Design for Inverted Pendulum.
3.1 Familiarization of the System (Phase 1)
In order to implement this project, the first phase that is needed to be concerned is the familiarization of the system. The whole system should be identified and clarified in order to execute the correct process flow of this system.
3.1.1 System Overview
The inverted pendulum is a highly nonlinear and open-loop unstable system. The control of inverted pendulum is to make the cart and swinging rod achieve desired equilibrium position as soon as possible. LQR and PID are the controllers that will be used in order
21 to achieve its target. In the meanwhile it will not have too strong oscillation range, too fast speed and angular velocity. When the inverted pendulum system achieves the desired position, it can overcome a range of disturbance and keep balance.
Arduino Inverted Pendulum
Figure 3.1: The Block Diagram of the system
Based on the above block diagram, it is shown that there are two elements that need to be controlled in using the inverted pendulum. The first one is the position control by the cart or the system meanwhile for the other one is by controlling the angle of the pendulum. The Arduino Mega in order to interface the software to the hardware so that the inverted pendulum can work as desired.
Angle control (Pendulum’s angle)
3.2 Project Implementation (Phase 2)
The project implementation will covers all of the controllers that will be done in this project. The mathematical model for each of the controller is very important in order to design the controller. The controller itself plays a big role in order to stabilize the inverted pendulum in upright position.
3.2.1 Inverted Pendulum
In this section, two control methods are proposed and explained in details which are PID and Linear Quadratic Regulator (LQR) controllers. Furthermore, the following design specifications have been made to evaluate the performance of both control schemes. The parameters that are used in designing the inverted pendulum are as below:
M mass of the cart 0.208 kg
m mass of the pendulum 0.08 kg
b friction of the cart 0.16 N/m/sec l length to pendulum center of mass 0.382 m
I inertia of the pendulum 12.5e-6 kg*m^2 L
F
Length of the rail
force applied to the cart 0.894m x cart position coordinate
23
Figure 3.2: Single inverted pendulum model
The cart with an inverted pendulum, shown in Figure 3.1, is bumped with an impulse force, F. The dynamic equations of motion for the system, and the pendulum's angle, theta = 0 is linearized. In other words, the pendulum are assume does not move more than a few degrees away from the vertical.
3.2.1.1 Equations of Motion
To derive the suitable mathematical model for an Inverted Pendulum system, Figure 3.2 is considered. Below is the mathematical equation for the system.
Adding all the forces on the cart in the horizontal direction,
ẍ + ẋ + = (1)
Adding all the forces on the pendulum in the horizontal direction,
ẍ + Ӫ − à ² sin = N (2)
Substituting equation (2) in equation (1),
( + )ẍ + ẋ + Ӫ − Ӫ = (3)
Adding all the forces along the vertical direction of the pendulum,
+ cos − = Ӫ + ẍ cos (4)
Considering sum of the moments about the center of gravity (COG) of the pendulum,
− − cos = Ӫ (5)
Now, from equation (4) & (5)
The system under consideration is a non-linear system. For ease of modeling and simulation, it has to take a small case approximation such that the system will be a linear one. The linearization point will be θ = Π
= Π +
ϕis the angle between the pendulum and vertical upward direction. If it is chosen that, ϕ≈0,then cos = -1, sin = -ϕ
So, after linearization equation (6) becomes,
( + ) − = ẍ (7)
And equation (3) becomes,
( + )ẍ + ẋ − =
Here, F is the mechanical force to be applied on the moving cart system. But in real time model it needs to input voltage proportional to the force F. If the input voltage is u, then equation (8) becomes,
( + )ẍ + ẋ − = (8)
3.2.1.2 Transfer Function
The transfer function of a linear, time-invariant, differential equation system is defined as the ratio of the Laplace transform of the output (response function) to the Laplace transform of the input (driving function) under the assumption that all initial conditions are zero.
Transfer function = G(s) = [ ]
[ ]
By using the concept of transfer function, it is possible to represent system dynamics by algebraic equation in s. If the highest power of s in the denominator of the transfer function is equal to n, the system is called an nth-order system [11].
Laplace transform of equation (7)
91