Fyp-Obstacle Avoiding Robot
Fyp-Obstacle Avoiding Robot
com
PROJECT REPORT
ON
Of
BACHELOR OF TECHNOLOGY
IN
DECEMBER 2012
DECLARATION
Sanchit Sharma
www.final-yearproject.com
BONAFIDE CERTIFICATE
SIGNATURE SIGNATURE
MIET ,MOHRI,SHAHABAD
DISTT. KURUKHETRA
www.final-yearproject.com
ACKNOWLEDGEMENTS
I avail this opportunity to express my profound sense of sincere and deep gratitude
to Mr. Vikas Sharma, Head of the ECE Department of MIET. For her valuable
guidance and meticulous supervision during the preparation of this project report.
I am very much thankful and highly obliged my project supervisor Er. Nitin
Nikesh. I am also very thankful to the staff member of the ECE Department for
providing me the suitable environment in terms of hardware & software.
Last but not least, We also very much thankful to our parents, brother and sisters
for their continuous encouragement and moral support during this project and other
people who helped us in preparing this project knowingly and unknowingly.
Sanchit Sharma
www.final-yearproject.com
ABSTRACT
This degree course aims at providing the student knowledge about the various
applications of electronics. So it is necessary to jump into the practical field.
Hence, I was assigned this project which is part of my syllabus.
www.final-yearproject.com
INDEX
1. INTRODUCTION TO DEPARTMENT
1.1 INTRODUCTION 1
2.1 CHARACTERSTICS 1
3.1 APPLICATIONS 2
2.1 INTRODUCTION 3
3. HARDWARE DESCRIPTION
CONCLUSION 41
BIBLIOGRAPHY 42
www.final-yearproject.com
LIST OF FIGURES
LI ST OF TABLES
CHAPTER-1
1.1 INTORDUTION:
Embedded systems are controlled by one or more main processing cores that is
typically either a microcontroller or a digital signal processor (DSP). The key
characteristic is however being dedicated to handle a particular task, which may
require very powerful processors. Since the embedded system is dedicated to
specific tasks, design engineers can optimize it reducing the size and cost of the
product and increasing the reliability and performance.
1.2 CHARACTERISTICS
1
www.final-yearproject.com
1.3 APPLICATIONS:
Embedded controllers may be found in many different kinds of system and are
used for many different applications. Such as:
CHAPTER-2
3
www.final-yearproject.com
4
www.final-yearproject.com
1) IR Sensors
2) Microcontroller AT89C52
3) Motor Driver
4) Motors
5
www.final-yearproject.com
WORKING:
but when IR light reflected back and fall on IR receiver. The resistance of
Rx it comes in range between Kilo ohms to hundred of ohms.
6
www.final-yearproject.com
IR sensor is nothing but a diode, which is sensitive for infrared radiation. This
infrared transmitter and receiver is called as IR TX-RX pair.
It can be obtained from any decent electronics component shop and costs less than
10Rs. Following snap shows 3mm and 5mm IR pairs. Colour of IR transmitter and
receiver is different.
7
www.final-yearproject.com
However you may come across pairs which appear exactly same or even has
opposite colours than shown in above pic and it is not possible to distinguish
between TX and RX visually. In case you will have to take help of multimeter to
distinguish between them.
2. Microcontroller
3. MOTOR DRIVER:
The MCU cannot drive the motors (used to actually make the robot run)
directly, so a motor driver is used.
L293D is used as driver IC. Motors are connected to this IC. According to
program in μc it drives the left and right motor.
8
www.final-yearproject.com
4. MOTOR
Motor are used for the movement of the robot .here we use the dc motor as it
has the principle of speed controlling.
9
www.final-yearproject.com
CHAPTER-3
HARDWARE DISCRIPTION
3.1HARDWARE MODULES:
Microcontroller
Motor driver
Motors
3.2 HARDWARE MODULE DISCRIPITON:
3.2MICROCONTROLLER:-
The AT89C52 is a low power ,high performance CMOS 8 bit microcomputer with
8k bytes of flash programmable and erasable read
Only memory .The device is manufactured using Atmel’s high density nonvolatile
memory technology and is compatible with the industry standard 80C51 and
80C52 instrution set and pinout .
3.2.1 FEATURES:
11
www.final-yearproject.com
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
highimpedance inputs
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 bythe internal pullups and can be used as inputs. As inputs,
12
www.final-yearproject.com
Port 1 pins that are externally being pulled low will source current (IIL) because of
the internal pullups.
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 bythe internal pullups and can be used as inputs. As inputs,Port 2
pins that are externally being pulled low will sourcecurrent (IIL) because of the
internal pullups.Port 2 emits the high-order address byte during fetches from
external program memory and during accesses toexternal data memory that use 16-
bit addresses (MOVX @DPTR). In this application, Port 2 uses strong internal
pullupswhen emitting 1s. During accesses to external data memory that use 8-bit
addresses (MOVX @ RI), Port 2emits the contents of the P2 Special Function
Register.Port 2 also receives the high-order address bits and somecontrol 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 bythe internal pullups and can be used as inputs. As inputs,Port 3
pins that are externally being pulled low will sourcecurrent (IIL) because of the
13
www.final-yearproject.com
RST-
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
14
www.final-yearproject.com
during accesses to external memory.This pin is also the program pulse input
(PROG) duringFlash programming.In normal operation, ALE is emitted at a
constant rate of 1/6the 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 ofSFR 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 noeffect if the microcontroller 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 programming enable voltage(VPP) during Flash
programming when 12-volt programming is selected.
15
www.final-yearproject.com
XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating
circuit.
XTAL2
Output from the inverting oscillator amplifier.
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 7. 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,
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
16
www.final-yearproject.com
17
www.final-yearproject.com
18
www.final-yearproject.com
3.3.1 FEATURES:
19
www.final-yearproject.com
3.4 MOTOR:
A direct current (DC) motor is another widely used device that translates electrical
pulses into mechanical movement. In the DC motor we have only + and - leads.
Connecting them to a DC voltage source moves the motor in one direction. By
reversing the polarity, the DC motor will move in the opposite direction. One can
easily experiment with the DC motor. For example, small fans used in many
motherboards to cool the CPU are run by DC motors. By connecting their leads to
the + and - voltage source, the DC motor moves. While a stepper motor moves in
steps of 1 to 15 degrees, the DC motor moves continuously. In a stepper motor, if
20
www.final-yearproject.com
we know the starting position we can easily count the number of steps the motor
has moved and calculate the final position of the motor. This is not possible in a
DC motor. The maximum speed of a DC motor is indicated in rpm and is given in
the data sheet. The DC motor has two rpms: no-load and loaded. The
manufacturer's data sheet gives the no-load rpm. The no-load rpm can be from a
few thousand to tens of thousands. The rpm is reduced when moving a load and it
decreases as the load is increased. For example, a drill turning a screw has a much
lower rpm speed than when it is in the no-load situation. DC motors also have
voltage and current ratings. The nominal voltage is the voltage for that motor under
normal conditions, and can be from 1 to 150V, depending on the motor. As we
increase the voltage, the rpm goes up. The current rating is the current
consumption when the nominal voltage is applied with no load, and can be from
21
www.final-yearproject.com
25mA to a few amps. As the load increases, the rpm is decreased, unless the
current or voltage provided to the motor is increased, which in turn increases the
torque. With a fixed voltage, as the load increases, the current (power)
consumption of a DC motor is increased. If we overload the motor it will stall, and
that can damage the motor due to the heat generated by high current consumption.
3.4.1ADVANTAGES:
22
www.final-yearproject.com
CHAPTER-4
23
www.final-yearproject.com
Power supply
Sensors
Microcontroller AT89C52
Motor driver
Motors
In this project we are using a d.c power supply. The power supply for
Microcontroller and H driver ICs are regulated using ics
VOLTAGE REGULATOR:
24
www.final-yearproject.com
voltage, e.g.,7805 (5 V), 7806 (6 V), 7808 (8 V), 7810 (10 V), 7812(12 V), 7815
(15 V), 7818 (18 V), and 7824 (24 V).These devices can handle a maximum output
current of 1.5 A if properly heat-sunk. To remove unwanted input or output
spikes/noise, capacitors can be attached to the regulator’sinput and output
25
www.final-yearproject.com
where “xx” represent the negative output voltage.These devices can handle a
maximum output current of 1.5 A. A number of different manufacturers make their
own kinds of voltage regulators.
SENSORS:-
The IR Transmitter block mainly used to generate IR signal. It uses timer IC555 in
astable multivibrator mode to generate square wave which have continuous pulses
of 50% duty cycle of frequency 38 KHz. This transmitter is so arranged that the IR
rays are focused on the sensor. IR sensor which gives normally 5v at output of it.
After receiving infrared light at output of sensor we get 0v.
MICROCONTROLLER AT89C52:
This is the most important block of the system. Microcontroller is the decision
making logical device which has its own memory, I/O ports, CPU and Clock
26
www.final-yearproject.com
MOTOR DRIVER:
Supply voltage (Vss) is the Voltage at which we wish to drive the motor.
Generally we prefer 6V for dc motor and 6 to 12V for gear motor, depending upon
the rating of the motor.
Logical Supply Voltage will decide what value of input voltage should be
considered as high or low .So if we set Logical Supply Voltage equals to +5V,then
-0.3V to 1.5V will be considered as Input Low Voltage and 2.3 V to 5V will be
considered as Input High Voltage.
L293D has 2 Channels .One channel is used for one motor.
Channel 1 - Pin 1 to 8
Channel 2 - Pin 9 to 16
Enable Pin is use to enable or to make a channel active .Enable pin is also
called as Chip Inhibit Pin.
All Input (Pin No. 2, 7,10and 15) of L293D IC is the output from
microcontroller .
All Output (Pin No. 3, 6,11and 14) of L293D IC goes to the input of Right
and Left motor.
OUTPUT CONNECTIONS:
OUTPUT 1 (Pin No 3) --- Negative Terminal of Right Motor
OUTPUT 2 (Pin No 6) --- Positive Terminal of Right Motor
OUTPUT 3 (Pin No 10) --- Positive Terminal of Left Motor
OUTPUT 4 (Pin No 14) --- Negative Terminal of Left Motor
28
www.final-yearproject.com
0 0 No Movement
Vss 0 Straight
0 Vss Reverse
29
www.final-yearproject.com
Means if Enable pin low, the output will be at 0 always. If its high output
depend on input
WHY DC MOTORS:
DC motors are most easy to control. One dc motor requires only two signals for
its operation. If we want to change its direction just reverse the polarity of power
supply across it. We can vary speed by varying the voltage across motor.
WHY TWO MOTORS:
By using two motors we can move our robot in any direction. This steering
mechanism of robot is called as differential drive.
30
www.final-yearproject.com
32
www.final-yearproject.com
CHAPTER-4
PROGRAMMING OF OBSTACLE AVOIDING ROBOT
org 000
clr a
mov p0,a
mov p2,a
mov p3,a
mov a,#0ffh
mov p1,a
main:
clr a
mov r6,a
mov r7,a
jmp k2
call find
call find13
jnb p1.0,loop1
jnb p1.1,loop2
jmp k2
33
www.final-yearproject.com
loop1:
jnb p1.0,$
call delay
mov p3,#0ffh
inc r7
jmp k2
loop2:jnb p1.1,$
call delay
CJNE R7,#01,AAS21
AAS21:
jc k2
nop
dec r7
mov a,r7
cjne a,#00h,k2
mov a,r6
cjne r6,#00h,k9
mov p3,#00h
jmp k2
jmp k2
34
www.final-yearproject.com
dec r6
jmp k8
mov p2,#0C0h
ret
mov p2,#0F9h
mov p3,#0ffh
ret
mov p2,#0A4h
mov p3,#0ffh
ret
mov p2,#0B0h
mov p3,#0ffh
ret
mov p2,#99h
mov p3,#0ffh
ret
35
www.final-yearproject.com
mov p2,#92h
mov p3,#0ffh
ret
mov p2,#82h
mov p3,#0ffh
ret
mov p2,#0F8h
mov p3,#0ffh
ret
mov p2,#80h
mov p3,#0ffh
ret
mov p2,#90h
mov p3,#0ffh
ret
mov r7,#00h
36
www.final-yearproject.com
mov p3,#0ffh
inc r6
MOV A,R6
CJNE A ,#10,FIND12
mov r6,#00h
mov r7,#00h
jmp k2
find11: jmp k2
find12: jmp k2
mov p0,#0C0h
ret
mov p0,#0F9h
mov p3,#0ffh
ret
mov p0,#0A4h
mov p3,#0ffh
ret
37
www.final-yearproject.com
mov p0,#0B0h
mov p3,#0ffh
ret
mov p0,#99h
mov p3,#0ffh
ret
mov p0,#92h
mov p3,#0ffh
ret
mov p0,#82h
mov p3,#0ffh
ret
mov p0,#0F8h
mov p3,#0ffh
ret
38
www.final-yearproject.com
mov p0,#80h
mov p3,#0ffh
ret
mov p0,#90h
mov p3,#0ffh
ret
mov r7,#00h
inc r6
MOV A,R6
CJNE A ,#10,FIND25
mov r6,#00h
mov r7,#00h
jmp k2
find24: jmp k2
find25: jmp k2
39
www.final-yearproject.com
djnz r0, i2
ret
end
40
www.final-yearproject.com
CONCLUSION
The project is “obstacle detection and the avoidance robot” is practically proved by
using the IR pairs for sensing the robot, h bridge for the driving the dc motor, dc
motor isused for the movement of the robot with the help of the micro controller.
41
www.final-yearproject.com
BIBILIOGRAPHY
TEXT BOOKS:
8051 Microcontroller And Embedded System by” Mazidi”
8051 Microcontroller by “K.J. Ayala”
WEBSITES:
htttp://www.datasheet4u.com
http://www.final-yearproject.com
http://www.extremeelectronics.co.in
42