System design for inverted pendulum using LQR control via IoT

. This research proposes control method to balance and stabilize an inverted pendulum. A robust control was analyzed and adjusted to the model output with real time feedback. The feedback was obtained using state space equation of the feedback controller. A linear quadratic regulator (LQR) model tuning and control was applied to the inverted pendulum using internet of things (IoT). The system ’ s conditions and performance could be monitored and controlled via personal computer (PC) and mobile phone. Finally, the inverted pendulum was able to be controlled using the LQR controller and the IoT communication developed will monitor to check the all conditions and performance results as well as help the inverted pendulum improved various operations of IoT control is discussed.


Introduction
Rotational and on-cart inverted pendulum are good example of non linear, unstable and high order systems that need to be stabilized. This balancing system is applied on high precision control such as on Segway, humanoid or some legged robots and so forth [1]. There are many kinds of theoretical control that can be applied to the inverted pendulum such as root locus, PID, Fuzzy logic, sliding mode or such new algorithms to balance and stabilize the inverted pendulum [2]. During balancing, the inertia forces from the mechanisms results a very large shaking force [3]. Dynamic balance can be achieved by adding mass to the system so that the inertia forces resulting from the added mass will be equal and opposite to those causing the shaking moment. Single inverted pendulum is an interesting nonlinear system to investigate [4]. Inverted pendulum is one of the most important plants in the science and industrial technologies [5] and ideal experiment device to test new control algorithm [6]. It because this system is poorly stable and has such as large of overshoot problem [7] and has a unique trait such as unpredictable, non-linear and consists of multiple variables [8]. Used in many studies The Linear Quadratic Regulator was applied to the inverted pendulum system that analyze performance of two different outputs between control cart position and pendulum angle [9,10]. Results of the experiment and simulation show that the LQR controller was able to compensate disturbances in the system and balance the inverted pendulum following the reference angle and cart position. Figure 1 shows the model of two type of inverted pendulum.

Research method
An inverted pendulum can be balanced either statically or dynamically. Static balance is accomplished by adding or removing weights until the component will remain stable. Dynamic balance is done by dynamically control the force to balance the system. Figure 2 shows the drawing and sum of forces applied on the system. All parameters involved are shown in Table 1.
Considering the inverted pendulum link in Figure 2, if the direction of the acceleration change then the direction of the associated inertia force is also constantly changing. It would be most convenient if the mass of the connecting rod could be replaced by one or more masses located where the direction of acceleration is more easily determined.
The mathematics model for cart The mathematics model for rod Substitute equation (2) into equation (1) results in Substitute equations (2), (3) into equation (4) results in The velocity and acceleration of the link are defined as u ≈ 0, _ u 2 u ≈ 0 and cosu ≈ 1. The period of the nonlinear model can substitute equations (5) and (6) will be calculated.
where J = I + ml 2 .   With the use of equation (7) and (8), the equations to be solved are: and the corresponding of the rod angular displacement is: The state space design will provide the equation as follows: See equation (14) below With some simplifying assumptions may take the field an electrical part. Based on the indicated direction of power which generated by the motor and transmitted through belt and pulley, the resultant of an electrical part is also given by The motor equation is: With corresponding the belt and pulley are Substitute equations (19) and (20) into equation (18) results in From equation (9) is the governing equation for the displacement of the cart. It is common to write these equations in the standard electrical from thus be Continuation of the analysis as the equation (10) is integrated to obtain:

See this equation below
The active of rod angular displacement is finally given by With total inductance value L is very lower than resistance R value (L < < R). The governing equation for L as a function can be neglected then the externally applied the equation for R thus is From equation (22) solution is given by From equation (23) solution is given by More commonly, with The state space design will provide the equation as follows: See equation (32) where

Results and analysis
In this research the balancing platform was balanced and controller dynamically. Balancing is accomplished either by reducing the mass or acceleration of link or by introducing forces opposite in direction of the inertia forces. Since it is often very difficult to reduce mass or acceleration of the link, the addition of forces to counteract the inertia forces is the most attractive method for reducing shaking forces.

Data analysis and Simulink
LQR control also is highly nonlinear behavior of the inverted pendulum that can design closed loop poles. It is mostly DC motor, encoder, cart, rod and electric devices or their combinations. The parameters are constant value as shown in Table 2.
The toolbox from MATLAB software can be applied in order to take the advantage of using the mathematical model of the state space control system. The Simulink model of the LQR control system can be shown in Figure 3.

LQR and results
Consider the mathematics model in equation (32) and the linear quadratic function is substitute the parameters in matrix Q and matrix R then given by The weight matrix has provided the complex poles at À13.93 ± 12.57i, À0.52 ± 0.47i and the optimal feedback gain matrix by pole placement method at K ¼ À4:0000 À11:3660 À98:6862 À9:5607 ½ and taking the initial state condition at x 0 ¼ 0 0 10 0 0 Â Ã T . The cart and pendulum response are using of optimal feedback matrix shown in Figures 4 and 5, respectively.
The pendulum oscillated in a small range angle around −0.15 rad to 0.15 rad. However, the system has some spikes at the maximum angle around À0.07 rad to 0.05 rad. In response to balance the system, the cart moves back and forth at the range around À0.38 m to 0.58 m.
When the disturbance was altered, the system still able to balance itself. The range of angle oscillation happened from −0.125 rad to 0.125 rad. The cart travelled in the range of −0.68 m to 0.65 m. The additional disturbance caused the range of the oscillation angle increased two times larger. The cart travel distance also increased almost twice further.
The matrix can modified by using the robustness and applied the parameters in matrix Q and matrix R then given by   The weight matrix has provided the complex poles at À12.28 ± 10.73i, À1.04 ± 0.93i and the optimal feedback gain matrix at K ¼ À12:0000 À16:8085 À89:3326 À10:9879 ½ and taking the initial state condition at x 0 ¼ 0 0 10 0 0 Â Ã T . The cart and pendulum response are using of robustness control matrix shown in Figure. 6. Additional sliding mode robust control to the LQR control improved the balancing performance of the system. The robustness of the system reduced the range of pendulum oscillation. The range of the oscillation is from −0.1 rad to 0.6 rad. Even though the cart traveled a bit farther than the first experiment, but still less than the second experiment result.
The three experiments above was conducted from upright position. Figure 7 shows the result of experiment using swinging algorithm. The pendulum starts from downward position, and then oscillate itself to reach upright position.
The system needs 9 seconds to go to upright position until stable. In order to reach the stable position, the cart traveled back and forth in the range from −0.5 m to 0.32 m.

Conclusion
The inverted pendulum is successfully made. The controller is using LQR. The optimal gain for the LQR to balance the inverted pendulum was found. Applying the optimal gain gives good stability. The LQR method is also used to control the cart position and the pendulum angle. The range of the pendulum oscillation without disturbance was 0.12 rad with distance range of the cart 0.96 m. When the disturbance was applied, the range of the oscillation increased to 0.25 rad and the cart distance was 1.33 m. LQR with robust algorithm has less range of oscillation, which was only 0.7 rad. However, the distance traveled by the cart  while oscillated was 1.2 m. The swinging algorithm also successfully balance the system. It took 9 second for the system to bring the pendulum to the upright position and stable. The cart oscillation range was 0.82 m.