Ball on the plate balancing control system

The problem of balancing is a continuous study challenge for application in many spheres of interest from education to transportation. Two-degree of freedom ball balancing laboratory test bench is an important plant for control systems understanding. This paper focuses on the mechanical design and control algorithm of balancing a ball on a plate. The plant was equipped with resistive touch screen for ball position data acquisition, stepper motors with position sensors for platform inclination angle feedback data and AVR microcontroller-based two-loop subordinate control system with PID controllers for ball position maintaining. The laboratory bench was designed and assembled in Saint Petersburg Electrotechnical University “LETI” at the Automatic control systems department.


Introduction
The problem of an unstable dynamic object balancing is one of the most relevant in the field of of automatic control systems construction [1][2][3][4][5][6][7][8][9][10][11]. Balancing technologies are used nowadays and could be applied in the future in a large number of scientific and technological areas. In addition to demonstrating the effect of the automatic control system and its settings have on a plant, the stabilization problem is used in such spheres as filming, navigation and transport control, including aerial and marine vehicles. Besides the task of ball on the plate balancing in two-dimensional space (plant with two degrees of freedom shown in figure 1, a), there is a simplified problem of ball and beam balancing (plant with one degree of freedom shown in figure 1, b). It is also worth mentioning the task of balancing a dynamic object on a platform was developed in the form of controlling a more complex Delta robots (plant with three degrees of freedom shown in figure 1, c) and the so-called Stuart platform (object with six degrees of freedom shown in figure 1, d), which is the evolution of Delta robots [12]. Ball on the plate, ball and beam and Stuart platform balancing control laboratory test benches could be applied for stabilization of horizontal planes, which is essential for such applications as transportation of fragile objects and stabilization of cameras. Delta robots are usually used in industrial processes of sorting the product on conveyor lines, so precise flange positioning and stabilization is quite necessary for such kind of robots. The problem of dynamic object stabilization and control has another application sphere, which socalled ballbots or ball balancing robots. Ballbots are mobile robots that have a single spherical wheel for the implementation of motion, so such design requires continuous self-balancing of the robot while both moving and standing. Due to the single contact spot between ball and surface, the ballbot is able to move freely in any direction and to unfold in one point. Such design increases maneuverability of the robot, but require control system for balancing and moving of the robot. In addition to fueling researchers`interests, ballbots are designed to help older people and disabled people to move and ballbots could probably become a new platform for future transport development. A ball balancing robot that was designed at Saint Petersburg Electrotechnical University "LETI" at the Automatic Control Systems Department that is equipped with three omnidirectional wheels with DC motor drives and position sensors, a PIDD control system and MPU-6050 position tracker, as shown in figure 2.  In addition to ballbots there is also a segment of inverted pendulums and its application in segways, monowheels and gyroscooters. In 2013 researchers from Austrian university demonstrated the stabilization of the triple inverted pendulum [13]. In figure 3, a triple inverted pendulum laboratory test bench is shown. In this paper, the problem of dynamic object balancing on a two-dimensional plane is considered, i.e. the plant with two degrees of freedom. The first step in solving the problem of an unstable object balancing on the plane is tracking current position of this object on a balancing plate. For this purpose, a video camera is often used [2, 6]. The camera is connected to a desktop computer via a standard protocol; it monitors the position of ball using digital filters (if the ball is painted contrast). Typically, Matlab connected to the plant controller is used for control purposes in such cases. For tracking the ball on the plane, a resistive touch screen could be used as well [4,7]. Touch panel allows user to get rid of the desktop computer with installed Matlab and make the test bench more compact and orderly. Since the use of a video camera, as well as a touch panel, entails costs, and the use of a video camera is also associated with quite a large amount of programming that is not directly related to the problem of balancing, in literature there are nontrivial ways to track the position of the object on the plate, such as the use of a phototransistor grid for instance [3]. The second step in solving the problem of unstable object on plate balancing is the choice of an automatic control system which can provide sufficient positioning accuracy of the dynamic object. The choice of control system is affected by the performance requirements and the set of system components. To solve that problem, as a rule, varieties of PID regulators are used [2-4, 10], however there are also systems with adaptive [8] and fuzzy [9] regulators. The plant for this work is a laboratory test bench with a platform on which the resistive touch screen is placed. After switching on the test bench, the ball located at some point of the touch screen should be brought to the central point of the sensor. In case of external disturbances (deviations of the ball position from the center of the touch panel), the object must be returned to the central point. The platform is driven by stepper motors equipped with self-made position sensors based on potentiometers. Two-circuit subordinate control system with P and PD-controllers is designed on the AVR Atmega8A microcontroller.   figure 4) for platform inclination feedback, control boards with motor control drivers and microcontroller and power supply unit (8 in figure 4) are placed. A plate with a resistive touch screen is mounted on the "tower" with a gimbal suspension (5 in figure 4) to limit the degrees of freedom of the platform to two and equips with a restrictive frame on the edge of the platform (2 in figure 4) to prevent the impossibility of reading the position of the ball on the sensor. Moreover, the wooden base carries metal balls`of different weigh (7 in figure 4) cradles for their easy storage and carrying. The platform "tower" with motors`mounts, gimbals, restrictive frame, metal balls cradles and protective elements of the laboratory test bench were printed on a 3D printer of ABS plastic. The size of the item is 400×400×220 mm. To determine the position of the ball on the plate, a four-wire 9-inch touch screen was used. The touch panel is connected to two channels of the ADC of the microcontroller to determine the X (longitudinal) and Y (transverse) coordinates of the object. The advantages of using the touch screen includes the possibility to work with the microcontroller directly and as a result short response time, as well as its cost. The disadvantages includes the presence of noise and, as a consequence, the need to filter the sensor`s signal.

The laboratory test bench mechanical design
Stepper motors with A4988 chip driver and a potentiometer for providing the motor`s shaft position feedback were chosen for motion implementation. Stepper motors are connected directly to the driver, which in turn is connected to the microcontroller by only two wires (STEP and DIRECTION). Drivers of the stepper motors are set to half-step operation mode. Motors potentiometers of the longitudinal and transverse axis of the platform displacement are connected to two more channels of ADC of the microcontroller. The advantages of using stepper motors include high torque and greater reliability. The disadvantages includes heating from long working time and necessity to install a driver for providing micro-step control modes. To reduce the heat dissipation, the stand is equipped with a standalone motors shutdown button. The laboratory test bench is shown in figures 5 a, b. For the data acquisition and processing as for generating the control action, the AVR microcontroller Atmega8A was chosen. The control algorithm of the test bench is written in C programming language in the development environment CodeVisionAVR. For the convenience of program debugging, the wireless UART data transfer protocol was used for information exchange between microcontroller and computer.

Ball balancing control system
A resistive touch panel is used to determine the position of the object on the table. Angle of inclination of the table is determined by potentiometers that track the angle of rotation of the stepper motorss hafts. The control system operates at a frequency of 100 Hz and involves reading information about the coordinates of the ball and the angle of inclination of the platform. The basis was adopted by a two-circuit subordinate automatic control system to maintain the position of the ball on the platform with versions of PID controller. The outer contour is responsible for controlling the position of the ball (data obtained from the resistive screen), and the inner -for the position of the platform (data obtained from the motor position sensors). In figure 6, the structure of the designed automatic control system is shown. Figure 6. Ball on the plate balancing control system diagram.
The goal of the control system is to bring the object into the centre point of the resistive touch screen and hold it in that point despite all the disturbances by changing the inclination angle of the plate. Due to half-step operation mode of the stepper motors the position of the ball should always be corrected by the control system. The step response settling time is about 3 seconds. Resistive touch screen ADC signal was filtered for noise cancelling. Based on the data obtained, it can be stated that control system manage with the task of sustaining the position of the ball at the central point of resistive touch screen.

Conclusions
In this paper the design of a ball balancing laboratory test bench was described. The object designed could be used for testing the stabilization and balancing control algorithms, which could be essential for instance for marine ships and aerial vehicles. The microcontroller-based control system tracks the ball position on the resistive touch screen and calculates the position error, which is the displacement of the coordinates of the ball relative to the central point of the resistive glass. Stepper motors with a position sensor allows control system to change the inclination angle of the platform with resistive glass for moving the ball on the table. Microcontroller two-loop subordinate control system with varieties of PID controllers allow to maintain the ball in the centre point of the resistive panel. The results obtained are important due to use of stepper motors instead of usual servos and lack of any external computer for commonly used computer vision system. Instead of it the described version of laboratory test bench could be programmed directly from user`s computer because of microcontroller based control system availability. In the future, it is planned to improve the filtering of the ball position feedback signal to increase the speed and quality of the automatic control system. Also, described problem could be transformed into more complicated delta robot control that could be used in many spheres of industrial automation from printing and milling to assembly lines.