Synchronizing of Stabilizing Platform Mounted on a Two-Wheeled Robot

This paper represents the designing, building, and testing of a self-stabilizing platform mounted on a selfbalancing robot. For the self-stabilizing platform, a servo motor is used and for the self-balancing robot, two dc motors are used with encoder, inertial measurement unit, motor driver, and Arduino UNO microcontroller board. A PID controller is used to control the balancing of the system. The PID controller gains (Kp, Ki, and Kd) were evaluated experimentally. The value of the tilted angle from IMU was fed to the PID controller to control the actuated motors for balancing the system. For the self-stabilizing control part, whenever the robot tilted, it maintained the horizontal position by rotating that much in the opposite direction. Keywords—PID controller, self-balancing, servo reference tracking, inertial measurement unit


INTRODUCTION
In the very near future, wide-spread domestic robotic uses will be the norm. Current technology shows significant potential for the practical use of robots. Such robots can communicate with people for assisting or doing repetitive tasks. The uses of mobile robots include museum guidance, blood pressure and sugar level checking systems in hospitals, and household robots for screening and cleaning, etc. For indoor uses, domestic mobile robots need to be able to maneuver rapidly.
Several previous researchers have conducted research on the two wheel. Ascento: Two Wheeled Jump Robot investigated by Klemm. Mobile land robot applications demand high speed and agility when navigating in complex indoor environments [1]. Autonomous Hybrid Soil / Air Mobility in Unknown Environment Researched by Fan. Hybrid land and air vehicles can have distinct advantages over land-specific or aviation-specific designs in terms of energy savings and increased mobility [2]. A controller study for a two-wheeled self-balancing robot was investigated by Prakash. The concept behind this twowheeled self-balancing robot is based on the principle of an inverted pendulum system [3]. The optimal controller design for a self-balancing two-wheeled robot system was investigated by Zad. The optimal controller is designed for a self-balancing two-wheeled robot system based on a strong Predictive Control (MPC) model [4]. The steering control in a two-wheeled multi-degree freedom wheelchair in a slope environment was researched by Hamati. Along with the development of the electrical transportation system, two-wheeled mobile robots have been widely studied because of their high mobility [5].
A step-back shift control of leader-follower consensus building of a nonholonomic heterogeneous wheeled cellular multirobot that is uncertainly networked was investigated by Tsai. The leader-follower consensus building control method uses backstepping shear mode control for an uncertain, networked group of heterogeneous nonholonomic wheeled mobile robots (NWMR) [6]. The hierarchical fast terminal sliding mode control for a two-wheeled robot selfbalancing on uneven terrain was researched by Zheng. The self-balancing two-wheeled robot (TWR) has attracted significant attention over the past decades worldwide [7]. The navigation of a two-wheeled robot that moves cooperatively to carry an object was investigated by Mohan. A method that allows a two-wheeled moving robot to navigate through a known environment while cooperatively carrying an object [8]. The inverse free solution for the inverse kinematics of a two-wheeled moving robotic system using the gradient dynamics method was investigated by Zhang. In order to effectively avoid the Jacobian inversion of conventional pseudoinverse solutions and to obtain a minimum two-norm error tracing solution to the inverse kinematics of the two-wheel mobile robot (TWMRS) system, the inverse-free solution uses the gradient dynamics (GD) method [9]. The Visio design and control of a Two-Wheeled Inverted Pendulum Cell Robot was investigated by Ben Mansour. Visio and the path following control problem of a Nonholonomic Inverted Pendulum Two Wheel Mobile Robot [10].
The low-cost mapmaking and obstacle avoidance of miniature surveillance robots is researched by Shi. Miniature robot cannot carry too many sensors to avoid obstacles because of its small volume [11]. Modeling Control and Decoupling for Self-Balancing Two-Wheeled Robots was investigated by Zheng. Dynamic modeling and state feedback control are presented for high-order, nonlinear, heavy couple and unstable two-wheel selfbalancing control robots (TWSBR) [12]. The dynamic modeling and design of the sliding mode controller of the two-wheel self-balancing robot were studied by Yuan. This robot dynamic model is presented based on Appell Equations [13]. Niu studied adaptive control based on the identification of BP neural networks for two-wheeled robots. For two-wheeled robots that are easily influenced by uncertain factors, such as changes in load, friction, road Journal of Robotics and Control (JRC) ISSN: 2715-5072 553 Author, Title conditions and external influences, on their actual movement, this paper refers to an adaptive method model based on the identification of BP artificial neural networks [14]. The design of the Lyapunov control function follows a smooth smooth path through the minimum projection method researched by Tsurumoto. Propose a design method of distinguishable strict control C∞ Lyapunov function (CLF) for different flat systems [15].
Mobile Inverted Pendulum Stabilization Using PID Controller Fractional Sequence was investigated by Paliwal. The mobile inverted pendulum (MIP) is a nonlinear robotic system popularly used by researchers to perform control experiments [16]. YAFT: A real-time two-wheeled inverted pendulum robot based on fuzzy logic researched by Ovur. mechanical design of a custom made two-wheeled inverted pendulum, named as YAFT, and the structure of an intelligent control system to solve its control problems [17]. Xiu researches the design of an automatic handling robot control system. To improve cargo handling efficiency and reduce human labor intensity, a robotic handling system that can recognize ribbons, recognize signs and charge automatically [18] is designed. An improved algorithm A for two-wheel self-balancing vehicle path planning was investigated by Wang. The improved A algorithm for twowheeled self-balancing vehicle path planning is designed to handle some of the typical errors caused by traditional path planning methods, such as multiple turns, uneven paths and low efficiency when the environment changes drastically [19]. TWIMP: Two-Wheeled Musculoskeletal Pendulums as Learning Control Platform in the Real World with Physical Contact of the Environment researched by Kawaharazuka. With the recent spread of machine learning in the field of robotics, humanoids that can act, perceive, and learn in the real world through contact with the environment need to be developed [20].
TWMM stability modeling and analysis using Kalman filters and PID controllers was investigated by Chhotray. The highly unstable and nonlinear nature of the inverted pendulum system has attracted the interest of many researchers in recent decades [21]. The Two Wheel Stick for the Walking Aid was investigated by Van Lam. Hardware design and two-wheel stick controller [22]. Glushchenko investigated the development of a neural network controller with online training to control a two-wheeled balancing robot. The problem of stabilizing a two-wheel balancing robot is the scope of this study [23]. Using the Numerical Optimization Method to Set the Regulator Coefficient on a Two-Wheel Balancing Robot was investigated by Ivoilov. It is devoted to adjusting the regulating coefficient of the automatic stabilization system of a two-wheel balancing robot [24]. Obstacle Avoidance for Unmanned Vehicles based on 2D LIDAR was investigated by Ma. AGV is gradually becoming the main tool for container handling in major international ports [25].
The optimization method for controlling parameters using a support vector engine was researched by Saito. In actual industrial processes, it is difficult to optimize parameters for control systems because of their interference [26]. Motion Control of Triple Links Inverted Pendulum in Two Wheel System Using Type-2 Fuzzy Logic Interval Control Based on Particle Swarm Optimization was investigated by Masrom. A motion control of a three-link inverted pendulum on a two-wheeled system, through Interval Type-2 Fuzzy logic Control based on Particle Swarm Optimization [27]. The multilevel LQ and fieldoriented control of a mobile inverse pendulum (Segway) with a permanent magnet synchronous machine were investigated by Schiffer. development and implementation of a two-wheeled mobile robot that balances stably and precisely [28].
It would be really important to be able to carry loads and having reach levels to human height. These are some of the potential applications of two-wheeled robots. A twowheeled balancing robot is easier to develop than that of the bipedal one without sacrificing flexibility and the ability to rotate on the position. Two-wheeled robots take fewer footprints than traditional three or four-wheeled robots with extra maneuverability around tight corners, corridors, etc.
The extra advantage of actively and dynamically balancing a robot is that even if the robot hits something at high speed it won't lose its stability and fall over. One example is the Segway personal carrier. But one problem is still not addressed. Segway or other two-wheeled selfbalancing robots cannot maintain its top surface parallel to the ground. To solve this problem, we need the help of a self-stabilizing platform. To exhibit the benefits of such a design, we constructed an upright, self-balancing, twowheeled robot as shown in Fig. 1 utilizing an IMU and a PID feedback control loop to maintain stability. RELATED WORK In the field of mobile two-wheel platforms, important research and development have been undertaken. The authors in [29] have used a tilt angle measuring inclinometer referenced to the floor, a gyroscope to calculate the tilt angle rate of change, and wheel encoders to get the platform speed. Balancing the performance difference of the linear quadratic regulator (LQR) and pole placement method are compared in this paper. A PID controller is used for controlling the pathway of the robot. The Fuzzy Controller Platform [30] uses the same basic kind of sensors as the CllPS Platform. Nevertheless, it uses a fuzzy controller that does not require a precise system equation for the platform motion control. They are both small-scale devices that are Journal of Robotics and Control (JRC) ISSN: 2715-5072 554 Author, Title mainly used to assess the controllers. The T-WIP Robot described in [31] uses wheel encoders for sensing the speed of the platform. Moreover, a gyroscope is used to obtain the pitch angle and the developed program calculates the pitch rate. A pole-placement designed balancing controller with a PID for heading trajectory control is implemented in MATLAB with the assistance of the RTW (Real-Time Workshop) Toolbox. Importance is given on selecting hardware and software to arrange for a robust two-wheel balancing platform. There is no thought, however, for further platform applications. J. Wu et al. [32] researched a two-wheeled, self-balancing robot with a fuzzy PD control method, as an example of a high-order, multi-variables, nonlinear and unstable system. Lekshmy S et al. [33] presented a balance model as a two-wheeled self-balancing robot which is capable of correcting itself to variations in weight and position using a single gyroscope and a single accelerometer. M. Moghaddas et al. designed an optimal PID controller for inverted pendulum with genetic algorithm [34]. Similar kinds of researches were conducted in [35], [36] emphasizing dynamic modeling. This research aims to combine a self-stabilizing platform and self-balancing robot and synchronize and stabilize the dynamics of them.

III. PROBLEM FORMULATION
Whenever a two-wheeled robot tries to move, it has to tilt its body a bit. So, it cannot always maintain its body perfectly level to the ground. So, we added a self-stabilizing platform on its top to compensate for this behavior. To establish the self-balancing platform, the following tasks are needed to complete: i. Sensor incorporation to assess the platform movement.
ii. Implementations of the hardware's to collect data for further analysis iii. PID controller design and determining the gains.

IV. SYSTEM CONFIGURATION
The robot, as shown in Fig. 1, consists of a strait pendulum body, which is attached to axes at which the two wheels and motors are mounted. The robot body has two DC-motors, sensors, and various circuit boards that contain microprocessors and electronically related devices, such as buck booster and motor driver and encoder.

A. Mechanical Components.
The robot's main chassis is mainly made up of plywood and the motor is mounted by a 90-degree motor bracket.

B. Sensors and Actuators
Sensors' output and actuators' actions are used to balance its dynamics and thus make it to stand upright. The following section will describe their functionality to make the system self-balancing. The preferences of sensors, actuators, and control algorithms will determine the maximum achievable performance of the robot.

1) Motor Driver:
The motor driver which is used here is an inexpensive and widely available L298 H bridge inverter. The H bridge configuration is commonly used for motor driving in robotics-related applications.
2) Inertial Measurement Unit: For the inertial measurement unit, mpu-6050 is selected. It incorporates 3 axis rate gyro and accelerometer with a built-in motion processing unit. It communicates with the microprocessor using an I2C communication protocol whose baud rate is pretty high for this application. For inertial measurement tasks, using both gyro and accelerometer is pretty common. A complimentary filter is used to do the angle fusion. The reason for using a less computationally hungry filter is that the microprocessor used here won't be able to handle that much processing with managing other tasks such as motor direction control and other stuff.

3) Buck Booster:
One issue is found out in the project is that as the battery charge drains out, its ability to actuate the motor decreases significantly. Even if the voltage changes a little the performance change is very dramatic as the PID gains are not tuned for that situation. For this reason, a buck-boost module is implemented to counter this problem. A Lipo 3 cell battery with 12.6-volt maximum is used. As the robot uses energy from it, its voltage decreases. Due to the buck-boost converter, a constant 12 volts is obtained whatever the voltage of the battery is. This issue could have been avoided by using power from a fixed power supply but which would significantly limit our experiment.

4) Wheel Selection:
For choosing wheel diameter, two sizes of wheels are tested. The bigger diameter wheel showed less satisfactory performance compared to smaller diameter wheels.

5) Motor Speed Difference Compensation:
In building the robot, one significant hardware issue that is faced is that the motors used in the project are not matched in torque-speedpower characteristics. As a result, the same command to the motors do not turn them equally which can be seen from Fig. 2. To tackle this problem, a local feedback controller is employed to mitigate the difference in their speed or traversed path. The individual characteristics of the motors such as torque, speed, current are figured out and then both motors are controlled individually with different command signals. Author, Title ATmega328P microcontroller and developed by Arduino.cc. The board is equipped with sets of digital and analog input/output (I/O) pins as shown in Fig. 3 that may be interfaced with various expansion boards (shields) and other circuits. The reason for using Arduino is that it has a built-in serial program uploader and convenient and easy-to-use open-source IDE software with a vast community of users willing to share any problem they face and get the remedy of it. 7) Self-Stabilizing Platform: Because of the coupled dynamics of tilt and forward velocity, to move forwards from equilibrium, it is necessary to first move backward allowing the intermediate body to tilt forwards before the beginning of the forwarding movement. So, its top platform will inherently tilt to move its body from one place to another place. To counter that issue a self-stabilizing platform is mounted on top of the robot so it could carry something perfectly horizontal whether the robot is inclined or going through some rough terrain. A servo motor is used as the actuator. This kind of arrangement and solution is not addressed before to the best knowledge of the authors.

V. CONTROL SYSTEM
The overall block diagram of the two-wheeled robot with self-stabilizing platform including closed loop feedback control system and its working mechanism is illustrated in Fig. 4. With the command signal given to the input the controller tries to maintain that parameter at the output using PID controller algorithm with real-time feedback. The robot's center of mass (CM) plays a crucial part in the balancing of the system. The balance controller algorithm tries to place the center of mass of the robot vertically above the wheel axis. One important thing to note here is that the wheel axis is a long straight line. So, the center of mass placed at any point vertically above this axis is sufficient to make the system stable and not to fall over. The balance controller is a PID controller whose control variable is the voltage of the motor and process variable is the tilting angle. The controller pushes the machine to the desired corner maintaining the balance. The standard PID algorithm is used with formula stated below- The PID controller tuning is performed with the trial and error method. The particular gain values, as shown in Table-I, are found well suited to achieve the desired performance. The system's (sensors measurement and control algorithm) sampling rate is about 10 ms as the system is implemented with a microprocessor. Robot speed is maintained by offsetting a certain pitch angle which is recovered by the PID controller. Because the algorithm will try to recover the angle the robot moves to tilting direction.
For any given acceleration, there exists a tilt-angle at which gravitational forces are perfectly balanced against the lifting force generated by maintaining the robot's acceleration. For any given speed, a small integral constant helps the robot to calculate and maintain the optimum angle.
For stabilizing the top mounted platform, we used servo motor which is coupled with the platform. The program flow chart for balancing the top platform is described in

VI. RESULT AND DISCUSSION
Using the PID algorithm the robot was well balanced and did not deviate more than ±2 degree. Input-Output data are shown in Fig 6 and 7 respectively. The reason for fluctuating is that the gears of motors are facing a lot of backlashes which resulted in unsmoothed operation. Although, the performance of balancing depends a lot on the surface on which the robot is standing and trying to balance, it is found that the perfect balancing is achieved on carpet although related data are not shown here as this case is nearly nonexistent in the outside environment.  To demonstrate how the system will behave under impulse disturbance, the system is given a nudge and it takes about 2s to stabilize itself. The system is well balanced as we can see from the output data in Fig. 8 of the balance robot pitch angle.
It is mentioned before that the servo motor is used to stabilize the platform. As the characteristics of servo are dominated by torque so it is much slower than others. The argument is visible by the graph on time occupied by servo motor to follow the reference point as shown in Fig 9. So, to get a faster response stepper motor should be a better choice for future development.

VII. CONCLUSION AND FUTURE WORK
The PID controller was successfully implemented on the robot together with a complementary filter and made it balance within the movement of 10 cm on the surface. The implemented PID controller was also able to handle a varying amount of load on the structure. It could also handle disturbances when someone was picking load from the structure. This was the result of a well-tuned PID gain parameter.
To further improve this work, the following suggestions are given. The problem with the speed calculations in Arduino, a fixed-point arithmetic routine could be written to improve speed. This must be written from scratch since there currently exist no libraries for the Arduino doing this. Again, a state-space controller can be implemented for better dynamic performance. Also, as we determined the system transfer function and other system parameters, great future work would be to model it in state space and find out the optimum gain and stabilize the robot very efficiently and dynamically. Besides these, implementing total circuit connections including ICs in a PCB would be a great way to reduce any loose connections between the electronic components. Also, designing the whole structure in CAD software and then 3D printing the parts would be a big step into reducing the asymmetrical nature of the distribution of loads of our bots.