Lontar - Template LONTAR KOMPUTER VOL. 10, NO. 3 DECEMBER 2019 p-ISSN 2088-1541 DOI : 10.24843/LKJITI.2019.v10.i03.p03 e-ISSN 2541-5832 Accredited B by RISTEKDIKTI Decree No. 51/E/KPT/2017 150 Development of Graphical Interface System for Inverted Pendulum Stabilization Erwin Susanto a1 , Bill Josef Stepanus Simanjuntak a2 , Agung Surya Wibowo a3 , Elvandry Ghiffary Rachman a4 , Estananto a5 a School of Electrical Engineering, Telkom University Jl. Telekomunikasi No 1, Terusan Buah Batu Bandung, Indonesia 40257 corresponding author: 1 erwinelektro@telkomuniversity.ac.id Abstract Currently, most of basic control engineering lectures teach both mathematic model and control of an inverted pendulum to explain stability problems in dynamic systems. The inverted pendulum system is a pendulum controlled with a certain force in order to stand in balance around vertical equilibrium line. Hence this system is a highly unstable system and needs stabilization methods using a kind of controller. This paper describes how to design a Proportional Derivative Integral (PID) controller via root locus technique to stabilize it and realization of its interface system for monitoring angle trajectory. This visualization is needed to observe the stability and effectiveness of its mathematic model and control design. Experimental results and analysis show that control design and interface system can be implemented well. Keywords: Graphical Interface, Inverted Pendulum, Stabilization, PID Control, Root Locus 1. Introduction To explain such a problem of stability in dynamic systems, inverted pendulum has become one of the important research topics for control system and engineering. The concept of inverted pendulum control scheme was adopted by many unstable system applications such as a rocket during take-off and robot balancer [1], whereas they can stand upright in their balanced position. In addition, inverted pendulum concept was also applied to aircraft autopilot systems, balancing robot and Segway. Then, the main purpose of inverted pendulum control is to stabilize an unbalanced system [2]. There are two main types of inverted pendulum, wheeled type [3], [4] and a type of inverted pendulum on a cart, for example was used in overhead crane with double pendulum [5]. This research aims to design and implement an inverted pendulum stabilization control and observe the graphic of the inverted pendulum angle by using an interface system. The control scheme used in this research was PID control for balancing inverted pendulum around equilibrium position. There are two variables that must be controlled, cart position moved by dc motor and pendulum angle balanced in erected position. Therefore, two encoder sensors were used to detect those variables. Stability plays crucial point that must be considered in designing inverted pendulum control system. This study also aims to develop an interface system to display dynamic stabilization using Visual Basic. We can input the proportional gain , integral and derivative gain parameters and trajectories of pendulum rod angle can be viewed in real-time. Figure 1 shows the structure of inverted pendulum and forces that were working in the system. In addition, realizing the physical system of an inverted pendulum in our own laboratory-scaled contributes to the future development of control system lectures, because the system has a potential contribution to any control algorithm implementations such as PID control, optimal and robust control and so on. This is done because although there are some inverted pendulums LONTAR KOMPUTER VOL. 10, NO. 3 DECEMBER 2019 p-ISSN 2088-1541 DOI : 10.24843/LKJITI.2019.v10.i03.p03 e-ISSN 2541-5832 Accredited B by RISTEKDIKTI Decree No. 51/E/KPT/2017 151 developed by other reported papers, we built our own inverted pendulum from beginning and it allows for enhancing any other control methods. It also helps in teaching in laboratory to conduct control methods. Figure 1. Structure of the Inverted Pendulum Model Figure 1 shows the structure of an inverted pendulum cart type that was built in our laboratory. The structure is essential to support modeling of physical systems. 2. Research Methods Research methods in this paper consist of design control for inverted pendulum stabilization using PID control technique and graphical interface design to observe the stabilization by figuring trajectory of pendulum angle around equilibrium line. To obtain the mathematic equations that arranging an inverted pendulum structure, possible forces that occurred were mapped as shown in Figure 1. Constants of physical parameters are listed in Table 1. Table 1. System parameters and variables Symbols Variables Constants M Mass of cart 0,51 kg m Mass of pendulum 0,05 kg L Length of pendulum 0,51 m l Length of half pendulum 0,255 m g Gravitational constant 9,8 ms -2 pendulum angle - One can develop a mathematic model of cart type inverted pendulum, in following description [6]. First, coordinates of the center of gravity from the pendulum rod in axes and can be written as follows (1) (2) Expressions of vertical and horizontal forces worked in the cart are (3) LONTAR KOMPUTER VOL. 10, NO. 3 DECEMBER 2019 p-ISSN 2088-1541 DOI : 10.24843/LKJITI.2019.v10.i03.p03 e-ISSN 2541-5832 Accredited B by RISTEKDIKTI Decree No. 51/E/KPT/2017 152 (4) Along axis, the force on cart was balanced: , (5) Against the center of gravity, pendulum rotational force can be expressed in the following equation (6) where inertia According to (1)-(6), the mathematical model of inverted pendulum is obtained as follows: (7) (8) To linearize model mathematically, because pendulum rod swayed in small angle, the following assumption holds, , , . Hence, linearization of (7) and (8) can be shown in the following equations (9) (10) It was obvious that (9-10) yield transfer function of input output relation (11) Before doing control design, the desired specification must be determined. In this paper, desired specifications for controlled systems were maximum overshoot 9.5%, settling time 5 seconds and zero steady-state error. The chosen specifications were taken based on practical aspects. The stabilized inverted pendulum is an underdamped system with damping ratio , and PID controller allows zero steady-state error. 2.1. Control Design By applying parameter constants in Table 1, to the transfer function of inverted pendulum, it was found that overshoot of unity feedback of the system in equation (11) was 100% and damping ratio was zero, see Figure 2(a). It was not possible to reach stable position around equilibrium point for this situation. Then, the problem that must be solved was how to design PID controller so that the system had desired specifications. The following explanation in applied control design via root locus technique was drawn from [7]. It was desired that overshoot less than 9.5 %, that was equivalent to damping ratio , then proportional derivative (PD) controller was designed with . To find , we choose a stable point located at line of , and with rule that all angles of open- loop poles and zeros must form to a chosen point , with . By using this design method, zero of the proportional derivative controller was obtained , see Figure 2(b) for its root locus. The next step was the design of proportional- LONTAR KOMPUTER VOL. 10, NO. 3 DECEMBER 2019 p-ISSN 2088-1541 DOI : 10.24843/LKJITI.2019.v10.i03.p03 e-ISSN 2541-5832 Accredited B by RISTEKDIKTI Decree No. 51/E/KPT/2017 153 integral (PI) controller and it was set to . A combination of these steps yielded system with PID controller and its root locus can be figured in Figure 2(c). Figure 2. Root locus of (a) Uncompensated Inverted Pendulum, (b) Inverted Pendulum with Proportional Derivative (PD) Controller and (c) Inverted Pendulum with Proportional Integral Derivative (PID) Controller The obtained controller gains by root locus technique was a generalized PID [8]: (12) Therefore, one can get PID gains, , , and . The system with PID controler had spesification overshoot 9.5% (damping ratio ζ = 0:6), time settling seconds. To find the steady-state error for unit step input, velocity gain was found in this equation (13) and the steady state error 2.2. Design of Inverted Pendulum System It was popular that control of inverted pendulum is one of the difficult nonlinear control realization [9]. The general concept of inverted pendulum system is to apply self-balancing control and stabilization around its equilibrium. Assume for the initial condition, pendulum rod direct to counter-clockwise direction, then DC motor responded its rotation to counter-clockwise such that the cart will move quickly to the left direction. The force applied on cart caused the pendulum to rotate in a clockwise direction. LONTAR KOMPUTER VOL. 10, NO. 3 DECEMBER 2019 p-ISSN 2088-1541 DOI : 10.24843/LKJITI.2019.v10.i03.p03 e-ISSN 2541-5832 Accredited B by RISTEKDIKTI Decree No. 51/E/KPT/2017 154 The direction of incremental encoder motion is the same as DC motor. The incremental encoder will detect the position of the cart and maintained always to be in the middle of the track. This mechanism also applied in the opposite direction of the pendulum rod movement. The inverted pendulum was driven by a DC motor and mounted on a cart. Absolute and incremental encoders detected actual measurements of angle and cart position to be fed into Arduino Mega microcontroller module. The microcontroller compared the actual measurements with setpoints and processed them to make a decision command signal to motor driver. Figure 3. Control of Inverted Pendulum Stabilization Figure 4. Screenshot of Stabilized Inverted Pendulum around Vertical Equilibrium 2.3. Interface Design Developing Graphical User Interface (GUI) with Visual Basic is an important need to view the system characteristics for any useful purposes. Some graphical interface examples for real systems can be found in data acquisition for microcontroller PIC16F877A [10], energy-saving purpose [11] and monitoring system for forest situation in Malaysia [12]. Today, the digital era has even facilitated the development of controllers using microcontrollers or microcomputers. In addition, the use of microcontrollers is very important in the advance of education and teaching, including for teaching control systems, electrical and electronics engineering lectures [13]. A microcontroller that was widely used to control the real system is Arduino equipped with an LONTAR KOMPUTER VOL. 10, NO. 3 DECEMBER 2019 p-ISSN 2088-1541 DOI : 10.24843/LKJITI.2019.v10.i03.p03 e-ISSN 2541-5832 Accredited B by RISTEKDIKTI Decree No. 51/E/KPT/2017 155 Integrated Development Environment (IDE) editor. Hence, to design an interface system, two software was used in this paper as follows: a. Arduino IDE that was used in the microcontroller to process and send data to the interface application and real implementation on hardware. b. Microsoft Visual Studio was used to design an interface application system. The application displayed the values and graphs of the reading of the angle and position of the encoder sensors. Figure 5. A swinging Inverted Pendulum and its Interface System displayed at Laptop Computer The actual value of the angle obtained from the absolute encoder, when the pendulum was at stabilization condition was compared with initial value by microcontroller Arduino Mega 2560. After that, data was fed to the microcomputer (laptop) installed with Visual Basic based Graphical User Interface. Figure 6. An Interface System displayed at Laptop Computer The displayed graphics consisted of a swing-up process, stabilization, and cart position. Trajectories of pendulum angle and cart position were displayed according to the sensor measurement results since the system was real-time. 3. Results and Discussion To find out whether the designed system was feasible or not, then testing of the complete system has been done. The testings included: 1. Interface application to view the graphics of achieved angle (swing-up and stabilization) from absolute and incremental rotary encoders. The system was designed to receive, process and display data through serial communication of Arduino Mega 2560 microcontroller, see Figure 5 and Figure 7 to view a swinging inverted pendulum with displayed angle pendulum and cart position. Figure 6 showed a graphical user interface for the inverted pendulum, consisted of swing angle, stabilization angle, and cart position. LONTAR KOMPUTER VOL. 10, NO. 3 DECEMBER 2019 p-ISSN 2088-1541 DOI : 10.24843/LKJITI.2019.v10.i03.p03 e-ISSN 2541-5832 Accredited B by RISTEKDIKTI Decree No. 51/E/KPT/2017 156 2. Designed control algorithm. From Figure 7, it can be seen that stable upright position was achieved less than 9 minutes 51 seconds with pendulum angle -2.46 0 and cart position at 10.35 cm from a center point of horizontal axis. Applying a PID controller for stabilization of inverted pendulum, enabled pendulum rod at stable upright position around the equilibrium line, see Figure 4. At pendulum angle was -2.46 0 < < 2.46 0 then this inverted pendulum was kept in desired specification, with overshoot 9.5% and zero steady-state error. It was shown that the interface application successfully recorded and displayed graphics of encoder measurements. At the stabilized pendulum rod angle, trajectories of set point and angle response tend to sway to a smaller angle than previous angle 2.46 0 (presented in larger picture). The development of the graphical interface for real systems using Visual Basic was presented in [11], [12]. However, these real systems are not faster than inverted pendulum stabilization in data acquisition responses. The fast dynamics real system data acquisition usually used applicable software, Lab View for example. Therefore, this application needs bigger storage in computer hard disk or memory. Figure 7. An Interface System displayed at Laptop Computer that showed Trajectories of Rod Angle and Cart Position insert is rod pendulum angle trajectory 4. Conclusion Trajectories of pendulum angle and cart position via a graphical interface system monitored in a laptop display were presented. The purpose of viewing these graphics is to study a control LONTAR KOMPUTER VOL. 10, NO. 3 DECEMBER 2019 p-ISSN 2088-1541 DOI : 10.24843/LKJITI.2019.v10.i03.p03 e-ISSN 2541-5832 Accredited B by RISTEKDIKTI Decree No. 51/E/KPT/2017 157 system design with real inverted pendulum. In this paper, root locus technique to design PID controller of inverted pendulum was described and the trajectory of angle stabilization was shown by graphical interface system. We build the mechanics, electronics, control modules by our own design. It has potential enhancement for any other control method applications. Hence, to the future works, the graphical interface system has an advantage for observing any control methods such as adaptive control, robust control and so on. Acknowledgment Funding grant of this research was supported by the Research Agreement Task, Ministry of Research Technology-Higher Education, Number 059/PNLT/PPM/2019. The authors also would thank Directorate of Research and Community Service, Telkom University for technical support. The research was also cooperated with assistant’s Control Laboratory to conduct the experimental measurements. References [1] G. Singh and A. Singla, “Modeling, analysis, and control of a single stage linear inverted pendulum,” in 2017 IEEE International Conference on Power, Control, Signals and Instrumentation Engineering (ICPCSI), pp. 2728–2733, Sep. 2017. [2] M. Antonio-Cruz, V. M. Hernández-Guzmán, and R. Silva-Ortigoza, “Limit cycle elimination in inverted pendulums: Furuta pendulum and pendubot,” IEEE Access, vol. 6, pp. 30317– 30332, 2018. [3] S. Kim and S. Kwon, “Nonlinear optimal control design for underactuated two-wheeled inverted pendulum mobile platform,” IEEE/ASME Transactions on Mechatronics, vol. 22, pp. 2803–2808, Dec 2017. [4] H. Fukushima, K. Muro, and F. Matsuno, “Sliding-mode control for transformation to an inverted pendulum mode of a mobile robot with wheel-arms,” IEEE Transactions on Industrial Electronics, vol. 62, pp. 4257–4266, July 2015. [5] H. Ouyang, J. Wang, G. Zhang, L. Mei, and X. Deng, “Novel adaptive hierarchical sliding mode control for trajectory tracking and load sway rejection in double-pendulum overhead cranes,” IEEE Access, vol. 7, pp. 10353–10361, 2019. [6] Shiuh-Jer Huang and Chien-Lo Huang, “Control of an inverted pendulum using grey prediction model,” IEEE Transactions on Industry Applications, vol. 36, pp. 452–458, March 2000. [7] N. N. Nise, Control System Engineering. John Wiley & Sons, Inc, 2011. [8] A. S. Wibowo and E. Susanto, “Performance improvement of water temperature control using anti-windup proportional integral derivative,” Lontar Komputer Jurnal Ilmiah Teknologi Informasi, pp. 81–94, 2018. [9] “[25 years ago],” IEEE Control Systems Magazine, vol. 38, pp. 10–11, Oct 2018. [10] M. Ghosh, S. Ghosh, P. Saha, and G. Panda, “Design and implementation of pic16f877a microcontroller-based data acquisition system with visual basic based GUI,” in 2016 7th International Conference on Intelligent Systems, Modelling and Simulation (ISMS), pp. 419– 423, Jan. 2016. [11] M. David and N. Y. Dahlan, “Development of visual basic based GUI for option an energy savings of ipmvp,” in 2014 IEEE 4th International Conference on System Engineering and Technology (ICSET), vol. 4, pp. 1–6, Nov 2014. [12] K. A. Othman, M. A. H. M. Isa, M. A. Baharuddin, M. A. Ghazali, Z. I. Khan, and N. A. Zakaria, “Forest monitoring system implementation using visual basic and android application,” in 2018 18th International Symposium on Communications and Information Technologies (ISCIT), pp. 447–451, Sep. 2018. [13] J. C. Martínez-Santos, O. Acevedo-Patino, and S. H. Contreras-Ortiz, “Influence of arduino on the development of advanced microcontrollers courses,” IEEE Revista Iberoamericana deTecnologias del Aprendizaje, vol. 12, pp. 208–217, Nov 2017.