Issue 
Int. J. Simul. Multidisci. Des. Optim.
Volume 11, 2020



Article Number  12  
Number of page(s)  8  
DOI  https://doi.org/10.1051/smdo/2020007  
Published online  28 July 2020 
Research Article
System design for inverted pendulum using LQR control via IoT
^{1}
Department of Mechatronics Engineering, Rajamagala University of Technology Thanyaburi, Thailand
^{2}
Department of Mechatronics Engineering, Mechatronics Polytechnic of Sanata Dharma, Yogyakarta, Indonesia
^{*} email: dechrit_m@rmutt.ac.th
Received:
15
October
2019
Accepted:
27
March
2020
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.
Key words: Inverted pendulum / state space control / Simulink / LQR control / IoT
© D. Maneetham and P. Sutyasadi, published by EDP Sciences, 2020
This is an Open Access article distributed under the terms of the Creative Commons Attribution License (https://creativecommons.org/licenses/by/4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
1 Introduction
Rotational and oncart 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, nonlinear 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.
Fig. 1
(a) Rotary inverted pendulum. (b) On cart inverted pendulum. 
2 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(1)
The mathematics model for rod(2) (3) (4)
Substitute equation (2) into equation (1) results in(5)
Substitute equations (2), (3) into equation (4) results in(6)
The velocity and acceleration of the link are defined as θ ≈ 0, and cosθ ≈ 1. The period of the nonlinear model can substitute equations (5) and (6) will be calculated.(7) (8)where J = I + ml ^{2}.
With the use of equation (7) and (8), the equations to be solved are:(9)and the corresponding of the rod angular displacement is:(10)
The state space design will provide the equation as follows:(11) (12) (13)
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:(17) (18)
With corresponding the belt and pulley are(19) (20)
Substitute equations (19) and (20) into equation (18) results in(21)
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 used to obtain(22)
Continuation of the analysis as the equation (10) is integrated to obtain:
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(24)
From equation (22) solution is given by(25)
From equation (23) solution is given by(26)
The state space design will provide the equation as follows:(29) (30) (31)
Fig. 2
Mechanical model of inverted pendulum. 
Parameter of inverted pendulum system.
3 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.
3.1 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.
Constant parameter.
Fig. 3
The Simulink of LQR control block. 
3.2 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 and taking the initial state condition at . 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 and taking the initial state condition at . 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.
Fig. 4
The simulation result of LQR. (a) Pendulum response; (b) cart response. 
Fig. 5
The simulation result of LQR with modified the disturbance. (a) Pendulum response; (b) cart response. 
Fig. 6
The simulation result of LQR with apply the robustness. (a) Pendulum response; (b) cart response. 
Fig. 7
The simulation result of LQR with swinging algorithm. (a) Pendulum response; (b) cart response. 
4 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.
References
 K. Udhayakumar, P. Lakshmi, Design of robust energy control for cart inverted pendulum, Int. J. Eng. Technol. 4, 66–76 (2007) [Google Scholar]
 B. Alan, S. Jindi, Swingup control of inverted pendulum systems, Robotica 14, 397–405 (1996) [CrossRef] [Google Scholar]
 J. Yi, N. Yubazaki, H. Kaoru, A new fuzzy for stabilization of parallel − type double inverted pendulum system, Fuzzy Sets Syst. 126, 105–119 (2002) [CrossRef] [Google Scholar]
 P.C. Yon, L.C. Jeang, R.C. Sheng, PCbased slidingmode control applied to paralleltype double inverted pendulum system, Mechatronics 9, 553–564 (1999) [CrossRef] [Google Scholar]
 L. Zhongjuan, Z. Xinzheng, C. Cuohai, G. Yuguang, The modeling and simulation on sliding mode control applied in the double inverted pendulum system, IEEE World Congr. Intell. Control Autom. 1089–1091 (2012) [Google Scholar]
 Y. Bian, J. Jiang, X. Xu, L. Zhu, Research on inverted pendulum network control technology, IEEE Third Int. Conf. Measur. Technol. Mechatr. Autom. 11–13 (2011) [Google Scholar]
 H.Y. Luo, J. Fang, An inverted pendulum fuzzy controller design and simulation, IEEE Int. Symp. Comput. Consum. Control 557–559 (2017) [Google Scholar]
 Y.L. Yon, L.H. Choon, M.F.W. Yen, Stabilising an inverted pendulum with PID controller, MATEC Web Conf. 152, 1–14 (2018) [Google Scholar]
 X. Yong, X. Jian, X. Bo, X. Hui, The inverted pendulum model with consideration of pendulum resistance and its LQR controller, IEEE Int. Conf. Electr. Mech. Eng. Inf. Technol. 3438–3441 (2011) [Google Scholar]
 B. Ramashis, U. Naiwritadey, Stabilization of double link inverted pendulum using LQR, IEEE Int. Conf. Curr. Trends Toward Conver. Technolog. India 1–6 (2018) [Google Scholar]
Cite this article as: Dechrit Maneetham, Petrus Sutyasadi, System design for inverted pendulum using LQR control via IoT, Int. J. Simul. Multidisci. Des. Optim. 11, 12 (2020)
All Tables
All Figures
Fig. 1
(a) Rotary inverted pendulum. (b) On cart inverted pendulum. 

In the text 
Fig. 2
Mechanical model of inverted pendulum. 

In the text 
Fig. 3
The Simulink of LQR control block. 

In the text 
Fig. 4
The simulation result of LQR. (a) Pendulum response; (b) cart response. 

In the text 
Fig. 5
The simulation result of LQR with modified the disturbance. (a) Pendulum response; (b) cart response. 

In the text 
Fig. 6
The simulation result of LQR with apply the robustness. (a) Pendulum response; (b) cart response. 

In the text 
Fig. 7
The simulation result of LQR with swinging algorithm. (a) Pendulum response; (b) cart response. 

In the text 
Current usage metrics show cumulative count of Article Views (fulltext article views including HTML views, PDF and ePub downloads, according to the available data) and Abstracts Views on Vision4Press platform.
Data correspond to usage on the plateform after 2015. The current usage metrics is available 4896 hours after online publication and is updated daily on week days.
Initial download of the metrics may take a while.