Obstacle Avoidance Robot Algorithm

27

Click here to load reader

description

The algorithm for obstacle avoidance

Transcript of Obstacle Avoidance Robot Algorithm

Page 1: Obstacle Avoidance Robot Algorithm

OBSTACLE AVOIDANCE ROBOT ALGORITHM

FIRDAUS BIN BACHOK @ EMBOK WALANG

This Report is Submitted Partial Fulfillment of Requirements for the Bachelor

Degree in Electronic Engineering (Computer Engineering)

Fakulti Kejumteraan Elektronik ( K e j ~ ~ t e n I a n Komputer)

Kolej Universiti Teknikal Kebangsaan Malaysia

Page 2: Obstacle Avoidance Robot Algorithm

ABSTRACT

Obstacle avoidance is one of the most critical factors in the design of

autonomous vehicles such as mobile robots. One of the major challenges in designing

intelligent vehicles capable of autonomous travel on highways is reliable obstacle

avoidance system. Obstacle avoidance system may be divided into two parts, obstacle

detection (mechanism, hardware, sensors) and avoidance contrd (algorithm, software,

code). Vector field histogram (VHF), vector field histogram with look

verification (VHF*) and virtual force field (W) are a few methods currently used in

obstacle avoidance algorithm. This project aims to improve the current obstacle

avoidance system using combinational of VHF* and coordination method. The

algorithm is programmed into PIC 16F84A and tested on a prototype. The prototype is

build using infra red sensor with comparator circuit and DC motor. The project has

been tested on several parametbs; target distance obstacle distance and size of an

obstacle. The result shows that the prototype works at 60% of successfid rate.

Page 3: Obstacle Avoidance Robot Algorithm

ABSTRAK

Sistem pengelak halangan adalah bahagian yang amat penting di dalam

rekabentuk sesebuah robot bergerak. Bahgian yang agak mencabar di dalam

rekabentuk robot bergerak adalah adalah bagaimana memastikan keblehpercayaan

sesebuah sistem pengelak halangan. Sistem pengelak halangan yang ingin diangunkan

did alam projek ini boleh dibahagikan kepada dua bahagian penting. Bahagian pertama

adalah perkakasan iaitu perkara berkenaan motor, pemproses mikro dan pengesan

halangan. Bahagian kedua pula adalah berkaitan perisian iaitu pengaturcaraan untuk

sistem pengelak halangan. Jenis pengesan yang biasa digunakan untuk mengesan

halangan ialah pengesan gelombang buyi, pengesan infia merah dan pengesan sonar.

Manakala jenis jenis algoritma yang telah digunakan utuk sistem pengelak halangan

ialah VHF, VHF* dan VFF. Projek ini bertujuan untuk memperbaiki sistem yang sedia

ada. Prototaip yang dibina untuk projek ini menggunakan PIC16F844 motor arus terus

dan pengesan infia merah. Prototaip yang dibina telah diuji dalam beberapa keadaan.

Didapati kebolehan prototaip ini untuk sampai ke kawasan sasaran adalah 60%.

Page 4: Obstacle Avoidance Robot Algorithm

CHAPTER I

INTRODUCTION

1.1 INTRODUCTION

The project is about the development an obstacle avoidance algorithm. There

are two main parts in this project which are hardware and software development.

Hardware consists of micro controller, motor controller, sensor, and motor circuits.

While the software development part involves of algorithm programming and

microcontroller programming.

Many types of controller that can be used such as Intel 8085 microprocessor,

Motorola 68k microprocessor, Atmel microcontroller, Peripheral Interface Controller

(PIC) microcontroller and Programmable Logic Controller (PLC). Controller that has

been chose for this project is PIC 16F84A microcontroller. This PIC is manufactured

by Microchip Technology.

Page 5: Obstacle Avoidance Robot Algorithm

The most suitable motor for this project is stepper motor. But due to budget

constrain, dc motor is been chosen for this project. Timer and delay concept is applied

in the controller program to control motor movement.

1.2 OBJECTIVE

The objectives of this project are:

Develop a prototype for obstacle avoidance robot.

This obstacle avoidance robot should be able to find their original track after

avoiding an obstacle.

The prototype should not have any line tracking sensor in order to achieve the

second objective.

1.3 PROBLEM STATEMENT

Nowadays there is a lot of obstacle avoidance robot has been developed. After

avoiding an obstacle, these robots cannot find their original direction. Therefore, this

project's main objective is to overcome this problem.

For example, if the robot is to reach a target at 10 meter to the north, but there is

an obstacle between the robot and the target; a normal obstacle avoidance robot will

Page 6: Obstacle Avoidance Robot Algorithm

never reach the target. This is because when the robot detects an obstacle, the robot will

change their direction but does not return to its original track. This example can be

illustrated as shown in Figure 1 .1 below.

DIRKTIOH:

H

E +. S

ROBOT MOVEMEWE

0 ORIGWW DIRECTION

THISPROJECT

- NORMAL ROBOT

Figure 1 . 1 : Robot movement

Page 7: Obstacle Avoidance Robot Algorithm

1.4 LIMITATIONS:

Obstacle that can be detected by the sensor:

Distance (max): 100 cm

High (min) : 8 cm

Wide (min) : 2 cm

Type any material that can reflect wave like paper, glass and metal

Shape any shape that can make the reflected wave reach IR detector

1.5 SCOPE OF WORK

This project covers:

Suitable devices that can be used in this project.

Development of a suitable algorithm for the robot in order to fulfill the objective

of this project.

PIC programming

Circuit developments

Build a prototype for obstacle avoidance robot.

Page 8: Obstacle Avoidance Robot Algorithm

1.6 REPORT STRUCTURE.

Chapter I is introduction of this project. It explains the objective of this project,

problem statement, limitations and scope of work.

Chapter II is about the literature review. Literature review is important in order

to understand previous work done in the same field. Literature review covers previous

algorithm, microcontroller PIC16F84q motor controller L293D, power supply and

rechargeable battery.

Chapter III is about the project methodology. This chapter explains the

procedures that have made in order to complete this project. It is include circuit design

and construct the prototype.

Chapter IV is about result and discussion for this project. Prototypes that have

been constructed at the previous chapter used to figure out the result of this project.

Chapter V is about summary and future recommendation. Summary have been

made due to overall project. Future recommendation is upgrade that can be made to this

project to make it more reliable.

Page 9: Obstacle Avoidance Robot Algorithm

LITERATURE REVIEW

2.1 INTRODUCTION

There are many types of devices and components can be use for constructing an

obstacle avoidance robot. This chapter will explain briefly about the device and

component that have been used in this project. The devices that have been chose for

this project is main controller, obstacle avoidance sensor, motor controller and power

source.

PIC16F84A is chosen as the main controller, quadruple half H-bridge drive

L293D as a motor microcontroller, IR transmitter and IR detector as an obstacle

avoidance sensor and nickel-metal hydride (NiMH) rechargeable battery as a power

source. Motor type that has been used in this project is DC motor.

Page 10: Obstacle Avoidance Robot Algorithm

2.2 MAIN CONTROLLER

There is a lot types of controller that can be use to control a system. Tree main

controller type have been commonly used today is programmable logic controller

(PLC), microprocessor and microcontroller.

PLC applications are widely used in electrical device control system. PLC

usually used in factory as production line control system. This type of controller

infrequently used for electronic control system. To implement this PIC for a robotic

system is not efficient due to the price of PLC. Currently the price for one unit PLC

controller is more then RM500. This price is really high compare to the price of one

microprocessor or microcontroller.

Microprocessor is usually implemented in electronic control system. It is widely

used in mobile phone, personal digital assistance (PDA), VCD player and robotic

control system. One chip microprocessor cannot stand alone. It has to be implemented

with memory chip, input output (IO) controller chip, clock and peripheral device. This

feature provides flexibility to microprocessor. The memory and I 0 port can be easily

expand by adding additional memory chip or I 0 controller chip. Example of

microprocessor is Intel 8085, Atmel and Motorola 68K.

Microcontroller is a single chip that contains controller processing unit, memory

and I 0 controller. It can operate alone without additional peripheral chip like

microprocessor. The advantages of microcontroller compare to microprocessor are

cheaper and easy to implement. Disadvantage of microcontroller is lest flexibility due

Page 11: Obstacle Avoidance Robot Algorithm

to integrated memory and I 0 controller. Microcontroller widely used in digital camera,

television, robot, electronic device and vehicle control system.

In this project used PIC Microchip microcontroller as a main controller. This

decision has been make due to the low price and simplicity of the microcontroller.

Microcontroller is also easier to find in the market compare to microprocessor and

PLC.

2.3 OBSTACLE AVOIDANCE SENSOR

There is a lot type of sensor available in the market now a day. In example infia

red (IR) sensor, limit switch, LDR, red green blue (RGB) sensor, digital compass, ultra

sonic sensor and sonar sensor. A few type of this sensors cannot find easily like sonar

sensor and digital compass.

There is a few type of sensor that can be use for obstacle detection. The most

common used is ultra sonic sensor, sonar sensor and infia red (IR) sensor. The

operation method apply in sonar and ultra sonic sensor is quite same. The difference

between sonar and ultra sonic sensor is the sonar sensor can be rotate 360 degree. All of

this sensor use wave reflection method to detect an obstacle.

Usually these obstacle avoidance sensors have two parts which is wave

generator and wave detector. For ultra sonic, sonar and IR it is used 38 kHz to 40 kHz

frequency to be operated.

Page 12: Obstacle Avoidance Robot Algorithm

2.3.1 IR sensor and IR LED

There are two main types of IR sensor. The first one is IR activated transistor.

Even the name is transistor, but this sensor only has two pin. This pin represent for

emitter and collector. This sensor will activate when there is a IR wave detected. Figure

2.9 shows the symbol of this sensor.

L

Figure 2.1 : IR sensor symbol

The second type of IR sensor is IR sensor that have tree pin. Two pin for supply

and the other one pin for output signal. The arrangement of the pin is not the same for

all this kind of sensor. Figure 2.10 shows a few type of pin arrangement for IR sensor.

Without datasheet, try and error analysis have to use to figure out the pin arrangement.

& &

Figure 2.2: Several type of IR sensor.

Source: http:// www.spettel.de/ralflprojekte/a~~~r~5/index.shtml

Page 13: Obstacle Avoidance Robot Algorithm

IR LED is an electronic component that can transmit IR wave. This IR LED is

the same as a normal LED. IR wave is not a visible light. R detector need to use to

check the hnctionality of this LED. Figure 2.11 shows the symbol of IR LED

Figure 2.3: IR LED symbol

2.4 MOTOR CONTROLLER

Motor controller is an interface circuit between the main controller and motor.

Common method used for robotic system is the H-bridge circuit. This method is

suitable for DC motor, and servo motor. Additional controller is needed for driving

stepper motor. This is because, stepper motor need certain input to make it rotate

forward or backward. One example that can be use to controller stepper motor is by

using IC L297 and ICL298.

Page 14: Obstacle Avoidance Robot Algorithm

2.4.1 H-Bridge motor controller

H-bridge motor controller is a motor driver that allows us to control the motor

either rotate forward, backward or stop (brake). Basic idea for H-bridge has 4 switches

to control the motor movement. Each motor movement required to turn ON two

switches at the same time. Figure below represent the basic idea for H-bridge motor

controller. Table below show the switch sequence how to control the motor movement.

Gnd

Figure 2.4: Basic design for H-bridge motor controller.

Switch to be ON I Polarity I Effect

A1 and A2 I Forward I Motor spin forward I I

B1 and B2 I Reverse 1 Motor spin reverse I I

A1 and B1 1 Brake 1 Motor act as a brake I

none I Free I Motor floats freely I I I I

Table 2.1 : Switch to control motor movement.

The explanation above just to present the basic idea for motor controller. But in

practical electronic circuit there is only two input switch. Which is one switch used to

control forward movement and the other one for backward movement. Usually 4 or 6

power transistor need to perform H-bridge circuit. This circuit needs combination of n-

Page 15: Obstacle Avoidance Robot Algorithm

type and p-type transistor. Power transistor commonly used in constructing motor

controller because of this circuit consume high power due to high operating current.

Figure 2.13 (a) below shows the combination of 6 to construct H-bridge circuit. And

Figure 2.13 (b) and (c) show us how to control the motor movement. While Figure 2.14

shows 4 transistor to construct H-bridge circuit.

01

input 2 input 1

8"d

Figure 2.5 (a): 6 transistors H-bridge

(b) Forward movement (c) backward movement

Figure 2.5: 6 transistors H-bridge

Page 16: Obstacle Avoidance Robot Algorithm

inpm 1 input 2

(a)

(b) Forward movement (c) backward movement

Figure 2.6: 4 transistors H-bridge

Currently there is already has a few integrated circuit (IC) that can perform the

operation of H-bridge circuit. This type of IC may perform better then the normal H-

bridge circuit. For example IC L293D; this IC contain 4 half H-bridge circuit, so this IC

can construct two H-bridge circuit. More over this IC support voltage operation from

4.5V to 36V with output current 1A. This IC also consumes less power compared to

normal H-bridge circuit.

Page 17: Obstacle Avoidance Robot Algorithm

Table below show us few type of IC that can perform as H-bridge circuit.

TTL and CMOS input compatible

Separate input-logic supply

Thermal shutdown

High noise immunity

Low pqwer dissipation

Internal clamp diode

TTL and CMOS input compatible Powa Gnd A

NO 'shoot through' current power Gnd B

DIRECTIOII B

Thermal shutdown at 17 10 "C BOOTSTRAP 96

Internal clamp diode

Table 2.2: H-bridge motor controller IC.

Page 18: Obstacle Avoidance Robot Algorithm

2.5 POWER SUPPLY

Power supply is use for supplying voltage to the circuit. There are 2 types of

power supply which are ac (alternating current) power supply and dc (direct current)

power supply. Robotic systems usually use dc power supply.

Dc power supply at least contains a regulator, filter and load resistor. Regulator

is use to regulate the output of the power supply and the filter use to stabilize the output

voltage. And load resistor will act as a short circuit protection. Commonly use

component for regulator is LM7805 which will provide positive 5V output and

LM7808 which will provide positive 8V output. Sometime diode zener can also be use

as regulator. Commonly use filter is low pass filter which is constructed by resistor and

capacitor. Figure 2.15 below show us the basic power supply circuit with 5V output.

Figure 2.7: Power supply circuit.

Page 19: Obstacle Avoidance Robot Algorithm

2.6 RECHARGEABLE BATI'ERY

Commonly used battery for robotic application is rechargeable battery. There

are many types of rechargeable battery with difference characteristic. The decision to

use which type of battery for robotic system depends on the requirement of the robot.

For small and low power consumption robotic system NiCd (nickel cadmium) or NiMH

(nickel metal hydride) rechargeable battery are commonly used. But for large and high

power consumption robotic system, lead acid rechargeable battery is commonly used.

2.6.1 Nickel cadmium (NiCd)

SaLIy Valve COP l+! I , Saltng Plate

Insulation Gasket

egsfive Electrode

Positlvr Eiectode

Figure 2.8: NiCd rechargeable battery structure.

(Source: Panasonic NiCd rechargeable battery datasheet)

Nickel cadmium rechargeable battery is the first commonly used in electronic

device. Currently the capacity of one AA size battery is 1000mAh. This rechargeable

battery can be recharge up to 1000 times. The advantages of this battery are low self

discharge rate, long life time and lower cost. While disadvantages of this battery type

are lower capacity, have memory effect (battery capacity decreases when shallow

charge and discharge cycles are repeated) and contain toxic material (Cadmium).

Page 20: Obstacle Avoidance Robot Algorithm
Page 21: Obstacle Avoidance Robot Algorithm
Page 22: Obstacle Avoidance Robot Algorithm

The advantages of this battery is, it have long life cycle. Under normal

conditions, the lithium ion battery has a life of more than 500 charge/discharge cycles.

This battery types also free from the memory effect, a phenomenon seen in nickel-

cadmium in which the apparent battery capacity decreases when shallow charge and

discharge cycles are repeated. Li-ion batteries have a faster recharging time by using

normal charger. The li-ion battery can be fully charged in 1 to 2 hours, using a

constant-current / constant-voltage (CCICV) type dedicated charger with a rated

voltage of 4.2V per cell.

The disadvantages for this type of battery are needs safety circuit while using

this battery and the cost is higher then using NiMH battery. Li-ion battery without

safety circuit can cause explosion. Normally Li-ion batteries available in the market are

provided with safety circuit.

Li-ion rechargeable batteries are commonly used for note book, personal digital

assistance (PDA) and hand phone.

Equation of chemical reaction inside the battery:

Charge Positive Eketrodfa LC002

- . Lii-x C002 + xLif + xe Discharge

Charge - Negative Electrode C + r ~ i + + xe- . CLlx Discharge

Charge Battery as a Whote - LiCoOz + C . Lic-x CoO2 + CLix

Discharge

Figure 2.13 : Reaction inside the Li-ion battery.

(Source: Panasonic Li-ion rechargeable battery datasheet)

Page 23: Obstacle Avoidance Robot Algorithm

cell connectors M

Sotiflue terminal

~lecrrolya rolurlon d i l m lulturicacld)

rmniue caring POIMUC ~ I e m ~ d e

(lead dioxide)

Figure 2.14: Lead-acid rechargeable battery structure.

(Source: http://newark. rutgers. edu/)

Lead-acid batteries are not usually used for electronic application. This type of

battery commonly used in car, motorcycle and uninterrupted power supply (UPS). The

advantage of this battery is higher energy density per unit price compare to the others

rechargeable battery. While disadvantages is it is contain toxic material and the weight

is heaviest compare to the others battery.

Equation of chemical reaction inside the battery: ~t me anode

1".-

At the cathode:

The overall reaction (during discharge) is therefore

Figure 2.15: Reaction inside the lead-acid battery.

(Source: http://newark.rutgers.edu/)

Page 24: Obstacle Avoidance Robot Algorithm

2.6.5 Battery arrangement

Battery arrangement is important aspect to be considered in building an

electronic system. There are two type battery arrangements that can be used; parallel

arrangement and serial arrangement.

Parallel arrangement is used to multiply the current source. Figure below show

the parallel arrangement.

Figure 2.16: Parallel arrangement.

Serial arrangement is used to gain the voltage source. Figure below show the

serial arrangement.

1000mA

Figure 2.17: Serial arrangement.

Page 25: Obstacle Avoidance Robot Algorithm

Both of this arrangement can be combine together in order to gain both current

and voltage source. Figure bellow shows the combination of serial and parallel

arrangement.

Figure 2.18: Combination of serial and parallel arrangement.

2.7 CONCLUSION

Literature review is an important part to understand each component and device

that have been chose in this project. After doing literature review all the specification

and characteristic of the devices and components have been figure out. This

understanding will help a lot while doing circuit design.

Page 26: Obstacle Avoidance Robot Algorithm

wm

w

*

.- w

s

3

TL

k

E,

g

E .&

4-

s3

g

bE

O

3 -

g-

0

A

83

.9

., s

&e

O

-3 C 2

6 6

,

:g

o

ww

*

2%

2 C

. - w z

2w

m

5S

%

eP

6

'e

!

Th

Z

0

g; $

0-

0 e

50

s

m2

$

. - $!

a*

0

w

so 9

.-

w

8 .-a 2

o

a

5

K $

-2

2 3

2 f,

0

*+

j*

8

C)

.-

e5

s

2 a

&.-2

g

p-,. .-

g S

KE

. -

Page 27: Obstacle Avoidance Robot Algorithm

Literature review: .Algorithm

.PIC ( .Software development 1

*Related hardware Software I Hardware

B * Chose suitable device

Study about algorithm and components that can

that have been used and be use in this project. collect all related

information. Study the data sheet for

each component. I Develop the algorithm C Searching the interface

by using MPLAB IDE circuit for each devices

1 I Design and simulate the I circuit.

Troubleshooting 'I' I Construct and test. I

Integrate the algorithm (programlsoftware) and

circuit (hardware) together

( Test the project. I Figure 3.1 : Flowchart for project methodology.