Design and Development of Two Wheeled

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

4th Student Conference on Research and Development (SCOReD 2006), Shah Alam, Selangor, MALAYSIA, 27-28 June, 2006

Design And Development of Two Wheeled


Autonomous Balancing Robot
Ong Yin Chee, Mohamad Shukri b. Zainal Abidin
Center for Artificial Intelligence And Robotic (CAIRO)
Universiti Teknologi Malaysia, City Campus,
Jalan Semarak 54100, Kuala Lumpur, Malaysia
Email : [email protected], [email protected]

Abstract - In this paper, the control of two-wheeled


autonomous balancing robot is presented. The system is based
on distance measuring sensor to detect the lean of the robot. II. DESIGN AND FABRICATION
PID control system is implemented to pilot the motors so as to
keep the system in equilibrium. The navigation of the robot is Hardware Structure
controlled by operator by using RC remote controller. The
robot has the ability to balance itself while moving and turning
on a flat terrain. The materials choose for the robot structure is an
importance element because the frame of the robot must be
I. INTRODUCTION robust, symmetrical and the center of the gravity of the
robot must be high. Beside that, the frame design of the
Two wheeled balancing robots have gained momentum robot must have the space to house the two DC motors,
over the last decade in a number of control and robotics sensors, circuitry and battery of the robot. The design of the
research centers around the world. Why? Two wheeled frame determines the stability and centre of gravity of the
balancing robot is a good platform for researchers to robot in static position or when the robot is in motion. For
investigate the efficiency of various controllers in control this project, the robot's frame is making by raw material-
system. The research on two wheeled balancing robot is Aluminum. Aluminum is used due to the light weight, rigid
based on inverter pendulum model. Therefore, a two and robustness quality of the material which is most
wheeled balancing robot needs a good controller to control suitable for the balancing robot. Besides that, in order to
itself in upright position without the needs from outside. make the center of the gravity of the robot to become high,
Nowadays, various types of controllers were implemented the robot’s battery location will be allocated on the top and
on two wheeled balancing robot for examples Linear center of the robot’s structure. The wheels of the robot are
Quadratic Regulator, Pole-Placement Controller, Fuzzy made by PE because it is a rigid and light material.
Logic controller, Proportional Integrated Derivative
Controller. The actuation to balance the robot is two unit of
GM8712 gear motor, with a 60.5:1 reducing gearbox DC
This project is to design and fabricate a two motor [19].
wheeled balancing robot that has the ability to balance itself
on flat terrain and investigate the suitability and
performance of PID controller in balancing system. The
robot chassis must be robust, symmetrical & the center of
gravity of the robot must be high. Two general purpose
distance measuring sensors (Sharp GP2D12) are used to
detect the current position and tilting angle of the robot.
Microcontroller is used to be the brain of the robot. The
entire PID controller algorithm will be compute into C
programming and store inside the microcontroller. Without
an active control system, the robot would just fall
over. Therefore, PID controller plays an important role in
this project. The navigation of the robot is controlled by Fig.1: GM8712 DC motor
operator by using RC remote controller. The robot has the
ability to balance itself while moving and turning on a flat
terrain.
1-4244-0527-0/06/$20.00 © 2006 IEEE 169

Authorized licensed use limited to: ULAKBIM UASL ISTANBUL TEKNIK UNIV Expert now Trial User. Downloaded on December 5, 2009 at 17:16 from IEEE Xplore. Restrictions apply.
4th Student Conference on Research and Development (SCOReD 2006), Shah Alam, Selangor, MALAYSIA, 27-28 June, 2006

PID control algorithm will be implementing on


this project for keeping the robot upright. The output of the
sensor which is in analog voltage will convert into digital
value first by using A/D converter of microcontroller then
inputs it into PID control algorithm to determine the speed
and direction of the motors in order to stabilize the robot
and stand it upright.

There are three PID control systems implemented


to stabilize the robot. One of the PID control systems is
used to control the tilt and angle of the robot and the other
two PID control systems are used to control the speed of
both left and right DC motors.

Fig. 2: The two wheeled balancing robot

Sensor and Electronic


Fig. 3: Block Diagram of PID Control
Two general purpose distance measuring sensors
(GP2D120) will be used on the balancing robot in order to
detect the current state of the robot. The sensors are The sampling rate of the program is 20ms. As its
mounted on an aluminum strip placed at the front and back name suggests, the PID algorithm consists of a three part
of the robot. The line of sight is toward the ground at an equation with proportional (P), integral (I), and differential
angle. The output of the sensors is an analog voltage. The (D) terms. These terms determine the controller output
GP2D12 can sense a height from 4 to 30 cm [17]. The (power to the motors) from its input signal (the two sensor
sensor's analog output voltage is measured by the PIC on- readings). The setpoint of the robot is the sensor’s reading
board A/D register. The robot keeping balance by when the robot perpendicular to the flat terrain. The
measuring the height at the front and back of itself and equation to calculate the PID controller output of the
adjusts the wheels position to maintain equal height. balancing system is simplified as follow:

PIC 16F 877A will be used on this project due to Error = Setpoint Reading – Current Sensor Reading
its special functions registers like 8 Analog to Digital + Input signal from RC receiver (1)
Converter module and 2 PWM generator module which are
needed on this project. The output of the sensor which is in The input signals from RC receiver are: signal to move
analog voltage will be connected to the PIC microcontroller forward and backward
A/D input pin. Beside that, two PWM generators will be
used to activate the robot’s motors and 20 MHz oscillator The proportional term increases the motor power as the
will be used to generate pulse for the microcontroller. To robot leans further over and decreases the motor power as
interface the DC motor and the microcontroller, a motor the robot approaches the upright position. A gain factor, Kp,
driver is needed. On this project, L293B will be used to do determines how much power to apply to the motors for any
the interfacing. It provides total DC current up to 2 Ampere. given lean, as follows:
In order to generate PWM pulse to two DC motors, the
output pin of the PWM (CCP1/CCP2) will be connected to Output Proportional Term = Kp * Error (2)
the L293B motor driver enable pin.
The 12V 1100mAH Ni-Mh rechargeable battery is While the proportional term is effective at
used as the power source for the robot. responding to the lean, once the robot reaches the upright
position it will proceed to tip in the opposite direction until
Control System the proportional control term increases the motor power
enough to reverse the robot’s motion, rotating it back in the
1-4244-0527-0/06/$20.00 © 2006 IEEE 170

Authorized licensed use limited to: ULAKBIM UASL ISTANBUL TEKNIK UNIV Expert now Trial User. Downloaded on December 5, 2009 at 17:16 from IEEE Xplore. Restrictions apply.
4th Student Conference on Research and Development (SCOReD 2006), Shah Alam, Selangor, MALAYSIA, 27-28 June, 2006

other direction. Therefore, the robot will oscillate back and Error of Right Motor Speed = Setpoint of right motor –
forth, just as a car with worn out shock absorbers bounces Current Speed Reading of Right Motor (10)
for a long time when the car goes over a bump [11].
Output Proportional Term of Right Motor
The differential term of the PID algorithm acts as a = Kp * Error of Right Motor Speed (11)
damper reducing oscillation. Another gain factor, Kd,
determines how much power is applied to the motors Output Differential Term of Right Motor
according to the following equation: = Kd * (Error of Right Motor Speed – Last Error of Right
Motor Speed) (12)
Output Differential Term Output Integral Term of Right Motor
= Ki * Sum of Error for Right Motor Speed (13)
=Kp Kd * (Error – Last Error) / T (3)
=(Kp Kd/T) * (Error – Last Error) (4)
Right Motor Speed = Proportional Term of Right Motor +
Differential Term of Right Motor + Integral Term of Right
Simplify as below:
Motor (14)
=KD * (Error – Last Error) (5)
For tuning the PID control of motor speed, the
Finally, neither the proportional nor differential
value of Kp Ki and Kd is get by trial and error method.
terms of the algorithm will remove all of the lean because
Although this is not efficiency method but it can control the
both terms go to zero as the orientation of the robot settles
speed of motor very well. For the speed control of left
near vertical.
motor, same method is using same as right motor speed
control algorithm.
The integral term sums the accumulated error (error
summed over time) and applies power in the opposite
direction indicated by the sum to drive the lean to zero, as
III. RESULT AND CONCLUSION
follows:
The Balancing Robot has successful balance itself
Output Integral Term
in upright position and the navigation of the robot can
= KpKi * Sum of Error * T (6)
control by a human operator. However, it has some
= KpKiT* (Sum of Error) (7)
drawbacks. The robot only can balance on a flat terrain. In
order to improve this problem, more advance sensors and
Simplify as below:
powerful algorithm must be implemented. Below figure is
= KI * (Sum of Error) (8)
the actual output of the robot which show the tilting angle
and PID controller output of the robot.
The output of the PID controller for balancing the robot will
be: The Actual Output of Two Wheeled Balancing Robot

Motor PWM = Proportional Term + Integral Term 40


Error

+ Differential Term (9) 30


PID Control

To tune the PID controller, Ki and Kd must be set to 20

zero first and the Kp is slowly increase until the robot start 10
to oscillate. Next, the Ki is slowly increased until the robot
start to oscillate again. Then the Kd is slowly increased 0

until the robot is stable and is not oscillating. Then the PID -10
controller is tuned. Although the tuning method used is not
optimized, but it does stabilized the robot to a level that it -20

can balance in upright position. -30

The PID controller for both of the motor speed will use -40
Time
the same method as above. The output of the Motor PWM
as equation (9) above will be used as the setpoint for left
and right motors. The Back EMF method used to detect the
current speed of both motors. The Back EMF refers to Fig. 4: The PID Output of the Robot.
using the voltage generated by a spinning motor (EMF) to
check the current speed of the motor's rotation [12].

1-4244-0527-0/06/$20.00 © 2006 IEEE 171

Authorized licensed use limited to: ULAKBIM UASL ISTANBUL TEKNIK UNIV Expert now Trial User. Downloaded on December 5, 2009 at 17:16 from IEEE Xplore. Restrictions apply.
4th Student Conference on Research and Development (SCOReD 2006), Shah Alam, Selangor, MALAYSIA, 27-28 June, 2006

IV. ACKNOWLEDGEMENTS

We would like to thank MOSTI and CAIRO for the funding


support (IRPA Vot. 74256).

V. REFERENCES

[1] Ooi, Rich Chi (2003). Balancing a Two-Wheeled Autonomous Robot.


University of Western Australia: Thesis B. Mechatronics Engineering.
[2] Christopher T. Killian, "Design, Modern Control Technology
Components and System," Anne Arundel Community College, US.
[3] Bose, I. (2000). How to Make Good Homemade PCBs? Electronics
for You Magazine. Pg 37-40.
[4] HI-TECH Software Pty. Ltd. PICC Lite C Manual. Australia: User
Manual.
[5] Microchip Technology Inc. Brushed DC Motor Fundamentals. USA:
Application Note.
[6] Microchip Technology Inc. RC Model Aircraft Motor Control. USA:
Application Note.
[7] Microchip Technology Inc. Implementing a PID Controller Using a
PIC18 MCU. USA: Application Note.
[8] http://leiwww.epfl.ch/joe/joerelatives.html
[9] http://www.geology.smu.edu/%7Edpa
[10] http://www.independencenow.com/?from=indetech. comindex.html
[11] http://www.teamhassenplug.org/robots/legway/
[12]http://www.acroname.com/robotics/info/articles/back-emf/back-
emf.html
[13] http://www.prism.gatech.edu/~gth856d/buffalo/
paper.pdf
[14] http://www.ridgesoft.com/articles/balancebot/
BuildingABalancingRobot.pdf
[15] http://homepage.mac.com/sigfpe/Robotics/
equibot.html
[16] http://www.balbots.com/articles
[17] http://info.hobbyengineering.com/specs/gp2d120.pdf
[18] http://www.tcnj.edu/~rgraham/PID-tuning.html
[19] http://www.pittmannet.com/122100.html

1-4244-0527-0/06/$20.00 © 2006 IEEE 172

Authorized licensed use limited to: ULAKBIM UASL ISTANBUL TEKNIK UNIV Expert now Trial User. Downloaded on December 5, 2009 at 17:16 from IEEE Xplore. Restrictions apply.

You might also like