0% found this document useful (0 votes)
24 views6 pages

2 Wheel Balancing Robot PID

This conference paper discusses the design and control of a two-wheeled balancing robot using a Linear-Quadratic Regulator (LQR) controller. The robot's system includes components like DC geared motors, an MPU 6050 sensor, and an Arduino Uno, focusing on achieving stability and balance on various surfaces. Experimental results demonstrate the effectiveness of the LQR controller in maintaining the robot's position in a balanced state.

Uploaded by

t01034339750
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views6 pages

2 Wheel Balancing Robot PID

This conference paper discusses the design and control of a two-wheeled balancing robot using a Linear-Quadratic Regulator (LQR) controller. The robot's system includes components like DC geared motors, an MPU 6050 sensor, and an Arduino Uno, focusing on achieving stability and balance on various surfaces. Experimental results demonstrate the effectiveness of the LQR controller in maintaining the robot's position in a balanced state.

Uploaded by

t01034339750
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/338674100

Control of Two-Wheeled Balancing Robot Using PID

Conference Paper · June 2019

CITATIONS READS
0 3,539

2 authors, including:

Aung Kyaw Nyein


West Yangon Technological University, Yangon, Myanmar
5 PUBLICATIONS 5 CITATIONS

SEE PROFILE

All content following this page was uploaded by Aung Kyaw Nyein on 18 January 2020.

The user has requested enhancement of the downloaded file.


Model-Based LQR Control of Two-Wheeled Balancing Robot
1
Khin Wai Hlaing Phyo, 2 Aung Kyaw Nyein
1,2
Department of Mechatronic Engineering (West Yangon Technological University),
Yangon, Myanmar
[email protected], [email protected]

solve balancing problem on various loose surfaces such as


Abstract— Two-wheeled balancing robot has working sand, pebble and soil [3]. The control techniques used are PID,
principle like inverted pendulum that the controller in the Linear-Quadratic Regulator (LQR), and Sliding Mode Control
mobile robot plays a critical role in self-balancing and .The comparison results of the three controllers are for angular
stabilizing. This paper inscribes the design, construction wheel position tracking, for external disturbances, and
and control of a two-wheeled balancing robot. There are parameter uncertainties in the model[4]. They proposed two
two DC geared motor, MPU 6050 and Arduino Uno in this
control methods, an innovative double PID control method and
system. The focus of this paper is to control the two-
a modern LQR (liner quadratic regulator) control method.
wheeled balancing robot by using Linear-Quadratic
Regulator (LQR) controller. In order to measure the angle Dynamic performance and steady state performance are
of robot, MPU 6050 is used and its measurement data noise investigated and compared of the two controllers [5].
is filtered using complementary filter. With the help of Reference [6] proposed that the presence of friction produces
encoder feedback, the control of two-wheeled balancing limits cycles. Considering one of the practical use of inverted
robot uses LQR controller included with adjusting motor pendulum, the electric two wheeled self-balancing vehicle, lots
speed and spinning direction. Kinematic and electrical of efforts have been spent to reduce the existed vibration by
parameters are determined experimentally, LQR control improved control algorithm [7] . The balancing robot principle
modelling based upon the linearized equations of motion. also has been implemented for transportation application. One
The experimental results show that the two-wheeled of them is Segway PT, a commercial personal transporter
balancing robot is able to maintain robot position at its product founded by Dean Kamen. It uses the same principle as
balanced condition. balancing robot but the movement depends on user’s body. To
move forward/backward, user needs to lean towards the
Keywords: Two-Wheeled Balancing Robot (TWBR), LQR
wanted direction and turning is controlled by the steer [8-9].
controller, MPU 6050, Complementary Filter, DC gear
motor with encoder. But many researchers related to balancing robot topics are still
focused on the balance control itself. In this paper, the robot
I. INTRODUCTION is composed of DC gear motors driving two wheels, a
structure, battery, MPU 6050 and microcontroller. It is a highly
Robotic technology to help human’s work is growing fast nonlinear and unstable system. LQR controller has been
nowadays. There are many researches that develop many kinds designed for balancing and stabilizing the robot.
of robot with different size, shape, and movement. Starting
from stationary robot that does not move its position, to mobile II. SYSTEM DESCRIPTION
robot that moves freely to any place. One of the applications A robot must employ a suitable control method to
of using these robots can be a service robot platform like obtain a good stability. The Two-wheeled balancing robot is
Segway. Different forms and uses, mobile robots have been built to serve as balancing robot for Linear Quadratic
designed and are in the market worldwide. As the result, Regulator (LQR) controller in this paper. Two-wheeled
balancing robots that serve various purposes have been balancing robot comprises of three main parts including
developed. TWBR is an open loop unstable system with highly sensors, microcontroller and motor as shown in Fig. 1.
nonlinear dynamics. TWBR problem is common in the field
of control engineering. One example for stationary robot is arm MPU
L298N Motor
robot which is commonly used as industrial robot that 6050 Arduino
resembles an inverted human arm mounted on a base [1]. The Motor
Uno
Encoder Driver
optimized SFC can only work in the certain operating range Motor
and cannot react to system uncertainty. When the operating
point is changed, the control gains have to be re-tuned in order Fig. 1 Block diagram of system components
to stabilize the robot, which is not very practical in the
In this block diagram, MPU-6050 sensor combines a 3-axis
operation. Recently, the soft computing techniques such as
accelerometer and a 3-axis gyroscope with Micro Electro
fuzzy logic and neural networks have been used to control
Mechanical System (MEMS).Accelerometer is used to detect
TWIP robot [2]. Two fuzzy controllers based on Mamdani and
angle of tilt or inclination along the X, Y and Z axes.
Takagi-Sugeno are designed for an inverted pendulum
Gyroscope is used to detect rotational velocity along the X, Y
subjected to disturbance. Moreover, artificial neural network-
and Z axes. The complementary filter provides data both for
based real-time switching dynamic controller is designed to
short and long term from gyroscope and accelerometer Equations 1 and 2 illustrate the displacement of point P along
respectively.The motor drive system with encoder consists of 𝑋𝑜 and 𝑍𝑜 axes;
motor controllers, and two DC motors. The robot uses dual H-
bridge motor controller to control two DC motors. For Xp = x + l sin θp (1)
controlling motor in both directions H bridge circuit is
used.Prototype of robot is shown in Fig. 2. Zp = l cos θp (2)

Lagrangian approach was used to generate the ordinary


differential equations (ODE) of system. Equation 3 shows the
general form of Lagrangian equation.
d ∂L ∂L
( )- = Qr (3)
dt ∂qr ∂qr

Equation 4 illustrates the Lagrangian equation of two-wheeled


balancing robot where, E is kinetic energy, U is potential
energy, F is dissipation energy and τr is required torque for left
Fig. 2 Prototype of Two-wheeled balancing robot
and right wheels.
A. Dynamic Modelling d ∂E ∂E ∂F ∂U
( )− + + = τr (4)
dt ∂q̇ r ∂qr ∂q̇ r ∂qr
The Dynamic model of two-wheeled balancing robot is
shown in Fig. 3 and the parameters description has been Total kinetic energy of chassis (EKC ) was observed by adding
provided in Table I. the translational and rotational kinetic energy of chassis.
TABLE I EKC = EKC ETKC + ERKC
LIST OF SYMBOLS AND SPECIFICATIONS
1 1
EKC = m(v 2 + l2 ωp 2 ) + mvlωp cos θp + Jc ωp 2 (5)
2 2
Parameters Description
Total kinetic energy of wheels (EKW ) was observed by adding
g =9.81 Gravity acceleration (m/s^2)
the translational and rotational kinetic energy of wheels.
M=0.0227 Wheel mass(kg)
EKW = ETKW + ERKW
R=0.035 Wheel radius(m) v2
EKW = Mv 2 + Jw (6)
R2
m=0.84 Chassis mass(kg)
Total kinetic energy (E) of two-wheeled balancing robot was
Distance of the center of the mass observed by adding equations 5 and 6.
l=0.032
from the wheel axle(m)
E = EKC + EKW
Jw= 4.593E-05 Wheel inertia moment(kg*m^2)
1 1
E= m(v 2 + l2 ωP 2 ) + mvl cos θP ωP + JC ωP 2 + Mv 2 +
Jc=0.0032 Chassis inertia moment(kg*m^2) 2 2
v2
JW
R2
coefficient of friction between
u0=0.1 1 1 1
wheel and ground E = mv 2 + ml2 ωP 2 + mvl cos θP ωP + JC ωP 2 + Mv 2 +
2 2 2
v2
coefficient of friction between JW (7)
u1=0 R2
chassis and wheel
There are no changes in potential energy of wheels while robot
moves. Therefore, total potential energy of system (U) was
defined by equation 8.

U = mgl cos θP (8)

Total dissipation energy of system (F) was defined by equation


9.

F = μ0 v 2 + μ1 ωP 2 (9)

Displacement of balancing robot was selected as the first


general variable (q1 ) in Lagrangian equation of system.
Fig. 3 Dynamic model of two-wheeled balancing robot
q1 =x. The first differential equation of system equations 10 is X=[ x θP v ωP ]T (16)
2JW
(m + 2M + ) ẍ + ml(cos θP )θ̈P + 2μ0 v = 0 (10) Equation 17 shows the expanded version of state equation.
R2
Ẋ1 A11 A12 A13 A14 X1 B1
Pitch angle of balancing robot was selected as the second
general variable (q2 ) in Lagrangian equation of system. Ẋ 2 A21 A22 A23 A24 X2 B2
=[ ]×[ ]+[ ]×u (17)
Ẋ 3 A31 A32 A33 A34 X3 B3
q2 = θP .The second differential equation of system equations ̇
[X 4 ] A41 A42 A43 A44 X4 B4
11 is;
Therefore, A, B, C and D matrices are shown below;
ml(cos θP ) ẍ + (ml2 + JC )θ̈P + (mvωP − mg)l(sin θP ) +
2μ1 ωP = τL + τR (11) 0 0 1 0
0 0 0 1
Equations 10 and 11 are two non-linear equations of two- (ml)2 g 2μ0 (ml2 +JC ) 2mlμ1
A= 0 −
den

den den
wheeled balancing robot. There is only one equilibrium point J J
(m+2M+2 W2 )mgl 2μ0 ml 2μ1 (m+2M+2 W2)
for balancing robot and it is when robot is balanced or up-right. R R
[0 den den

den ]
Therefore, it was assumed that θP = 0.
(18)
sin θP ≈ θP 0
cos θP =1 0
ml
B= − (19)
den
Linear equations of two-wheeled balancing robot were J
m+2M+2 W
observed by substituting equations 10 and 11 into non-linear R2
[ den ]
equations. Equations 12 and 13 show the linear equations of
system. 1 0 0 0
C=[ ] (20)
0 1 0 0
2JW
(m + 2M + ) ẍ + mlθ̈P + 2μ0 v = 0 (12)
R2

ml(cos θP ) ẍ + (ml2 + JC )θ̈P + (mvωP − mg)lθP + 0


D=[ ] (21)
2μ1 ωP = τL + τR (13) 0

B. State-Space Modelling Where ;


JW
Equations 14 and 15 are two equations of general state- den = (m + 2M + 2 ) (ml2 + JC ) − (ml)2 (22)
R2
space model for a dynamic system. Fig.4 illustrates the related
block diagram of the state-space equations. The state equation express by substituting parameters;

Ẋ = AX + Bu (14) 0 0 1 0 x 0
0 0 0 1 θP 0
Ẋ = [ ]×[ v ]+[ ]u
Y = CX + Du (15) 0 −2.2150 −2.5376 0 −8.46
0 79.1397 16.8 0 ωP 302.31
The output equation express;
x
1 0 0 0 θP
Y=[ ]×[ v ]
0 1 0 0
ωP

Fig. 4 Block Diagram of state space equation III. PROPOSE METHOD


In this paper, Linear Quadratic Regulator is used to stabilize
Four state variables were chosen for dynamic system of two- a Two-wheeled balancing robot. LQR controller is useful to
wheeled balancing robot. Equation 16 shows the state vector handle multivariable systems that is also called a state-
of dynamic system (X). Four elements of state vectors are: feedback control system. The optimal control will be written
Chassis displacement, x as a state feedback, given by the equation 23.
Chassis pitch angle, θP U(k) = - K x(k) (23)
Chassis velocity, v
Chassis angular velocity, ωP To determine the gain matrix K, the performance index, cost
function J should be minimized by equation 24.
State variables of velocity and angular velocity are derivative
k −1
of displacement and pitch angle respectively in equation 16. 1
J = ∑k=ko
x T (k + 1)Qx(k + 1) + uT (k)Ru(k) (24)
Q and R are weight function for the states relates to as to reach stable state of the system. As the simulation results,
controller accuracy and the inputs relates to controller effort. the robot moved forward and balanced itself after 0.25
Q is a positive semidefinite matrix and R is a positive definite seconds.
matrix. The key for optimal controller design is to select the
appropriate weighting matrix Q and R. The widespread IV. EXPERIMENTAL RESULTS
method used to choose Q and R by means of simulation and This paper tends to design and develop the prototype for
trial. The larger weight matrix Q will increase the gain matrix, two wheeled balancing robot with LQR controller. The control
K which can make fast response system to achieve circuit and the structure of the robot are successfully
intermediate state cost function. In this section, the LQR constructed. The robot has achieved results at a satisfactory
controller is tuned by changing the nonzero elements of the level and the testing results of the experimental system which
Q11 and Q22 elements, which, corresponding to and closely is implemented are described. The gain value of position data
influence the two concerned states: position and angle. R value is not use for balancing condition. The following experimental
is set to 1.We choose the weighting matrix; result test1 of Fig. 7 and 8 are listed using the value obtained
gain, K= [0 3.43 0 5.79].
5000 0 0 0
0 10 0 0
Q=[ ] , R=1
0 0 0 0
0 0 0 0
In MATLAB, we can use the command lqr(A,B,Q,R) to
obtain the linear state feedback controller of gain matrix K.
This controller had the gain, 𝑲 = [0.001 3.43 201.68 5.79]
for balancing robot. Fig. 5 and 6 illustrate the closed-loop
impulse response of displacement and pitch angle of system
respectively.

Fig. 7 Pitch Angle and PWM for LQR Balancing Test1

Fig. 5 Closed-loop Simulation Result for Displacement

Fig. 8 Experimental Overall Result for LQR Balancing Test1


In this experiment with the value obtained gain K, vehicle
start capable to be balanced but the response is oscillation.
LQR control is calculated based on a linear model of the plant
under control. If the linear model represents plant exactly, then
the controller is optimal. However, there are plant changes or
nonlinearities and then the resulting controller will degrade
and the system may even become unstable. The states of a
Fig. 6 Closed-loop Simulation Result for Pitch Angle system can have some physical meaning (e.g. velocity,
The state feedback controller with LQR control method is acceleration), but sometimes they have no physical
used as a closed loop system to get the good responses as well interpretation at all. Consequently, there may be difficulty in
obtaining the states to use for feedback. Therefore, we adjusted ACKNOWLEDGMENT
the gains by means of intuition manual tuning. The following Specials thanks are due to my supervisor Dr. Aung Kyaw
experimental result test2 of Fig. 9 and 10 are listed using the Nyein (Professor), Department of Mechatronic Engineering
reduce value of gain, K= [0.15 2.35 0.1 5.5].
(West Yangon Technological University) and my co-
supervisor Dr. Aemi Aung (Professor), Department of
Mechatronic Engineering (West Yangon Technological
University) for their kindness and guidelines for this paper. I
wish to thank my teachers to help me through this paper. I
would like to express my special thanks to my parents for their
noble.

REFERENCES
[1] Schilling, Robert. "Fundamentals of robotics." (2013).

[2] Marzi, Hosein. "Fuzzy control of an inverted pendulum


using AC induction motor actuator." In Computational
Intelligence for Measurement Systems and Applications,
Proceedings of 2006 IEEE International Conference on, pp.
109-114. IEEE, 2006.
Fig. 9 Pitch Angle and PWM for LQR Balancing Test2
[3] Unluturk, Ali, and Omer Aydogdu. "Adaptive control of
The value of reduce gain, K is the best response when two-wheeled mobile balance robot capable to adapt different
compared with the testing. The robot is able to maintain the surfaces using a novel artificial neural network–based real-
upright standing balance position in Fig. 9. time switching dynamic controller." International Journal of
Advanced Robotic Systems 14, no. 2 (2017):
1729881417700893.

[4] Juan Villacrés, Michelle Viscaíno, Marco Herrera, Oscar


Camacho "Real-Time Implementation of Different Controllers
for a Two-wheeled Inverted Pendulum" INTERNATIONAL
JOURNAL OF CIRCUITS, SYSTEMS AND SIGNAL
PROCESSING ,Volume 10, 2016 .

[5] Wende Li, Hui Ding , Kai Cheng "An Investigation on the
Design and Performance Assessment of double-PID and LQR
Controllers for the Inverted Pendulum" UKACC International
Conference on Control 2012
Cardiff, UK, 3-5 September 2012 .

[6] H. T. Teixeira, Victor Semedo de Mattos Siqueira, Celso


Jose Munaro, “Comparison of Methods for Estimation and
Fig.10 Experimental Overall Result for LQR Balancing Test2 Compensation of Friction Applied to an Inverted Pendulum,”
Proceedings of the IEEE, International Conference on Control
Overall result contain pitch angle, pulse width modulation and Automation, Santiago, Chile, pp. 818-823, December
PWM, left and right revolution per minute RPM. Experimental 2011.
overall result for LQR balancing test as shown in Fig. 10.
[7] D. Chol, J. Oh, “Human-friendly Motion Control of a
V. CONCLUSION Wheeled Inverted Pendulum by Reduced-order Disturbance
We have constructed two-wheeled balancing robot, and Observer,” Proceedings of IEEE, International Conference on
implemented a pitch angle estimator and stabilizing LQR Robotics and Automation, Pasadena, USA, pp. 2521-2526May
controller for the balancing motion. Optimization of 2008.
mechanical design will be required design improvement for [8]"Segway PT." Wikipedia. Wikimedia Foundation. Web.
balancing motion. The two-wheeled balancing robot system 30 Apr. 2015. <https://en.wikipedia.org/wiki/Segway_PT>.
gets a stable and smooth condition by this control method,
which provides a stable and reliable balance condition for the [9] "Segway - The Leader in Personal, Green Transportation."
motion control. The robot can balance the upright position only Segway - The Leader in Personal, Green
by using two wheels. As future work, it is considered how can Transportation.Web.11Mar.2015.<http://www.segway.com/.
compare robot position at its balanced condition with another
methods.

View publication stats

You might also like