Development of Graphical Interface System for Inverted Pendulum Stabilization

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.


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  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.

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.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 Against the center of gravity, pendulum rotational force can be expressed in the following equation where inertia According to ( 1)-( 6), the mathematical model of inverted pendulum is obtained as follows: 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 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.

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 openloop 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 .A combination of these steps yielded system with PID controller and its root locus can be figured in Figure 2(c).
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

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.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.

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   Trajectories of pendulum angle and cart position were displayed according to the sensor measurement results since the system was real-time.

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.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.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.
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 .
Figure 1.Structure of the Inverted Pendulum Model

3 )
of vertical and horizontal forces worked in the cart are (axis, the force on cart was balanced: , (b) for its root locus.The next step was the design of proportional-p-ISSN 2088-1541 DOI : 10.24843/LKJITI.2019.v10.i03.p03e-ISSN 2541-5832 Accredited B by RISTEKDIKTI Decree No. 51/E/KPT/2017 153 integral (PI) controller and it was set to

Figure 2 .
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

Figure 3 .
Figure 3.Control of Inverted Pendulum Stabilization

Figure 4 .
Figure 4. Screenshot of Stabilized Inverted Pendulum around Vertical Equilibrium (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 .
Figure 5.A swinging Inverted Pendulum and its Interface System displayed at Laptop Computer

Figure 6 .
Figure 6.An Interface System displayed at Laptop ComputerThe 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.
Figure 6  showed a graphical user interface for the inverted pendulum, consisted of swing angle, stabilization angle, and cart position.

Figure 7 .
Figure 7.An Interface System displayed at Laptop Computer that showed Trajectories of Rod Angle and Cart Position insert is rod pendulum angle trajectory4.ConclusionTrajectories 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