INTRODUCTION

The Ball-and-Plate (BaP) system, like the Ball-and-Beam and the magnetic levitator systems, have arisen a special interest in teaching engineering and research due to its complex dynamics based on an inherent instability and nonlinearity. The main advantages of this type of systems are its low cost, easy implementation and the opportunity that it offers to make experimental validation of theoretical knowledge in modeling, controling and other disciplines of engineering like the computer vision and robotics.

Several works are reported by specialized literature. In ^{1} a BaP system is constructed with two magnetic suspension actuators for two degrees of freedom. For this system, a ball position controller using the Liapunov function was designed. A visual servo control for a BaP system using a LQR control approach is presented by Cheng et al. in ^{2}. The control of a BaP system using a friction compensation scheme, PD position controller and PD angular controller is discussed in ^{(}^{3}. In ^{4}, a basketball robot project in which six degrees of freedom manipulator makes a balancing control of a ball on a plate based only on haptic information is presented. In ^{5} balancing a ball on a plate is achieved using low cost phototransistor sensors. Two independent PID control algorithm, one for each motor, are programmed in an AVR ATMega16 microcontroller. In ^{6}, a normal proportional derivative (PD) control is modified to a new dual form for controlling a BaP system. This variant corresponds to an asymptotic stable dual PD control with a nonlinear compensation. A novel mechatronic design of a BaP system is presented in ^{7}, and two control strategies for ball position are discussed: 1) a PID controller with supervisory fuzzy control and 2) a sliding control. Finally, in ^{8}^{,}^{9}^{,}^{10}^{,}^{11}^{,}^{12} the modeling, construction and control of Ball-and-Beam systems, the one-dimensional version of BaP systems, are discussed.

In ^{13}^{)} four control methods are compared: PID controller, sliding mode controller, fuzzy controller and LQR controller; all applied to a ball and plate system. The results of this work relate the responses of the four controllers graphically and with values associated with establishment time, over-impulse and steady-state error. The author concludes -based on his graphical and numerical answers- that the controller with the best performance is the Sliding Mode control to solve the problem of static and dynamic tracking for nonlinear systems with high complexity as it overcomes modeling imprecisions and parameter variations.

In this paper, four stages of engineering analysis and design are addressed. The first stage corresponds to the phenomenological analysis of the movement of ball on plate, from which its representation in space state is obtained. In a second stage, with the previous results, a state feedback controller using the pole assignment method is developed and the establishment time and percentage overshoot as the main design parameters are considered. In third stage, simulations are performed in Simulink® in order to verify the fulfillment of the desired parameters. Finally, our BaP-controller system implementation is experimentally validated.

THEORETICAL ANALYSIS

Modeling

From the phenomenological analysis, it is possible to observe the forces acting in the BaP system. It should be mentioned that in the modeling of the system, only the dynamic of the Ball-on-the Plate is taken into account. The forces acting on the system with an angle p of one of its axes are defined in the free-body diagram shown in Figure 1.

According with the free-body diagram and applying the second Newton's law, we have:

In the equation (1), the first term defines the force component as a function of the inclination angle p, and the second term corresponds to the frictional force between the plate and the contact point of the ball. Given the dynamic of the BaP system, two movements are identified: translation and rotation. The latter is produced by the torque due to the contact point of the ball with the plate and its distance to mass center. It is described by:

In equation (2), t is the torque, *f* _{ s } is the frictional force and *R* is the ball ratio. Applying Newton's second law for rotational movement, caused by the torque, we have:

Where in equation (3) a are the angular acceleration and the *I* _{ cm } is the inertial of mass center, given by the expression of equation (4).

From equations (1) and (4) the following differential equation is obtained:

Now, (5) it is a nonlinear differential equation because it has a sinusoidal component. The development of a controller for this system is highly complex due to the nonlinear quantity. Nevertheless, this task becomes simpler if the nonlinear equation is converted into a linear equation. As shown in Figure 2, the sine function could be considered linear around its zero crossing. This could be used for the equation linearization but incorporates an operational restriction of the plate inclination in the range *[-n/6, n/6].* Considering the above, we obtain the linear equation given in (6).

Since for this system a state feedback controller will be designed, it is necessary to go from the differential equation to a state space representation, and make the following substitutions:

We can obtain the lineal model described by equations (7) and (8).

The matrix form of equations (7) and (8) are given in equations (9) and (10) respectively.

And

This representation is valid for both, x and y axes.

Controller Design

Before starting to design the state feedback controller, it is necessary to demonstrate that the system is both, observable and controllable ^{14}. To do so, we must prove that:

Where **A, B** and **C,** are the matrices included in equations (9) and (10). When equations (11) and (12) are evaluated according to the values of **A, B** and **C** matrices, we can obtain the following two results:

This proves that the system studied is controllable and observable. When designing the space state controller, the pole assignment method was used. In this method the closed loop system poles are placed on the complex plane S, to obtain the desired dynamic behavior, as shown in Figure 3.

The characteristic equation of the system is changed into a desired characteristic equation by considering the next two design parameters:

Where *t* _{ sd } is the establishment time and *M* _{ pd } is the percentage of over-impulse. From this, the damping coefficient ξ and the natural frequency ϖ_{n} are calculated using the expressions (13) and (14).

These values are put into a second-order characteristic equation of the form:

To obtain:

To determine the feedback gains we can use Ackermann's formula, which is given by:

Where *K* is the gain vector and Φ(A) can be calculated by using the expression:

α_{1} and α_{2} values are taken from (16). After solving and simplifying we obtain:

Where K is the feedback gain vector. The response of this controller retains a steady-state error, but the BaP system has an integrator in its dynamics, therefore it is recommended to use servo system type 1 ^{14}, like the one shown in Figure 4.

For equation (17), *K1* corresponds to the first element of *K* and *Km* is a modified version of *K,* where the first element is replaced by zero. This can be observed in equations (18) and (19).

This controller is applied for positioning on both axes, *x* and y.

SIMULATION

At this point, with a dynamic system model and a state feedback controller design, it is necessary to observe the stability and dynamic behavior of the plant-controller system. For doing so, the program Simulink® of Matlab® will be used.

In Figure 5 it should be noted that the position of the ball in the *x* and *y* axes corresponds to the outputs of the BaP system, while the step signals correspond to the inputs. The obtained response is shown in Figure 6, the straight lines correspond to the speed of the ball, and the curve lines are the *x-y* ball position.

According to Figure 4 and equations (18) and (19), the simulation diagram of Figure 7 allowed us to obtain the BaP-controller system response shown in Figure 8. Note that each coordinate position has a different set-point, *x =* 0.5 and *y =* 0.75.

At this point, we can see that the controller forces the system to accomplish the design requirements of *t* _{ sd } *=1s* and *M* _{ pd } *= 2%* for both, *x* and *y* position.

SYSTEM IMPLEMENTATION

The Ball-and-Plate system was built with two acrylic pieces of *0.35 m* ^{ 2 } each one. The first one corresponds to the *10 mm* width base, and the second, to the *3mm* width plate. Between them, the following pieces were placed:

Central Piece

allows the two degrees of freedom of the BaP system, the plate rests over it, which is made of polytetrafluoroethylene. Its operating range is [-15°, 15°] as it is shown in Figure 9.

Axes

were made of stainless steel. At one of its ends there is a small piece that allows the plate to be tilted. Axes are properly threaded to provide the possibility of adjustment of the platform with respect to the servomotors, as shown in Figure 10. Axes are responsible for converting the rotation movement of the servo motors into the linear motion required to incline the plate.

EXPERIMENTAL VALIDATION

For the BaP system under consideration we have an input and an output per axis. Therefore, it is necessary to incorporate a state observer to estimate the internal states of the real system, required to produce the control law. Figure 14 shows the system configuration after incorporating the state observer.

It should be noted that the observer only needs the input and output for each coordinate *(x,* y). The **A, B** and **C** matrices are known (see equations (9) and (10)) but the L matrix needs to be calculated.

The observer response must be faster than the control response ^{14}, therefore the establishment time for the observer (t_{so}) must be less than the establishment time for the controller *(t* _{ sd } *).*

The observer's characteristic equation is defined the same way that in (16), and making the proper operations we obtain the following:

To calculate the L matrix we can use Ackermann's formula

Where

And

Replacing and solving the matrix that makes the observer response faster than the controller's, we obtain:

It should be mentioned that the configuration shown in Figure 14 will be applied to two servomotors, one for each *x* and *y* position of the ball on plate. As shown in Figure 15, there are two input references to the controller *s.p* _{ x } and *s.p* _{ y } *,* and two control actions *U* _{ x } *(t)* and *U* _{ y } *(t)* are generated, one for each servo motor.

The interface between the BaP system and a PC is implemented through an Arduino UNO and a webcam. The microcontroller module receives the control signals generated by the control algorithm that runs on the PC and generates PWM signals to drive the servo motors. This causes the plate tilt to maintain the *x-y* reference position of the ball. Figure 16 shows the complete experimental setup.

A webcam is used as the position sensor of the ball on the 2D plate. Both, the video processing algorithm to determine the position of the ball and the control algorithm were implemented with Labview.

Video processing algorithm consists of the following stages: 1) Image Mask, for dimension reduction, 2) Measure, for corner detection, 3) Color Threshold to take into account only orange (ball) and black (platform), 4) Binary Image Inversion, to take into account the dynamics of the ball, not the platform, 5) Advance Morphology, to remove sections of the image that could be mistaken for the sphere and 6) Particle Analysis where the ball center coordinates are taken.

In Figure 17, the control algorithm in Labview can be seen. The configuration shown in Figure 14 is used to control each servo motor. Here we can see a SubVI corresponding to the observer; this algorithm is shown in Figure 18.

The parameters of the controller and the observer, used in the experimental validation phase, can be seen in Tables 1 and 2.

Figures 19 and 20 show the BaP system responses. These figures show the response of the BaP system (blue line) to different changes in the reference x-y position (red line). The green line corresponds to the control action generated to move the servo motors.

According to the results obtained from the experiment, Table 3 lists the values corresponding to the desired response parameters and steady-state error (Ess).

Compared to ^{14}, the controller used in this work outperforms the PID controller, the fuzzy controller and the LQR controller as well, but it is not better than the sliding mode controller.

This work stands out for the simplicity of the modeling taking into account only the dynamics of the ball on the plate, unlike the works mentioned here, where the servomotors and the sensor element are also included, which makes the mathematical treatment difficult.

The implementation of the system is robust enough to be used as a laboratory experiment to advance experimental validations with different control alternatives, thus achieving a contribution to the training of professionals in this area of engineering, due to the fact that it is a complex system presenting a high degree of alignment and instability.

CONCLUSIONS

By linearizing the system, the operating range of the platform is restricted, a situation that is convenient

because the mechanical constraints with which the central ball joint (central piece) was designed only allows inclinations of ± 15° in the *x-y* plane. This results in the convenient operation of the BaP system in the linear zone.

Since no sensors are available to detect BaP system states, it was necessary to include a full-order observer with establishment time twice as fast as the controller. In this way it was possible for the observer to estimate the states of the system before the controller stabilizes them.

The fact of taking into account the states of the system -in this case the position and speed- allowed the controller to generate a suitable control signal, achieving a correct response of the system to the disturbances, and allowing to locate the sphere around the desired set-point.

The servo-system type 1 is ideal to control processes whose dynamic behavior incorporates an integrator. This configuration is useful for eliminating the steady-state error in the system response when the states are fed back. Additional advantages of the servo-systems type 1 are that they avoid the need of a different gain for each reference position and avoid the need of making additional calculations in cases where it is required to add an integrator.

Due to the high speed of the system's response, it was necessary to calculate a controller whose desired poles provided an establishment time of 1 second. During the experimental stage, it was observed that by increasing this value, the servomotors presented a small oscillatory movement until the sphere was located at the desired point, which allowed to clearly identify the desired conditions of the controller, which were presented in Table 1.

The results of this work can be consulted in the link below: https://www.youtube.com/watch?v=cgi5SiukWcY