Professional Documents
Culture Documents
Robô Pêndulo Controle PID
Robô Pêndulo Controle PID
Robô Pêndulo Controle PID
net/publication/285470677
CITATIONS READS
0 679
4 authors, including:
Claudia Borzea
National Research and Development Institute for Gas Turbines
19 PUBLICATIONS 8 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Claudia Borzea on 18 May 2018.
Abstract - The complexity of the inverted pendulum system has drawn the interest of many researchers
around the world. Its instability feature is a good example for a control engineer, with the purpose of
verifying the control theory. To verify this system, equilibrium can be maintained, being possible to do
the simulation using a method with a closed loop controller, such as LQR or PID.
The article presents the achievement of a two-wheeled inverted pendulum (WIP) system, having an open-
source development Arduino platform as control centre, which is programmed with Processing open-
source environment. With the purpose of optimizing the system operation, a Kalman filter is implemented
on the Arduino platform.
1. Introduction
The stabilization issue has been increasingly approached The main goal was to design a mechatronic system
in recent years, being found in a very vast application consisting of an inverted pendulum articulated on the
range. One of the classical stabilization control issues is wheels axis of a two-wheeled system, with constructive
the inverted pendulum. The process is nonlinear and solutions to correct the design errors of existent
unstable, with a single input signal and several output products, and to simplify the realization of a control and
signals. The inverted pendulum presented in this article actuation system.
is a two-wheeled inverted pendulum system.
The stabilization of the inverted pendulum represents a 2. The structure of Two-Wheeled Inverted
basic model for the control of other similar processes, Pendulum (WIP) System
such as: rocket takeoff, equilibration of heavy loaded
cranes, etc. In recent researches, the balancing of the The design principle was the following: the mechanical
inverted pendulum has often been studied in the modern components consisted of LEGO components, the centre
control theories, such as fuzzy control, variable gain of gravity being chosen as high as possible in regard to
control, nonlinear control and neural networks. the axis of rotatio.
Besides these components used as support, the v3 control platform and an electronic block consisting
system also consists of motors (Lego NXT with 1:48 of L298 motor driver circuit, a DC-DC convertor with
integrated reduction gearbox and rotation transducer 3.3V DC, and a Bluetooth HC-05 communication
with 720 pulses per rotation), the Arduino Mega 2560 module for the connection with a computer system.
246 The Romanian Review Precision Mechanics, Optics & Mechatronics, 2015, Issue 48
PID Control for Two-Wheeled Inverted Pendulum (WIP) System
The control system also integrates a GY-521 3. The control program implemented on the
sensor based on MPU-6050. This one is used to provide Arduino platform
the necessary information to the control algorithm,
regarding angles, speeds and angular accelerations. Starting from the mathematical model necessary
Thus, an inertial sensor had to be installed, being for the implementation of the control algorithm, it was
necessary to read the data provided by this one, but also possible to elaborate the control program of the system,
to filter this data, in order to reduce noise and errors as which was implemented in the Arduino Mega platform.
much as possible. As programming environment, the open-source Arduino
MPU-6050 is the first integrated 6 axis motion software (IDE) was used, which uses Java programming
tracking device that combines a 3 axis gyroscope, a 3 language that is based on Processing open-source
axis accelerometer, and a digital motion processor language.
(DMP), all in a small package, of 4mmx4mmx0.9mm. The control algorithm for the inverted pendulum
The values received from MPU-6050 sensor are system is similar to the one presented in figure 3
transmitted to the Arduino development platform
through I2C interface.
The entire control process is a closed loop, the left motor, respectively minus the output of PID 3
steps repeating with a predetermined frequency (figure controller on right motor, or vice versa. Depending on
4). Initially, all parameters have to be declared and all the output reference of PID 1 controller, the entire
the necessary conditions have to be set for the following inverted pendulum structure can be controlled for
steps. This first step of initialization is included in moving forwards or backwards. Depending on the
setup() function of the program, and is passed through output reference of PID 3 controller, the structure can be
once. controlled so that to turn or rotate.
After passing through the first step, the program The frequency of passing through the loop is a
will run a closed loop, at the end of each set of steps very important factor, with direct effect on the stability
being obtained the command for each motor. The loop level of the system. In figure 4, the main steps are
of the program implemented on Arduino platform is presented briefly, behind whom there are various other
loop() function. The PWM signal for each motor is steps such as: calibration of the signals received from
equal to the sum of the outputs of PID 1, respectively sensors, filtering these signals, communication with
PID 2 controllers, plus the output of PID 3 controller on computer, checking the battery level, etc.
The Romanian Review Precision Mechanics, Optics & Mechatronics, 2015, Issue 48 247
PID Control for Two-Wheeled Inverted Pendulum (WIP) System
Figure 4: Main processing steps of the program implemented in the Arduino platform
Figure 5 presents the interface generated by the adjusted directly from here. By means of this program,
program. The upper part contains the graphics which the time necessary for the control process of the robot is
present interest, and the bottom part contains the significantly reduced.
parameters of the three PID controllers, that can be
248 The Romanian Review Precision Mechanics, Optics & Mechatronics, 2015, Issue 48
PID Control for Two-Wheeled Inverted Pendulum (WIP) System
For the statistically optimum estimation of the state of measurement. For the implementation of the filter on
the basic system, the implementation of a Kalman filter the Arduino platform, the functional model has been
is very useful. This algorithm uses a series of used, which was modified according to proper
measurements observed in time, which contain noise necessities. The original source code [4] belongs to
(random variations) and other inaccuracies, and realizes Kristian Lauszus, cofounder of TKJ Electronics, an
estimations of the unknown variables that tend to be enterprise in Denmark specialized in electronic
more accurate than the ones based on a single components and their applications.
(1)
(2)
Based on this equation, the code implemented in the Arduino platform is:
(3)
(4)
Based on this equation, the code implemented on the Arduino platform is:
(5)
Based on this equation, the code implemented on the Arduino platform is:
(6)
The Romanian Review Precision Mechanics, Optics & Mechatronics, 2015, Issue 48 249
PID Control for Two-Wheeled Inverted Pendulum (WIP) System
Based on this equation, the code implemented on the Arduino platform is:
(7)
(8)
Based on this equation, the code implemented on the Arduino platform is:
In case S is a matrix, P cannot be divided by S, and therefore the inverse matrix has to be computed.
(9)
In this case, the equation becomes:
(10)
Based on this equation, the code implemented on the Arduino platform is:
(11)
(12)
A posteriori error covariance is reduced because the state estimation error has been diminished.
Based on this equation, the code implemented on the Arduino platform (the following variations being chosen for most
IMU) is:
Instead of Kalman filter, a complementary filter can be implemented:
250 The Romanian Review Precision Mechanics, Optics & Mechatronics, 2015, Issue 48
PID Control for Two-Wheeled Inverted Pendulum (WIP) System
(13)
where the sum of the coefficients is 1. This filter is simpler, but less accurate, providing however good results when
used for simpler systems.
Figure 6: Graphics obtained in the following cases: unfiltered, filtered with Kalman Filter and filtered with
Complementary Filter
The Romanian Review Precision Mechanics, Optics & Mechatronics, 2015, Issue 48 251