Position Control of a Ball & Beam Experimental Setup Based on Sliding Mode Controller

Abstract: In this paper, a sliding mode control (SMC) method is introduced to design a control methodology for the ball and beam experimental setup (BBS) that consists of a servo motor, beam and ball. The proposed control method is realized in two cascaded control structures such that primary and secondary, respectively. In the primary part, called outer loop, the position of the ball is controlled by changing the angle of the beam. In the secondary part, called inner loop, the needed voltage is generated to determine appropriate position angle of the servo motor to adjust the position of the beam. Furthermore, a well-tuned conventional PI controller is also applied to the system to indicate the priority and effectiveness of the SMC. The results obtained in real-time show that the SMC is better than the PI controller in the aspect of reference tracking, fast response to the changes and accuracy as well.


Introduction
In recent years, the balance control of the systems has become very interesting and important topic for nonlinear control theory. Thus, some prototypes have been developed to understand and observe such systems whose dynamics will be balanced. As an example, the ball and beam laboratory setup (BBS) has been designed and widely used for control applications in undergraduate and graduate levels or academic researches to realize linear control practises. In literature, some control studies on balance controlling of the BBS are investigated and published by the researches who are interested in control theories. Maalini et. al., have used PI, PD and PID controllers to control ball position by means of a servo motor that adjusts the needed angle of the beam [1]. The controllers have been tuned in open loop and closed loop systems, respectively. Then, they have compared the controllers according to their control performances. Ramirez-Neira et. al., have tackled with the position control problem of the BBS using a robust Generalized Proportional Integral (GPI) controller [2]. First of all, they have linearized the nonlinear system dynamics depending on the tangent linearized system model around the equilibrium point. Then, they have designed the proposed controller to realize trajectory tracking control of the system with disturbance rejection. The experimental results show the successes of the proposed controller with satisfactory position error level. Yuanyuan and Yongxin, have designed a Fuzzy-PID controller to control the BBS [3]. The simulation results show that the Fuzzy-PID controller better than the conventional PID controller in the aspect of balancing and error elimination. Oh et. al., have introduced a study based on the Fuzzy cascade controller with optimization using hierarchical fair competition-based genetic algorithm (HFCGA) [4]. The aim of the proposed method is to realize the position control of a BBS in both simulation and experimentally, respectively. The parameters of the fuzzy cascade controller are optimized through HFCGA. Also, the proposed method is compared with a PD cascade controller. The simulation and experimental results show that the proposed method is better than the PD controller in terms of delay time, rise time, settling time and good at tracking reference as well. Jain et. al., have modelled and applied a Model Reference Adaptive Controller using MIT gradient rule to control the BBS [5]. They have used the gradient theory to design MIT rule for adjusting the parameters of the controller so that the system can adapt itself to the changes occurs in the system to track the ideal reference model. The simulation and experimental results indicate that the system shows satisfactory performance and able to adapt itself to the changes properly. Chang et. al., have proposed a pair of decoupled fuzzy-sliding mode controllers (DFSMCs) for a BBS [6]. To balance a ball on a beam, they've used both fuzzy controller; in which the system dynamics are ill-defined or to reduce the design complexity, and sliding mode controller that is robust to system uncertainties and a well-known nonlinear controller as well. Also, they've proposed an improved ant colony optimization (ACO) to optimize the controller's parameters. The simulation and experimental results show that the proposed DFSMCs with improved ACO show better performance for position control and balancing the ball when compared with traditional ACO algorithms.
In this paper, a sliding mode controller is designed and applied to the BBS to realize position control in real time. The SMC is a kind of nonlinear controller that is robust to parameter uncertainties, gives fast response to changes and can be easily apply to a system whether system has more complex structure or not. Moreover, a conventional PI controller is also applied to the system to compare the proposed controller. The experimental results indicate that the SMC is superior to the PI controller according to error elimination, reference tracking, rise time, settling time and overshoot percentages.

Mathematical Model of the Ball & Beam System
The nonlinear dynamic equations of the system can be derived depending on the Newton's second law of motion. The main purpose in the system is that adjusting the servo motor's angle with proper input voltage, the ball can be kept in desired position by means of proper beam angle adjusted by reference motor angle. Before deriving the system mathematically, some information have to be given about the BBS. The theta angle  is produced by servo motor and operated between .
where  and r are the beam angle and the ball position, respectively. Also, arm r is the distance between screw and motor gear, g is the acceleration of gravity, and R is the radius of the ball. Moreover,  represents the time-constant of the system, 1 K represents the steady-state gain, b J represents the moment inertia of the ball and m V is the input of the BBS [7]. Besides, the schematic diagram of the BBS is given below in Fig. 1.
transformation can be done. After this transformation, the state-space equations obtained can be written as in Eq. 3.
Considering the Eq. 3, the control input m V can be written as in Eq. 4 [7].  Here, some constant values of the BBS are given in Tab. 1 with their real values and some parts of the system are also described in Tab. 2 [8]. Furthermore, the experimental setup is also given in Fig. 2.

Sliding Mode Controller Design
Before designing the control algorithm, the error must be defined as given below [9].
Afterwards, a sliding surface can be described in Eq. (6).
A SMC can be designed in a regular form as follows for a system [10]; In this state space description, which is positive definite and its derivative is, the solution 0 ) , (  t x  will be stable if time derivative of the Lyapunov function cab be expressed as [11] where P is a positive definite matrix. Thus, the derivative of the Lyapunov function will be negative and this will ensure the stability. Eqs. (11) and (12) Second, using Eq. (15) the control input to the system can be found by the following equation: and the result of the short algebra can be written as Third, from time derivative of the sliding function, Multiplying both sides with and using Eq. (21), Finally, when this equation is substituted in Eq. (22) the control signal is written as given below.
B is multiplier coefficient of the control signals of the system. Furthermore, since the system has a cascaded structure, the needed angle that is generated by servo motor also as an slave reference control signal angle and can be achieved by applying the same processes done for inner loop control. Then, the outer loop control signal can be written as given below.
where , 3 B multiplier coefficient of the control signal.

Experimental Results
In this section, the experimental results are presented to show the validity of the SMC method comparing with the classical PI controller. In Fig. 4, the SMC results are presented for step + square reference signal. For step part of the reference input signal, the proposed controller has nearly same overshoot magnitude and rise time when compared with the PI controller as seen in Fig. 5. However, the SMC has lower settling time and also tracks the step reference signal with less error whereas the PI controller has steady state error. For time varying part of the  reference signal, the square wave is applied to show both controllers' performance when sudden changes occur. In Fig. 5, the PI controller has overshoot/undershoot and is not able to give fast response to track the square reference signal in a desired level. On the other hand, the SMC shows better performance and gives fast response to track the square reference signal when compared with the PI controller. Although the SMC produced the  angle at higher magnitude level than the PI controller to adjust beam's angle, the proposed controller produced the control signal at lower magnitude level.  In Fig. 6 and Fig. 7, the experimental results are presented for step + sinusoidal reference input signal for SMC and PI controllers, respectively. In Fig. 6, the SMC has lower rise time and settling time as well as having less tracking error when compared with the PI controller. Also, the proposed controller tracks the time-varying sinusoidal reference signal with lower delay time whereas the PI controller fails to track positive part of the time-varying reference signal. To adjust the position of the beam, the PI controller produced the needed angle  at lower magnitude level while the SMC produced higher magnitude level. On the other hand, the proposed controller has lower magnitude level control signal that is better for the system in terms of energy saving and extending components' life when compared with the PI controller.

Conclusion
In this paper, the SMC technique is used to control the BBS for different step + time-varying reference input signals and compared with a well-tuned classical PI controller. From the experimental results, the SMC shows better performance in terms of overcoming parameter variations, error elimination and reference tracking compared with the PI controller. Also, the proposed controller has given fast response to deal with nonlinearities that the system has, under time-varying part of the reference signals. Moreover, the SMC has less overshoot/undershoot, rise time, settling time, delay time and also, has lower control signal magnitudes. To conclude, the SMC method demonstrates better steady state performance and is prior to the PI controller with respect to error elimination capability, good reference tracking, coping with parameter variations and gives fast response to the changes in the reference signals as well.