Using a Combination of PID Control and Kalman Filter to Design of IoT-based Telepresence Self-balancing Robots during COVID-19 Pandemic

COVID-19 is a very dangerous respiratory disease that can spread quickly through the air. Doctors, nurses, and medical personnel need protective clothing and are very careful in treating COVID-19 patients to avoid getting infected with the COVID-19 virus. Hence, a medical telepresence robot, which resembles a humanoid robot, is necessary to treat COVID-19 patients. The proposed self-balancing COVID-19 medical telepresence robot is a medical robot that handles COVID-19 patients, which resembles a stand-alone humanoid soccer robot with two wheels that can maneuver freely in hospital hallways. The proposed robot design has some control problems; it requires steady body positioning and is subjected to disturbance. A control method that functions to find the stability value such that the system response can reach the set-point is required to control the robot's stability and repel disturbances; this is known as disturbance rejection control. This study aimed to control the robot using a combination of Proportional-Integral-Derivative (PID) control and a Kalman filter. Mathematical equations were required to obtain a model of the robot's characteristics. The state-space model was derived from the self-balancing robot's mathematical equation. Since a PID control technique was used to keep the robot balanced, this state-space model was converted into a transfer function model. The second Ziegler-Nichols's rule oscillation method was used to tune the PID parameters. The values of the amplifier constants obtained were 𝐾 𝑝 =31.002, 𝐾 𝑖 =5.167, and 𝐾 𝑑 =125.992128. The robot was designed to be able to maintain its balance for more than one hour by using constant tuning, even when an external disturbance is applied to it.

guidelines for health professionals and the public in general [8]. Doctors, nurses, and medical personnel must wear protective clothing while treating patients due to the risk of cross-transmission [9,10]. Publics need to minimize physical touch and direct human contact [11]. This new regulation greatly affects healthcare management systems and many other systems in general [12][13][14]. For example, rehabilitation robots can be used to correct weakened hand function [15,16] so that rehabilitation is no longer entirely dependent on doctors and health workers. However, although physical contact still needs to be limited, health professionals still must be 'present' in many cases. Hence, telepresence becomes essential to minimize direct contact to reduce the transmission rate of the disease while preserving face-to-face, engaging interactions.
Telepresence robots can empower people to work, play, and learn with others, regardless of geographical distance [17]. Telepresence in robotics is a subfield of robotic-assisted routes, where humans act as operators, sending highlevel instructions to the assistive robot while receiving sensory feedback [18]. The sensory feedback can be experienced in various ways. For example, Rhee et al. [19] discovered a telecollaboration that involves teleporting long-distance collaborators to another real-world environment. Similarly, Sun and Yan [20] proposed a mixed realitybased teleoperation system. Convenient Virtual Reality (VR) planning optimized human perception for telepresence was researched by Becerra et al. [21]. As telepresence continues to develop, researchers also proposed and studied many fundamental algorithms and methods to deliver these sensory feedbacks. Deep 3-D segmentation of Point Cloud was researched by Zhong et al. [22]. Spatial presence, performance, and behavior between real, distant, and virtual immersive environments were studied by Khenak et al. [23]. Meanwhile, Erat et al. [24] proposed real-time view planning of unstructured Lumigraph modeling.
In the meantime, studies and research regarding data communication stability in systems with the Internet of Things (IoT) also continued. For example, a study regarding Similarity Meter and Distance Meter for Set Neutrosophic Interval with IoT Industry Evaluation was researched by Peng [25]. A more sophisticated, reliant, and robust predictive control mechanism also has been developed for a networked teleoperation space robot [26]. The stability of data communication with Xbee S2b Zigbee used on an Arduino-based sumo robot was investigated [27]. These findings implied that a medical telepresence robot could establish stable and secure real-time data communication using one of these technologies so that doctors can engage with patients or monitor patients' health conditions more safely.
Other challenges in designing a medical telepresence robot are related to its mechanical configuration and control system. A medical telepresence robot should represent human presence to make engaging interactions possible. Its height should be an average height of a human and should be able to maneuver freely and autonomously. Moreover, it requires to be battery-operated with less energy consumption so that it can also be used for monitoring patients' conditions.
A self-balancing robot is a two-wheel robot with a working principle similar to an inverted pendulum that balances itself vertically on a horizontal surface [27]. An inverted pendulum has a center of gravity above the fulcrum [28]. The inverted pendulum's basic concept is to find and stabilize the stick's position above the robot [29]. This robot configuration design is similar to human feet. In addition, two-wheeled robots consume less power with stabilityenhancing behavior than four-wheeled robots. Also, they have better maneuverability since using two wheels reduces the turn radius to zero. Some researchers used the inverted pendulum balancing method for stabilizing other robots. For example, the combined sliding mode control method used for swing-up control and stabilization was investigated by Park and Chwa [30]. The virtual linear inverted pendulum model for bipedal propulsion planning was investigated by Motoi [31]. An efficient 3-D three-legged walker stabilization and directional control based on PDAC was proposed by Aoyama [32]. This robot configuration requires a strong and stable control system to keep a balance and maintain its position and condition without outside assistance when it becomes subject to disturbance [33]. Meanwhile, several methods have been used to maintain the robot's balance. For example, Sliding Mode Control (SMC) has been used as a nonlinear controller [34][35][36]. It can also be combined with a high-level observer for better control performance [37]. A synchronized stabilization platform was also proposed to control the inverted pendulum [38]. Another nonlinear controller proposed for controlling inverted pendulum was Feedback Linearization [39,40]. Predictive control techniques such as Model Predictive Control (MPC) [41] were also reported. Another filtering method was also used, such as Kalman filter [42,43]. LQR-based controllers were also made [44][45][46][47][48]. Moreover, intelligent control techniques were also proposed: Neural Network [49][50][51][52], and Fuzzy [53][54][55].
However, those aforementioned methods are unsuitable for disturbance rejection control in medical telepresence robots since they require complex calculations that consume more power and memory. Another popular controller in the control system is the proportional-integral-derived (PID) control [56,57]. Simplicity, durability, and near-optimal performance are the reasons why PID control is so popular in the industry [58]. It is simple, functionally easy to understand, and practical [59,60]. Since it only requires simple calculations, PID will consume less power and memory, making it the most suitable controller for medical telepresence robots. PID algorithm requires parameter setting to get performance with minimum error, thus, its tuning process must be properly done to achieve the correct parameters [61,62]. The parameters to be obtained from PID control system are , , and [63,64]. Most researchers used sophisticated PID tuning methods to set the , , and configuration values, such as the Fuzzy logic algorithm [65,66]. Others even combined it with the Kidney-Inspired Algorithm [67] and PSO [68], making it more complex. However, the Ziegler-Nichols method is one of the standard tuning methods used to set the , , and configuration values. There are two methods of Ziegler-Nichols's tuning, the first method [69] and the second method [70]. Ziegler-Nichols is one of the oldest tuning methods designed for PID controllers. Ziegler Nichols tuning method may provide less performance for complex or advanced systems; it can be the simplest method yet sufficient to give good system control performances for less complicated systems.
In disturbance rejection control, measurement noise profoundly affects the control system performance. Noise from the sensors makes less accurate system measurements. Bad system measurement can make the controller too aggressive or even too tolerant to error, making it unable to correct errors in the system. Then, the Kalman Filter algorithm can be used for sensors with highly sensitive response characteristics to changes in reading values of the object being measured. The filter can reduce noise in output data readings while enhancing efficiency [71,72].
Disturbance rejection control is highly essential in designing medical telepresence robots since the proposed design is two-wheeled, self-balancing mobile robots. The selfie sticks where the mobile phone/tablet will be hung need to be balanced by the robot so that it can do its function properly. Many studies have analyzed self-balancing robots in detail, but only one approach has been used, and it was not specifically designed for medical telepresence robots. Therefore, this study aimed to propose a disturbance rejection control method and implementation, equipped with noise filtering by Kalman Filter, which can perform in a robust and stable manner, specifically designed for medical telepresence robots. Hopefully, the result of this study can help health professionals to overcome the overwhelming COVID-19 pandemic by making them treat patients more safely with low-cost and easy-to-be-designed medical telepresence robots.
The paper will be organized in the following structure. The first section is an introduction to the problem and research problem formulation. Next, the design of the self-balancing robot will be explained, and the model of the robot will be presented. Then, the conversion of the transfer function model into state-space representation is explained in the next section. The fourth section will contain fundamental theories regarding PID control design, while the fifth will consist of the Ziegler Nichols tuning rules. The fundamental theory of Kalman Filter will be described in the sixth section. Finally, the results and discussion will be presented in the eighth section, and the conclusion will be presented in the last section.

2-Methodology
The research method is shown in Figure 1. The first is system modeling using the Lagrange equation. The obtained model was in state-space representation, but it was then converted to a transfer function to implement the PID. The next step is PID controller design and Ziegler Nichols tuning. After that, the Kalman filter was designed. The next is simulation and hardware design. Then, examinations were done to get the data research. The result of the examination will be analyzed and evaluated. The research is considered finished if the proposed controller can give good results. Vice versa, the examination will be repeated if it cannot provide good performance results.

3-Self-Balancing Robot Modeling
Self-balancing medical telepresence robot modeling was one of the phases in robot design [73,74]. It was designed to understand the characteristics of the robot's dynamic behavior [75][76][77]. The first step was to determine the coordinates, the force, the energy, and the Lagrangian functions of the system, and the next step was to determine the motion equation using the Lagrange equation [78][79][80].
The self-balancing device had two degrees of freedom, allowing it to be represented using two general coordinates [81]. The coordinates used for the analysis of this robot are the horizontal shift from the robot and the angle shift of the inverted pendulum ( ). will be positive if the motion is to the right and ( ) positive if the movement is clockwise, calculated from its reverse position as illustrated in Figure 2 [82].

3-1-Kinetic Energy and Potential Energy
The kinetic energy on the wheel (ER) is the sum of the wheel rotational kinetic energy and the wheel translation, as expressed in Equation 1, is the mass of the wheel, and is the rotational speed of the wheel towards the horizontal: The translation of Equation 4 yields Equation 7; Thus, the total kinetic energy T is expressed in equation The robot moves along the horizontal axis, and the potential energy of the system was determined entirely by the angle of the inverted pendulum written in Equation 10. is the acceleration of the earth's gravity, and is the length of the inverted pendulum = cos (10)

3-2-Lagrangian
At this phase, a dynamic system analysis was performed using the Lagrangian method written in Equation 11.
Substituting Equations 9 and 10 into Equation 11 obtained the Lagrangian Equation 12.

3-3-The Lagrange Equation
Lagrange analysis on dan was performed after and as the general coordinates had been determined. The completion of the Lagrange equation for p was written in Equation 13.
Equation 12 was used to calculate the partial derivative expressed in Equation 13, which yielded Equation 14.
The completion of the Lagrange equation for  was written in Equation 16.
Equation 14 was used to calculate the partial derivative expressed in Equation 16, which yielded Equation 17.
The self-balancing robot's system equation was then formulated as in Equation 19.

3-4-Linearization
Equation 14 is a nonlinear equation. The control system was aimed to keep the inverted pendulum upright. The equation was linearized and applicable for sin 0   dan 1   as formulated in Equation 20.
By completing Equation 15, ̈ dan ̈ were obtained, as written in Equations 22 and 23.
Equation 23 was expressed in a state-space equation to obtain Equation 24, denoted the force acting on the robot self-balancing system .

4-State-Space to Transfer Function
The self-balancing model's state space was converted to a transfer function model to be controlled by the PID control. The following are state-space equations.
By taking Laplace transformation (with zero value at the initial conditions), the equations turned into: Then, Equation 28 can be rewritten as: Both sides were then pre-multiplied with ( − ) −1 so that the following equation can be obtained.
By substituting X (s) in the output equation, Equation 29 can be expressed as: Finally, the transfer function equation can be formulated as:

5-PID Control Design
The PID control characteristics were strongly influenced by combining each control action Proportional , Integral And Derivative ( ) [83]. The regulation of the , , and constant values showed the prominent nature of each control action [84]. When one or two of the control actions were more prominently set out, they would significantly contribute to the overall system. Control action parameters were not independent, so if one of the values was changed, there would be a change in the system response [85]. Figure 3 shows the block diagram for the combination of proportional (P), integral (I), and derivative (D) control action.

6-Ziegler Nichols Tuning Rules
The Ziegler-Nichols rules related the Plant transient response characteristics to the values of , , and [70]. The parameter tuning in this research was conducted based on the second method of the Ziegler Nichols rules, in which the values = ∞ and = 0 must be set first; the response from the plant can only be seen if the value of is set (Figure 4). This method involved giving the value of ranging from 0 to the critical value before the plant responds with an oscillating curve. This approach could not be used if the response did not display an oscillating curve.

Figure 4. Giving Value to Plant
This method was performed by providing value to the plant periodically from 0 to critical value of until the plant responds with an oscillating curve. Thus, the critical value of and period value of were determined using the experimental method. Figure 5 illustrates the oscillating response expected from the system. Table 1 presents the PID formula using the second method of Ziegler-Nichols rules. P, PI, and PID are three different types of control.

7-Kalman Filter
The noise in a signal containing readings or measurements was reduced or eliminated using the Kalman Filter [86]. It estimated the process state in a system, minimizing the mean square error value before, now, or in the future [87,88]. The two processes in Kalman Filter were time update and measurement update [89]. Time update was the process of predicting future readings, and measurement update was the process of correcting the predicted value. The noise in the measurement results was used to calculate time update and measurement update to obtain a more accurate estimation value [90]. The two processes in the Kalman filter were the prediction stage and the correction stage [91].

7-1-Prediction Stage (Time Update)
A prediction stage is a process in which future readings are predicted to obtain state and covariance values ranging from − 1 to [92]. Two equations at the Prediction Stage were State Prediction and Error Covariance Prediction [93,94].

The state Prediction equation is
where is state transition matrix and is the control matrix.
The Error Covariance Prediction equation is; where is the state variance matriks and is the process variance matrix.

7-2-Correction Stage
A correction stage is a process of correcting the predicted value [95]. The first step was to calculate the Kalman gain (39). Next, the actual process value , which would be used for post-estimation state calculations (40), was determined. Finally, the post-estimation error covariance values (41) were obtained using Kalman Gain equation, Estimation, and Covariance Error in the correction stage.
The Kalman Gain equation is; where is the measurement matrix and is measurement variance matrix.

The Estimation equation is;
The covariance error equation is The prediction and correction stages were repeated several times, with the post-estimation values used to calculate the next new pre-estimation value. Figure 5 shows some of the electronic components used to build the robot. It consisted of Arduino nano components, DC motors with encoders, L298N motor drivers, MPU sensors 6050, a 16×2 LCD, and a push-button. The components were assembled and simulated to be integrated into a robot-enabled system.

8-2-Robot mechanical design
The robot comprises three chassis arranged in three levels, as shown in Figure 6. The top and bottom chassis were made of 2 mm black acrylic material. The middle chassis was produced using a PCB and control center consisting of an Arduino microcontroller, an L298N driver, and a GY-521 MPU 6050 sensor. The robot chassis included switches, push buttons, 16×2 LCD, and the bottom chassis included batteries and two DC encoders. It had two wheels as a driving force. The robot's dimensions and weight were 16×16×6 cm and 642 grams, and the wheels' diameter and weight were 6.5 cm and 36 grams.
The robot was designed in a two-wheel configuration to increase its power efficiency, maneuverability, and stability-enhancing behavior. It was also battery-operated with a Lithium rechargeable battery. Figure 7 shows the mechanical design of the prototype. A height-adjustable selfie sticks with a rounded base made of durable plastic will be added to the robot using 3M industrial double-sided tape. Meanwhile, the universal phone/tablet holder on the tip of the selfie stick was equipped with a mechanical, adjustable neck-angle gripper.  Figure 8 shows the design of the self-balancing robot control system. The PID control and the Kalman filter were two methods to stabilize the robot. The tuning method to find the PID parameter values was the second method of Ziegler-Nichols's rules. The Kalman filter was combined with an Inertial Measurement Unit (IMU) sensor to eliminate noise.

Figure 8. Design of the proposed disturbance rejection control
A system modeling for the self-balancing robot was required to design a PID control system. Table 2 presents a set of parameters to determine the transfer function values of the robot mass, wheel mass, robot length, and gravitational acceleration values.  (42) After obtaining the transfer function value from the robot system, tuning the PID parameter as the control value of the robot was completed.

8-4-Communication and Connectivity Design
In order to provide telepresence and automatic function to the robot, the robot will be equipped with a DTMF decoder module. DTMF was chosen due to its reasonably small size and dimension (37×25×12 mm, 10g) while enabling motor control through Skype/WhatsApp communication. The proposed connectivity design is described briefly as follows. A tablet/smartphone with an internet connection is attached to the robot and connected to the DTMF module. When the tablet/smartphone receives a video call through Skype/WhatsApp, it will automatically answer the call. The caller will type a specific number as code to move the robot to the right/left; the specific number will emit a sound with a particular frequency, and DTMF will decode it. Therefore, the robot can be remotely controlled based on the specific number that the caller typed.
The Equation 43 is the value of obtained from the graph:

8-6-Determining , and values
After obtaining the and values, the second Ziegler-Nichols rules were used to calculate the , and values and the results were formulated in Equations 39, 40, and 41.  Figure 10 displays the three-level self-balancing robots created, controlled by PID control and Kalman filter. The robot used two DC motor drives. The first and third level chassis were made of Acrylic, while the second level chassis was made of PCB installed with the electrical parts. The PID control used Ziegler Nichols's rules and was tested using simulations and an actual robot implementation, whereas the Kalman filter was tested using an actual robot implementation.

9-1-System Simulation
Simulations on this robot system were performed on the Simulink in Matlab software. It was conducted when the transfer function value and the PID tuning value of the system had been obtained using a step test signal. It aimed to observe the transient response of the system. Figure 11 illustrates the system simulation without PID application. The self-balancing robot was modeled using the transfer function with a step signal. Figure 12 shows that the system's initial response was stationary while an upward movement was shown an infinite period later. It proves that the system without a PID controller is unstable.  Figure 13 illustrates the block diagram of system simulation with PID. The input was a step function and PID control with , , and of 31.002, 5.2104201, and 126.1393875, respectively. The step response resulted is displayed in Figure 13.

Figure 13. Block diagram of the system with PID
It demonstrates that the PID controller improves the system's reaction ( Figure 14). It is proven by the transition period as presented in the table. The time sampling in this system testing was 50 seconds with a rise-time value of 4.448s, pre-shoot 0.625%, overshoot 24.375%, and undershoot 1.696%. Figure 15 illustrates the comparison of angle readings of the system with and without PID. Three graph curves show the set-point value, roll angle value without Kalman filter, and roll angle value with Kalman filter colored in black, blue, and red, respectively. The red-colored gravitational curve shows that the Kalman filter can reduce the noise signal from the IMU. The self-balancing robot cannot be stabilized without implementing any controller. Figure 16 displays the motor speed response without PID. It shows that the movement of the two motors is constant, and there is a condition in which the motor moves backward and then quickly moves forward at a relatively fast speed. When the graph shows an increasing line, the motor moves forward; while the graph exposes a decreasing line, the motor moves backward. At the beginning of the movement, the robot's response was slow, but later it moved fast. Based on the motor movement, the robot has no feedback to the motor to be used as a reference to stay balanced.  Figure 17 illustrates the comparison of angle readings of the system PID. Three graph curves are set-point curves, roll angle curves without Kalman filter, and roll angle curves with Kalman filters in black, blue, and red lines. The figure shows that the self-balancing robot is stable. The disturbances can be eliminated by using the filter.  Figure 18 illustrates the motor speed response system with PID. The movement direction was the same, but the left motor was more dominant than the right because they had different responses when carrying loads even though they had similar specifications. The graph exposes that the motor movement oscillates due to balancing the position by moving forward and backward. The motor movement referred to robot angle changes. When the robot was about to fall forward, the motor responded by moving forward or CW with a certain speed to return to a balanced position. Conversely, when the robot was about to fall backward, the motor responded by moving backward or CCW.  5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 Figure 18. Motor speed response system with PID

9-6-Testing for Real Robot System for Disturbance
The test was performed after it was found that a more stable system could be applied to this robot system by using PID control. The robot was pushed to observe whether it could maintain its balance or not. Figure 19 reveals the system response to disturbance. The response given by the system to the robot appears to be satisfactory. The robot was pushed two times. The roll angle reading showed an overshoot, but it was not the noise generated by the sensor reading but an external disturbance. The Kalman filter, used as an algorithm to filter the actual angle readings, could reduce and even eliminate noise caused by external disturbance for the robot to remain stable to reach or approach the set-point. It enabled the robot to return to its balance without falling. Figure 20 shows the motor speed response to the disturbance. The robot was firstly stable, then moved backward or CCW when pushed. The robot retreat was the response. When the motor remained stable, it indicated that the system improved the robot's state and gave feedback to the motor to stabilize so that the robot did not fall.

10-Conclusion
A robust and stable disturbance rejection control was successfully designed specifically for the proposed medical telepresence robot. The PID parameters were tuned using the second method of Ziegler Nichols rules, resulting in = 31.002, = 5.167 and = 125.992128 for a prototype of a self-balancing robot with a size of 16×16×16 cm. The combination of GY-521 MPU 6050 sensor reading and the Kalman Filter aimed to get an accurate reading value. The robot system was tested using simulation and real robots under three different conditions: without a PID controller, with a PID controller, and when given a disturbance. The measurement evaluations were performed by comparing the Kalman filter with the GY-521 MPU 6050 sensor readings. According to the simulation and real-time implementation results, the robot maintained balance for approximately one hour before the system was turned off and re-balanced itself when applied with external disturbances. The Kalman filter provides the best for the robot's system performance because it can reduce and eliminate noise in the readings when the robot is either stationary or subjected to a disturbance.

11-2-Data Availability Statement
The data presented in this study are available in article.

11-4-Conflicts of Interest
The authors declare that there is no conflict of interests regarding the publication of this manuscript. In addition, the ethical issues, including plagiarism, informed consent, misconduct, data fabrication and/or falsification, double publication and/or submission, and redundancies have been completely observed by the authors.