You are on page 1of 86

A PROJECT REPORT ON 2010

DESIGN OF OBSTACLE DETECTION


& COLLISION AVOIDANCE ROBOT

Under the esteemed guidance of :

Mr. S. K. Das (Scientist , CMERI –Durgapur)


Mr. Prajit Paul (Lecturer ,Asansol Engineering Submitted By:
College)
Supriya-
AEIE(10805062003)
Aatreyee Sarkar-
AEIE(10805062010)
Asansol Engineering College
Dipu Kumari-
Vivekanand Sarani , Kanyapur AEIE(10805062011)
Mukund Bihari-
Asansol - 713305 ECE(10803061046)
mukundbihari.blogspot.com 2010

CENTRAL MECHANICAL ENGINEERING RESEARCH


INSTITUTE
MAHATMA GANDHI AVENUE
DURGAPUR-713209, West Bengal

Certificate

This is to certify that the Final Year Project Report submitted

by

Supriya(AEIE),Aatreyee Sarkar(AEIE) ,Dipu Kumari (AEIE)

and Mukund Bihari(ECE) is a record of the work carried out

on project “Design of Obstacle detection and Collision

Avoidance Robot” by them under our guidance. The work has

been completed at the Robotics and Auomation Laboratory,

CMERI, Durgapur.

Shri S. K. Das
Dr S. N. Shome
Scientist
Scientist
Robotics and Automation
Group Head & DU Head
Laboratory

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 2


mukundbihari.blogspot.com 2010

ACKNOWLEDGEMENT

An academic project marks the beginning of the transition from amateur to


a professional. It is the forum where theory is put into perspective.We is
thankful to the Director, CMERI for his kind permission to carry out our
summer training at CMERI (a CSIR establishment), and Durgapur.

We will also like to thank Dr.S.N.Shome, Scientist G and Group head who
offered us the opportunity to carry out our training at Robotics and
Automation Lab under the supervision of Shri S.K.Das Scientist-C. We
acknowledge our indebtedness to Shri S.K.Das for providing his esteemed
guidance and substantial guidance to our Final Year Project.

Mr. A. Basu Adhikari (JRF) of CMERI and Mr. Biplap CMERI, Durgapur,
Mr. Jyotirmaya Karmkar and Mr. Sonatan Dutta need a distinct mention
here, because without there perpetual efforts to systematize our work it
wouldn‟t have been possible to complete the project on time.

We are also greatly indebted to our college for making provisions for the
arrangement of our summer training at such a reputed organization of
CMERI.

Finally I endeavor indispensable roles which have been played by many


individuals. My gratitude to those entire individuals in single words of
“THANKS”, sincerely hoping it will convey the depth of the feeling.

Supriya
Aatreyee Sarkar
Dipu Kumari
Mukund Bihari

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 3


mukundbihari.blogspot.com 2010

Contents
1. Summary 6

2. Overview 7

3. Flowchart 9

4. Components used

 Microcontroller AT89C52 11
 Voltage comparator 23
 Motor driver 25
 Variable resistance 28
 IR sensors 29
 Crystal oscillator 32
 Voltage regulator 34
 Other components 35
 DC motor 38
 Robotic wheel 39
 Vehicle Base 39

5. Circuit Implementation

 Voltage comparator 41
 AT89C52 circuit 44
 Motor Driver circuit 47
 Voltage Regulator 50

6. Microcontroller programing

 C program 52

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 4


mukundbihari.blogspot.com 2010

 Screen shots of keil programing 57

7. Loading program in microcontroller

 ALL100 61
 Screen shots of program loading 62

8. Problems faced during designing of robot

 Faulty microcontroller board 74


 Problem of motor driver circuit 75
 Voltage drop of 2V 75
 Excessive heating of LM7805 76

9. Possible Improvements 77

10. References and Resources

 Books and Links 78


 Tools of the trade 78
 Electronic shops 78

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 5


mukundbihari.blogspot.com 2010

SUMMARY
The main objective of this project is to design a obstacle detection and
collision avoidance robot with help IR sensors embedded around the body
of robotic vehicle.This design can be used in fully automated vehicles like
cars etc , moving materials in industries fom one to another place and
similar other commercial application.
Starting with an overview of the system the document would cover
implementation details like components used ,circuits and algorithms,
problems faced during designing of the obstacle detection and collision
avoidance robot .

It has also been described that how the microcontroller program has been
embedded in the microcontroller with help of a burner device.

Some suggestions on improving the design and its commercial application


have also been discussed in the later part of the document.

The „Reference and Resources‟ page has a list of relevant books, websites,
electronic shops and commonly used parts & their prices.

Prerequisites:
 Knowledge of electronics devices and circuits and microcontroller.
 Knowledge of circuit design.
 Knowledge of Keilμvision 3.
 Knowledge of ALL 100 program burner.

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 6


mukundbihari.blogspot.com 2010

OVERVIEW
The robot uses four IR sensors to sense any obstacle in between its
path.The data coming out from those sensors are fed into voltage
comparators where the sensor data is compared with a fixed reference
voltage.After the comparision of sensor data nad the Vref the volatge
comparator gives output as 0V for presence of any obstacle and

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 7


mukundbihari.blogspot.com 2010

5 V for absence of obstacle.This output of comparator circuit is fed into the


microcontroller in which decision making program is stored .The
microcontroller processes the output of comparator circuit according to the
program stored in it and gives output at another port .

The output of microcontroller is fed into the motor driver circuit which
ampifies the low output current coming from microcontroller so that its
output becomes capable to drive the DC motors fitted in the robotic vehicle
base.

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 8


mukundbihari.blogspot.com 2010

FLOWCHART

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 9


mukundbihari.blogspot.com 2010

COMPONENTS USED

 Microcontroller(AT89C52)
 Voltage Comparator(LM311P)
 Motor Driver(L293D)
 Variable Resistance
 IR Sensor(GP2D12)
 Crystal Oscillator(ML 11.0592)
 Voltage Regulator(LM7805)
 Other Components
 IC Base
 Vero Board
 Wire Connectors
 DC Motor
 Robotic Wheel
 Vehicle Base

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 10


mukundbihari.blogspot.com 2010

MICROCONTROLLER
(AT89C52 24PI)
The AT89C52 is a low-power, high-performance CMOS 8-bit
microcomputer with 8 Kbytes of Flash programmable and erasable read
only memory (PEROM). The device is manufactured using Atmel‟s high
density nonvolatile memory technology and is compatible with the industry
standard 80C51 and 80C52 instruction set and pinout.

The on-chip Flash allows the program memory to be reprogrammed in-


system or by a conventional nonvolatile memory programmer. By
combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel
AT89C52 is a powerful microcomputer which provides a highly flexible and
cost effective solution to many embedded control applications.

AT89C51 24PI

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 11


mukundbihari.blogspot.com 2010

The AT89C52 provides the following standard features: 8 Kbytes of Flash,


256 bytes of RAM, 32 I/O lines, three 16- bit timer/counters, a six-vector
two-level interrupt architecture, a full duplex serial port, on-chip oscillator,
and clock circuitry. In addition, the AT89C52 is designed with static logic for
operation down to zero frequency and supports two software selectable
power saving modes. The Idle Mode stops the CPU while allowing the
RAM, timer/counters, serial port, and interrupt system to continue
functioning. The Power down Mode saves the RAM contents but freezes
the oscillator, disabling all other chip functions until the next hardware
reset.

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 12


mukundbihari.blogspot.com 2010
Pin Configuration

Pin Description

VCC
Supply voltage.

GND
Ground.

Port 0

 Port 0 is an 8-bit open drain bidirectional I/O port. As an output port,


each pin can sink eight TTL inputs. When 1s are written to port 0
pins, the pins can be used as high-impedance inputs.

 Port 0 can also be configured to be the multiplexed low-order


address/data bus during accesses to external program and data
memory. In this mode, P0 has internal pullups.

 Port 0 also receives the code bytes during Flash programming and
outputs the code bytes during program verification. External pullups
are required during program verification.

Port 1
 Port 1 is an 8-bit bidirectional I/O port with internal pullups.

 The Port 1 output buffers can sink/source four TTL inputs. When 1s
are written to Port 1 pins, they are pulled high by the internal pullups
and can be used as inputs. As inputs, Port 1 pins that are externally

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 13


mukundbihari.blogspot.com 2010

being pulled low will source current (IIL) because of the internal
pullups.

 In addition, P1.0 and P1.1 can be configured to be the timer/counter 2


external count input (P1.0/T2) and the timer/counter 2 trigger input
(P1.1/T2EX), respectively, as shown in the following table.

 Port 1 also receives the low-order address bytes during Flash


programming and program verification.

Port 2

 Port 2 is an 8-bit bidirectional I/O port with internal pullups.

 The Port 2 output buffers can sink/source four TTL inputs. When 1s
are written to Port 2 pins, they are pulled high by the internal pullups
and can be used as inputs. As inputs, Port 2 pins that are externally
being pulled low will source current (IIL) because of the internal
pullups.

 Port 2 emits the high-order address byte during fetches from external
program memory and during accesses to external data memory that
uses 16-bit addresses (MOVX @ DPTR). In this application, Port 2
uses strong internal pullups when emitting 1s. During accesses to
external data memory that uses 8-bit addresses (MOVX @ RI); Port 2
emits the contents of the P2 Special Function Register.

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 14


mukundbihari.blogspot.com 2010

 Port 2 also receives the high-order address bits and some control
signals during Flash programming and verification.

Port 3
 Port 3 is an 8-bit bidirectional I/O port with internal pullups.

 The Port 3 output buffers can sink/source four TTL inputs. When 1s
are written to Port 3 pins, they are pulled high by the internal pullups
and can be used as inputs. As inputs, Port 3 pins that are externally
being pulled low will source current (IIL) because of the pullups.

 Port 3 also serves the functions of various special features of the


AT89C51, as shown in the following table.

 Port 3 also receives some control signals for Flash programming


And programming verification.

RST

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 15


mukundbihari.blogspot.com 2010

Reset input. A high on this pin for two machine cycles while the oscillator
is running resets the device.

ALE/PROG
Address Latch Enable is an output pulse for latching the low byte of the
address during accesses to external memory.This pin is also the program
pulse input (PROG) during Flash programming.

In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator


frequency and may be used for external timing or clocking purposes. Note,
however, that one ALE pulse is skipped during each access to external
data memory. If desired, ALE operation can be disabled by setting bit 0 of
SFR location 8EH. With the bit set, ALE is active only during a MOVX or
MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the
ALE-disable bit has no effect if the microcrontroller is in external execution
mode.

PSEN

Program Store Enable is the read strobe to external program memory.


When the AT89C52 is executing code from external program memory,
PSEN is activated twice each machine cycle, except that two PSEN
activations are skipped during each access to external data memory.

EA/VPP

External Access Enable. EA must be strapped to GND in order to enable


the device to fetch code from external program memory locations starting
at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA
will be internally latched on reset. EA should be strapped to VCC for
internal program executions. This pin also receives the 12-volt
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 16
mukundbihari.blogspot.com 2010

programming enable voltage (VPP) during Flash programming when 12-


volt programming is selected.

XTAL1
Input to the inverting oscillator amplifier and input to the internal clock
operating circuit.

XTAL2
Output from the inverting oscillator amplifier.

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 17


mukundbihari.blogspot.com 2010

BLOCK DIAGRAM OF AT89C52

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 18


mukundbihari.blogspot.com 2010
Block Diagram of Microcontroller(AT89C52)

Interrupts

The AT89C52 has a total of six interrupt vectors: two external interrupts
(INT0 and INT1), three timer interrupts (Timers 0, 1, and 2), and the serial
port interrupt. These interrupts are all shown in Figure below. Each of these
interrupt sources can be individually enabled or disabled by setting or
clearing a bit in Special Function Register IE. IE also contains a global
disable bit, EA, which disables all interrupts at once. Note that Table below
shows that bit position IE.6 is unimplemented. In the AT89C51, bit position
IE.5 is also unimplemented. User software should not write 1s to these bit
positions, since they may be used in future AT89 products. Timer 2
interrupt is generated by the logical OR of bits TF2 and EXF2 in register
T2CON. Neither of these flags is cleared by hardware when the service
routine is vectored to. In fact, the service routine may have to determine
Whether it was TF2 or EXF2 that generated the interrupt, and that bit will
have to be cleared in software.

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 19


mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 20


mukundbihari.blogspot.com 2010

Oscillator Characteristics

XTAL1 and XTAL2 are the input and output, respectively, of an inverting
amplifier that can be configured for use as an on-chip oscillator, as shown
in Figure below. Either a quartz crystal or ceramic resonator may be used.
To drive the device from an external clock source, XTAL2 should be left
unconnected while XTAL1 is driven, as shown in Figure below. There are
no requirements on the duty cycle of the external clock signal, since the
input to the internal clocking circuitry is through a divide-by-two flip-flop, but
minimum and maximum voltage high and low time specifications must be
observed.

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 21


mukundbihari.blogspot.com 2010

Crystal Oscillator

ML 11.0592 crystal Oscillator

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 22


mukundbihari.blogspot.com 2010

Maximum rating of AT89C51

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 23


mukundbihari.blogspot.com 2010

VOLTAGE COMPARATOR
(LM311P)

The LM311 are single high-speed voltage comparators. These devices are
designed to operate from a wide range of power-supply voltages, including
15-V supplies for operational amplifiers and 5-V supplies for logic
systems. The output levels are compatible with most TTL and MOS circuits.
These comparators are capable of driving lamps or relays and switching
voltages up to 50 V at 50 mA. All inputs and outputs can be isolated from
system ground. The outputs can drive loads referenced to ground, VCC+ or
VCC–. Offset balancing and strobe capabilities are available, and the
outputs can be wire-OR connected. If the strobe is low, the output is in the
off state, regardless of the differential input.

LM 311 voltage comparator

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 24


mukundbihari.blogspot.com 2010

Pin Configuration of LM311

Functional Block Diagram

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 25


mukundbihari.blogspot.com 2010

MOTOR DRIVER
(L293D)

The Device is a monolithic integrated high voltage, high current four


channel driver designed to accept standard DTL or TTL logic levels and
drive inductive loads (such as relays solenoides, DC and stepping motors)
and switching power transistors. To simplify use as two bridges each pair of
channels is equipped with an enable input. A separate supply input is
provided for the logic, allowing operation at a lower voltage and internal
clamp diodes are included.

L293D Motor Driver IC

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 26


mukundbihari.blogspot.com 2010

BLOCK DIAGRAM

L293D Motor Driver

The L293D is a quadruple half H-bridge bidirectional motor driver IC that


can drive current of up to 600mA with voltage range of 4.5 to 36 volts. It is
suitable to drive small DC-Geared motors, bipolar stepper motor etc.

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 27


mukundbihari.blogspot.com 2010

Specifications

 Supply Voltage Range 4.5V to 36V


 600-mA Output current capability per driver
 Separate Input-logic supply
 It can drive small DC-geared motors, bipolar stepper motor.
 Pulsed Current 1.2-A Per Driver
 Thermal Shutdown
 Internal ESD Protection
 High-Noise-Immunity Inputs

Applications

 DC and stepper motor drives


 Position and velocity servomechanisms

PIN CONFIGURATION

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 28


mukundbihari.blogspot.com 2010

Pin configuration of L293D

VARIABLE RESISTANCE
Variable resistors consist of a resistance track with connections at both
ends and a wiper which moves along the track as you turn the spindle. The
track may be made from carbon, cermet (ceramic and metal mixture) or a
coil of wire (for low resistances). The track is usually rotary but straight
track versions, usually called sliders, are also available.

Variable resistors are often called potentiometers in books and


catalogues. They are specified by their maximum resistance, linear or
logarithmic track, and their physical size. The standard spindle diameter is
6mm.

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 29


mukundbihari.blogspot.com 2010

Variable resisitance

IR SENSORS
(GP2D12)
General Description
The Sharp GP2D12 is an analog distance sensor that uses infrared to
detect an object between 10 cmand 80 cm away. The GP2D12 provides a
non-linear voltage output in relation to the distance an objectis from the
sensor and interfaces easily using any analog to digital converter.

Features
• High immunity to ambient light and color of object
• No external control circuitry required
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 30
mukundbihari.blogspot.com 2010

GP2D12

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 31


mukundbihari.blogspot.com 2010

The angles in this triangle vary based on the distance to the object. The
receiver portion of these new detectors is actually a precision lens that
transmits the reflected light onto various portions of the enclosed linear
CCD array based on the angle of the triangle described above. The CCD
array can then determine what angle the reflected light came back at and
therefore, it can calculate the distance to the object.

Sensing distance of GP2D12

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 32


mukundbihari.blogspot.com 2010

Characteristics of GP2D12 sensors

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 33


mukundbihari.blogspot.com 2010

CRYSTAL OSCILLATOR
(ML 11.0592)
XTAL1 and XTAL2 are the input and output, respectively, of an inverting
amplifier that can be configured for use as an on-chip oscillator, as shown
in Figure below. Either a quartz crystal or ceramic resonator may be used.
To drive the device from an external clock source, XTAL2 should be left
unconnected while XTAL1 is driven, as shown in Figure below. There are
no requirements on the duty cycle of the external clock signal, since the
input to the internal clocking circuitry is through a divide-by-two flip-flop, but
minimum and maximum voltage high and low time specifications must be
observed.

Crystal oscillator

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 34


mukundbihari.blogspot.com 2010

Why two 33pF capacitors are used with crystal oscillator in 89C52
microcontroller?

Usually, crystal is between two pins of the CPU, and two caps of 33 pF are
mounted from these pins to the ground.
The purpose is to "dephase" the crystal signal to provide a lead/lag to the
buffers inside the CPU and allows the oscillation! (The oscillator is a feed-
back loop around a buffer: you need input/output OUT OF PHASE to
maintain oscillation. The caps shift the phase, while the Xtal maintains the
frequency).

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 35


mukundbihari.blogspot.com 2010

VOLTAGE REGULATOR
(LM7805)
The LM78M05, a three-terminal positive voltage regulator employ built-in
current limiting, thermal shutdown, and safe-operating area protection
which makes them virtually immune to damage from output overloads.

With adequate heatsinking, they can deliver in excess of 0.5A output


current. Typical applications would include local (on-card) regulators which
can eliminate the noise and degraded performance associated with single-
point regulation.

Features
• Output current in excess of 0.5A
• No external components
• Internal thermal overload protection
• Output voltages of 5V

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 36


mukundbihari.blogspot.com 2010

OTHER COMPONENTS

RESISTORS
 10 kΩ
 8.2 kΩ
 330 kΩ

CAPACITORS
 10 µF
 330 µF
 0.1 µF
 33 pF

DIODES
1N4007

The 1N4007 Diode is in a series of 1 Amp


diodes the Peak reverse voltage is 50V. It's
a generic diode.Only lets current flow in one
direction.

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 37


mukundbihari.blogspot.com 2010

IC BASE
 40 pin
 16 pin

40 pin 16pin

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 38


mukundbihari.blogspot.com 2010

VERO BOARD
Stripboard is a widely-used type of
electronics prototyping board
characterized by a 0.1 inch (2.54
mm) regular (rectangular) grid of
holes, with wide parallel strips of
copper cladding running in one
direction all the way across one side
of the board. It is usually known by
the name Veroboard, which is a
trademark, in the UK, of British
company Vero Technologies Ltd, who
invented this kind of board.

WIRE CONNECTORS

These connectors are used to


connect wires through the vero
board through which input , power
supply or outputs are taken out
through the board.

Different conectors used are:

 8 pin
 4 pin
 2 pin

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 39


mukundbihari.blogspot.com 2010

DC MOTOR (12V -50mA)


These are very commonly used in
robotics. DC motors can rotate in
both directions depending upon
the polarity of current through the
motor. These motors have free
running torque and current ideally
zero. These motors have high
speed which can be reduced with
the help of gears and traded off
for torque.

Here a single phase bidirectional DC motor is used. Bidirectional motor


is used so that our robotic vehicle can move in both forward and
backward directions easily in case if any obstacle is in between the path
of the robotic vehicle. Any obstacle in between the path of robot will be
detected by IR sensors incorporated around the body of vehicle.

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 40


mukundbihari.blogspot.com 2010

ROBOTIC WHEEL
Two types of wheel
have been used:

 Main
wheel(Front)
 Support
wheel(Rear)

VEHICLE BASE
It is made up of light weight material alumunium which provides easy
movement of the robotic vehicle. It has folowing provisions in it:

 Slot for DC motors.


 Rear support wheel.
 Slot to clamp sensors.
 9V battery holder.
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 41
mukundbihari.blogspot.com 2010

CIRCUIT IMPLEMENTATION

 AT89C52 circuit
 Voltage comparator
 Motor Driver circuit
 Voltage Regulator

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 42


mukundbihari.blogspot.com 2010

VOTLAGE COMPARATOR CIRCUIT


LM311P
LM311P is a voltage comparator circuit which compares the output of front ,
left , right and rear sensor with reference voltage coming from variable
resistance (potentiometer).The Vref is adjustable and it is kept in the range of
0.4V to 2.5V.

Lower the value of reference voltage is set ,greater will be the sensing distance
of sensors.

Vref α OF OBSTACLE
DESIGN Sensing distance
DETECTION ofAVOIDANCE
AND COLLISION sensor ROBOT 43
mukundbihari.blogspot.com 2010

Vref is fed into pin no. 2 and the sensor input is fed into pin 3 of the LM311P
IC.Pin no. 1 and 4 si shorted and connected with ground. Vcc (5V) is
connected with pin no. 8 of the comparator .Pin no.7 and 8 are shorted
through 330 kΩ resistor.But here we have used resistor of value of about
400kΩ.Pin no. 5 and 6 do not have any connection.

The comparator circuit is of inverting nature i.e. if senor output is high


then we get 0V output from the LM311P circuit.

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 44


mukundbihari.blogspot.com 2010

VOLTAGE COMPARATOR BLOCK DIAGRAM

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 45


mukundbihari.blogspot.com 2010

MICROCONTROLLER CIRCUIT
AT89C52

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 46


mukundbihari.blogspot.com 2010

The output of voltage comparator circuit is fed as input in the


microcontroller at port 1.The output of microconroller is taken out at port 2
and fed into motor driver L293D.

BLOCK DIAGRAM OF MICROCONTROLLER

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 47


mukundbihari.blogspot.com 2010

AT 89C52

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 48


mukundbihari.blogspot.com 2010

Following pins are taken as input in the microcontroller:

 Pin 1.0 – Front sensor


 Pin 1.1 – Left sensor
 Pin 1.2 – Right sensor
 Pin 1.3 – Rear sensor

Following pins are taken as output from the microcontroller :

 Pin 2.0
 Pin 2.1
} MOTOTR 1

 Pin 2.2
 Pin 2.3
} MOTOTR 2

Eight 10kΩ pull-up resistors are connected to the microcontroller at port


P0.Rest of the ports have inbuilt pull-up resistors, so there is no need to
connect pull-up resistors to the port1 , port2 and port3.A 10µf capacitor is
connected between pin9 and Vcc .A resistor of 8.2kΩ is connected between
pin 9 and the pin18of the microcontroller. Crystal is connected to pin no.18
and pin 19.Two ceramic capacitors of 33pF are connected between both
pin of crsytal and the ground.These capacitors stablize the output of
crsytal.Output of pin 10 and pin 11 is connected to the MAX232 Ic meant
for serial communication.Power supply to the microcontroller is
giventhrough a voltage regulator circuit which takes 12V as input and 5 V
as output.

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 49


mukundbihari.blogspot.com 2010

MOTOR DRIVER
L293D
L293D motor driver needs two voltage levels :

 12V at pin no.8


 5V at pin no. 1 ,9 and 16.

The main function of driver is to amplify the 15mA current, coming from the
microcontroller which is incpable to drive 50mA rating motor.It can give
output current upto 600mA.

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 50


mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 51


mukundbihari.blogspot.com 2010

The driver circuit basically consists two H-bridges for driving small DC
motors.In a H-bridge circuit ther are four transistors of which only two are in
ON state which are located diagonally.The two pair of transistors gives us
the bidirectional rotation of motor.

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 52


mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 53


mukundbihari.blogspot.com 2010

VOLTAGE REGULATOR
Voltage Regulator is needed as because we have different voltage level
requirement in different components.e.g.Our motor requires 12v supply but
circiuts like microcontroller board and voltage comparator requires only 5 V
suply.

Also motor driver IC L293D reqiures 5V and 12V simultaneously.So, we


have incorporated two voltage regulator circiuts on our board.

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 54


mukundbihari.blogspot.com 2010

CURCUIT DIAGRAM OF VOLTAGE


REGULATOR

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 55


mukundbihari.blogspot.com 2010

MICROCONTROLLER PROGRAMMING

Microcontroller
program has been
done usinng the
software µvision 3
keil.This software
provides Keil C51
Compiler to compile
program.It converts
C program into Hex
format , Binary
format nad asm
format.

C PROGRAM

#include<reg52.h>

sbit irinf = P1^0; //sets port1.0 as i/p for front sensor//

sbit irinl = P1^1; //sets port1.1 as i/p for left sensor//

sbit irinr = P1^2; //sets port1.2 as i/p for right sensor//

sbit irinb = P1^3; //sets port1.3 as i/p for rear sensor//

sbit outlp =P2^0; //sets port2.0 as output for left motor//

sbit outln =P2^1; //sets port2.1 as output for left motor//

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 56


mukundbihari.blogspot.com 2010

sbit outrp =P2^2; //sets port2.2 as output for right motor//

sbit outrn =P2^3; //sets port2.3 as output for right motor//

void MSdelay(unsigned char);

void main ()

P1=1; //sets port1 as i/p//

while(1)

if(irinf==1&&((irinr==1&&irinl==1)||(irinr==1&&irinl==0)||(irinr==0&&irinl
==1)||

(irinr==0&&irinl==0)||(irinb==1||irinb==0)))

//both motor On and vehicle moves in forward direction//

outlp = 1;

outln = 0;

outrp = 0;

outrn = 1;

MSdelay(250);
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 57
mukundbihari.blogspot.com 2010

else if(irinf==0&&((irinr==1&&irinl==1)||(irinr==0&&irinl==0)))

//left motor On and vehicle takes turn in right direction avoiding


obstacle in left//

outlp =1;

outln =0;

outrp =0;

outrn =0;

MSdelay(250);

else if(irinf ==0&&(irinl==1&&irinr==0))


//right motor On and vehicle takes turn in left direction avoiding obstacle in
right

outlp =0;

outln =0;

outrp =0;

outrn =1;

MSdelay(250);

else if(irinf ==0&&irinl==0&&irinr==0&&irinb==1)


//both motor On in reverse directionand vehicle moves back direction
avoiding obstacle in left , right and front//

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 58


mukundbihari.blogspot.com 2010

outlp =0;

outln =1;

outrp =1;

outrn =0;

MSdelay(250);

else if(irinf
==0&&irinl==0&&irinr==0&&irinb==0) //both motor OFF and vehicle stops//

outlp =0;

outln =0;

outrp =0;

outrn =0;

MSdelay(250);

void MSdelay(unsigned char itime)


DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 59
mukundbihari.blogspot.com 2010

unsigned int i,j;

for(i=0;i<itime;i++)

for(j=0;j<1275;j++);

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 60


mukundbihari.blogspot.com 2010

SCREEN SHOTS OF KEIL PROGRAMING

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 61


mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 62


mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 63


mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 64


mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 65


mukundbihari.blogspot.com 2010

LOADING PROGRAM IN AT89C52


ALL100

Binary format of C program is loaded into the microcontroller with ALL


100 Burner connected to computer through a USB port. It has in-built
Hex to Binary, Binary to Hex Coverter.It can programm ICs upto 48 pin.

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 66


mukundbihari.blogspot.com 2010

SCREEN SHOTS OF LOADING PROGRAM


STEP 1: Conversion of hex code to bin code

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 67


mukundbihari.blogspot.com 2010

STEP 2: Choosing manufacturers’ name

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 68


mukundbihari.blogspot.com 2010

STEP 3: Selection of IC type and its name

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 69


mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 70


mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 71


mukundbihari.blogspot.com 2010

STEP 5: Checking of IC

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 72


mukundbihari.blogspot.com 2010

STEP 6: Blank checking

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 73


mukundbihari.blogspot.com 2010

STEP 7: Loading program from buffer

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 74


mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 75


mukundbihari.blogspot.com 2010

STEP 8: Choosing file format to be loaded

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 76


mukundbihari.blogspot.com 2010

STEP 9: Prograrming the IC

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 77


mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 78


mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 79


mukundbihari.blogspot.com 2010

STEP 10: Checking wether program is stored in IC or not.

STEP 10: Remove the IC from the ALL 100 burner.

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 80


mukundbihari.blogspot.com 2010

PROBLEMS FACED DURING


DESIGNING THE ROBOT

FAULTY MICROCONTROLLER BOARD


This was our first major problem.Our microcontroller board was not giving
output as it seemed that no program stored in microcontroller although we
had burnt the program.

After lengthy manuovere when we failed to debug the circuit we designed


another fresh microcontroller board alongwith the serial communication IC
MAX232 on the same board.

Later on we found that

Ther was logical error in our

Program.We had not defined

Syntax

P1 = 1;

Which defines port1 as input?

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 81


mukundbihari.blogspot.com 2010

MOTOR DRIVER CIRCUIT


Intially we had decided to use ULN2003 as motor driver circuit as it is a
darlington pair connection which also amplifies current.But we were unable
to drive the motor with the help of this IC.

Then we decided to use the H-bridge circuit alongwith Optcoupler IC


MCT2E but here we had again problem due to the complexity of H-bridge
circuit.Then we decided to use L293D which as it has itsef built-in two H-
bridge circuits.This time we were succesful to drive both of our motors.

Fig: H-bridge circuit alongwith MCT2E optocoupler

VOLTRAGE DROP OF 2V
This was the greatest problem ever we faced in our project.We faced lots of
difficulty to debug the problem of 2V votage drop when the all the circuits

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 82


mukundbihari.blogspot.com 2010

were interconnected with each other.We checked our whole circuit twice
and thrice but we were unable to find the error.Finally after long manoeuvre
the fault was detected in the comaprator circuit.There was a short circuit in
the comaprator circuit between the fist sensor input male connector pin and
first comparator output male connector pin.

EXCESSIVE HEATING OF LM7805

We observed that when power supply was given continuosly for more than
6 to 7 mins. LM7805 got heated upto undesirabel level enough to burn
human skin.To overcome this excessive heat we incorporated alumunium
heat sink with both the LM7805 ICs.

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 83


mukundbihari.blogspot.com 2010

Possible Improvements
 Use of differential steering with gradual change in wheel
speeds.
 Use of Hysteresis in sensor circuit using LM339
 Increment in number of sensors to enhance the obstacle
detection capibilty
 Incorporation of a camera whose data can be sending
through wirless tehnology to a fixed station.
 Incorporation of robotic hand to remove the obstacle in
case there is no way for the movement of the robot.
 General improvements like using a low dropout voltage
regulator, lighter chassis etc.

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 84


mukundbihari.blogspot.com 2010

REFERENCE AND RESOURCES


 The 8051 Microcontroller and Embedded
Systems Using Assembly and C
Second Edition
Muhammad Ali Mazidi
Janice Gillispie Mazidi
Rolin D. McKinlay

 http://www.letsmakerobots.com
 http://www.acronamerobotics.com
 http://www.ti.com

 http://www.st.com

TOOLS
 µVision keil 3
 ALL 100 IC program burner
 Drill machine for drilling holes in vero board
 File to adjust the motors in chassis

SHOPS
 Gemini radio , Chandni Chowk , Kolkata
 Reliance Electronics , Asansol

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 85


mukundbihari.blogspot.com 2010

THE END

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 86