Design and Implementation of Self-Balanced Robot Using Proteus Design Tool and Arduino-Uno
Design and Implementation of Self-Balanced Robot Using Proteus Design Tool and Arduino-Uno
net/publication/332111398
CITATIONS READS
7 1,436
1 author:
Niranjan L.
CMR Institute of Technology
51 PUBLICATIONS 352 CITATIONS
SEE PROFILE
All content following this page was uploaded by Niranjan L. on 01 April 2019.
1
Niranjan L, 2 Suhas A R, 3 Chandrakumar H S
1,2,3
Electronics and Communication Engineering, R R Institute of Technology, Bengaluru
Abstract- This paper explores the self-balancing robot, which is a kind of robot where it is nonlinear and unstable system.
The system is stabilized using three axis gyroscope sensor and accelerometer which is the heart of the robot and is based on
gyroscope effect. Here we use two stepper motor instead of a regular DC motor. The reason behind this is to have a precise
and good performance to have no loss when the battery voltage drops. The entire system is controlled by the Arduino-Uno
controller. The angle estimation is done via the complementary filters, LQR and LQR-ANN of the system to stabilize and
to synchronize both the motors. This will improve the stability performance significantly. The same is implemented using
the Proteus design tool and Mat-Lab
Keywords -Roboarm, Servomotor, FlexSensor, Arduinouno, RF Module, L298N module, MATLAB, proteus
1
Corresponding Author
DESIGN AND IMPLEMENTATION OF SELF-BALANCED ROBOT USING PROTEUS DESIGN TOOL AND ARDUINO-UNO
also can be widely used fora bicycle and machine mobile +12V for the L298N module, you need to remove the
mechanism. At the top of thispaper, sliding mode jumper just above the +12V input.
controller is designed and simulated by MATLAB[8]. The
simulation results show that the designed controller is The self-balancing robot is not new, but when we
ready to stabilize the machine self-balancingrobot model started this research project we found a lot of information,
around equilibrium with great initial deviated rollangle but never in the same place, we had to search a lot to join
upto 45°, the steering management has result on the all information in a single research project. The materials
stabilityof the mechanism. A Supervisory Control & Data and electronics used in the research project, was a servo
Acquisition (SCADA) system provides users with a
Human Machine Interface (HMI) which can be used for motor for a good results and also we can user stepper
controlling, monitoring and protection of devices. motor for the same. The chassis is made from the plastic
with three flours each flour has different components
II.Modeling
which has to be in the same order for better results. We
The mobile robot may be a removable initial order user L293 for driving the motors[10].The physics behind
inverted pendulum where it works as the heart of the this is very simple, the robot stand in two points lined, the
whole device. It is a mobile platform, which may attain wheel, and it tends to fall and lose his verticality, the
balance by its self-regulation. For cognizing the mobile movement of the wheel in the direction of the falling rises
robot additional and precisely, we need to analysis its the robot for recover the vertical position.
mathematical model. The establishment of additional
A Segway-type vehicle is a classic inverted
actual model is that the premise of planning control system
pendulum control problem that is solvable in two degrees
and management rule. The robotic systems have a
of freedom for the simplest models. The vehicle attempts
mechanical part, controlsystem and sensing system. Here
to correct for an induced lean angle by moving forward or
we use Arduino Uno board for the implementation of the
backwards, and the goal is to return itself to vertical. Or at
system and as a data acquisition system. Itcontains one
least not fall over.For that objective we have two things to
embedded system sensors for the balancing the system and
do, in one side of it we have to measure the angle of
two stepper motor for the system as wheels. The platform
inclination (Roll) that have the vehicle, and in the other
structured by metallic element bars containsthree layers.
hand we have to control the motors for going forward or
within the 1st layer, there are a unit motors, reducers,
backwards to make that angle 0, maintaining his
batteries, 2 wheels of car and 2 little safety wheelsin front
verticality. The concept is implemented using the radio
and back. within the middle layer, there are accelerometer
transceivermodule [4]. Emphasis being given to
and gyroscope as the heart of the unit.
presentation of idea. The implementation is based around
III. System Design the well-known microcontroller originally designed by
Intel but the chips that we are using were manufactured by
To keep the robot balanced, the motors should
the Atmel corp. Although any other microcontroller could
counteract the autumn of the robot. This action needs a
be used without any major change. The only direct impact
feedback and a correcting part. The feedback component is
will be only in the software or the assembly code written
that the MPU6050 gyroscope plus accelerometer, which
for the particular microcontroller. The system uses the
provides each acceleration and rotation in all 3 axes that is
simple transmitter section designed using the USART [3].
employed by the Arduino to understand this orientation of
the robot. The correcting component is that the motor and IV. Angle Measurement
wheel combination[9]. The Connection of the sensor to the
Here for measure the angle we have two sensors,
Arduino and testing the connection are done using proteus
accelerometer and gyroscope, both have his advantages
design tool before implementing on the hardware. The
and disadvantages. The accelerometer can measure the
code is analyzed using the Arduino IDE codes. The L298N
force of the gravity, and with that information we can
module can provide the +5V needed by the Arduino as
obtain the angle of the robot, the problem as we have seen
long as its input voltage is +7 V or greater. However, we
in the accelerometer is that it can also measure the rest of
have chosen to have separate power sources for the motor
the forces the vehicle is summited, so it has lot of error and
and the circuit for isolation. If the system us Note that if
noise. The gyroscope is used to measure the angular
you are planning to use a supply voltage of more than
velocity, so if we integrate this measure we can obtain the
angle the robot is moved, the problem of this measure is
that is not perfect and the integration has a deviation, that battery so don't have to connect arduino's power to it, but
means that in short time the measure is so good, but for we need 6 wires to control it, 3 for each motor, one for
long time terms the angle will deviate much form the real send the PWM signal for control the motor velocity, and
angle.Those problems can be resolved
esolved be the combination for indicate the direction we want the motor to spin. The
of both sensors, that's called sensor fusion, and there are a code has 4 files: one the main code, a second one for the
lot of methods to combine it. In this research project we motors, the third is for the PID, and the last one is for the
have tried two of them: Kalman Filter, and complementary sensor code.
filter.
In the main code is to initialize the entire robot
The Kalman filter is an algorithm very exten
extended in which in turn communicates with the sensors and other
robotics, and offers a good result with low computational devices connected to it. The sensor errors are calculated
cost. The library is used for arduino that implements this and modified to get the better results. The initial angle is
method. found and madee to zero, it means that the sensor has an
initial deviation, when we place the robot vertically the
The Complementary filter is a combination of two
sensor doesn’t show that the angle is zero, instead send a
or more filters that combines the information from
deviation angle, this initial angle is used to subtract it from
different sources and gets
ts the best value you want.
the posterior measurements of thee sensors, to obtain the
angle = A * (angle + gyro * dt) + (1 - A) * real angle. So when we initiate the robot we have to
acceleration;where A is normally equals to 0.98. maintain it vertically until it starts to move the wheels.
First we tried to use Kalman filter but the results The next part of code is the loop where we take the
obtained was not up to the mark, the angle was calculated sensor values every 10 milliseconds, the frequency of
with a little delay and it affect the control. sampling is 100Hz,
00Hz, this value is chosen as very low and
The Kalman filter has three variables and can be very high frequencies could not work, and we calculate the
changed based on the parameter of your sensor, and angle of the robot using the complementary filter
varying this can obtain better result, the values were previously explained. The angle is known and now we can
changed to get the better results but was not good and we use that information to control the motors, this uses an
tried to implement the same using complementary filter. intermediate PID, the simplest way to control things
The main structure of the robot was created using some efficiently. In order to use the accelerometer, in this case
plastics materials for chassis with some nuts and screws, the ADXL345, the relative library is used for this case.
two wheels with two motors, one battery socket, one caster V.System
System Analysis
wheel, and even 2 little wheels for encoders.
The two motor were placed in the lower part of the
structure and closed it with the two plastic parts, keeping it
together with the screws. The electronics and the battery
creates a tower in the upper part of the structure.The
electronics were used here aree arduino UNO, a motor
driver, in this case a L298 was used, here we use a
commercial motor driver based on the chip L298, maybe
much powerful that we need for these motors but we have
it and it works fine. If a DC motor has to be used, then a
DC motor driver that is a H-bridge
bridge or use a L293. For the Fig. 1: Block diagram ofSelf
Self balanced robot
IMU we used 10DOF that is GY-80 80 with 33-axis
To keep the robot balanced, the motor should offset
accelerometer, 3-axis
axis gyroscope, magnetometer, barometer
the fall of the robot. This action requires a feedback and a
and temperature sensors. We use only accelerometer and
revision section. The feedback component is the MPU6050
gyro. The IMU is connected to the Arduino using I2C bu bus,
Gyroscope + Accelerometer, which provides each of the
so we need 2 wires for communication (SDA and SCL)
three axes used by the Arduino for fo each acceleration and
and 2 wires for power, it uses 3.3V so we need 3.3V wire
and GND. The motor driver take power directly form the
rotation to understand this direction of the robot. running. The angle of inclination is measured relative to
Correction part is a combination of motor and wheel. this point. Keep the robot stable at a fixed angle, you will
find the angle will gradually increase or decrease. It will
The sensor connection to the Arduino and the test
not stay stable. This is due to the inherent drift of the
connection were done using the proteus design tool before
gyroscope. In the code given above, the cycle time is
using the hardware implementation. Arduino is a joint
calculated using the millis () function built into the
open supply component and packaging company, project
Arduino IDE. In later steps, we will use timer interrupts to
and user community used to change and manufacture
create accurate sample intervals. The sampling period will
single-board microcontrollers and microcontroller suites
also be used to generate the output using the PID
for building digital devices and interactive objects for
controller.
sensing and managing objects in the physical world. The
project's products are released in ASCII text file hardware VII. The Result Is Combined With A Supplemental
and software packages licensed under the GNU General Filter
Public License (LGPL) or the GNU General Public
We have two metrics from the perspective of two
License (GPL), allowing anyone to make Arduino boards
different sources. The measurement from the
and software distributions. The Arduino board comes
accelerometer is affected by a sudden horizontal
preinstalled.
movement and the measurement from the gyro gradually
The Arduino board style uses a series of deviates from the actual value. In other words,
microprocessors and controllers. These boards come with a accelerometer readings are affected by short duration
set of digital and analog input / output (I / O) pins that will signals and the gyroscopes read signals over long periods
connect multiple expansion boards (shields) and different of time. These books complement each other to some
circuits. These boards have a serial communication extent. Using complementary filters to combine them, we
interface, as well as Universal Serial Bus (USB) on some get stable, accurate angular measurements. The
models, and are also used to load programs from a complementary filter is essentially a high-pass filter acting
personal computer. Microcontrollers often use functional on the gyroscope and a low-pass filter acting on the
programming from the programming languages C and C accelerometer to filter out the drift and noise in the
++. In addition to leveraging the traditional compilation measurement. currentAngle = 0.9934 * (previousAngle +
toolchain, the Arduino project provides an integrated gyroAngle) + 0.0066 * (accAngle) 0.9934 and 0.0066 are
development environment (IDE) filter coefficients with a filter time constant of 0.75s.
VI.Basic Concept &The Implementation Of The A low-pass filter allows any signal longer than this
System duration to pass, and a high-pass filter allows any signal
that is shorter than this duration to pass. The filter's
Using an accelerometer to measure dip, the MPU6050
response can be adjusted by choosing the correct time
has a 3-axis accelerometer and a 3-axis gyroscope. The
constant. Lowering the time constant will allow more
accelerometer measures the acceleration of three axes and
horizontal acceleration to pass. Eliminate accelerometer
the gyroscope measures the angular velocity of the three
and gyroscope offset errors. By defining the offset value in
axes. In order to measure the tilt angle of the robot, we
the setup () routine, any errors due to offsets can be
need the acceleration values along the y-axis and the z-
eliminated.
axis. The atan2 (y, z) function gives the angle of curvature
between the positive z-axis of the plane and the point VIII. Experimental Analysis
given by the coordinates (z, y) on the plane, with the
Here the PID stands for Proportional, Integral and
counterclockwise angle being a positive sign), The minus
Derivative. Each of these terms provides a unique answer
sign indicates the clockwise angle (left half plane, y <0).
to our self-balancing robot. As the name suggests, the
We use the library written by Jeff Rowberg to read the
proportional term produces a response proportional to the
MPU6050's data. Upload the code given below to see how
error. For our system, the error is the robot's tilt angle. The
the dip changes.
integral term generates a response based on the cumulative
Using a gyroscope to measure the tilt angle, the error. This is essentially the sum of all errors multiplied by
MPU6050's position is zero tilt when the program starts the sampling period. This is a response based on past
system behavior. Derivative terms are proportional to the energy, generalized coordinate and generalized force into
derivative of the error. This is the difference between the the Lagrange’s equation. Then the equations will be in the
current error and the previous error divided by the form of
sampling period.
(MRL R2 + JRL + MP R2 + PδJ ) θRL + ( MP R2 + JPδ)
This serves as a predictive term that resp
responds to the
robot's behavior in the next sampling cycle. Multiplying θRR + MPRLθP = CL (7)
these terms by their corresponding constants (ie, Kp, Ki,
and Kd) and adding the results yields an output that is then (MRRR2 + JRR + MP R2 + PδJ ) θRR + ( MP R2 + JPδ)
sent as a command to drive the motor. The ultrasonic θRL + MPRLθP = CR (8)
distance sensor we use is US-020.020. It has four pins, Vcc,
Trig, Echo and Gnd. It is powered by a 5V power supply. MPRLθRL+ MPRLθRR+ (JPθ + MPL2) θP= MPgLθP – (CL
The trigger and echo pins are connected to the Arduino's + CR) (9)
digital pins 9 and 8, respectively. We will use the NewPing
library to get the sensor's distance value.
e. We will read the XI. Simulation Results
distance every 100 milliseconds, and if the value is
between 0 and 20 centimeters, we will order the robot to
perform a rotation. This should be enough to keep the
robot away from obstacles.
The translation of kinetic energy of wheels in the
form as shown below,
T1 = MRL X2RL + MRR X2RR ….(1)
The rotation
on kinetic energy of two wheels is in the form of
2 2
T2 = J θ + J θ …..(2)
RL RL RR RR Fig. 2: Simulation result for two motors.
The translation kinetic energy
rgy of body’s center of mass is
T3 = MP ((θP L cosθP + XRM)2 +
τ ∆
let = α and = 1- α Fig. 9: Robot motor speed control block diagram.
diagram
∆τ ∆τ
Fig. 10: Prototype Model [6]. Suhas A.R, Arun T V “Substation Automation
Systems”, published in IJSER Journal, volume 7
X. Conclusion Issue 05, May 2016, pp-215
215-218.
Experimental results show that the developed [7]. Niranjan L, Sreekanth B, Suhas A R, Mohan
control strategy allows the robot to maintain its balance Kumar B N “Advanced System for fo Driving
dynamically. In addition, robots are also able to recover Assistance in Multi-Zones
Zones using RF and GSM
from the tilt caused by external disturbances. By using PID Technology” in International Journal of
and improved LQR control algorithm, the improved LQR Engineering Research & Technology (IJERT),
has better performance than PID in robot selfself-balancing. ISSN: 2278-0181,
0181, Vol. 3 Issue 6, June – 2014.
Future work will focus on higher speed motions and higher
spatial precision motion control. More and more Will [8]. Chandrakumar H S, Tejaswini M R, “Robust face
develop more useful features. detection and person recognition using gabor
texture and multi block LBP features”, published
in IJSER Journal, volume 7 Issue 05, pp-210-214,
pp
References May-2015