Вы находитесь на странице: 1из 40

ABSTRACT

The navigation and control of an autonomous vehicle is a highly complex task. Making a vehicle
intelligent and able to operate unmanned requires extensive theoretical as well as practical knowledge.
An autonomous vehicle must be able to make decisions and respond to situations completely on its own.
avigation and control serves as the ma!or limitation of the overall performance" accuracy and
robustness of an autonomous vehicle. avigation is a key aspect when designing an autonomous
vehicle. An autonomous vehicle must be able to sense its location" navigate its way toward its
destination" and avoid obstacles it encounters.
1
CHAPTER-1
INTRODUCTION
#obotics is a very popular field of knowledge. $ince many years human beings have tried to build an
autonomous robot. Thanks to the development of a new technologies dreams of human beings become
realistic. #obotics attracts ordinary people not only those educated in this domain. There are more and
more complex robots constructed. They are equipped with built%in computers therefore they become
autonomous system.

1.1 Motivation
The study of autonomous vehicles is a fairly new area of research. &t can be considered a speciali'ed
branch of robotics and has only been made possible due to the most recent technological advancements.
The study of robotics and autonomous vehicles emerged from humans( interest in controlling the world
around them. )umans have always sought new inventions that make their lives simpler. They have
strived to explore and go where they have not gone before. *rom these desires the study of robotics and
autonomous vehicles was born.
The birth of the microprocessor in the seventies created a technological explosion" opening numerous
areas of research. +ne such field was sensor technology. $ensors are devices that change a physical
quantity into an electrical signal" thus allowing that quantity to be measured. $cientists have created
sensors that detect anything from temperature to velocity. ,nfortunately" it has only been in the past few
decades that the cost of the microprocessor and sensors has been affordable to anyone besides the
military and government.
-ith the invention and advancement of these devices as well as their decreasing costs" the study of
robotics is now open to anyone. ew ideas and research are constantly emerging. Autonomous vehicles
have the potential to make our lives simpler and in some cases protect our livelihood. Autonomous
vehicles could mow our lawns" drive us around" or fight for our country. &t is from these benefits that
research and funding in this area will continue indefinitely for years to come.
1.2 Terminolog
The definition of an autonomous vehicle is rather vague and open to much debate. &t is hard to define
exactly what an autonomous vehicle is because the terms used to describe it are also open%ended. This
thesis will define an autonomous vehicle as a mobile robot that can intelligently navigate itself within an
environment without human interaction. ,nfortunately" terms such as robot" intelligence" and
environment have many different meanings. Therefore" in order to understand the autonomous vehicle
studied in this thesis those terms must also be defined.
2
*or the context of this the term robot will describe a machine that has a perceived level of intelligence.
Therefore" a robot can interpret inputs and respond to them in a useful way. *or this work" a robot will
collect data from its sensors" process it" and then respond to it by controlling its actuators. To an outside
observer the robot appears to be making intelligent decisions based on situations it encounters in its
environment.
The term environment must also be defined. -ith the world so complex" assumptions must be made
about the environment in order for a robot to interact with it. ot every event or situation can be planned
for. )owever" by creating a simple model of the world around the robot" hopefully" the most important
situations can be planned for. #obots have been designed for numerous environments including land"
air" sea" and outer space. This thesis assumes that the robot will operate on flat ground and thus will have
its movement restricted to two dimensions" using an x and y coordinates system. &t is also assumes that
the robot will have to react to obstacles its sensors can detect.
1.! APP"ICATION
.xisting Autonomous /ehicles
1.!.1 Militar A##li$ation%
&n the past decade" due to constant world conflict and the rapid advancement of technology" there has
been a great demand for autonomous vehicle research within the ,.$. military. -ithin the next twenty
years the ,.$. military hopes to have a significant percentage of its fighting force composed of
autonomous vehicles.
Autonomous vehicles are the preferred method of fighting in the future due to their efficiency" data
collection abilities" and protection of human life. Autonomous vehicles will be smaller" lighter" more
fuel efficient" and cheaper than their currently manned counterparts. *urthermore" since it is a machine it
will not get bored of mundane tasks assigned to it. Most importantly" they can enter hostile
environments and safely going where humans cannot go.
Autonomous vehicles are already making their presence felt on the battlefield today. $everal unmanned
surveillance aircraft proved their worthiness on the battlefields of Afghanistan and &raq. The two most
prominent ,nmanned Aerial /ehicles 0,A/s1 are the ,$ Air *orce(s 2redator and 3lobal )awk.
Another example" the 3lobal )awk" is a strictly surveillance and reconnaissance ,A/. &t was built for
)igh%Altitude" 4ong%.ndurance missions. .quipped with sophisticated radar and imagery devices it can
supply responsive and sustained data from anywhere within enemy territory" day or night" regardless of
weather.
Autonomous vehicles are also being used in the sea by the avy and on the ground by the Army. &n &raq"
land mines near roads or inside buildings have killed and in!uredhundreds of troops. &n response" the
2entagon has deployed unmanned mine seeking vehicles. These vehicles have robotic arms that can
3
remotely disable improvised explosive devices. $everal drones were damaged while disabling bombs.
)owever" the loss of a robot is well worth the price of saving human lives.
-hile many of these vehicles may seem like something out of a science fiction novel" there are still
many hurdles that must be overcome. *irst" the amount of intelligence these vehicles have is still very
primitive. /ehicles such as the 2redator still require much of their control to be done by humans. To
some degree" they can be considered advanced remote control vehicles and not autonomous vehicles.
)aving unmanned vehicles accomplish more complex goals will require better navigation and control
schemes.
*urthermore" different environments provide different challenges. Autonomous air vehicles are by far
the most sophisticated autonomous vehicles today. )owever" they do not face the terrain challenges of a
ground vehicle or communication and location problems of an underwater vehicle.
1.!.2 Con%&mer A##li$ation%
As technology advances and becomes cheaper" more applications of autonomous vehicles will become
apparent. As in most cases with technology" what was once a high end" top secret military application
eventually ends up in the consumer market with a completely different function. As an example" the
3lobal 2ositioning $ystem 032$1 was developed in the 5678s and had a strictly military application.
)owever" today it is used for many other purposes" from cars( navigation systems to mail and package
tracking. $imilar things will happened with autonomous vehicles and applications are already beginning
to emerge today.
Another example of a consumer autonomous vehicle is *riendly #obotics( #obomower .*riendly
#obotics claims a consumer can get their lawn cut by simply pressing a button. ot only can one
schedule when #obomower mows the lawn" but #obomower will also monitor its battery power and find
its way back to its charging station without any assistance.
9oth of these products appear to be great solutions to mundane tasks. )owever" there are problems with
both of them. ,nfortunately" in a practical setting these products underperform. They are truly not
intelligent devices and make a lot of assumptions in order to simplify the world around them. *or
instance" both devices navigate through their environment in a random fashion. They move forward until
they encounter a wall or obstacle" then they make a turn randomly and begin moving forward again until
another wall or obstacle is hit. &n a simple environment" such as a rectangular room or circular lawn"
with very few obstacles this method may be acceptable. )owever" in the complex environment of the
real world" this method proves to be inefficient and ineffective. #eviews of these products claim that
when these products were used in a real world setting they ended up not vacuuming the whole room or
leaving strips of grass unmoved. +bviously" a better system of navigation must be devised for these
systems. -ith all the technology available today" there must bebetter" more efficient way to
autonomously navigate through a house or around a lawn.
4
CHAPTER-2
COMPONENTS
An autonomous vehicle is a complex mechanical and electrical system. :esigning an autonomous
vehicle requires knowledge from many disciples of engineering" including mechanical" aerospace"
electrical" and computer engineering. ,sually" mechanical and aerospace engineers study the dynamics
of the system. They create mathematical models to analy'e the physical characteristics of the system.
Modeling a system is a difficult task and can be infinitely complex. 9eing able to model a system in a
simple yet concise way is highly dependent on the system being modeled. $ystem modeling is still a
large area of research today.
.lectrical engineering is also important when designing and studying autonomous vehicles. .lectrical
engineers interface the electronics onto the system and design ways to control the system. +nce a
mathematical model of the system is generated" control techniques can be employed to get the system to
act as desired. This again is difficult because many constraints come into play. ot only must a system
abide by the laws of physics but it must also meet performance and financial constraints. An
autonomous vehicle is laden with expensive sensors and controllers. 3etting these devices to work with
one another is also complicated. A thorough knowledge of electronics" sensors" and microcontrollers is
definitely required.
*inally" autonomous vehicles require knowledge from computer engineering and computer science.
3iving autonomous vehicles intelligence requires complex software. A computer engineer must
understand the system they are working with and then translate it into code. Acquiring sensor data"
processing that data" and controlling actuators are all done via software. Making this software robust"
reliable" and user friendly is a huge design task.
2.1 Atmega 1' Develo#ment Boar(
2.1.1 S#e$i)i$ation% an( *eat&re%
The atmega 5; :evelopment 9oard *eatures are<
=8 2in Atmel ATmega5;>?@ microcontroller with internal system clock upto A M)' and
externally upto 5; M)'
5;>?@ B9 *lash #AM memory for programs
5>@ B9 of $#AM
C5@>58@= 9ytes of ..2#+M
+ne ;x5 2in $2& #elimate )eader
.ight ?x5 2in #elimate header inputs for A analog sensors
5
+ne 5; 2in header to connect 5;D@ alphanumeric 4E:
Two onboard L293D drivers for motors (upto 600 mA per channel)
Dual !0" #olta$e re$ulator
Dual power input options (Throu$h mole% connector or throu$h D& 'ac()
Two pro$rammable )icro*+witches
Two pro$rammable L,Ds
Two D-DT switches (one for power on.off and one for reset)
)A/ 232 Level shifter for 0+232 communication
1ne 3%2 -in relimate header for 0+2332 communication
3our ! -in ber$istic( headers (male) from each port of ATme$a26.32
4ide input power ran$e from volts to 25 volts at 26"*2 Amps
7oard si8e of 6 % 3 inches9 on hi$h :ualit; -&7
2.1.2 Port% an( Conne$tor% Detail%
<ere is the detailed information of the atme$a 26 Development 7oard =
Po+er Unit,
IC -./0 ,
&t is a voltage #egulator &E -hich #egulates the voltage to FCv :E minimum voltage must be
F7/ :E &nput to as to convert the output .
-./0 an( Po+er Conne$tor <
2ower $witch is used to turn on the power supply of the board. 2ower will flow to voltage
regulators only when the power switch is in down position.
2ower supply can be given either through the 2ower Eonnector or through
the :E Gack. 9e sure to use +4H +. power source.
6
Reg&late( 0 1olt% Po+er O&t#&t,
This connector can be used to provide power to any external device. Taking into consideration"
that the board can only withdraw power up to @ Amps" power output from this !ack may vary.
Re%et S+it$2,
This switch is used to reset the program counter to 'ero and restart the program execution.
When execution is done, Reset switch is needed to be kept in down position.
While writing the program to the chip, reset switch should be kept in up position
"ED%,
*our 4.:s are provided on the board for the testing purpose. These 4.:s can be programmed
to glow. Eonnection details of the 4.:s and microcontroller pins are given below I
4.: 5 < 2ortE.5
4.: @ < 2ortE.@
4.: ? < 2ortE.?
4.: = < 2ort:.@
.ach individual 4.: can be programmed to glow or to blink by programming the corresponding
microcontroller pin.
7
3/ Pin Ba%e )or mi$ro$ontroller,
This base is provided to install and remove microcontroller chip easily. This board supports
+4H two microcontrollers I ATmega5; and Atmel ATmega?@. 9oth microcontrollers have
exactly same pin configuration but they differ in terms of the memory. *or more information
on microcontroller" refer to the respective datasheet.
1' Pin Ba%e )or "24!D Driver IC%,
There are two bases provided onboard to use 4@6?: )%9ridge with microcontroller. This board
supports +4H 4@6?: :river. o other )%9ridge &E can be installed instead of 4@6?:. *or
more information on 4@6?:" refer to its datasheet.
"24!D IC,
&t is ) 9ridge Eircuit used to control the :irection of the motor.
&t is used basically as we cannot withdraw much power from the
microcontroller and as we merely give FC volts to the microcontroller but Motor have a rating of
5@v" 5Amp so the need of 4@6?: is essential
Motor Conne$tor%,
8
The :evelopment 9oard(s four :E motor outputs are located bottom left side of the board by
means of motor connectors. These connectors can also be used to drive two stepper motors.
These connectors have following configuration I
M+T+#5
*or Eonnector 5 I
2-M Ehannel J 2-M59
:irection 9it J 2ort:.?
*or Eonnector @ I
2-M Ehannel J 2-M5A
:irection 9it J 2ort:.;
M+T+#@
*or Eonnector 5 I
2-M EhannelJ 2ortE.;
:irection 9it J 2ortE.7
*or Eonnector @ I
2-M EhannelJ 2ortE.=
:irection 9it J 2ortE.C
Eig2t ! Pin Hea(er% )or Sen%or%,
This board provides capability to connect up to eight sensors directly to A:E port of the
ATmega5;>?@. A:E need to be configured and started while working with Analog sensors
whereas A:E need to kept off while working with :igital sensor with same 2ort A. )owever
types of sensors can be used at a time but they both should be different ports" i.e. analog sensors
should be on 2ort A 0with A:E started1 and digital sensors should be on any other port 0with that
port in input mode1.
3iven below is the connection details of all eight headers with corresponding
microcontroller pin I
9
G5@ J 2ortA.7 0or1 A:E071
G5? J 2ortA.C 0or1 A:E0C1
G5= J 2ortA.? 0or1 A:E0?1
G5C J 2ortA.5 0or1 A:E051
G57 J 2ortA.; 0or1 A:E0;1
G5; J 2ortA.= 0or1 A:E0=1
G5A J 2ortA.@ 0or1 A:E0@1
G56 J 2ortA.8 0or1 A:E081
RS2!2 Conne$tor,
This connector is provided for #$@?@ communication. 2in configuration of #$@?@ is given
below I
#K J 2ort:.8
TK J 2ort:.5
1' Pin "CD Hea(er%,
A 5; 2in header is provided to interface one 5; D @ Alphanumeric 4E:. 3iven below are the pin
configuration details I
4cdpin J 2in
:b= J 2ortb.=
:bC J 2ortb.C
10
:b; J 2ortb.;
:b7 J 2ortb.7
. J 2ortb.?
#s J 2ortb.@
:9= to :97< :ata 9uses of 4E:
.< .nable pin of 4E:
#s< #egister $elect of 4E:
These pin configuration are only for the 4E: which is 5; D @ alphanumeric display. *or other
type of 4E: this may vary. #efer to related datasheet of the 4E: incase if you are using a
different one.
2.2 52eel%
-heeled robots are robots that navigate around the ground using motori'ed wheels to propel
themselves. This design is simpler than using treads or legs and by using wheels they are easier
to design" build" and program for movement in flat" not%so%rugged terrain. They are also more
well controlled than other types of robots. :isadvantages of wheeled robots are that they can not
navigate well over obstacles" such as rocky terrain" sharp declines" or areas with low friction.
-heeled robots are most popular among the consumer market" their differential steering
provides low cost and simplicity. #obots can have any number of wheels" but three wheels are
sufficient for static and dynamic balance. Additional wheels can add to balanceL however"
additional mechanisms will be required to keep all the wheels in the ground" when the terrain is
not flat.
2.! A$t&ator
An actuator is a mechanism for activating process control equipment by use of pneumatic"
hydraulic" or electronic signals. Actuators have been used in robotics since the fieldMs invention
in the early 56C8sL however those original robots were created for research and industrial
applications. &t has only been in the last few decades that the technology has advanced far
enough to put the power of robotics into the hands of home users. The most common actuator in
11
#obotics is :E Motors. :E Motors converts electrical into mechanical energy. :E Motors are
best at high speed and low torque.
2.!.1 Motor Control
The final A,T++M+,$ #+9+T subsystem controls the motors onboard the
A,T++M+,$ #+9+T. The inputs of the path following and global coordinate model were
the vehicle(s linear and rotational velocities. 9ased on the vehicle(s wheel radius and half wheel
base" r and b" there is a one to one mapping between the vehicle(s linear and rotational velocity"
v and N" and the vehicle(s wheel velocities" N4 and N#.
The kinematic models and controllers used to derived the path following and tra!ectory tracking
controllers assumed that the motors of the actual system were ideal. 9ased on this assumption" it
is implied that the motors have an infinite resolution and can instantaneously change to any
desired speed. )owever in actuality" these assumptions are not true. &f a controller is
implemented digitally" a motor only has a discrete number of speeds it can be set to.
*urthermore" there is always a delay in the amount of time it takes for a motor to achieve a
certain speed. ot taking these practical constraints into account in the actual implementation of
the A,T++M+,$ #+9+T could lead to undesired and unpredictable results.
The most common actuator in #obotics is :E Motors. :E Motors converts electrical into
mechanical energy. :E Motors are best at high speed and low torque.
A :E motor is a mechanically commutated electric motor powered from direct current 0:E1.
The stator is stationary in space by definition and therefore it(s current. The current in the rotor is
switched by the commutator to also be stationary in space. This is how the relative angle
between the stator and rotor magnetic flux is maintained near 68 degrees" which generates the
maximum torque.
:E motors have a rotating armature winding 0winding in which a voltage is induced1 but non%
rotating armature magnetic field and a static field winding 0winding that produce the main
magnetic flux1 or permanent magnet. :ifferent connections of the field and armature winding
provide different inherent speed>torque regulation characteristics. The speed of a :E motor can
be controlled by changing the voltage applied to the armature or by changing the field current.
The introduction of variable resistance in the armature circuit or field circuit allowed speed
control. Modern :E motors are often controlled by power electronics systems called :E drives.
:E motors are widely used in robotics because of their small si'e and high energy output. They
are excellent for powering the drive wheels of a mobile robot as well as powering other
mechanical assemblies. $peed reduction is often required because many actuators are suited to
12
high speeds and low torques. Also" weight>inertia of actuators affects the dynamics" so the
actuators are placed at or near the robot base. Thus" a transmission system must be used.
:E Motors are easy to control. +ne :E Motor requires only two signals to perform operations.
&f we want to change its direction !ust reverse the polarity of power supply across it. -e can vary
the speed of motor by varying the supply across it. This simplifies controller design immensely"
and there are a number of known techniques to meet motor performance criteria such as rise
time" settling time" peak overshoot and steady state error.
2.! Po+er %&##l S%tem,
&t is the system which supplies power to the motors and other electronic devices fitted on the
robot.
2.3 Sen%or (evi$e% )or )ee(6a$7
$ensory devices are the sensors. A sensor is a type of transducer.A Transducer is a device
0usually" electrical" electronic" or electro%mechanical1" that converts one type of energy to another
for various purposes including measurement or information transfer. The &# $ensor $et consists
of an &# transmitter and an &# receiver mounted side by side on a tiny 2E9. -ith minimum
interface and C/:E power" it can be used as a reflective type &# sensor for mobile robot or low
cost ob!ect detection sensor.
&# $ensors work by using a specific light sensor to detect a select light wavelength in the &nfra
#ed 0&#1 spectrum. 9y using an 4.: which produces light at the same wavelength as what the sensor is
looking for" you can look at the intensity of the received light. -hen an ob!ect is close to the sensor" the
light from the 4.: bounces off the ob!ect and into the light sensor. This result in a large !ump in the
intensity" which we already know can be detected using a threshold.
13
@ types of sensors have been used<
&# sensor
4.: sensor
Prin$i#le% O) O#eration
14
2.0 Serial Comm&ni$ation B RS2!2 An( MA8 2!2
2.0.1 Serial Comm&ni$ation B RS2!2
*or serial communication" ATM.3A5; is provided with two pins :.8 and :.5 which are
working as #eceiver and Transmitter
:.8% #K: 0 receiver1
:.5% TK: 0transmitter1
$o" using #K: and TK:" we can receive and send data from the microcontroller using serial
communication port called as #$@?@. These pins are also called as ,A#T.
15
ow"#$@?@ helps in serial communication with other devices e.g. personal computers" #*&:"
$im module etc.
2.0.2 MA8 2!2
MAK@?@ is an &E that operates on single C/ supply and it is integrated with two drivers and two
receivers .All receivers can be used to convert #$@?@ levels to TT4>EM+$ levels and all drivers
can be used to convert TT4>EM+$ level inputs to #$@?@ levels.
16
MAX 232
2.' 9SM Mo(&le
2lug and play 3$M Modem to interface serial interface.,se it to send $M$ by controlling it
through simple AT commands from micro controller. The modem consists of all the required
external circuitry required to start experimenting with the $&M?88 module like the power
regulation" external antenna" $&M )older" etc.
*eat&re%,
,ses the extremely popular $&M?88 module
2rovides serial TT4 interface for easy and direct interface to microcontrollers
Ean be controlled through standard AT commands
+nboard wire antenna for better reception.
The $&M?88 allows an ad!ustable serial baud rate from 5@88 to 55C@88 bps 06;88 default1
4ow power consumption of 8.@C A during normal operations and around 5 A during
transmission
+perating /oltage< 7 % 5C/ AE or :E

17
9SM !// Mo(&le
2.- In-S%tem-Programmer
To burn program in ATmega5;" we directly connect the ,$9 programmer with the
microcontroller. +nly C pins of microcontroller are need to be connected to the programmer.
They are<
M+$&"M&$+" $EB" #.$.T" 3#+,:.
These pins are present at ;"7"A"6 and 55 th pin of the microcontroller.


18
CHAPTER !
INTER*ACIN9
"24!( 5it2 Motor%
19
CHAPTER-!
PRO9RAMMIN9 IN BASIC "AN9UA9E USIN9 BASCOM-A1R
!.1 Overvie+
9A$E+M I A/# is an &:. based development platform and is developed by ME$ .lectronics.
9A$E+M uses 9A$&E programming language. &t is very easy to write"compile and download the
program with 9A$E+M.
!.2 Ba%i$%
To write program with 9asic language for A/#" start with following sentences I
1. De)ine :reg)ile ; instruct the compiler to use the specified register file.
20
Snta<
:RE9*I"E = "name_of_file"
ameOofOfile % &t refers to the name of register file. The register files are stored in the 9A$E+M%
A/# application directory with .:AT extension.
The register file holds information about the chip such as the internal registers and interrupts addresses.
Since we are using Atmega16 Microcontroller, we will define
PregfileJ m5;def.dat Qthis file is loaded for Atmel atmega5;
ote< *or Atmega?@" we will define PregfileJ m?@def.dat
2 . :$r%tal I &t defines the clock speed at which you want to run your microcontroller.
Snta<
:CR=STA" = Value
/alue % A numeric constant defining the *requency of the crystal.
E<am#le ;
Pcrystal J =888888 Q it set the clock speed at =M)'
!. Con)ig - The CONFIG statement is used to configure the arious hard!are
deices and other features of microcontroller.
-e are required to configure the following hardware and features<
a1 4E:
b1 A:E
c1 Timer
>a? Con)ig&ring "CD
9A$E+M allows us to configure 4E: with ease. Hou can configure various types of 4E:s with
9A$E+M like 5;D@" 5;D=" @8D@" @8D= +# =8D= alphanumeric 4E:s.
21
The 4cd provided on .KT$A2&.$ Eontroller 9oard is of si'e 5;D@ i.e. 5; char in one line and total
of @ lines of display.

Snta< )or Con)ig&ring "CD,
CON*I9 "CD = "C#_t$pe
"CD@t#e % It is the t$pe of "C# $ou !ant to configure. It can &e'
=8 D ="5; D 5" 5; D @" 5; D =" 5; D =" @8 D @ or @8 D = or 5; D 5a or @8D=A.
*or .xample < 5;D@ means < 5; Eharacter in one line and a total of @ lines

CON*I9 "CDPIN = (IN ) #*+= (N)#*,=(N) #*-=(N) #*.=(N) /=(N) 01=(N
To configure a 5;D@ alphanumeric 4E: of ext$apiens :evelopment 9oard" the command is I
Eonfig 4E: J 5;D@
Eonfig lcdpin J pin" :b= J 2ortb.= " :bC J 2ortb.C " :b; J 2ortb.; " :b7 J 2ortb.7 " . J 2ortb.?
" #s J 2ortb.@
>6? Con)ig&ring ADC
22
Snta<
CON*I9 ADC = single) (0/1C2"/0 = 23TO) 0/F/0/NC/ = opt
2#C %
It defines the 0unning mode of 2#C. Its alue is 1ING"/.
4e use 1ING"/ to ena&le getadc56 command ) if !e use Free ) the alues are
freel$ ta7en &$ the 8icrocontroller
2#.$EA4.# I
A numeric constant for the clock divider. ,se A,T+ to let the compiler generate the best value
depending on the KTA4.
*or A:E to work a clock of C8 to @88 B)R " so we use auto to select Maximum possible Elock
*requency available .
#.*.#.E. I
it simply means to whom adc must compare to give a value i.e. as the maximum resolution of the A:E
is 58 bits . meaning it can maximum convert values from 8 to 58@?0@S58%51 " so if we are reffering
Avcc0i.e FC /1 that meams on giving an input to the microcontroller(s A:E pin FC/ the digital value
we will get at the controller will be 58@?.
Eonfiguring A:E in 9A$E+M is also very easy. To configure A:E in 9A$E+M for
.KT$A2&.$ :evelopment 9oard" the statement is I
Eonfig Adc J $ingle " 2rescaler J Auto " #eference J Avcc
$tart A:E
>C? Con)ig&ring Timer% to generate P5M
23
Snta<
CON*I9 TIMER1 = CO3NT/0 9 TI8/0 9 (48)
(0/1C2"/= :9;9-+9<,-9:=<+)
2-M J A T 6 T58"
E+M2A#. A 2-M J E4.A# ,2T E4.A# :+- T :&$E+.ET
E+M2A#. 9 2-M J E4.A# ,2T E4.A# :+- T :&$E+.ET
TIMER1, It is a :- &it counter.
PRESCA"E - The TI8/0 is connected to the s$stem cloc7 in this case. >ou can
select the diision of the s$stem cloc7 !ith this parameter.
/alid values are 5" A" ;=" @C; or 58@=" This command divides the &nternal Elock to a value " to increase
the time duration .
P5M - Can &e ;) ? or :=.
This is the resolution of the (48 if selecting ; 5#efault6 ma@imum ariation !hich
can &e optained !ill &e = to <,, 5<A;-:6) so the registor p!m:aBp!m:& could
!ithstand a ma@imum alue of = to <,,.
COMPARE A>B? P5M % It refers to (48 compare mode.It compairs the alue to
the reference to get that !eather motor should rotate cloc7!ise Bcounter
cloc7!ise. It can &e C"/20 3( 52nti-Cloc7!ise6 or C"/20 #O4N5Cloc7!ise6
-ith 9A$E+M" again it is very easy task. To generate 2-M" the statement is I
Eonfig Timer5 J 2wm " 2wm J A " 2rescale J 5 " Eompare A 2wm J Elear :own " Eompare 9
2wm J Elear :own
$tart Timer5
Timer5 is a 5; bit timer which actually works in two parts" each one of A bit" simultaneously. $o the
above statement is actually generating two 2-Ms" 2-M 5A and 2-M 59. $ame way timer @ can be
24
configured. #efer ATmega5;>?@ datasheet and 9A$E+M help for more information regarding timers
and 2-M generation.

CHAPTER-3
PRO9RAM CODES
4.1-LCD interface and display
>re$file ? @m26def6dat@ A
>cr;stal ? 5000000
&onfi$ Lcd ? 26 B 2
&onfi$ Lcdpin ? -in9 Db5 ? -ortb659 Db" ? -ortb6"9 Db6 ? -ortb669 Db ? -ortb69 , ? -ortb639 0s ?
-ortb62
&onfi$ Adc ? +in$le9 -rescaler ? Auto9 0eference ? Avcc
25
&onfi$ Timer2 ? -wm9 -wm ? !9 -rescale ? 29 &ompare A -wm ? &lear Down9 &ompare 7 -wm ?
&lear Down
+tart Adc ..+tarts AD&
&ls .. &lears the +creen
+tart Timer2
Lcd @C,%tsapiens@ ..Displa;s the te%t on the screen
Lowerline ..Ce%t line
Lcd @welcome@
,nd
4.2-Metro Train Prototype
>re$file ? @m26def6dat@
>cr;stal ? 2000000
&onfi$ Lcd ? 26 B 2
&onfi$ Lcdpin ? -in9 Db5 ? -ortb659 Db" ? -ortb6"9 Db6 ? -ortb669 Db ? -ortb69 , ? -ortb639 0s ?
-ortb62
&onfi$ Timer2 ? -wm 9 -rescale ? 2 9 -wm ? ! 9 &ompare A -wm ? &lear Down 9 &ompare 7 -wm ?
&lear Down
+tart Timer2
26
Do
&ls
Lcd @forward@
-wm2a ? 200
-ortd66 ? 0
-wm2b ? 200
-ortd63 ? 0
4aitms 2000
&ls
Lcd @left@
-wm2a ? 200
-ortd66 ? 0
-wm2b ? "0
-ortd63 ? 0
4aitms 2000
&ls
Lcd @ri$ht@
-wm2a ? "0
-ortd66 ? 0
-wm2b ? 200
-ortd63 ? 0
4aitms 2000
&ls
27
Lcd @stop@
-wm2a ? 0
-ortd66 ? 0
-wm2b ? 0
-ortd63 ? 0
4aitms 2000
&ls
Lcd @bac(ward@
-wm2a ? "0
-ortd66 ? 2
-wm2b ? "0
-ortd63 ? 2
4aitms 2000
&ls
Lcd @stop@
-wm2a ? 2""
-ortd66 ? 2
-wm2b ? 2""
-ortd63 ? 2
4aitms 2000
&ls
Loop
28
,nd
4.3- Analog Sensor Caliration
>re$file ? @m26def6dat@
>cr;stal ? 5000000
&onfi$ Lcd ? 26 B 2
&onfi$ Lcdpin ? -in 9 Db5 ? -ortb65 9 Db" ? -ortb6" 9 Db6 ? -ortb66 9 Db ? -ortb6 9 , ?
-ortb63 9 0s ? -ortb62
&onfi$ Adc ? +in$le 9 -rescaler ? Auto 9 0eference ? Avcc
+tart AD&
Config Timer: = (!m ) (!m = ; ) (rescale = : ) Compare 2 (!m = Clear #o!n )
Compare * (!m = Clear #o!n
+tart Timer2
Dim A As inte$er .. declaring variable A of type integer
&ls .. Clear screen
Do .. Start the loop
A? DetAD& (0) .. The input of sensor connected to Pin 0 of port A will be
stored in variable A. Here in this case Pin 0 refers to !"# connector of
$evelop%ent &oard. Please refer to Page ' for pin connection details.
L&D A .. Displa; the value of variable A on L&D
Loop .. ,nd of Loop
,nd (( to end the progra%
29
4.4- !ire A"oidance
>re$file ? @m26def6dat@ A
>cr;stal ? 2000000
&onfi$ Lcd ? 26 B 2
&onfi$ Lcdpin ? -in 9 Db5 ? -ortb65 9 Db" ? -ortb6" 9 Db6 ? -ortb66 9 Db ? -ortb6 9 , ? -ortb63 9 0s ?
-ortb62
&onfi$ Adc ? +in$le 9 -rescaler ? Auto 9 0eference ? Avcc
&onfi$ Timer2 ? -wm 9 -wm ? ! 9 -rescale ? 2 9 &ompare A -wm ? &lear Down 9 &ompare 7 -wm ?
&lear Down
+tart Adc
&ls
+tart Timer2
Dim 0 As Ente$er
Do
&ls
0 ? Detadc(0)
Ef 0 F 00 Then
-wm2b ? 0
30
-ortd63 ? 0
-wm2a ? 0
-ortd66 ? 0
Lcd @obstacle found@
Lowerline
Lcd @stop@
,lseif 0 G 00 Then
-wm2b ? 2""
-ortd63 ? 0
-wm2a ? 2""
-ortd66 ? 0
Lcd @no obstacle found@
Lowerline
Lcd @move@
,nd Ef
Loop
,nd
31
CHAPTER 0
"INE *O""O5ER
0.1 Intro(&$tion
4ine follower is an autonomous robot which follows either black line in white are or white line in black
area. #obot must be able to detect particular line and keep following it.
32

Blo$7 Diagram
An array of sensor is used to detect the line. 9ased on the status of sensors" special circuit or controller
decides the position of line and also the required direction of motion required to follow the line. Motor
driver circuit is used to +>+** the 4.*T>#&3)T motors of the robot to provide desired motion.
0.2 Sen%or%
$ensors are required to detect position of the line to be followed with respect to the robot(s position.
Most widely used sensors for the line follower robot are 2)+T+$.$.#$. They are based on the basic
observation that the white surface reflects the light and the black surface absorbs it.
$ensor circuit contains emitter" detector and comparator assembly.
2hotosensors
&# or /&$&94. light is emitted from the emitter 0&# light is mostly preferred to avoid interference from
the visible light which is generally around the robot. )owever &# light is also present in atmosphere but
its intensity is much less than that of visible light" so &# light can give much reliable output. *or better
accuracy of the sensors" they must be covered properly for the isolation from the surrounding.1

This emitted light strikes the surface and gets reflected back. &f the surface is white" more intensity of
light gets reflected and for black surface very less intensity of light is reflected.

2hoto detector is used to detect the intensity of light reflected. The corresponding analog voltage is
induced based on the intensity of reflected light. This voltage is compared with the fixed reference
voltage in comparator circuit and hence it is converted into logic 8 or logic 5 which can be used by the
controller.
33
Prin$i#le o) line )ollo+er %en%or
34
5or7ing #rin$i#le
0.! Program $o(e o) line )ollo+er
>re$file ? @m26def6dat@ A
>cr;stal ? 5000000
&onfi$ Lcd ? 26 B 2
&onfi$ Lcdpin ? -in 9 Db5 ? -ortb65 9 Db" ? -ortb6" 9 Db6 ? -ortb66 9 Db ? -ortb6 9 , ? -ortb63 9 0s ?
-ortb62
&onfi$ Adc ? +in$le 9 -rescaler ? Auto 9 0eference ? Avcc
&onfi$ Timer2 ? -wm 9 -wm ? ! 9 -rescale ? 2 9 &ompare A -wm ? &lear Down 9 &ompare 7 -wm ?
&lear Down
+tart Adc
&ls
+tart Timer2
Dim 1b As Ente$er
Dim Cob As Ente$er
Dim ) As Ente$er
Dim A As Ente$er
Lcd @obHect case@
4aitms "00
35
1b ? Detadc(0)
4aitms "00
&ls
Lcd @no obHect case@
4aitms "00
Cob ? Detadc(0)
4aitms "00
&ls
Lcd @calculate mean@
) ? 1b I Cob
) ? ) . 2
Do
&ls
A ? Detadc(0)
Ef A F ) Then
-wm2b ? 0
-ortd63 ? 0
-wm2a ? 0
-ortd66 ? 0
Lcd @no obHect@
Lowerline
36
Lcd @stop@
Cls
,lseif A G ) Then
-wm2b ? 2""
-ortd63 ? 0
-wm2a ? 2""
-ortd66 ? 0
Lcd @obHect found@
Lowerline
Lcd @move@
Cls
,nd Ef
Loop
,nd
37
CONC"USION
38
RE*ERENCES
U5V -.2. Aung" Analysis on Modeling and $imulink of :E Motor and its :riving $ystem ,sed for
-heeled Mobile #obot" 2roceedings +f -orld Academy +f $cience" .ngineering And Technology"
vol. @;" pp.@66%?8;" :ecember @887
U@V T. 9rWunl" #esearch relevance of mobile robot competitions" &... #obotics and Automation
Maga'ine" vol. ;" no. =" pp. ?@I?7 " :ecember 5666 0;1
U?V 9orenstein" G." Mobile #obot 2ositioning< $ensors and Techniques" Gournal of #obotic $ystems"
/ol. 5=" &ssue = 056671" pp. @?5%@=6.
U=V 9rown" Gim" 9rief )%bridge Theory of +peration" http<>>www.dprg.org>tutorials>566A%8=a>"
0:allas" TK< :allas 2ersonal #obotics 3roup. April" 566A1.
UCV Huan" Ging" Halou )uang and Xiang )an" A $trategy of 2ath *ollowing Eontrol for -heeled
Mobile #obots" 2roceedings of the Cth -orld Eongress on &ntelligent Eontrol and Automation" 05C%56
Gune @88=1" &..." /ol. ;" pp. =665I=66C.
39
U;V Eao" Ruo 4iang" Huyu )uang" and .rnest 4. )all" #egion *illing +perations with #andom +bstacle
Avoidance for Mobile #obots" Gournal of #obotic$ystems" /ol. C &ssue @ 056AA1" pp. A7%58@.
40

Вам также может понравиться