You are on page 1of 87

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. P
rajit Paul (Lecturer ,Asansol Engineering College) Submitted By: SupriyaAEIE(108
05062003) Aatreyee SarkarAEIE(10805062010) Dipu KumariAEIE(10805062011) Mukund B
ihariECE(10803061046)
Asansol Engineering College Vivekanand Sarani , Kanyapur Asansol - 713305
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 Avoid
ance Robot” by them under our guidance. The work has been completed at the Robotic
s and Auomation Laboratory, CMERI, Durgapur.
Dr S. N. Shome Scientist Group Head & DU Head
Shri S. K. Das Scientist Robotics and Automation 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 prof
essional. 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 unde
r the supervision of Shri S.K.Das Scientist-C. We acknowledge our indebtedness t
o Shri S.K.Das for providing his esteemed guidance and substantial guidance to o
ur 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 indivi
duals 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. 2. 3. 4.
Summary Overview Flowchart Components used Microcontroller AT89C52 Vo
rator Motor driver Variable resistance IR sensors Crystal oscillator Voltage reg
ulator Other components DC motor Robotic wheel Vehicle Base 11 23 25 28 29 32 34
35 38 39 39 6 7 9
5.
Circuit Implementation Voltage comparator AT89C52 circuit Motor Driver circuit V
oltage Regulator 41 44 47 50
6.
Microcontroller programing C program 52 4
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT
mukundbihari.blogspot.com 2010
Screen shots of keil programing 57
7.
Loading program in microcontroller ALL100 Screen shots of program loading 61 62
8.
Problems faced during designing of robot Faulty microcontroller board Problem of
motor driver circuit Voltage drop of 2V Excessive heating of LM7805 74 75 75 76
77
9. 10.
Possible Improvements References and Resources Books and Links Tools of the trad
e Electronic shops
78 78 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 collisi
on avoidance robot with help IR sensors embedded around the body of robotic vehi
cle.This design can be used in fully automated vehicles like cars etc , moving m
aterials in industries fom one to another place and similar other commercial app
lication. Starting with an overview of the system the document would cover imple
mentation details like components used ,circuits and algorithms, problems faced
during designing of the obstacle detection and collision avoidance robot . It ha
s 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 book
s, 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 pr
ogram 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 dat
a coming out from those sensors are fed into voltage comparators where the senso
r data is compared with a fixed reference voltage.After the comparision of senso
r data nad the Vref the volatge comparator gives output as 0V for presence of an
y 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 mi
crocontroller in which decision making program is stored .The microcontroller pr
ocesses the output of comparator circuit according to the program stored in it a
nd gives output at another port .
The output of microcontroller is fed into the motor driver circuit which ampifie
s 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 Drive
Resistance IR Sensor(GP2D12) Crystal Oscillator(ML 11.0592) Voltage Regulator(L
M7805) Other Components IC Base Vero Board Wire Connectors DC Motor Robotic Whee
l 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 Kby
tes of Flash programmable and erasable read only memory (PEROM). The device is m
anufactured using Atmel‟s high density nonvolatile memory technology and is compat
ible with the industry standard 80C51 and 80C52 instruction set and pinout. The
on-chip Flash allows the program memory to be reprogrammed insystem or by a conv
entional 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 byt
es of RAM, 32 I/O lines, three 16- bit timer/counters, a six-vector two-level in
terrupt architecture, a full duplex serial port, on-chip oscillator, and clock c
ircuitry. In addition, the AT89C52 is designed with static logic for operation d
own to zero frequency and supports two software selectable power saving modes. T
he 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 th
e 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 pi
n 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 multiple
xed low-order address/data bus during accesses to external program and data memo
ry. In this mode, P0 has internal pullups. Port 0 also receives the code bytes d
uring 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 outp
ut 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 input
s, 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 a
ddition, P1.0 and P1.1 can be configured to be the timer/counter 2 external coun
t input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectivel
y, as shown in the following table.
Port 1 also receives the low-order address bytes during Flash programming and pr
ogram verification.
Port 2
Port 2 is an 8-bit bidirectional I/O port with internal pullups. The Port 2 outp
ut 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 input
s, Port 2 pins that are externally being pulled low will source current (IIL) be
cause of the internal pullups. Port 2 emits the high-order address byte during f
etches from external program memory and during accesses to external data memory
that uses 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses stron
g internal pullups when emitting 1s. During accesses to external data memory tha
t 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 outp
ut 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 input
s, Port 3 pins that are externally being pulled low will source current (IIL) be
cause of the pullups. Port 3 also serves the functions of various special featur
es 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 r
unning 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 (PR
OG) 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 cloc
king purposes. Note, however, that one ALE pulse is skipped during each access t
o 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 MO
VC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disabl
e 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 AT8
9C52 is executing code from external program memory, PSEN is activated twice eac
h 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 FF
FFH. Note, however, that if lock bit 1 is programmed, EA will be internally latc
hed 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 12volt programmin
g is selected.
XTAL1
Input to the inverting oscillator amplifier and input to the internal clock oper
ating 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 inte
rrupt. These interrupts are all shown in Figure below. Each of these interrupt s
ources can be individually enabled or disabled by setting or clearing a bit in S
pecial Function Register IE. IE also contains a global disable bit, EA, which di
sables 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. Use
r 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 wh
en 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 amplifie
r that can be configured for use as an on-chip oscillator, as shown in Figure be
low. Either a quartz crystal or ceramic resonator may be used. To drive the devi
ce from an external clock source, XTAL2 should be left unconnected while XTAL1 i
s 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 fo
r operational amplifiers and 5-V supplies for logic systems. The output levels a
re compatible with most TTL and MOS circuits. These comparators are capable of d
riving lamps or relays and switching voltages up to 50 V at 50 mA. All inputs an
d outputs can be isolated from system ground. The outputs can drive loads refere
nced to ground, VCC+ or VCC–. Offset balancing and strobe capabilities are availab
le, and the outputs can be wire-OR connected. If the strobe is low, the output i
s 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 dr
iver designed to accept standard DTL or TTL logic levels and drive inductive loa
ds (such as relays solenoides, DC and stepping motors) and switching power trans
istors. 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 opera
tion 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 dr
ive 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 Sep
arate Input-logic supply It can drive small DC-geared motors, bipolar stepper mo
tor. Pulsed Current 1.2-A Per Driver Thermal Shutdown Internal ESD Protection Hi
gh-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 a
nd 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 potentio
meters in books and catalogues. They are specified by their maximum resistance,
linear or logarithmic track, and their physical size. The standard spindle diame
ter 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 infr
ared 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 an
d interfaces easily using any analog to digital converter. Features • High immunit
y 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 receiv
er portion of these new detectors is actually a precision lens that transmits th
e reflected light onto various portions of the enclosed linear CCD array based o
n the angle of the triangle described above. The CCD array can then determine wh
at angle the reflected light came back at and therefore, it can calculate the di
stance 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 amplifie
r that can be configured for use as an on-chip oscillator, as shown in Figure be
low. Either a quartz crystal or ceramic resonator may be used. To drive the devi
ce from an external clock source, XTAL2 should be left unconnected while XTAL1 i
s 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 microcontrolle
r? Usually, crystal is between two pins of the CPU, and two caps of 33 pF are mo
unted from these pins to the ground. The purpose is to "dephase" the crystal sig
nal to provide a lead/lag to the buffers inside the CPU and allows the oscillati
on! (The oscillator is a feedback loop around a buffer: you need input/output OU
T OF PHASE to maintain oscillation. The caps shift the phase, while the Xtal mai
ntains 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, th
ey can deliver in excess of 0.5A output current. Typical applications would incl
ude local (on-card) regulators which can eliminate the noise and degraded perfor
mance associated with singlepoint regulation.
Features
• Output current in excess of 0.5A • No external components • Internal thermal overloa
d 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 o
f 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 boa
rd.
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 conec
tors 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 direction
s depending upon the polarity of current through the motor. These motors have fr
ee running torque and current ideally zero. These motors have high speed which c
an be reduced with the help of gears and traded off for torque. Here a single ph
ase bidirectional DC motor is used. Bidirectional motor is used so that our robo
tic vehicle can move in both forward and backward directions easily in case if a
ny obstacle is in between the path of the robotic vehicle. Any obstacle in betwe
en 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 dis
tance of sensors.
DESIGN Vref α OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT Sensing dist nce
of sensor
43
mukundbih ri.blogspot.com 2010
Vref is fed into pin no. 2 nd the sensor input is fed into pin 3 of the LM311P
IC.Pin no. 1 nd 4 si shorted nd connected with ground. Vcc (5V) is connected w
ith pin no. 8 of the comp r tor .Pin no.7 nd 8 re shorted through 330 kΩ resisto
r.But here we have used resistor of value of about 400kΩ.Pin no. 5 and 6 do not ha
ve 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 P
in 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 Pi
n 2.2 Pin 2.3
} }
MOTOTR 1 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 capaci
tors of 33pF are connected between both pin of crsytal and the ground.These capa
citors stablize the output of crsytal.Output of pin 10 and pin 11 is connected t
o the MAX232 Ic meant for serial communication.Power supply to the microcontroll
er 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 micr
ocontroller which is incpable to drive 50mA rating motor.It can give output curr
ent 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 stat
e which are located diagonally.The two pair of transistors gives us the bidirect
ional 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 requireme
nt in different components.e.g.Our motor requires 12v supply but circiuts like m
icrocontroller 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 soft
ware provides Keil C51 Compiler to compile program.It converts C program into He
x format , Binary format nad asm format.
C PROGRAM
#include<reg52.h> sbit irinf = P1^0; sbit irinl = P1^1; sbit irinr = P1^2; sbit
irinb = P1^3; sbit outlp sbit outln =P2^0; =P2^1; //sets port1.0 as i/p for fron
t sensor// //sets port1.1 as i/p for left sensor// //sets port1.2 as i/p for rig
ht sensor// //sets port1.3 as i/p for rear sensor// //sets port2.0 as output for
left motor// //sets port2.1 as output for left motor// 56
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT
mukundbihari.blogspot.com 2010
sbit outrp sbit outrn =P2^2; =P2^3; //sets port2.2 as output for right motor// /
/sets port2.3 as output for right motor//
void MSdelay(unsigned char);
void main ()
{ P1=1; while(1) { //sets port1 as i/p//
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 i
n forward direction// { outlp outln outrp outrn = 1; = 0; = 0; = 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 O
n 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 ob
stacle in right { outlp =0; outln =0; outrp =0; outrn =1; MSdelay(250); } else i
f(irinf ==0&&irinl==0&&irinr==0&&irinb==1) //both motor On in reverse directiona
nd 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 Burne
r connected to computer through a USB port. It has in-built Hex to Binary, Binar
y 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’ n me
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT
68
mukundbih ri.blogspot.com 2010
STEP 3: Selection of IC type nd its n me
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT
69
mukundbih ri.blogspot.com 2010
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT
70
mukundbih ri.blogspot.com 2010
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT
71
mukundbih ri.blogspot.com 2010
STEP 5: Checking of IC
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT
72
mukundbih ri.blogspot.com 2010
STEP 6: Bl nk checking
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT
73
mukundbih ri.blogspot.com 2010
STEP 7: Lo ding progr m from buffer
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT
74
mukundbih ri.blogspot.com 2010
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT
75
mukundbih ri.blogspot.com 2010
STEP 8: Choosing file form t to be lo ded
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT
76
mukundbih ri.blogspot.com 2010
STEP 9: Progr rming the IC
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT
77
mukundbih ri.blogspot.com 2010
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT
78
mukundbih ri.blogspot.com 2010
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT
79
mukundbih ri.blogspot.com 2010
STEP 10: Checking wether progr m 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
mukundbih ri.blogspot.com 2010
PROBLEMS FACED DURING DESIGNING THE ROBOT
FAULTY MICROCONTROLLER BOARD
This w s our first m jor problem.Our microcontroller bo rd w s not giving output
s it seemed th t no progr m stored in microcontroller lthough we h d burnt th
e progr m. After lengthy m nuovere when we f iled to debug the circuit we design
ed nother fresh microcontroller bo rd longwith the seri l communic tion IC MAX
232 on the s me bo rd.
L ter on we found
th t
Ther w s logic l error in our Progr m.We h d not defined Synt x P1 = 1; Which de
fines port1 s input?
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT
81
mukundbih ri.blogspot.com 2010
MOTOR DRIVER CIRCUIT
Inti lly we h d decided to use ULN2003 s motor driver circuit s it is d rlin
gton p ir connection which lso mplifies current.But we were un ble to drive th
e motor with the help of this IC. Then we decided to use the H-bridge circuit l
ongwith Optcoupler IC MCT2E but here we h d g in problem due to the complexity
of H-bridge circuit.Then we decided to use L293D which s it h s itsef built-in
two Hbridge circuits.This time we were succesful to drive both of our motors.
Fig: H-bridge circuit longwith MCT2E optocoupler
VOLTRAGE DROP OF 2V
This w s the gre test problem ever we f ced in our project.We f ced lots of diff
iculty to debug the problem of 2V vot ge drop when the ll the circuits
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT
82
mukundbih ri.blogspot.com 2010
were interconnected with e ch other.We checked our whole circuit twice nd thric
e but we were un ble to find the error.Fin lly fter long m noeuvre the f ult w
s detected in the com pr tor circuit.There w s short circuit in the com pr tor
circuit between the fist sensor input m le connector pin nd first comp r tor o
utput m le connector pin.
EXCESSIVE HEATING OF LM7805
We observed th t when power supply w s given continuosly for more th n 6 to 7 mi
ns. LM7805 got he ted upto undesir bel level enough to burn hum n skin.To overco
me this excessive he t we incorpor ted lumunium he t sink with both the LM7805
ICs.
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT
83
mukundbih ri.blogspot.com 2010
Possible Improvements
Use of differenti l steering with gr du l ch nge in wheel speeds. Use of Hystere
sis in sensor circuit using LM339 Increment in number of sensors to enh nce the
obst cle detection c pibilty Incorpor tion of c mer whose d t c n be sending
through wirless tehnology to fixed st tion. Incorpor tion of robotic h nd to
remove the obst cle in c se there is no w y for the movement of the robot. Gener
l improvements like using low dropout volt ge regul tor, lighter ch ssis etc.
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT
84
mukundbih ri.blogspot.com 2010
REFERENCE AND RESOURCES
The 8051 Microcontroller nd Embedded Systems Using Assembly nd C Second Editio
n Muh mm d Ali M zidi J nice Gillispie M zidi Rolin D. McKinl y http://www.letsm
kerobots.com http://www. cron merobotics.com http://www.ti.com http://www.st.co
m
TOOLS
µVision keil 3 ALL 100 IC progr m burner Drill m chine for drilling holes in vero
bo rd File to djust the motors in ch ssis
SHOPS
Gemini r dio , Ch ndni Chowk , Kolk t Reli nce Electronics , As nsol
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT
85
mukundbih ri.blogspot.com 2010
THE END
DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT
86