You are on page 1of 40

8 8

Th Th
Semester Semester
Electronics & Telecommunication Engineerin Electronics & Telecommunication Engineering g

Acknowledgement
It is our privilege to express our sincerest regards to our
project coordinator, Ms. Madhusmita Nahak & Ms Geetanjali
Jena, for their valuable inputs, able guidance,
encouragement, hole!hearted cooperation and
constructive criticism throughout the duration of our project.
"e deepl# express our sincere thanks to our $ead of
%epartment %r &rof. '.(.Mohapatra for encouraging and
alloing us to present the project on the topic Line
Follower Robot at our department premises for the
partial fulfillment of the re)uirements leading to the aard
of *!+ech degree.
"e take this opportunit# to thank all our lecturers ho have
directl# or indirectl# helped our project. "e pa# our respects
and love to our parents and all other famil# members and
friends for their love and encouragement through out our
career. ,ast but not the least e express our thanks to our
friends for their cooperation and support.



EST D - 1999 - ISO 9001:2000
SE CT OR 4, ROURKELA 769002
( AFF ILI ATE D T O BPU T , R OURKELA )
CERTIFICATE
+his is to certif# that -onali Mishra, *alaram &anda,
-an#asi *arad, &ulkeshu %ash and Gaurav -inghdeo
students of &admanava (ollege of .ngineering,
-ector!/, 0ourkela!112, have successfull# completed a
project on Line Follower Robot in 3
th
semester at
%epartment of .lectronics & +elecommunication
.ngineering.
+his report has not been submitted to an# other
4rgani5ation & does not form part of an# (ourse
undergone b# then, for the aard of *!+ech %egree.

$ead of %ept 6.+.7
&roject Guide
!ro" #$r%&'&C&(oha)atra
(s (adhusmita *ahak

INDEX
1. INTRODUCTION
2. OVERVIEW
3. BLOCK DIAGRAM OF LINE FOLLOWER ROBOT
4. CIRCUIT DIAGRAM Of LINE FOLLOWER ROBOT
5. IMFLEMENTATION
a)Design of Microconrroller Frogrammer
L)Whar is ISF!
6. SENSORS
a) Design Of Infrared Sensor Circuir
L) Frinciple of operarion of rhe I.R. L.E.D. and
Fhororransisror
c) Fosirioning of sensors
d) Infra-Red Sensor Array
e) Analog ro digiral converrer
f) LM339 Compararor
g) Fin Diagram Of LM339
h) Funcrion Of rhe compararor
7. MICROCONTROLLER
a)Fin Diagram of AT89C51
L) OnLoard Fin Connecrions
8. BIFOLAR MOTOR DRIVER
a)Fin Diagram of L293D
L) Fin Connecrions
c) Moror Driving
d)DC Morors
9. SOURCE CODE
10. HEX CODE GENERATED FOR THE CODE
11.FROBLEMS ENCOUNTERED
12. REFERENCES AND RESOURCES
INTRODUCTION
Whar is a line follover!
Line follover is a machine rhar can follov a parh. The parh can Le
visiLle like a Llack line on a vhire surface (or vice-versa) or ir can Le
invisiLle like a magneric field.
Why Luild a line follover!
Sensing a line and maneuvering rhe roLor ro sray on course, vhile
consranrly correcring vrong moves using feedLack mechanism forms a
simple yer effecrive closed loop sysrem. As a programmer you ger an
opporruniry ro 'reach' rhe roLor hov ro follov rhe line rhus giving ir a
human-like properry of responding ro srimuli.
Fracrical applicarions of a line follover: Auromared cars running on
roads virh emLedded magners, guidance sysrem for indusrrial roLors
moving on shop floor erc.
Frerequisires:
Knovledge of Lasic digiral and analog elecrronics.
C Frogramming Sheer inreresr, an innovarive Lrain and perseverance!

OVERVIEW
In rhe line follover roLor projecr ve have used 3 pairs of IR (infra-red)
emirrer/sensor. The sensor on gerring Llocked or unLlocked sends comLinarion of
high/lov signals ro AT89C51 microconrroller vhich are processed and
Circuit model of Line Follower Robot
appropriare signals are senr ro L293D (moror driver chip) vhich svirches on/off
rhe morors so as ro keep rhe roLor moving in one direcrion.
+L,C' $IA-RA( ,F LI*E F,LL,.ER
R,+,T/0
CIRC1IT $IA-RA( ,F LI*E F,LL,.ER
R,+,T/0
+he microcontroller receives signals from the Infrared
-ensor circuit. +he code burnt inside the ..&04M processes
the signal and send appropriate signals to the ,289% and
turns on:off the motors shon in the figure above. +he
program that processes the signals received from the
,M998 is given on the page later of this project report and
the code has been implemented using microcontroller
programming in assembl#.
PICTURE OF THE DEVELOPMENT BOARD
IMPLEMENTATION
Design of Microc onrrolle r Frogramm er
The circuir shovn aLove is microconrroller programmer (AT89CXXseries). Ir
Lurns rhe HEX code of rhe microconrroller program in rhe EEFROM of rhe
microconrroller using rhe parallel porr of rhe compurer.
Design of microcontroller programmer
The ISF programmer shovn Lelov sends rhe HEX code ro rhe programmer
(hardvare).
ISP (IN SYSTEM PROGRAMMING) PROGRAMMER
PICTURE OF THE PROGRAMMER BOARD
"$;+ I- I-&<
In-Sy sre m Fro gr ammin g (aLLreviared ISF) is rhe aLiliry of some
programmaLle logic devices, microconrrollers, and orher programmaLle
elecrronic chips ro Le programmed vhile insralled in a complere sysrem, rarher
rhan requiring rhe chip ro Le programmed prior ro insralling ir inro rhe sysrem.
The primary advanrage of rhis fearure is rhar ir allovs manufacrurers of elecrronic
devices ro inregrare programming and resring inro a single producrion phase,
rarher rhan requiring a separare programming srage prior ro assemLling rhe
sysrem. This may allov manufacrurers ro program rhe chips in rheir ovn sysrem's
producrion line insread of Luying preprogrammed chips from a manufacrurer or
disrriLuror, making ir feasiLle ro apply code or design changes in rhe middle of a
producrion run. Typically, chips supporring ISF have inrernal circuirry ro
generare any necessary programming volrage from rhe sysrem's normal supply
volrage, and communicare virh rhe programmer via a serial prorocol. Mosr
programmaLle logic devices use proprierary prorocols or prorocols defined Ly
older srandards. In sysrems complex enough ro require moderarely large glue
logic.
DESIGN OF INFRARED SENSOR CIRCUIT:
Fr inc iple of o pe rar io n o f rh e I . R. L. E.D . a nd
Fhor or ra ns is ro r: -
A Fhorodiode is a p-n juncrion or p-i-n srrucrure. When an infrared phoron of
sufficienr energy srrikes rhe diode, ir excires an elecrron rhereLy crearing a moLile
elecrron and a posirively charged elecrron hole. If rhe aLsorprion occurs in rhe
juncrion's deplerion region, or one diffusion lengrh avay from ir, rhese carriers
are svepr from rhe juncrion Ly rhe Luilr-in field of rhe deplerion region,
producing a phorocurrenr. Fhorodiodes can Le used under eirher zero Lias
(phorovolraic mode) or reverse Lias (phoroconducrive mode). Reverse Lias
induces only lirrle currenr (knovn as sarurarion or Lack currenr) along irs
direcrion. Bur a more imporranr effecr of reverse Lias is videning of rhe deplerion
layer (rherefore expanding rhe reacrion volume) and srrengrhening rhe
phorocurrenr vhen infrared falls on ir. There is a limir on rhe disrance Lerveen
I.R. L.E.D. and infrared sensor for rhe pair ro operare in rhe desired manner. In
our case disrance is aLour 5mm.
Infra-Red emirrer sends our IR pulses.
Fosirion calcularion is done rhrough
inrensiry of reflecred lighr received Ly
rhe derecror.
AmLienr inrerference is negligiLle.
FOS ITIONI NG OF SEN SOR S:-
The resisrance of rhe sensor decreases vhen IR (infrared) lighr falls on ir. A good
sensor vill have near zero resisrance in presence of lighr and a very large
resisrance in aLsence of lighr. Wherher rhe sensors are Lighr Dependenr Resisrors,
laser diode, Infrared Sensors, Ulrrasonic Sensors or anyrhing else,rhe ourpurs of
rhe sensor modules are fed ro rhe Non-inverring inpur of a compararor . The
reference volrage of rhe compararor is fed ro rhe inverring inpur of rhe
compararor Ly a rrim por or a runing device connecred Lerveen rhe supply lines.
LM339 is a compararor IC rhar digirizes rhe analog signal from rhe sensor array.
Since rhe ourpur of LM339 is TTL compariLle ir can Le direcrly fed ro rhe masrer
microconrroller.
0.5cm
EMITTER DETECTOR
The generalized connecrion diagram of Sensor Inrerfacing virh microconrroller is
shovn Lelov:-
CONNECTING INFRARED MODULE WITH MICROCONTROLLER MCS-51
When rhe sensor/emirrer pair is on shining surface sensor is on i.e. in
lov impedance mode vhich one can easily viev as L.E.D. corresponding
ro rhar sensor doesn'r glov. The ourpur of rhe opamp is HIGH
SIGN AL and rhis HIGH SIGNAL is given ro rhe microconrroller and
vhen rhe sensor is on normal non-reflecring surface ir's off i.e. in
HIGH IMFEDANCE srare vhich one can easily viev as L.E.D.
corresponding ro rhar sensor glovs up and LOW SIG NAL is given ro
rhe microconrroller.

Infra-Red Sensor Array
Black Wire Output Voltage
Red Wire !5V
Bro"# Wire $#d
ANALOG TO DIGITAL CONVERTER:-
Ir is clear rhar rhe ourpur of rhe porenrial divider is an analog volrage. Bur
Microconrroller does nor accepr rhe analog volrage. So ve need ro converr rhe
analog volrage ro digiral Lefore ve feed ir ro rhe microconrroller.
For rhis conversion ve can use
1. Compararors
2. ADCs
-
COMPARATOR LM339
+
V+
V-
V0
V0 = High when V+ > V-
V0 = Low when V+ < V-
V0 = High when V+ > V-
V0 = Low when V+ < V-
LM! COMPARATOR:-
FIN DI AGRAM OF LM339:-
This device consisrs of four independenr precision volrage compararors virh an
offser volrage specificarions as lov as 2mV. This compararor is designed ro
specifically operare from a single pover supply over a vide range of volrages.
Operarion from splir pover supplies is also possiLle. This compararor also has a
PIN DIAGRAM OF LM339
unique characrerisric vhich is rhar rhe inpur common-mode volrage range
includes ground even rhough operared from a single pover supply volrage.
FUNCTION OF T"E COMPARATOR:-

V
+
V
-
V
+
> V
-
0 V
HIGH
-
+

V
+
V
-
V
+
< V
-
0 V
LOW
-
+
(ICR,C,*TR,LLER/0
FI N D IAGRAM OF AT89C 51: -

PIN DIAGRAM OF AT89C51
The AT89C51 is a lov-pover, high-performance CMOS 8-Lir microcompurer
virh 4KLyres of Flash FrogrammaLle and ErasaLle Read Only Memory (FEROM).
The device is manufacrured using Armel's high densiry nonvolarile memory
rechnology and is compariLle virh rhe indusrry srandard MCS-51 insrrucrion ser
and pinour. The on-chip Flash allovs rhe program memory ro Le reprogrammed
in-sysrem or Ly a convenrional nonvolarile memory programmer. By comLining a
versarile 8-Lir CFU virh Flash on a monolirhic chip, rhe Armel AT89C51 is a
poverful microcompurer vhich provides a highly flexiLle and cosr effecrive
solurion ro many emLedded conrrol applicarions. The AT89C51 provides rhe
folloving srandard fearures: 4KLyres of Flash, 128 Lyres of RAM, 32 I/O lines, rvo
16-Lir rimer/counrers, five vecror rvo-level inrerrupr archirecrure, a full duplex
serial porr, on-chip oscillaror and clock circuirry. In addirion, rhe AT89C51 is
designed virh sraric logic for operarion dovn ro zero frequency and supporrs rvo
sofrvare selecraLle pover saving modes. The Idle Mode srops rhe CFU vhile
alloving rhe RAM, rimer/counrers, serial porr and inrerrupr sysrem ro conrinue
funcrioning. The Fover dovn Mode saves rhe RAM conrenrs Lur freezes rhe
oscillaror disaLling all orher chip funcrions unril rhe nexr hardvare reser.

PICTURE OF THE MICROCONTROLLER
ON#OARD PIN CONNECTIONS:-
#IPOLAR MOTOR DRIVER:-
L293D is a Lipolar moror driver IC. This is a high volrage, high currenr pushpull
four channel driver compariLle ro TTL logic levels and drive inducrive loads. Ir
has 600 mA ourpur currenr capaLiliry per channel and inrernal clamp diodes.
The L293 is designed ro provide Lidirecrional drive currenrs of upro 1 A ar
volrages from 4.5 V ro 36 V. The L293D is designed ro provide Lidirecrional drive
currenrs of up ro 600-mA ar volrages from 4.5 V ro 36 V. Borh devices are
designed ro drive inducrive loads such as relays, solenoids, dc and Lipolar srepping
morors, as vell as orher high-currenr/high-volrage loads in posirive supply
applicarions. All inpurs are TTL compariLle. Each ourpur is a complere rorem-pole
drive circuir, virh a Darlingron rransisror sink and a pseudo-Darlingron source.
Drivers are enaLled in pairs, virh drivers 1 and 2 enaLled Ly 1,2EN and drivers 3
and 4 enaLled Ly 3,4EN. When an enaLle inpur is high, rhe associared drivers are
enaLled, and rheir ourpurs are acrive and in phase virh rheir inpurs. When rhe
enaLle inpur is lov, rhose drivers are disaLled, and rheir ourpurs are off and in rhe
high-impedance srare. Wirh rhe proper dara inpurs, each pair of drivers forms a
full-H (or Lridge) reversiLle drive suiraLle for solenoid or moror applicarions.
PIN DIAGRAM OF L$!D:-
4 5 12 13
16 8
1
2
15
9
7
10
3
14
6
11
VCC1- LOGIC
SUPPLY= 5V
LM+
OUTPUT FOR
MOTOR1
OUTPUT FOR
MOTOR2
L_IN1
L_EN
GN
L293
INPUT
LINES
R_EN
L_IN2
R_IN2
R_IN1
LM-
RM+
RM-
PIN DIAGRAM OF L293D
The Device is a monolirhic inregrared high volrage, high currenr four channel
driver designed ro accepr srandard DTL or TTL logic levels and drive inducrive
loads (such as relays solenoides, DC and srepping morors) and svirching pover
rransisrors. To simplify use as rvo Lridges each pair of channels is equipped virh
an enaLle inpur. A separare supply inpur is provided for rhe logic, alloving
operarion ar a lover volrage and inrernal clamp diodes are included. This device is
suiraLle for use in svirching applicarions ar frequencies up ro 5 kHz.
The L293D is assemLled in a 16 lead plasric packaage vhich has 4 cenrer pins
connecred rogerher and used for hearsinking The L293DD is assemLled in a 20
lead surface mounr vhich has 8 cenrer pins connecred rogerher and used for
hearsinking.
PIN CONNECTIONS:-

CONNECTION DIAGRAM FOR DRIVING BIPOLAR DC MOTOR
MOTOR DRIVING:-
EN IN % IN $ Mo&or
S&a&'s
( X X S&o))ed
% ( ( S&o))ed
% % % S&o))ed
% % ( CW
% ( % CCW


PICTURE OF BIPOLAR MOTOR DRIVER
DC MOTORS:-
These are very commonly used in roLorics. DC morors can rorare in Lorh
direcrions depending upon rhe polariry of currenr rhrough rhe moror. These
morors have free running rorque and currenr ideally zero. These morors have
high speed vhich can Le reduced virh rhe help of gears and rraded off for rorque.
Speed Conrrol of DC morors is done rhrough Fulse Widrh Modularion rechniques,
i.e. sending rhe currenr in inrermirrenr Lursrs. FWM can Le generared Ly 555
rimer IC virh adjusred dury cycle. Varying currenr rhrough rhe moror varies rhe
rorque.

PICTURE OF DC MOTOR USED
SOURCE CODE:-
FROGRAM FOR LINE FOLLOWER
=======SYSTEM REGISTERS==============
F0 EQU 080H
F1 EQU 090H
F2 EQU 0A0H
F3 EQU 0B0H
TH1 EQU 08DH
TL1 EQU 08BH
TCON EQU 088H
TMOD EQU 089H
IE EQU 0A8H
SF EQU 081H
FLAG1 EQU 0D0H
,======= FORT FIN DEFINITIONS ========
SENSOR1 EQU F1.0
SENSOR2 EQU F1.1
LED_RED EQU F0.6
LED_GREEN EQU F0.7
L_EN EQU F0.2
R_EN EQU F0.4
L_MO1 EQU F0.1
L_MO2 EQU F0.0
R_MO1 EQU F0.3
R_MO2 EQU F0.5
, X X X X M X L R
, X X X X 1 X 0 0 - FWD -- 03
, 0 1 - TR 01
, 1 0 - TL 02
, 00 - STOF 00
,========== HERE THE MAIN FROGRAM STARTS ==========
ORG 0000H
AJMF START
ORG 0050H
START: MOV R1,#0FFH
MOV R2,#004H
MOV F2,#000H
LOOF: MOV C,SENSOR1
MOV LED_RED,C
MOV C,SENSOR2
MOV LED_GREEN,C
MOV A,F1
ANL A,#003H
CJNE A,#000H,CHECK_LEFT ,////// GO FORWARD /////////
SETB R_MO1
CLR R_MO2
SETB L_MO1
CLR L_MO2
MOV R1,#0FFH
MOV R2,#004H
AJMF LOOF
CHECK_LEFT:
CJNE A,#001H,CHECK_RIGHT ,////// TURN LEFT ///////////
SETB R_MO1
CLR R_MO2
CLR L_MO1
SETB L_MO2
MOV R1,#0FFH
MOV R2,#004H
HERE_LEFT:
MOV A,F1
ANL A,#003H
CJNE A,#003H,LEFT_CONT
DJNZ R1,LEFT_CONT
DJNZ R2,LEFT_CONT
AJMF STOF
LEFT_CONT:
JB F1.0,HERE_LEFT
AJMF LOOF
CHECK_RIGHT:
CJNE A,#002H,CHECK_STOF ,/////// TURN RIGHT ///////
CLR R_MO1
SETB R_MO2
SETB L_MO1
CLR L_MO2
MOV R1,#0FFH
MOV R2,#004H
HERE_RIGHT:
MOV A,F1
ANL A,#003H
CJNE A,#003H,RIGHT_CONT
DJNZ R1,LEFT_CONT
DJNZ R2,LEFT_CONT
AJMF STOF
RIGHT_CONT:
JB F1.1,HERE_RIGHT
AJMF LOOF
CHECK_STOF:
DJNZ R1,LOOF
STOF: SETB R_MO1
SETB R_MO2
SETB L_MO1
SETB L_MO2
HERE_STOF:
AJMF HERE_STOF

END
"EX CODE GENERATED FOR T"E CODE:-
: 020000000150AD
: 1000500079FF7A0475A000A2909286A2919287E51A
: 10006000905403B4000ED283C285D281C28079FF3E
: 100070007A040157B4011ED283C285C281D280792D
: 10008000FF7A04E5905403B40306D904DA0201B8F8
: 100090002090F00157B4021EC283D285D281C28063
: 1000A00079FF7A04E5905403B40306D9E3DAE10159
: 1000B000B82091F00157D99FD283D285D281D280C6
: 0200C00001C07D
: 00000001FF
PRO#LEMS ENCOUNTERED:-
The ISF programmer requires dedicared supply of 9V from rhe USB of your F.C.
Exrern supply of orher rhan 9V generares error vhile vriring rhe HEX code ro rhe
Microconrroller. The programmer vas soldered 3 rimes Lefore ir could
successfully program rhe chip.
The program vas difficulr ro implemenr as ir vas our firsr encounrer virh
microconrroller programming in assemLly.
The large numLer of inrerconnecrions in rhe circuir made ir roo difficulr ro
solder.
The IR sensors Lurnr up on soldering so ve have ro use remperarure conrrolled
soldering iron.
In rhe model designed ro shov line follover roLor, elecrric morors oughr ro Le
Lidirecrional and of lov varrage i.e. should drav lesser currenr orhervise rhe
moror can drav currenr ro such a level ro Lurn up rhe enrire circuir.
REFERENCES AND RESOURCES:-
Boo ks :
1) The 8051 Microconrroller and EmLedded Sysrems Using
AssemLly and C By Muhammad Ali Mazidi, Janice Gillispie
Mazidi & Ro lin D. McKinlay
WeLs ire s r ef er re d:
1) Armel Corp. Makers of rhe AVR microconrroller
vvv.armel.com
2) One of rhe Lesr sires AVR sire vvv.avrfreaks.ner
3) One of rhe Lesr sire for Microconrroller projecrs
vvv.kmirl.ac.rh
4) Keil, rhe developer of Keilvision vvv.keil.com
5) Informarion from vvv.vikipedia.com

You might also like