 Open Access
 Total Downloads : 483
 Authors : Aja Mariam Johnson, Nasar A.
 Paper ID : IJERTV6IS070240
 Volume & Issue : Volume 06, Issue 07 (July 2017)
 DOI : http://dx.doi.org/10.17577/IJERTV6IS070240
 Published (First Online): 29072017
 ISSN (Online) : 22780181
 Publisher Name : IJERT
 License: This work is licensed under a Creative Commons Attribution 4.0 International License
Design and Development of a Two Wheeled Self Balancing Robot for an Application of Object Carrying
Aja Mariam Johnson
Electrical and Electronics Engineering TKM College of Engineering
Kollam
Nasar A.
Electrical and Electronics Engineering TKM College of Engineering
Kollam
Abstract Two Wheeled Self Balancing Robot is a foremost research topic in the area of robotics and control engineering. The principle of operation behind a self balancing robot is an inverted pendulum concept. The major focus on this paper is the hardware development of a two wheeled self balancing robot for an application to carry objects from one place to another. The modeling of the self balancing robot is done in terms of the inverted pendulum .Since the two wheeled self balancing robot has some inherent characteristics like instability, non linearity different types of controllers like PID,LQR, LQR with precompensation are used and their performance are compared.Simulations are carried out in MATLAB/SIMULINK. A PID controller is incorporated in the hardware section to improve and ensure a good performance for the system
Keywords Self Balancing; Instability; Controlling; PID; LQR

INTRODUCTION
The research and new innovations related to self balancing robot has gained momentum in the field of robotics and control engineering. The basic working principle behind self balancing robot is an inverted pendulum concept. The examples of inverted pendulum in certain real applications includes rockets like MAXUS in its starting position,Segway the personnel transporter, a self balancing vehicle. Two wheeled self balancing robot is an important type among mobile robots. Unlike an ordinary robot, a two wheel self balancing robot requires just two point of contact with the oor surface. The unique stability control that is required to keep the robot upright dierentiates it from ordinary robots. The basic idea of a selfbalancing robot is simple drive the wheels in the direction in which the robot tilts. This is similar to the inverted pendulum model in control theory. It has great advantages like small size,exibility,low cost because of these advantages ,it can be used in various application in the field of control engineering. The inherent complexity associated with control of this platform nd its application in design and development of control system of automobiles,spacecrafts,transportation facilities including military transport. The developed hardware is used to develop an object carrying vehicle which can be used to reduce the human eorts in working places,oces,house hold applications. This is a cost eective solution using PID algorithm for this two wheeled vehicle
Problem Definition
The reason behind huge application of Self Balancing Robot in the various application in control engineering is its mechanical stabilty.Comparing with ordinary four wheel robot ,two wheeled robots have many advantages like cost reduction, size reduction, nd its increased application like rockets, military transportation etc. But the instability associated with this make the design and modeling so much complex.

SYSTEM MODELLING
Two wheeled self balancing robot depend upon the principle of operation of inverted pendulum[1]. This concept is a common example found in all control engineering text books and a hot topic among the researchers focusing in control area. For the modeling of a self balancing robot for an object carrying purpose , an inverted pendulum with a cart system can be used. The system is completely unstable with out a controller. It can be make stable by moving the cart forward or backward if the pendulum tends to fall in forward or backward direction. This forward or backward force will give an acceleration to the wheels according to the angle between the vertical position of the pendulum and current position of pendulum. The inverted pendulum is an example of highly unstable, on linear dynamic system. Generally in self balancing robots controlling depend on the application for which it is used. In this paper the self balancing robot is meant for the application of object carrying so the two controlling sub systems are self balancing subsystem, for preventing the system from falling down when it moves forward or backward. And the second subsystem is yaw rotation subsystem for steering angle regulation when it moves left or right. The free body diagram of inverted pendulum with a cart is given in the gure.1. For this system, the control input is the force u that moves the cart horizontally and the outputs are the angular position of the pendulum and the horizontal position of the cart x.The terms used in the modeling are

M is the mass of the Cart

m is the mass of Pendulum

b is the frictional co ecient for cart

l is the length to the pendulum center of mass

I is the moment of inertia of pendulum
(I ml2 ) mgl sin mlxcos
Equation (9) is non linear,
(9)

Force applied to the cart

is pendulum angle from vertical
Linearising 4, 9 assume and are small so
sin , cos 1, 2 0
F (M m)x bx ml
(I ml2 ) mgl mlx
Let us assume F=u,
(11)
(10)
Taking Laplce transform of equations (10),(11) and applying zero initial conditions
(I ml2 ) (S) mgl (S) mlX (S)S 2 (12)
(M m)X (S)S 2 bX (S) ml (S).S 2 U (S)
From equation (12)
(I ml) (S)S 2 mgl (S)
X (S)
mlS 2
Fig 1.Free body diagram of inverted pendulum with cart system[1]
According to Newtons second law of motion cart equation is
F=Mx+bx+H (1)
X (S) (S)[ I ml g ]
ml S 2
Transfer function, with pendulum angle (S) as output is given by
ml S 2
Horizontal motion of center of gravity of pendulum rod is
d 2
S 4
b(I ml 2 )
S 3
q
q

(M m)mgl S 2
q

bmgl S
q
rad/n
m (x l sin ) H dt
(2)
mx ml[cos 2 sin ] H
mx mlcos ml2 sin ] H
substituting (3) in (1)
(3)
Where q [(M m)(I ml 2 ) (ml 2 )]
And the transfer function with a cart X(S) as output,
(I ml 2 )S 2 gml
F Mx bx mx mlcos ml 2 sin (4)
Rotation motion about center of gravity
X (S )
U (S )
S 4
b(I ml 2 )
S 3
q
q

(M m)mgl S 2
q

bmgl S q
I Vl sin Hl cos
(5)
State Space Model of Inverted Pendulum System
Vertical motion of center of gravity of pendulum rod is,
d 2
m
dt
ml d
dt
(l cos ) V mg (6)
( sin ) V mg (7)
V mg ml2 cos mlsin (8)
Substituting (3) (9) in (6),equations can be written as, I mgl sin ml2 mlxcos I mgl sin ml2 mlxcos
x1
0 1
b(I ml 2 )
0
1

m2 gl 2

0 PID Controller
x2
0 S
S 0
The PID controller has mainly three constant parameters. The
0
x3 =
x 0
0
mlb
0
mgl(M m)
0
Proportional (P), The derivative (D),The Integral (I).This is closed loop control system and also called as negative
feedback system. Input to the controller is error form the/p>
4
S S
1
x 0
ml 2 I
x2 S
x + 0
3 ml
system .Error is deviation between the desired state and the measured state and this is error ,which is fed as the input of
the controller is used for three purpose. The error term will be used on the controller is to execute the proportional, integral and derivative term. The P component is used as for the purpose of error elimination. It simply calculates the angular
measurement of the robot and makes the motors move in the
x4
S
x1
same direction to stop the falling of the robot. The Integral term will nd the average of past errors and this term has an important role in reducing the steady state errors. The
1 0 0
y = 0 0 1
0 x
2
0 x3
Derivative component will handle the overshoots and reduces the robot vibrations of the robot. The gains of the PID controller is chosed based on trial and error method. The output of the controller is given by,
Stability Analysis
x4
V (t) K p e(t) Ki e(t) Kd e(t)
Response with PID
Before going with a controller certain assumption took in the
From the derived transfer function of the inverted pendulum it is understood that system is highly unstable because of the pole location at the right side of the Splane. The same result is also is obtained from the root locus plot clearly denotes the theoretical instability of the system.So in order to make the system stable a controller is necessary.
Fig 2:Root locus diagram of inverted pendulum model
III SIMULATION AND TEST RESULTS
The inverted pendulum with a cart system is not stable with out any controller. From the impulse response of this system clearly shows the runaway nature that implies the complete instability of the system. This instability is because of the presence of open loop pole in the right half of the Splane. So in order to make the system stable a controller is necessary. Different controller is used and a performance evaluation is also done in this session.
design are, the controller will maintain the pendulum vertically upward when the cart is subjected to an applied force of 1Nsec impulse. Under these conditions, the design criteria are:

Settling time of less than 5 seconds

Pendulum should not move more than 0.05 radians away from the vertical
In fig3 a simulink model of inverted pendulum system with PID controller is given and the in fig 4.4 impulse response of pendulum without a controller is also given.In that the overshoot is more and settling time is more than that of design criteria. So to get a stable response PID controller is added in the subsystem. The simulink model and responses are given above. The settling time of the response after inserting a controller is
1.64 seconds, which is less than the 5 seconds which satisfy the requirement .The steady state error approaches zero in a fast manner. The peak response is larger than the requirement of 0.05 radians. However the overshoot is somewhat higher in the response we had obtained so in order to reduce the overshoot it is necessary to increase the amount of derivative control. For Kd=20,the overshoot is reduced and more satisfactory response is obtained.
angle and the cart's position. lqr method has an advantage of control of both outputs. More desirable response can be obtained by changing the non zero elements in the Q matrix
Fig 3: impulse response of pendulum with overshoot reduction
Linear Quadratic Regulator
The LQR algorithm is basically used to find the state feedback controller. It is a special type of optimal control problem which deals with linear system and minimization of cost or objective functions i.e. LQR the L terms denotes a linear plant Q term denotes the quadratic cost function and R terms is a regulator .In LQR function the cost function is also considered than other conventional controllers like PID.While designing the LQR controller both the cart position and pendulum angle are considered. The basic principle behind the controller design for an inverted pendulum is if the pendulum is displaced, the controller will determine the cart position to make the angle displaced from the vertical position to zero(=0).
The first step in designing the LQR controller is to check whether the system is controllable or not. The system is completely state controllable if and only if the controllability matrix must have rank where the rank of a matrix is the number of non zero rows .To check the controllability first form the controllability matrix C.
1
0
0
0
0
0
0
0
Where C= [B AB A2B .An1B] and obtained as
c
Fig 4: Step response with LQR controller
Here Q(1,1)=1 and R=1 ..The value k matrix is obtained as [ 1.0000 1.6567 18.6854 3.4594] .From the graph it is obtained as there is a considerable reduction in the overshoot But the there must be reduction in the settling time so inorder to make a better response assume Q(1,1) =6370 more values of Q(1,1) yield better response.This is because while Increasing the magnitude of Q there is a reduction in error but requires a greater control force u. This will leads to more control effort generally corresponds to greater cost thati.e. if we have to supply a large energy the Cost of components like actuators will be higher
Controllability =4
0 0 1 0
0 0 0 0
Therefore, system is completely state controllable and so the linear quadratic regulation method can be used as the state feedback control gain matrix . The MATLAB command is lqr allows to choose two parameters, and , which will balance the relative importance of the control effort ( ) and error (deviation from 0), respectively, in the cost function that is needed to optimize. Here the value of R ia assumed as 1 and Q=CC .The cost function corresponding to this R and Q places equal importance on both the control and the state variables which are outputs the pendulum's
Fig:5. step response with Q(1,1)=6378
Even though the controller designed using LQR technique meets the design consideration. there is still problems associated due to the influence of the steady state error. In comparison with other design methods, output is feedbacked and compare it to the reference input to compute an error, with a full state feedback controller all states are feedbacked.
Linear Quadratic Regulator with Pre Compensation
Fig 6:step response with LQR Pre Compensation
the steady state error is reduced and also settling time. and the pendulum's overshoot is within specified range.The precompensator Nemployed here is calculated based on the model of the plant and the precompensator is located outside of the feedback loop.. The precompensator is able to eliminate the steadystate offset using knowledge of the plant model
IV HARDWARE IMPLEMENTAION
Fig:7.Block diagram of the robotic system
The robot consists of three platforms .Top most platform is used for carrying the objects from one place to another. Second platforms will accommodate the microcontroller arduino UNO, an Inertial Measurement Unit and a motor driver mounted on it. On the lower part of the base platform, the two motors with a torque (126 rpm) are clamped. The whole structure of the robotic body gets balanced on two wheels .The wheels have a required grip providing sucient friction. The gure of the robotic body is given below.
Robot Chasis Specifications
The Self balancing robotic chassis is electrically powered by two 12V, 126rpm, DC metal gearmotors. It has a 28mm width between the wheels with wear resistant rubber grip gives greattraction, which is necessary to make it sef balancing. It has 3mm thick aluminiumbodyforms a rigid platform which holds the motors and wheels.
Tyre Specifications

Outer dia of wheel: 65mm

Width of wheel: 28mm

Brass tting suits 4mm shaft
Motor Specications

Rated Voltage(DC): 12V/6V

No load speed: 126rpm/75rpm

No Load Current: 46mA/30mA

load Speed: 100rpm/60rpm

load Current: 250mA/280mA

Power output: 1.25W/1.25W

load torque: 1.2kg.cm/0.8kg.cm

Stall torque: 4.2kg.cm/2.5kg.cm

Stall Current: 1A/900mA

Gear ratio: 1 : 34

The Arduino Microcontroller
The microcontroller used is Arduino Uno which basically uses ATmega328 . There are 14 digital input and output pins.Six of them can be used as PWM outputs and also six analog inputs. A16 MHz ceramic resonator is used to provide the clock. The Arduino can be simply poweredvia using a USB connection or with external supply. Externally it can be powered with a ACtoDC adapter or battery. The leading advantages of the this microcontroller are in expensive, operates on cross platform, simple and a clear programming environment, availabilityof open source and extensible software.
Inertial Measurement Unit and I2CProtocol
In robotic applications it is necessary to use sensors such as accelarometer, gyroscope for measuring some essential quantities like rate of angular tilt, vibrations etc. The major area where the applications of IMU are most common includes aircrafts, spacecraft, satellites, unmanned areial vehicles etc. The feature of this IMU are tiny, prescence of mounting holes , accelerometer and gyro ,3.3V input ,I2C interfacing.
The function of the accelerometer is to give the components of acceleration along its axis and these data are more sensitive and noisy while gyroscope gives the components of angular velocity along its axis and these data are less sensitive and I2C is the mode used for communication .SDA (Data) and SLC (clock) are the two important lines of the I2C bus which can be run in parallel to communicate with several devices at once. I2C facilitate upto 112 slaves like sensor to be controlled by a single master like Arduino microcontroller. The slave device which are connected to the bus must have its own unique address so the master can communicate directly with that particular device.
Fig:8. Developed Hardware
VI.CONCLUSION
Design and Development of a two wheeled self balancing robot with object carrying is done .The peculiar application implemented is the robot is able carry an object without falling. The modelling of the self balancing robot is done with the help of inverted pendulum concept. Since the modelled system is highly unstable it is necessary to use appropriate controllers and a comparative study of different controllers
like PID, LQR, LQR with precompensation, were done. The analysis of the impulse response of the system for the different controllers are simulated with MATLAB/Simulink.LQR with precompensation offers a much better performance and satisfies the design consideration of settling time less than 1 sec and vertical angle of pendulum less than 5 radian
ACKNOWLEDGMENT
I am immensely indebted to my guide , for his constructive guidance and advice and show my extreme gratitude to all Faculties and Technical stas in Electrical and Electronics Engineering Dept., for providing all the help and necessary facilities to complete this work.
REFERENCES

Osama Jamil , Mohsin Jamil , Yasar Ayaz and Khubab Ahmad Modeling, Control of a TwoWheeled SelfBalancing Robot International Conference on Robotics and Emerging Allied Technologies in Engineering (iCREATE),2014

Charles Yong and Chiew Foong Kwong, Wireless Controlled Two Wheel Balancing Robot, International Journal of Network and Mobile Technologies ;Vol: 2; Issue: 2; page: 88; Date: 2011.

V. C. Gungor and G. P. Hancke, Kinematic Analysis of Mobile Robot with Two Body Frames,IEEE Trans. Ind. Electron., vol. 56, no. 10, pp. 42584265, Oct. 2009.

Amir A. Bature, Salinda Buyamin, Mohamed. N. Ahmad, Mustapha Muhammad4A Comparison of Balancing Controller for Two Wheeled Self Balancing Robot international Journal of Mechanical and Mechatronics Engineering IJMMEIJENS Vol:14 No:03 Dec.2008, vol. 1, pp. 36.

Charles Yong and Chiew Foong Kwong, Wireless Controlled Two Wheel BalancingRobotr, International Journal of Network and Mobile Technologies ;Vol: 2; Issue: 2;page: 88; Date: 2011

Y.J. Wen and A. M. Agogino Simulation and Control of a Two wheeled Selfbalancing Robot ,, in Proc. IEEE Wireless Control Hive Netw. Conf., Aug. 2008, pp. 17.

V. C. Gungor and G. P. Hancke, Kinematic Analysis of Mobile Robot with Two Body Frames,IEEE Trans. Ind. Electron., vol. 56, no. 10, pp. 42584265, Oct. 2009.

A. C. Caputo and P. M. Pelagagge, Static Force Analysis of a Mobile Humanoid Robot Appl. Thermal Eng., vol. 29, no. 14/15, pp. 32043211, Oct. 2009

Umar Adeel, K.S.Alimgeer, Omair Inam, Ayesha Hameed, Mehmood Qureshi and Mehmood Ashraf Autonomous Dual Wheel Self Balancing Robot Based on Microcontroller, J. Basic. Appl. Sci. Res., 3(1)843848, 2013

S. W. Nawawi, M. N. Ahmad, and J. H. S. Osman Real Time Control of a Two Wheeled Self Balancing Robot International Journal of Electrical, Computer, Energetic,Electronic and Communication Engineering Vol:2, No:3, 2008