0% found this document useful (0 votes)
3 views

Chapter1 Introduction

The document discusses the design and implementation of a self-balancing robot utilizing an inverted pendulum concept, which employs a control mechanism to maintain stability. It incorporates components such as an ATMEGA328P microcontroller, MPU6050 accelerometer and gyroscope, and a PID feedback system to achieve balance and navigate effectively. The paper also outlines the tuning process for PID constants and suggests future enhancements for improved performance and applications.

Uploaded by

h2803372
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Chapter1 Introduction

The document discusses the design and implementation of a self-balancing robot utilizing an inverted pendulum concept, which employs a control mechanism to maintain stability. It incorporates components such as an ATMEGA328P microcontroller, MPU6050 accelerometer and gyroscope, and a PID feedback system to achieve balance and navigate effectively. The paper also outlines the tuning process for PID constants and suggests future enhancements for improved performance and applications.

Uploaded by

h2803372
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Special Issue - 2021 International Journal of Engineering Research & Technology (IJERT)

ISSN: 2278-0181
NTASU - 2020 Conference Proceedings

Self Balancing Robot


Sahil Patil Dhananjay Bhavsar
Electronics & Telecommunication Engineering Electronics & Telecommunication Engineering
Vidyavardhini’s College of Engineering & Technology Vidyavardhini’s College of Engineering & Technology
Vasai(w), India Vasai(w), India

Shubham Mantri Shraddha Gosavi


Electronics & Telecommunication Engineering Electronics & Telecommunication Engineering
Vidyavardhini’s College of Engineering & Technology Vidyavardhini’s College of Engineering & Technology
Vasai(w), India Vasai(w), India

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

Volume 9, Issue 3 Published by, www.ijert.org 249


Special Issue - 2021 International Journal of Engineering Research & Technology (IJERT)
ISSN: 2278-0181
NTASU - 2020 Conference Proceedings

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

defines the boundary limit where the accelerometer readings


tends to stop and the gyroscope readings take over and vice- Fig.3 : PID Flowchart
versa. It mainly deals about how much of the output should
depend on the current value or a new value that arrives. Both COMPONENTS
the values of ‘α’ need to be same, and it is usually greater than
0.5 from the definitions above. The microcontroller ATMEGA328P along with MPU6050
(accelerometer and gyroscope) and L298N motor driver is
𝜏 responsible for balancing of the robot. The sensor module
α=
𝜏 + 𝑑𝑡 MPU6050 and motor driver L298N are programmed by the

Volume 9, Issue 3 Published by, www.ijert.org 250


Special Issue - 2021 International Journal of Engineering Research & Technology (IJERT)
ISSN: 2278-0181
NTASU - 2020 Conference Proceedings

help of microcontroller. The position of the robot in 3- ➢ Kd = 1.4


dimensional geometry(angle of inclination) and the angular ➢ Ki = 70
velocity of the wheels(speed by which the robot is falling) is
determined by the sensor MPU6050. The microcontroller, by
utilizing these values instructs the motor driver module to rotate
the motors in order to counteract the falling motion of the robot.

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.

2) MPU6050 IMU [6]


It is an Inertial measurement Unit commonly known as
IMU, which is used to measure gravitational acceleration and
rotational velocity. It is a 6-axis sensor module which contains
3-axis accelerometer and 3-axis gyroscope integrated on a Fig.4 : Results obtained from Sensors
single chip. It is basically used to determine the exact location Fig.4 shows the acceleration components obtained from
of the robot in 3-dimensional space. The outputs of the accelerometer and gyro outputs across all three axes in
gyroscope are defined in degrees per second. Hence in order to coordinate planes. This is basically the data/information
get the angular position integration of the angular velocity is regarding the position of the robot , which is achieved from the
needed. 6-axis motion tracking device(MPU6050).
Gravitational acceleration can be measured by the
Accelerometer along the 3 axes and thereby by using some sort CONCLUSION AND FUTURE SCOPE
of math we can calculate the sensor position. So by combining
the accelerometer data values and gyroscope data values we In this project we were able to implement a self-balancing
can get very precise information defining orientation of sensor. robot by using PID tuning method. The assembled
configuration of the robot is shown in Fig.5. The bot balances
3) L298N Motor Driver[7] itself effectively while leaning in forward or backward
This module is used to drive DC motors. As the module directions by the implementation of a closed loop algorithm.
uses dual H-bridge drive, it is possible to drive two motors at
the same time. It supports driver voltage from 5v to 35v.

RESULTS

For the robot to stand upright, it is necessary that the


microcontroller generates an appropriate output which is then
sent as a command to drive the motors. This command is
generated by multiplying each of the PID(proportional,
derivative and differential) response components by their
corresponding constants (Kp, Kd and Ki) and summing the
result. The values of these constants is obtained by performing
the following steps.

STEPS FOR TUNING THE PID CONSTANTS

Step 1: Set Ki and Kd to zero and gradually increase Kp so that


Fig.5 : Assembled model
the robot starts to oscillate about the zero position.
Step 2: Increase Ki so that the response of the robot is faster
The performance can be further improved by enhancing the
when it is out of balance. Ki should be large enough so that the
precision of motor speed readings, thereby improving stability.
angle of inclination does not increase. The robot should come
Also by installing a Bluetooth module or some wireless
back to zero position if it is inclined.
technology it is possible to create a remote controlled
Step 3: Increase Kd so as to reduce the oscillations. The
prototype, increasing its array of applications.
overshoots should also be reduced by now.
The above mentioned features can be used as a
Step 4: Repeat the above steps by fine tuning each parameter
modification to the existing system while designing a more
to achieve the best result.
efficient system in the future. These robots can be used for
By executing the above mentioned steps, we obtained the
smart gardening purposes; autonomous trolleys in malls,
suitable values of the PID constants(in double data type) as:
hospitals and airports; an intelligent robot for various
➢ Kp = 60
purposes. Currently popularized as “Segways”, these

Volume 9, Issue 3 Published by, www.ijert.org 251


Special Issue - 2021 International Journal of Engineering Research & Technology (IJERT)
ISSN: 2278-0181
NTASU - 2020 Conference Proceedings

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

[1] F. Grasser, A. D’Arrrigo, S. Colombi, and A. C. Rufer, “JOE: A mobile,


inverted pendulum,” IEEE Transactions on Industrial Electronics,vol.
49, no. 1, pp. 107–14, 2002.
[2] D. P. Anderson. (2003, Aug.) nBot balancing robot. Online.
[Online].Available: http://www.geology.smu.edu/ dpa-www/robo/nbot.
[3] A.-J. Baerveldt and R. Klang, “A low-cost and low-weight attitude
estimation system for an autonomous helicopter,” in IEEE
InternationalConference on Intelligent Engineering Systems, sep 1997,
pp. 391–5.
[4] https://sites.google.com/site/myimuestimationexperience/filters/comple
mentary-filter
[5] [https://www.sparkfun.com/products/9061]
[6] [https://howtomechatronics.com/tutorials/arduino/arduino-and-
mpu6050-accelerometer-and-gyroscope-tutorial/]
[7] [http://wiki.sunfounder.cc/index.php?title=Motor_Driver_Module-
L298N]

Volume 9, Issue 3 Published by, www.ijert.org 252

You might also like