Chapter1 Introduction
Chapter1 Introduction
ISSN: 2278-0181
NTASU - 2020 Conference Proceedings
Abstract— Self-balancing robot is an effective approach to the development, with applications ranging from robotics, to
development and advancement in the field of robotics. In this process control and network control.
particular model, the concept of inverted pendulum is used. Self-
balancing is a process by which a system achieves stability by This paper explains the design along with the construction
internal forces. The basic idea of this project is to overcome the
challenge of balancing initially unstable system, by providing
and control mechanism of a two-wheel self-balancing robot.
control mechanism to the robot so that it can balance on its own. This robot is self-driven by the interaction of the following
The robot uses sensor values provided by accelerometer and components: DC motors, a microcontroller, a gyroscope(3-
gyroscope to find exact position of itself in three-dimensional axis) and an accelerometer(3-axis) for attitude determination.
geometry and send the values to microcontroller. The To deal with the problem of sudden horizontal movements and
microcontroller on the other hand uses programs in it to give gyro drifts in sensors, a complementary filter is
proper instruction about rotation of wheels to the motor driver implemented[3]. PID(proportional integral derivative), is the
module which in turn helps to balance the robot. This robot is feedback mechanism used for this project.
advantageous over traditional four wheeled robots as it helps in
taking sharp turns and navigating through tighter areas thus,
serving as an essential machine for various industrial
BLOCK DIAGRAM OF CONTROL SYSTEM
applications.
Fig.1 illustrates the block diagram of the system. This
Keywords- ATMEGA328P, Self-Balancing, Accelerometer, shows the output from certain blocks and their respective
Gyroscope, PID, Complementary filter inputs. The microcontroller ATMEGA328P acts like the heart
of the system. Because it manages to input readings from the
INTRODUCTION Sensors which include Accelerometer and Gyroscope, and
The invention of self-balancing robots has been a massive Complementary filter , and based on these readings
milestone in the history of robotics. These machines are communicates with the motor driver.
particularly characterized by their ability to balance on two
wheels by the implementation of a closed loop algorithm. A MPU6050 Compleme Microco
self-balancing robot has an unstable dynamic system unlike M ntary filter ntroller
any other robot which rests itself on either three or more Accelerometer
wheels. It works on the same phenomena as that of an inverted
pendulum. Its design is more complex, as it needs to maintain Gyroscope
its upright (vertical) position, however this design has many
advantages which allows it to be used in practical scenarios. Motor1
Motor
It’s ability to turn on the spot and sustainable architecture
driver
increases its applications in industries. It is essential for the
robot to not only balance but also maintain its position, Motor2
withstanding external forces or unexpected disturbances if any.
Active researches on two wheeled robots have been widely
increased since the early versions of the studies on self- Fig.1 : Block Diagram
balancing robots by JOE[1] and n-BOT[2] complete with
inertial activity sensors, encoders and on-wheel WORKING AND METHODS
microcontrollers. A board of digital signal processor was To keep the robot balanced, the motors must counteract the
featured by JOE, which was robot falling by rotating the wheels in desired direction as
based on a controller board on various microprocessors and the shown in Fig.2. This action requires feedback and correcting
ATMEGA series of the Atmel architecture. It is rapidly elements. The feedback element is the MPU6050 gyroscope +
emerging as a popular platform for both education and product accelerometer, which gives both acceleration and rotation in
all three axes. The Arduino uses this to know the current
orientation of the robot. The correcting element is the motor This equation is derived from Filter/Control theory.
and wheel combination. Where, 𝜏 is the desired time constant(determines the response
speed of the readings),and
1
dt =
𝑓𝑠
Where, 𝑓𝑠 →sampling Frequency.
The current angle of inclination(ϴ) is determined by
combining the values of angles from both gyroscope and
accelerometer, according to the formula:
ϴ = [(1- α).(previousAngle + β1)] + [α.(β2)]
Where,
β1 →angle obtained from gyroscope
β2 →angle obtained from accelerometer
Fig.2. : Working Principle
First reading is the angle as resulted from gyroscope(β1) by
To know the exact position of robot we need to use sensor integration. Accelerometer gives the second reading. For
values. Accelerometer gives an indication of orientation in instance when the output of gyroscope is null(0), angle will
static conditions. Gyroscope is a good indicator of tilt angle in converge to that of the result given by accelerometer(β2). If the
dynamic conditions. We have to combine both the slow moving value of ‘α’ is very small the output angle will not trust the
signals from accelerometer and fast moving signals from reading from the accelerometer and eventually it will trust the
gyroscope. The gyroscope mainly comprises a drift and in a gyroscope.
lesser time the values returned are completely wrong. The In order to control the speed at which wheels should
accelerometer, on the other hand, returns true values when the pivot,PID (proportional integral derivative), which is a control
acceleration is progressive, but it suffers from vibrations, thus loop feedback mechanism largely used in control systems, is
resulting in wrong angle values. So in order to have correct used. This concept is mainly used for calculation of ‘error’
values we use a Complementary filter which is a math filter value. Here firstly the measured and desired set points are
used to combine both signal values. The concept behind calculated; the difference is obtained for further calculations.
Complementary filter is to allow the accelerometer signals to The proportional(P) term which is derived from PID is based
pass through a low-pass filter and the gyroscope signals to pass on the current angle difference from Zeroth Point. The
through a high-pass filter and finally combine the results to give integral(I) term derived from the PID relies on the current angle
the final signal[4]. difference or error(e(t)) from point zero which is then
Equation for low pass filter[4]: multiplied by the gain, and subsequently accumulated over
time. The integral control also contributes in balancing the
y(n)=[(1- α).x(n)]+ [α.y(n-1)] robot if it is moving. The derivative (D) term which is derived
from PID is the current rate of rotation. In order for the robot to
Where, balance properly the hardware/physical orientation of the robot
x(n)→ pitch/roll/yaw output from the accelerometer plays a vital role. In other words the center of gravity of the
y(n)→ filtered final pitch/roll/yaw which is the input robot should be balanced. The PID constants i.e, kp, kd and ki
for the next phase of program. can be determined by trial and error method. Fig.3 briefly
represents the flowchart of the PID algorithm.
Equation for High pass filter[4]:
Kp.e(t)
y(n)=[(1- α).y(n-1)]+[(1- α)(x(n)-x(n-1))] Reference
Angle Summation
Where, + of results Motors
x(n) → is the pitch/roll/yaw output from the -
Ki.e(t) ∑
gyroscope
y(n) → is the filtered final pitch/roll/yaw which is the Kd.e(t)
input, for the next phase of program.
Complemen
tary
Here, ‘n’ depicts the indication of current samples and ‘α’ Filtered Angle Filter
1) ATMEGA-328P [5]
It is a high performance 8-bit microcontroller based on
AVR RISC architecture. It is a 28 pin microcontroller which
has 32KB flash memory and runs on a frequency of 20Hz with
external crystal within 1.8v to 5v operating voltage.
RESULTS
machines are mostly used for travel and tourism purposes and
by private security services. It has been put to use by a range
of private and military organizations since its invention.
REFERENCES