Robotics

86
2010 DESIGN OF OBSTACLE DETECTION & COLLISION AVOIDANCE ROBOT A PROJECT REPORT ON Asansol Engineering College Vivekanand Sarani , Kanyapur Asansol - 713305 Under the esteemed guidance of : Mr. S. K. Das (Scientist , CMERI Durgapur) Mr. Prajit Paul (Lecturer ,Asansol Engineering College) Submitted By: Supriya- AEIE(10805062003) Aatreyee Sarkar- AEIE(10805062010) Dipu Kumari- AEIE(10805062011) Mukund Bihari- ECE(10803061046)

description

design of collision detection and obstacle avoidance robot using 8051 microcontroller

Transcript of Robotics

Page 1: Robotics

2010

DESIGN OF OBSTACLE DETECTION

& COLLISION AVOIDANCE ROBOT A PROJECT REPORT ON

Asansol Engineering College

Vivekanand Sarani , Kanyapur

Asansol - 713305

Under the esteemed guidance of :

Mr. S. K. Das (Scientist , CMERI –Durgapur) Mr. Prajit Paul (Lecturer ,Asansol Engineering

College)

Submitted By:

Supriya-AEIE(10805062003)

Aatreyee Sarkar-AEIE(10805062010)

Dipu Kumari-AEIE(10805062011)

Mukund Bihari-ECE(10803061046)

Page 2: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 2

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.

Dr S. N. Shome

Scientist

Group Head & DU Head

Shri S. K. Das

Scientist

Robotics and Automation

Laboratory

CENTRAL MECHANICAL ENGINEERING RESEARCH INSTITUTE

MAHATMA GANDHI AVENUE DURGAPUR-713209, West Bengal

Page 3: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 3

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

Page 4: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 4

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

Page 5: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 5

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

Page 6: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 6

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.

Page 7: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 7

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

Page 8: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 8

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.

Page 9: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 9

FLOWCHART

Page 10: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 10

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

Page 11: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 11

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

Page 12: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 12

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.

Page 13: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 13

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

Page 14: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 14

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.

Page 15: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 15

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

Page 16: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 16

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

Page 17: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 17

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.

Page 18: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 18

BLOCK DIAGRAM OF AT89C52

Page 19: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 19

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.

Page 20: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 20

Page 21: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 21

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.

Page 22: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 22

Crystal Oscillator

ML 11.0592 crystal Oscillator

Page 23: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 23

Maximum rating of AT89C51

Page 24: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 24

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

Page 25: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 25

Pin Configuration of LM311

Functional Block Diagram

Page 26: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 26

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

Page 27: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 27

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.

Page 28: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 28

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

Page 29: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 29

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.

Page 30: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 30

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

Page 31: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 31

GP2D12

Page 32: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 32

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

Page 33: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 33

Characteristics of GP2D12 sensors

Page 34: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 34

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

Page 35: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 35

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).

Page 36: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 36

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

Page 37: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 37

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.

Page 38: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 38

IC BASE

40 pin

16 pin

40 pin 16pin

Page 39: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 39

VERO BOARD

WIRE CONNECTORS

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.

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

Page 40: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 40

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.

Page 41: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 41

ROBOTIC WHEEL

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.

Two types of wheel

have been used:

Main

wheel(Front)

Support

wheel(Rear)

Page 42: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 42

CIRCUIT IMPLEMENTATION

AT89C52 circuit

Voltage comparator

Motor Driver circuit

Voltage Regulator

Page 43: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 43

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 α Sensing distance of sensor

Page 44: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 44

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.

Page 45: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 45

VOLTAGE COMPARATOR BLOCK DIAGRAM

Page 46: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 46

MICROCONTROLLER CIRCUIT

AT89C52

Page 47: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 47

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

Page 48: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 48

AT 89C52

Page 49: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 49

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

Pin 2.2

Pin 2.3

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.

MOTOTR 2

MOTOTR 1

Page 50: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 50

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.

Page 51: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 51

Page 52: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 52

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.

Page 53: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 53

Page 54: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 54

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.

Page 55: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 55

CURCUIT DIAGRAM OF VOLTAGE

REGULATOR

Page 56: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 56

MICROCONTROLLER PROGRAMMING

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//

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.

Page 57: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 57

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);

Page 58: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 58

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//

Page 59: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 59

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)

Page 60: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 60

unsigned int i,j;

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

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

Page 61: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 61

SCREEN SHOTS OF KEIL PROGRAMING

Page 62: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 62

Page 63: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 63

Page 64: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 64

Page 65: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 65

Page 66: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 66

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.

Page 67: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 67

SCREEN SHOTS OF LOADING PROGRAM

STEP 1: Conversion of hex code to bin code

Page 68: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 68

STEP 2: Choosing manufacturers’ name

Page 69: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 69

STEP 3: Selection of IC type and its name

Page 70: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 70

Page 71: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 71

Page 72: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 72

STEP 5: Checking of IC

Page 73: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 73

STEP 6: Blank checking

Page 74: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 74

STEP 7: Loading program from buffer

Page 75: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 75

Page 76: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 76

STEP 8: Choosing file format to be loaded

Page 77: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 77

STEP 9: Prograrming the IC

Page 78: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 78

Page 79: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 79

Page 80: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 80

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

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

Page 81: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 81

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?

Page 82: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 82

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

Page 83: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 83

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.

Page 84: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 84

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.

Page 85: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 85

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

Page 86: Robotics

mukundbihari.blogspot.com 2010

DESIGN OF OBSTACLE DETECTION AND COLLISION AVOIDANCE ROBOT 86

THE END