A Comparison between PID and LQR controllers for stabilization of a ball
balancing robot
SHASHI BHUSHAN SANKHYAN1, GUNCHITA KAUR WADHWA2
1University of Mumbai, Department of Mechanical Engineering, Pillai HOC College of Engineering and Technology,
Rasayani, 410207, Maharashtra, INDIA
2 Department of Mechanical Engineering, ASET, Amity University Mumbai, Panvel, 410206, Maharashtra, INDIA.
Abstract: Ball balancing robot (BBL) forms a dynamically stable system mounted on a ball which is in point
contact with the ground surface. An omni-directional system for the BBL with maneuvering ability in the
horizontal plane is attained as compared to two-wheeled robots, which can only move forward or backward.
The stability of the BBL is defined by its capability to retain the upright position under all circumstances.
Available literature [1, 2, 4, 5] includes the use of several single controllers to stabilize the BBL. This study
performs a comparison of two popular controllers for stability analysis of the BBL, which included two
model-based controllers, i.e., Proportional Integral Derivative (PID) and Linear Quadratic Regulator (LQR).
A 2D planar model is considered for mathematical modeling at the two vertical planes as well as the
horizontal plane. Furthermore, the steady state equations are derived using the Euler-Lagrangian method.
PID and LQR controllers are used to provide stability to the BBL using a mathematical toolkit in MATLAB.
The results from MATLAB are used to study the differences between PID and LQR for stability of the BBL
based on time needed to balance the robot. The settling time for the PID and LQR controllers was 0.79
seconds and 2.25 seconds, respectively. The results illustrate that the PID controller stabilized the BBL in
upright position efficiently and more swiftly as compared to the LQR controller.
Keywords: Ballbots; LQR; MATLAB; Mathematical Modeling; PID.
Received: September 27, 2022. Revised: May 25, 2023. Accepted: June 21, 2023. Published: July 17, 2023.
1. Introduction
Self-balancing robots are well acknowledged for
their ability to stabilize themselves using one or two
wheels or a ball [11]. The concept of inverted
pendulum is applied for either type, i.e., the center
of mass of the robot lies above its point of contact
with the ground. The pioneering concept based on
this method is the two-wheeled robot, which
balances itself with a point contact on the ground.
This allows it to move freely in forward and
backward directions, as used in the popular Segway
RMP wheelchair, [6, 12] known as the IBOT.
Subsequently, further developments in the same
field emerged with tele-presence [7] and UBOT [8, 9,
10]. A major limitation is that the wheels of the robot
were uni-directional due to which the bot is falling
in the vertical plane and not permitting sideways
movement. This led to the development of the
single wheeled robots which overcame this
constraint and could perform several tasks in
desired directions with ease.
Ballbots were developed as the shortcomings of the
two wheeled robots were apprehended [3, 13, 14, 15].
Unlike two wheeled robots, BBL can balance itself
on a ball and moreover it can maneuver in any
direction at any instant (omni-directional). The
principle on which the BBL works is to keep the
center of mass of the robot in line with the point of
contact between the ground surface and the ball.
Therefore, in order to keep the robot in upright
position, the movement of the ball is controlled
counter to movement of the body. This is achieved
by using omni-directional wheels which rotate the
main ball in contact with ground in the counter
International Journal on Applied Physics and Engineering
DOI: 10.37394/232030.2023.2.10
Shashi Bhushan Sankhyan, Gunchita Kaur Wadhwa
E-ISSN: 2945-0489
93
Volume 2, 2023
direction further maintaining upright position of the
robot.
A BBL mainly consists of three mechanical parts:
body, undercarriage and the ball. The undercarriage
consists of three omni-directional wheels attached
to DC motors which are placed rotation-
symmetrically at 120° on the ball. The omni-
directional wheels are mounted on a ball that rolls
on the ground allowing the robot to move in any
direction. The body of the robot is mounted on the
undercarriage. The dynamics of the BBL is complex
given the ability to move along all directions in the
horizontal plane. The first prototype of a BBL was
developed by Tom Lauwers and Ralph Hollis. They
incorporated rollers instead of omni-directional
wheels and a belt drive mechanism which allowed
the ballbot to move forward [16, 5]. Consequently,
there were many upcoming researchers which began
to research on this topic [2, 17, 18, 19].
Laszlo Havasi (2005) autonomously developed a
ballbot named ERROSphere, which used optimal
control theory using a linear quadratic regulator
(LQR) model based on a linear approximation of
the system equations. Furthermore, Kumagai (2008)
named his work as BallIP [14] at the Tohoku Gakuin
University. The model in this case could balance
not only the robot itself but also an additional
weight of 3 kg, which demonstrated another
application of the ballbot in the field of
transportation. In 2010, students of mechanical
engineering department of a University in Zurich
developed a ball balancing robot named Rezero.
The main characteristics of Rezero were that it
could maneuver like a human being.
A second prototype of Ballbot was made by Tohoku
Gakuin University (TGU) utilizing stepper motors
placed at the corners forming a shape of a triangle
which took into account the yaw mechanism [16, 20].
University Of Adelaide demonstrated their ballbot
and tried to balance it on using balls of an
assortment of sizes [16, 21]. Till date the studies on
BBL were carried out using single controller to
stabilize the BBL. This paper presents the
comparison of two model-based controllers, i.e.,
PID and LQR.
The current study focuses on the comparison of two
controllers, LQR and PID with an objective to
develop an optimal system controller. For
previously developed balancing robots, researchers
have used only a single controller for the system.
The authors could not find a comparison study for
the two most popular controllers. The objective of
the current study is to develop a prototype of BBL
and study the two controllers on the system and
suggest the best out of two for better stability of the
BBL.
2. Mathematical Modeling
A 2D model for the BBL is considered for this
study. Mathematical model for two planes i.e.,
vertical plane (YZ/XZ) and horizontal plane (XY)
are used for generating the equations of motion.
International Journal on Applied Physics and Engineering
DOI: 10.37394/232030.2023.2.10
Shashi Bhushan Sankhyan, Gunchita Kaur Wadhwa
E-ISSN: 2945-0489
94
Volume 2, 2023
Figure 1. 2Dmodel of the BBL.
Where
rB Radius of the ball
rW Radius of Omni wheel
IB Moment of inertia of the ball
IW Moment of inertia of the Omni wheel in the YZ-/XZ-plane
IWxy Moment of inertia of the Omni wheel in the XY-plane
IA Moment of inertia of the body of the robot in the YZ-/XZ-plane
IAxy Moment of inertia of the body of the robot in the XY-plane
l Distance between COM of the ball and COM of the body of the robot
And,
And specify the orientation of the ball,
, and specify the orientation of the body and
, and specify the orientation of the virtual actuating wheels.
2.1 Mathematical model
Energy in YZ/XZ Plane
Derivation of the kinetic energy and the potential
energy of the different parts of the BBL including
the equations for the ball, the frame, and the omni-
directional wheels were obtained.
The kinetic energy (T) of the ball is given as the
summation of translational and rotational energy:


󰇗
󰇗
The potential energy (V) of the ball is given by
(1)
(2)
International Journal on Applied Physics and Engineering
DOI: 10.37394/232030.2023.2.10
Shashi Bhushan Sankhyan, Gunchita Kaur Wadhwa
E-ISSN: 2945-0489
95
Volume 2, 2023
The potential energy for the ball is zero as the ball is moving on horizontal surface and therefore has no
potential energy.
Similarly, the kinetic and potential energy of the body are given underneath
Whereas the potential energy is

Energies of the omnidirectional wheel are denoted as

󰇟󰇛
󰇗
󰇛󰇜󰇗󰇗󰇛󰇜󰇗
󰇠
󰇛
󰇗󰇗󰇜
󰇛󰇜
Lagrangian equation for the YZ/XZ Plane is given by summation of kinetic energies for ball, body and
omnidirectional wheels and subtracting the summation of potential energies.
󰇗󰇗
Further to which as the Lagrangian for the YZ/XZ plane is used to find the equation of motions by using
Euler Lagrangian equation, which is given by

󰇗 

󰇧
󰇗󰇨 


(3)
(4)
(7)
(8)
(9)
(5)
(6)
International Journal on Applied Physics and Engineering
DOI: 10.37394/232030.2023.2.10
Shashi Bhushan Sankhyan, Gunchita Kaur Wadhwa
E-ISSN: 2945-0489
96
Volume 2, 2023
The equations of motion are derived from the above
Euler Lagrange further to which result is obtain by
combining the equations in the form below
󰇘󰇗󰇗

 
 

󰇟󰇛󰇜󰇠
 󰇛󰇜󰇟󰇠󰇟
󰇠
 󰇛󰇜󰇟󰇠󰇟
󰇠
 󰇛󰇜
 󰇛󰇜󰇗󰇛󰇜

󰇛󰇜󰇛󰇛󰇜󰇜
2.2 3D Solid model
The 3D model for the BBL is prepared using
commercial software (Solid works 2014 developed
by Dassault Systems version 22 release date
October 7, 2013). This model represents an
overview of the actual model of the Ballbot as
shown in Figure 2.
(10)
(11)
(12)
(13)
(14)
(15)
(16)
(17)
International Journal on Applied Physics and Engineering
DOI: 10.37394/232030.2023.2.10
Shashi Bhushan Sankhyan, Gunchita Kaur Wadhwa
E-ISSN: 2945-0489
97
Volume 2, 2023
Figure 2. 3D Solid works model showing the BBL in upright position
2.3 State Space
Applying Lagrange equation to the above model the
State Space for YZ/XZ Plane is denoted by
󰇘󰇘󰇗
(18)
󰇘󰇘
(19)
󰇗
(20)
󰇗󰇘
(21)
󰇗󰇛󰇗󰇜
(22)
󰇗
(23)
󰇗󰇛󰇗󰇜
(24)
󰇗
(25)

(26)
Table 1: Parameters derived from 3D model
Parameter
Description
Value
mb
mass of ball
0.181[kg]
ma
mass of body
1.64 [kg]
mw
mass of omnidirectional wheel
0.00782 [kg]
rb
radius of ball
0.062 [m]
rw
radius of omnidirectional wheel
0.0225 [m]
l
length of end of body to c.o.g.
0.219 [m]
Ib
moment of inertia of ball
4.63 x 10^-4 [kg-m^2]
Iw
moment of inertia of omnidirectional wheel
1.98 x 10^-5 [kg-m^2]
Ia
moment of inertia of body
5.4 x 10^-3 [kg-m^2]
g
gravitational acceleration
9.81 [m/s/s]
International Journal on Applied Physics and Engineering
DOI: 10.37394/232030.2023.2.10
Shashi Bhushan Sankhyan, Gunchita Kaur Wadhwa
E-ISSN: 2945-0489
98
Volume 2, 2023
󰇯






󰇰
󰇯 


󰇰
󰇣



󰇤
󰇣
󰇤
Figure 3. Actual prototype
a) Isometric view showing the acrylic plate,
b) Front view showing the body and omnidirectional wheel
2.4 Controller design
ProportionalIntegralDerivative (PID)
controller is a control loop feedback
mechanism (controller) commonly used in control
systems. A PID controller continuously calculates
an error value e(t) as the difference between a
desired set point and a measured process
variable and applies a correction based
on proportional (Kp), integral (Ki), and derivative
(Kd) terms.
The controller tries to minimize the error over time
by tuning of a control variable u(t), which is further
dependent on coefficients of proportional, integral
and derivative terms given by the following
formula.
a
b
International Journal on Applied Physics and Engineering
DOI: 10.37394/232030.2023.2.10
Shashi Bhushan Sankhyan, Gunchita Kaur Wadhwa
E-ISSN: 2945-0489
99
Volume 2, 2023
Figure 4.A block diagram of a PID controller in a feedback loop
Linearquadratic regulator (LQR) is a method to
define state-feedback control gain matrix .
In LQR controller two parameters, R and Q, are
considered which balances the control effort (u) and
error, respectively. The simplest case is to assume
R=1 and Q=C’*C.
The LQR method basically allows for the control of
both outputs (the body angle and the ball position).
So as the value of Q is given by C’*C, Q is
represented by a 4x4 matrix as
Q=󰇯
󰇰
The element (1, 1) in the above matrix denotes the
weight on the ball’s position and the element (3, 3)
denotes the weight on the body’s angle. The input
weight value R is considered at 1. Now further the
value of K which is given by k=lqr (A,B,Q,R) is
plotted in the graph shown in Figure 7.
3. Results and Discussion
The performance of both, PID and LQR controllers
for the BBL are presented in this section by
comparing the settling time and peak amplitude.
International Journal on Applied Physics and Engineering
DOI: 10.37394/232030.2023.2.10
Shashi Bhushan Sankhyan, Gunchita Kaur Wadhwa
E-ISSN: 2945-0489
100
Volume 2, 2023
Figure 5. Response of the body position to an impulse disturbance under PID control
The response of the body position to an impulse
disturbance under PID control when the values of
Kp =100, Ki =1 and Kd =1 is illustrated in Fig. 5.
The amplitude vs. time graph shows that the
Settling time for the system is 0.175 seconds and
the peak amplitude is 0.449 radians after 0.02
seconds. The settling time of the response is
determined to be 0.175 seconds, which is less than 2
seconds and which is well within the accepted limit.
As per the literature [14, 15] the limit for settling time
for the robot is 2 seconds and tilt angle is 5°. Since
the steady-state error approaches to zero in a
sufficiently swift manner, no further integral tuning
is needed. The peak response, however, is larger
than the needed value of 0.08 radians (5˚).
Therefore the overshoot can be controlled by
increasing and tuning the amount of derivative
control. Hence, at Kd=12 proper response is
achieved and graph is plotted showing its
characteristics as shown in Figure 6.
International Journal on Applied Physics and Engineering
DOI: 10.37394/232030.2023.2.10
Shashi Bhushan Sankhyan, Gunchita Kaur Wadhwa
E-ISSN: 2945-0489
101
Volume 2, 2023
Figure 6. Response of the body position to an impulse disturbance under PID control
Figure 6 depicts the response after changing the
derivative control Kd=12, the overshoot has been
reduced so that the body does not move more than
away from the vertical axis. Additionally, it is
observed that the settling time for the system is
0.483 seconds and the overshoot is controlled as the
peak amplitude value is 0.048 radians after 0.01
seconds.
Figure 7. Step response with LQR
Figure 7 illustrates the peak amplitude for LQR
controller as 0.025 m which is lower as compared to
earlier results of PID controller. However, the time
taken to balance the system is 2.25 seconds, which
is higher as compared to PID controller.
International Journal on Applied Physics and Engineering
DOI: 10.37394/232030.2023.2.10
Shashi Bhushan Sankhyan, Gunchita Kaur Wadhwa
E-ISSN: 2945-0489
102
Volume 2, 2023
Table 2: Comparison between PID and LQR controller
Controllers
Rise Time(s)
Settling Time(s)
Peak Amplitude(m)
Peak time(s)
PID
0.004
0.798
0.0481
0.01
LQR
0.004
2.25
0.025
0.1
The comparison in the Table 2 shows that PID
controller has more overshoot in the beginning but
it controls and balances the system in 0.798 seconds
as compared to LQR controller for which overshoot
is less but settling time for stabilization is 2.25
seconds. Thus for this system PID controller gives
better results for stabilization as compared to LQR
controller.
Figure 8: Comparison of tilt angle response using PID controller between SBR (Self-balancing Robot)
and BBL
The comparison between BBL and SBR [22] in the
aspects of the performance of the control system is
shown in Figure 8. The results show that the
response time to get BBL stable is less as compared
to SBR. Moreover, PID controller has a higher
overshoot in case of SBR. As illustrated by Wei An
[22] for a control system on a two wheeled self-
balancing robot and using PID controller studied the
response performance. Similarly, the current study
illustrates that the BBL is more efficient than SBR
when compared for stabilization of the robotic
system.
4. Conclusion and Future Work
In this paper, a detailed 2D mathematical model of a
ball balancing robot, named BBL, has been
presented. The dynamic model of BBL mobile robot
with nonlinear equations has been derived using
Lagrange’s method. The equations derived are then
linearized using the Euler-Lagrangian approach and
further analyzed for controller design. The
linearized equations have been analyzed to see
whether the system is controllable and observable,
-0,4
-0,2
0
0,2
0,4
0,6
0,8
1
1,2
1,4
-0,25 0 0,25 0,5 0,75 1 1,25 1,5
Amplitude
Time (Seconds)
SBR
BBL
International Journal on Applied Physics and Engineering
DOI: 10.37394/232030.2023.2.10
Shashi Bhushan Sankhyan, Gunchita Kaur Wadhwa
E-ISSN: 2945-0489
103
Volume 2, 2023
and can be stabilized. State space model has been
derived to get final equations for further assessment.
Comparison between the two model-based
controllers, i.e., PID and LQR for balancing the
robot has been presented. Experiments have been
carried out to test the controllers and the results are
presented for stabilization time and swift
movement. A comparative study based on the
system between PID and LQR illustrates that the
PID controller stabilizes the BBL in upright
position more efficiently and faster as compared to
the LQR controller.
In future work, 3D mathematical modeling will be
taken into account and the controllers will be
compared in real time.
5. Statements & Declarations
5.1 Funding
This work was supported by University of
Mumbai as a part of minor research project,
(Grant number 424). Author 1 Mr. Shashi
Bhushan Sankhyan has received research
support from University of Mumbai.
5.2 Competing Interests
The authors have no relevant financial or
non-financial interests to disclose.
5.3 Author Contributions
All authors contributed to the study
conception and design. Literature survey,
3D modeling and analysis were performed
by Mr. Shashi Bhushan Sankhyan and Ms.
Gunchita Kaur Wadhwa. All authors read
and approved the final manuscript.
References
[1] R.Hollis. Ballbots. Scientific American,.
[Online] October 23, 2006. [Cited: December 23,
2014.]
[2] Development of a robot balanced on a ball- first
report, implementation of the robot and basic
control,”. M. Kumagai and T. Ochiai. 2010,
Journal of Robotics and Mechatronics, vol. 22, no.
3,, pp. 348–355,.
[3] A Dynamically Stable Single -Wheeled Mobile
Robot with Inverse Mouse Ball Drive .
T.B.Lauwers, G.A. Kantor,R.L.Hollis. 2006.
[4] XIN, YEOH JIA, Balancing
Ballbot”.Universiti Teknologi Malaysia 2012, p. 99.
[5] One is enough. Tom Lauwers, George Kantor
and Ralph Hollis. 2005, 12th International
Symposium on Robotics Research.
[6] Suomela, Tomi Ylikorpi and Jussi. Ball-shaped
Robots. [book auth.] Houxiang Zhang. Climbing &
Walking Robots, Towards New Applications,.
Vienna, Austria : Itech Education and Publishing,
2007, pp. 546,.
[7] Segway robotic mobility platform. H. G.
Nguyen, J. Morrell, K. Mullens, A. Burmeister,S.
Miles, N. Farrington, K. Thomas, and D. Gage.
2004, In SPIE Proc.5609: Mobile Robots XVII,.
[8] Anybots. [Online] 2010. [Cited: November 28,
2014.] http://anybots.com,.
[9] Designing a self-stabilizing robot for dynamic
mobile manipulation. P. Deegan, B. Thibodeau, and
R.Grupen. 2006, Robotics: Science and Systems -
Workshop on Manipulation for Human
Environments.
[10] Mobile manipulators for assisted living in
residential settings. P. Deegan, R. Grupen, A.
Hanson, E.Horrell, S. Ou,E. Riseman, S. Sen, B.
Thibodeau, A. Williams, and D. Xie. 2008,
Autonomous Robots, Special Issue on Socially
Assistive Robotics,, pp. 24(2):179–192,.
[11] Golem Krang:Dynamically stable humanoid
robot for mobile manipulation. M. Stilman, J.
Olson,and W. Gloss. 2010, In Proc. IEEE Int’l
Conf. on Robotics and Automation,, pp. 3304
3309,.
[12] Kumar, Vivek.Self Balancing Bots. Kanpur :
IIT, 2012.
[13] Ballbot Rezero: Mechanical design, system
modeling and control. M. Neunert, P. Fankhauser,
S. Leutenegger, C. Pradalier, F. Colas,and R.
International Journal on Applied Physics and Engineering
DOI: 10.37394/232030.2023.2.10
Shashi Bhushan Sankhyan, Gunchita Kaur Wadhwa
E-ISSN: 2945-0489
104
Volume 2, 2023
Siegwart,. 2013, IEEE Robotics and Automation
Magazine.
[14] Dvelopment of a Robot Balancing on a Ball.
M.Kumagai, T.Ochiai. 2008.
[15] “Dynamic modeling and sliding-mode control
of a ball robot with inverse mouse-ball drive. C.-W.
Liao, C.-C.Tsai, Y. Y. Li, and C.-K. Chan. Aug.
2008, SICE Annual Conference, pp. 2951 – 2955.
[16] Kugel Balance: Ballbots-the future of personal
transport? Vijay Ramnath, Swarnim Raizada. 2013,
p.3.
[17] ERROSphere: an equilibrator robot. Havasi., L.
2005, Int’l Conf. on Control and Automation, pp.
971-976.
[18] “Development of a robot balanced on a ball
Application of passive motion to transport. Ochiai.,
M. Kumaga and T. 2009, Int. Conf. Robotics and
Automation ICRA ’09., pp. 4106-4111.
[19] Rezero. [Online] 2010.
http://www.rezero.ethz.ch.
[20] Development of a Robot Balanced on a ball-
First report,Implementation of the robot and basic
control. Ochiai, Masaaki Kumagaind Takaya. 2010,
Journal of robotics and Mechatronics.
[21] J.Fong, S.Uppill. Design and Build a Ballbot.
Adelaide,Australia : s.n., 2009.
[22] Wei An and Yangmin Li. Simulation and
control of a two wheeled self-balancing robot,
ROBIO, china DEC2013.
Contribution of Individual Authors to the
Creation of a Scientific Article (Ghostwriting
Policy)
The authors equally contributed in the present
research, at all stages from the formulation of the
problem to the final findings and solution.
Sources of Funding for Research Presented in a
Scientific Article or Scientific Article Itself
No funding was received for conducting this study.
Conflict of Interest
The authors have no conflicts of interest to declare
that are relevant to the content of this article.
Creative Commons Attribution License 4.0
(Attribution 4.0 International, CC BY 4.0)
This article is published under the terms of the
Creative Commons Attribution License 4.0
https://creativecommons.org/licenses/by/4.0/deed.en
_US
International Journal on Applied Physics and Engineering
DOI: 10.37394/232030.2023.2.10
Shashi Bhushan Sankhyan, Gunchita Kaur Wadhwa
E-ISSN: 2945-0489
105
Volume 2, 2023