Sie sind auf Seite 1von 37

WALL FOLLOWER

1
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 1
PREFACE
Difference in the academic life & practical life is revealed when enters the real life
& competitive world of industry where there is a cut throat competition & one has
to forcefully follow the theory of Charles Darwin Survival of Fittest. In order to
exist in the competitive world one has to be fully aware of all aspects of industrial
life. To meet this requirement in our engineering curricula, provision of practical
training program has been made.
The Practical Training is an essential requirement for an engineering student.
The student has to take the training for the pre-described period as per the
university norms. The purpose of training is to help the student to gain industrial
experience. Moreover, as for the utility of training concerning, it can be said that
student gets an opportunity during his training to imply the theoretical knowledge
in the field work & to clear the difficulties in a better way.
This report has been written with the intention of bringing together and tying
up some of the loose ends of analogue and digital circuit design, those parts that
are never mentioned in the textbooks and rarely admitted elsewhere. This report is
includes the circuit diagram of the various circuit like motor driver, sensors,
controller etc. but it exclude the specification of the Ics. This is also comprises of
the controller description & also brief description of normally used controller for
the purpose of selecting any controller for our purpose. In this report some of the
design issues related to the grounding of the circuit is also discuss but the detail
description of the design issues of the robot design is beyond the scope of the
report.
The report should be written in a clear & unambiguous language so that the
reader can also objectively judge the adequacy & the validity of report. It is hoped
that these will facilitate the use of the report in self study & that the upcoming
practicing engineer will find the text useful in updating himself in this fast moving
field.
WALL FOLLOWER
2
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 2
ACKNOWLEDGEMENT
I would like to express my deep feelings of gratitude and indebtedness to all those
people who are responsible for the successful completion of my practical training.
There are some individuals without whom this practical training would never reach
its final outcome.
We would like to thank our mentor Er. Arun Grover and team of Victory
Coaching and Training Centre, Sri Ganganagar, played a vital role in the
completion of the practical training. It is with pleasure we express our deep sense
of gratitude and profound thanks to our beloved for there support during our
stressful times and soothed frayed nerves. We thank them for all their patience and
support.
We would also like to convey our thanks to all our faculty members and our
friends who have helped us directly or indirectly during the course of our report
entitled Basic Embedded System Design in the field of Robotics for its
successful completion.
With regards and gratitude,
RAVINDER KUMAR
WALL FOLLOWER
3
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 3
Theory
1. Introduction to Robotics
In practical usage, a Robot is a mechanical device which performs automated
physical tasks, either according to direct human supervision, a pre-defined
program, or a set of general guidelines using artificial intelligence techniques.
Robots are typically used to do the tasks that are too dirty, dangerous, difficult,
repetitive or dull for humans. This usually takes the form of industrial robots used
in manufacturing lines. Other applications include toxic waste cleanup, underwater
and space exploration, mining, search and rescue, and mine finding. Recently
however, robots are finding their way into the consumer market with uses in
entertainment, vacuum cleaning, and lawn mowing. A robot may include a
feedback-driven connection between sense and action, not under direct human
control, although it may have a human override function. The action may take the
form of electro-magnetic motors or actuators (also called effectors) that move an
arm, open and close grips, or propel the robot. The step by step control and
feedback is provided by a computer programrun on either an external or embedded
computer or a microcontroller. By this definition, a robot may include nearly all
automated devices. Ask a number of people to describe a robot and most of them
will answer they look like a human. Interestingly a robot that looks like a human is
probably the most difficult robot to make. It is usually a waste of time and not the
most sensible thing to model a robot after a human being.
Mobile Robots:
Fig 1.Mars Explorer
image
Mobile robots are able to move, usually they perform
task such as search areas. A prime example is the Mars
Explorer, specifically designed to roam the mars
surface.
Mobile robots are a great help to such collapsed
building for survivors Mobile robots are used for task
where people cannot go. Either because it is too
dangerous of because people cannot reach the area that
WALL FOLLOWER
4
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 4
needs to be searched.
Rolling Robots: Rolling robots have wheels to
move around. These are the type of robots that can
quickly and easily search move around. However they
are only useful in flat areas, rocky terrains give them a
hard time. Flat terrains are their territory.
Fig 2. rolling robots
Can be divided in two categories:
Walking Robots: Robots on legs are usually brought
in when the terrain is rocky and difficult to enter with
wheels. Robots have a hard time shifting balance and
keep them from tumbling. Thats why most robots with
have at least 4 of them, usually they have 6 legs or
more. Even when they lift one or more legs they still
keep their balance. Development of legged robots is
often modeled after insects or crawfish.
Stationary Robot:
Robots are not only used to explore areas or imitate a
human being. Most robots perform repeating tasks
without ever moving an inch. Most robots are
working in industry settings. Especially dull and
repeating tasks are suitable for robots. A robot never
grows tired; it will perform its duty day and night
without ever complaining. In case the tasks at hand are
done, the robots will be reprogrammed to perform other
tasks.
WALL FOLLOWER
5
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 5
Autonomous robots:
Autonomous robots are self supporting or in other
words self contained. In a way they rely on their own
brains.
Autonomous robots run a program that gives them
the opportunity to decide on the action to perform
depending on their surroundings. At times these
robots even learn new behavior. They start out with a
short routine and adapt this routine to be more
successful at the task they perform. The most
successful routine will be repeated as such their
behavior is shaped. Autonomous robots can learn to
walk or avoid obstacles they find in their way. Think
about a six legged robot, at first the legs move ad
random, after a little while the robot adjust its
program and performs a pattern which enables it to
move in a direction.
2. Introduction to sensors
A sensor is a type of transducer. A sensor is a device that converts a physical
phenomenon into an electrical signal. As such, sensors represent part of the
interface between the physical world and the world of electrical devices, such as
computers. The other part of this interface is represented by actuators, which
convert electrical signals into physical phenomena. Sensors are used in everyday
life. Applications include automobiles, machines, aerospace, medicine, industry
and robotics.
The ability to trace objects is a trait that has enabled humans to manipulate
the environment. Without the ability to see, we would not be able to do our work.
It makes sense, then, to provide sensor to our robot creations so they can
manipulate objects and use tools. Sensors are extremely important for any robot.
WALL FOLLOWER
6
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 6
We can talk about sensors in general, but in an application like Micro mouse, we
can customize the discussion so the sensors are optimized for this application.
There are vast numbers of sensors used in robotics. A robotic sensor is used to
detect an object around him. Robotic sensors come in a variety of styles. They can
be photo diodes, phototransistors, photo resistors (LDR), photocells, TSOP,
piezoelectric crystals and many others.
Purposes:
Sensors on a robot serve several purposes. The first purpose is to make sure the
robot can detect errors. Errors are a way of life. Sensitive sensors that can detect
slight errors can help the robot correct errors before errors accumulate to a level
that can no longer be corrected.The second purpose of sensors on a robot is to
sense the obstacle in between the path of the robot. The range of the sensor gives
our robot time to stop or decrease or increase the speed save the time in the
competitions.
Types of Sensor:
On the basis of signal detection method :
Different sensors require different sensing strategies. There are three modes of
signal detection used by sensors:
1. Through-beam detection
2. Reflex detection.
Through beam detection method:
The through-beam method requires that the source and detector are positioned
opposite each other and the light beam is sent directly from source to detector.
When an object passes between the source and detectors, the beam is broken;
signal shows the detection of an object.
Through-beam detection generally provides the longest range of the three
operating modes and provides high power at shorter range to penetrate steam, dirt,
or other contaminants between the source and detector. Alignment of the source
and detector must be accurate.
Reflex detection method:
WALL FOLLOWER
7
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 7
The reflex method requires that the source and detector are installed at the same
side of the object to be detected. The light beam is transmitted from the source to a
retro reflector that returns the light to the detector. When an object breaks a
reflected beam, the object is detected.
The reflex method is widely used because it is flexible and easy to install and
provides the best cost-performance ratio of the three methods. The object to be
detected must be less reflective than retro reflector.
Proximity detection method:
The proximity requires that the source and detector are installed on the same side
of the object to be detected and aimed at a point in front of the sensor. When an
object passes in front of source and detector, light from the source is reflected from
the objects surface back to the detector, and the object is detected.
The only difference between reflex detection & proximity method is reflection of
signal from retro reflector and from object to be detected. Each sensor type has a
specific operating range. In general through-beam sensor offer the greatest range,
followed by reflex sensors, then by proximity sensors.
2.1 Some commonly used sensors
1. LED-LDR SENSOR:
An LED-LDR sensor circuit is very simple and cheap before moving to discuss the
details first we understand the working of light dependent resistor. A photoresistor
is made of a high-resistance semiconductor. If light falling on the device is of high
enough frequency, photons absorbed by the semiconductor give bound electrons
enough energy to jump into the conduction band. The resulting free electron (and
its hole partner) conduct electricity, thereby lowering resistance.LDRs or Light
Dependent Resistors are very useful especially in light/dark sensor circuits.
Normally the resistance of an LDR is very high, sometimes as high as 1000 000
ohms, but when they are illuminated with light resistance drops dramatically.
Explation:
Transmitter: the current coming to the base of the transistor is passing through a
current limiting resistor of 1K. This current made the transistor to work in the
active region and the voltage at the collector is low hence LED light up and send
WALL FOLLOWER
8
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 8
light to the receiver.
Receiver: When the light level is low (no light detected) the resistance of the LDR
is high. This prevents current from flowing to the base of the transistors.
Consequently the LED does not light. However, when light shines onto the LDR
its resistance falls and current flows into the base of the first transistor and then the
second transistor. This makes the collector voltage low & indicating LED lights.
The output of the circuit is taken from
the indicating LED anode point. The
preset resistor can be turned up or
down to increase or decrease resistance,
in this way it can make the circuit
more or less sensitive. The
illumination of the indicating LED is
also increase by reducing the value
of 470 resistor to 200. Table shows
the practical parameter value.
Problem:
The main problem of using LED-LDR is the problem of its very much
sensitivity to the environment light. As the environment changes (i.e. the light
conditions) the variable resistance (pot) needs to be adjusted in order to maintain
its proper working. By changing the value of the resistance of the pot, we change
the value of voltage applied at the base of transistor BC 547 due to potential
divider network and thus brings the transistor in active region. To save the LDR
from the environment light cover it properly. So it is better to use IR transmitter
receiver sensor circuit, which is less affected by the environment.
2 SIMPLE INFRARED LIGHT PROXIMITY SENSORS
Light may always travel in a straight line, but it bounces off nearly
everything. You can use this to your advantage to build an infrared collision
detection system. You can mount several infrared bumper sensors around the
periphery of your robot. They can be linked together to tell the robot that
something is out there, or they can provide specific details about the outside
environment to a computer or control circuit. This is the simplest of all range
nding sensors. An IrED shines IR to a potential wall, and a phototransistor picks
up the intensity of the reected radiation. In theory, the intensity is the inverse of
distance squared.
WALL FOLLOWER
9
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 9
Explation:
In the you can see the merger of the three circuit transmitter, receiver &
comparator. The IR-LED transmit the light whish is not visible with the naked eyes
but can see by mobile camera because it works in the infrared region. This light is
absorb by the photo diode when it detect the light its resistance decrease & current
get the least resistance path to the ground. Because of this phenomenon the voltage
at inverting end of the comparator is low & output of the comparator is high &
indicating LED off. When light is not detecting the voltage at the inverting end is
high & output of the comparator is low. The output given by the comparator is fed
to the controller which works on the TTL logics.
Sensitivity can be adjusted by changing the value of R2; reduce the value to
increase sensitivity. An increase in sensitivity means that the robot will be able to
detect objects farther away. A decrease in sensitivity means that the robot must be
fairly close to the object before it is detected.
Bear in mind that all objects reflect light in different ways. Youll probably
want to adjust the sensitivity so the robot behaves itself best in a room with white
walls. But that sensitivity uses an infrared phototransistor.
Lists of parts for infrared proximity sensor
R1 270 resistor
R2 10K resistor
Q1 Infrared sensitive phototransistor
LED1 Infrared light-emitting diode
WALL FOLLOWER
10
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 10
3 TSOP1738 SENSORS
The circuit designed as per the previous works fine but there is a limitation
of the range of the sensors. The problem of range can be solved by using
TSOP1738 as the IR receiver. This TSOP receiver normally find in the TV remote
control systems.
By changing the modulation frequency of the IR LED, we can estimate the
range to an object from the IR LED and TV remote control, which allows you to
decide whether to take immediate evasive action or slightly alter the course of the
robot. This is the normal IR receiver used in the common TV remotes. It receives a
signal of 38 kHz. This device is active low i.e. when the sensor does not receive a
signal its output is high while the output goes low when it receives the signal.
Giving a signal of 38 kHz gives a range of 25-30 cms in the reflected signal which
is sufficient for detecting an obstacle and stops the robot. Hence this is a better
choice than the normal IR receivers which provide a range of not more than 5-10
cms. The circuit diagram for the IR transmitter and TSOP1738 is given as
below.The opaque barrier is there between the TSOP & IR LED to ensure there is
not a direct path from the IR LED to the TV remote control.
3 ULTRASONIC SENSOR:
WALL FOLLOWER
11
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 11
Ultrasonic sensing is an example of reflective sensing. The sensor usually
consists of a transmitter and receiver pair and responds to variation in the amount
of reflected energy detected by the receiver. The transmitter emits a high frequency
sound wave, which reflects off the object and is detected by the receiver, where the
Time-of-Flight (TOF) information can be calculated. The range of the object can
be determined from the TOF data if the speed of the sound wave is a known
constant. These sensors are accurate over distances of several meters, with their
accuracy dependant on the span of the transmitted signal.
Accuracy of sensor:
Accuracy only applies to sensors that are supposed to be calibrated. For
calibrated sensors of a particular make/model, the output is supposed to relate to
some physical quantities regardless of the individual sensor. For example, if a
sensor is sensing a wall & it gives in the output a voltage of 1.6v then we have to
examine the interfacing issues because if we use a controller with TTL
compatibility then for that it is logic low but we want that if sense the wall then it
should be logic 1 hence we have to use interfacing logics.
If we use number of sensor than each individual one is almost guaranteed to
output a different voltage at the same distance from an object. Hence we have to
study the design issues of that circuit or refer data sheet.
WALL FOLLOWER
12
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 12
3. Motors
Motors come in many sizes and types, but their basic function is the same. Motors
of all types serve to convert electrical energy into mechanical energy. They can be
found in VCR's, elevators, CD players, toys, robots, watches, automobiles, subway
trains, fans, space ships, air conditioners, refrigerators, and many other places. The
performance of the motor is very important in circuit design. This is because the
electrics motors directly affect its speed and pushing capability. Motor
performance information is needed to select the required speed. The current
requirements from the motor will dictate what type and size batteries will need and
they are also a factor in determining the minimum current requirements for motor
speed controllers.

DC Motor:
DC motors seem quite simple. Apply a voltage to both terminals, and it will
spin. DC motors are non-polarized which means that it can reverse voltage so the
motor will rotate in two directions, forward and backward. Typical DC motors are
rated from about 6V-12V. The larger ones are often 24V or more but for the
purpose of this project, it is necessary to use 6V-12V range motor. Voltage is
directly related to motor torque. The more voltage supplied, the higher the torque
will be produce. Specifications of most DC motors show high revolutions per
minute (rpm) and low torque.
Fig. D.C. motor
From the start, DC motors seem quite simple. Apply a voltage to both
terminals, and it spins. But what if you want to control which direction the motor
spins? Correct, you reverse the wires. Now what if you want the motor to spin at
half that speed? You would use less voltage. But how would you get a robot to do
those things autonomously? How would you know what voltage a motor should
get? Why not 50V instead of 12V? What about motor overheating? Operating
motors can be much more complicated than you think. DC motors are non-
WALL FOLLOWER
13
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 13
polarized - meaning that you can reverse voltage without any bad things
happening. Typical DC motors are rated from about 6V-12V. The larger ones are
often 24V or more. But for the purposes of a robot, you probably will stay in the
6V-12V range. So why do motors operate at different voltages? As we all know (or
should), voltage is directly related to motor torque.
STEPPER MOTORS:
Stepper motors differ from standard DC motors in such a way that they have two
independent coils which can be independently controlled. As a result, stepper
motors can be moved by impulses to precede exactly a single step forward or
backward, instead of a smooth continuous motion in a standard DC motor. A
typical number of steps per revolution is 200, resulting in a step size of 1.8. Some
stepper motors allow half steps, resulting in an even finer step size. There are also
a maximum number of steps per second, depending on load, which limits a stepper
motors speed.
Stepper motors seem to be a simple choice for building mobile robots,
considering the effort required for velocity control and position control of standard
DC motors. However, stepper motors are very rarely used for driving mobile
robots, since they lack any feedback on load and actual speed (for example a
missed step execution). In addition to requiring double the power electronics,
stepper motors also have a worse weight/performance ratio than DC motors.
WALL FOLLOWER
14
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 14
4. Robot batteries
The robots are no longer limited to bulky low power non-rechargeable batteries,
and today there is a large assortment to suit your robots' demands. How are
batteries rated? With any battery you will see a voltage and a power rating. Battery
voltages can be somewhat complicated. When fully recharged, a battery will often
be 15% above its voltage rating. When fully discharged, about 15% below its
rating. A fully charged battery will also immediately drop below its rating when
driving heavy loads, such as a DC motor. To increase battery voltage, wire
multiple of them in series. Batteries also cannot supply an infinite current. So
expect batteries of different types but equal voltages to have different current
outputs. To increase battery current output, wire multiple of them in parallel. This
is why batteries often come in assembled packs of smaller cells. So when using a
battery, make sure your circuit handles changes in battery voltage. For the power
rating you will see something like 1200mAh. mAh means milliamps per hour. So if
it is 1200mAh, that means the battery can supply 1.2 amps for one hour or 2.4
amps for 30 minutes or 0.6 amps for two hours.
Lithium (Li-ion) is the new standard for portable power. Li-ion batteries
have the same high energy capacity as NiMHs, power output rates of NiCads, and
weigh about 20%-35% less. They also have zero memory effect problems,
meaning you can recharge whenever. Although lithium batteries are the most
advanced for portable power, they are also the most expensive. Also, they are
made out of totally non-toxic material, making them safe for cute squirrels and
pretty trees. What is to be remembered is to, lithium ignites very easily, and forms
large quantities of hydrogen when put in contact with water, so don't shoot at it or
blow it up or anything of that nature. Also, fire extinguishers are usually water
based, so dont use them on lithium battery fires.
WALL FOLLOWER
15
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 15

WALL FOLLOWER
16
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 16
5. Microcontroller
Introduction to microcontroller
A microcontroller is a computer with most of the necessary support chips on
board. A Central Processing Unit (CPU) that executes the programs. Some
random-access memory (RAM) where it can store data that is variable. Some read
only memory (ROM) where programs to be executed can be stored. Input and
output (I/O) devices, that enable communication to be established with the outside
world i.e. connection to devices such as keyboard, mouse, monitors and other
peripherals. There are a number of other common characteristics that define
microcontrollers.
If a computer matches a majority of these characteristics, then it can be classified
as a microcontroller. Microcontrollers may be:
Embedded inside some other device (often a consumer product) so that
they can control the features or actions of the product. Another name for
microcontroller is therefore an embedded controller.
Dedicated to one task and run one specific program. The program is stored
in ROM and generally does not change
.
A low-power device. A battery-operated microcontroller might consume as
little as 50 mW.
A microcontroller may take an input from the device it is controlling and
controls the device by sending signals to different components in the device.
A microcontroller is often small and low cost. The components may be
chosen to minimize size and to be as inexpensive as possible.
WALL FOLLOWER
17
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 17
What is a microcontroller actually?
History of microcontroller:
The first single-chip microprocessor was the 4-bit Intel 4004 released in
1971, with the Intel 8008 and other more capable microprocessors becoming
available over the next several years. However, both processors required external
chips to implement a working system, raising total system cost, and making it
impossible to economically computerize appliances.
The Smithsonian Institution says TI engineers Gary Boone and Michael Cochran
succeeded in creating the first microcontroller in 1971. The result of their work
was the TMS 1000, which went commercial in 1974. It combined read-only
memory, read/write memory, processor and clock on one chip and was targeted at
embedded systems.
About 55% of all CPUs sold in the world are 8-bit microcontrollers and
microprocessors. According to Semico, over four billion 8-bit microcontrollers
were sold in 2006.
A typical home in a developed country is likely to have only four general-purpose
microprocessors but around three dozen microcontrollers. A typical mid-range
automobile has as many as 30 or more microcontrollers. They can also be found in
many electrical devices such as washing machines, microwave ovens, and
telephones.
WALL FOLLOWER
18
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 18
Use of microcontroller in robotics:
A microcontroller can be considered a self-contained system with a
processor, memory and peripherals and can be used as an embedded system.
[5]
The
majority of microcontrollers in use today are embedded in other machinery, such
as automobiles, telephones, appliances, and peripherals for computer systems.
While some embedded systems are very sophisticated, many have minimal
requirements for memory and program length, with no operating system, and low
software complexity. Typical input and output devices include switches, relays,
solenoids, LEDs, small or custom LCD displays, radio frequency devices, and
sensors for data such as temperature, humidity, light level etc. Embedded systems
usually have no keyboard, screen, disks, printers, or other recognizable I/O devices
of a personal computer, and may lack human interaction devices of any kind.
Types of microcontrollers:
Microcontrollers can be classified on the basis of internal bus width,
architecture, memory and instruction set.
THE 8-BIT MICROCONTROLLER:
When the ALU performs arithmetic and logical operations on a byte (8-bits)
at an instruction, the microcontroller is an 8-bit microcontroller. The internal bus
width of8-bit microcontroller is of 8-bit. Examples of 8-bit microcontrollers are
Intel 8051 family and Motorola MC68HC11 family.
THE 16-BIT MICROCONTROLLER:
When the ALU performs arithmetic and logical operations on a word (16-bits)
at an instruction, the microcontroller is a 16-bit microcontroller. The internal bus
width of16-bit microcontroller is of 16-bit. Examples of 16-bit microcontrollers are
Intel 8096family and Motorola MC68HC12 and MC68332 families. The
performance and computing capability of 16 bit microcontrollers are enhanced
with greater precision as compared to the 8-bit microcontrollers.
THE 32-BIT MICROCONTROLLER:
When the ALU performs arithmetic and logical operations on a double word
(32- bits) at an instruction, the microcontroller is a 32-bit microcontroller. The
internal bus width of 32-bit microcontroller is of 32-bit. Examples of 32-bit
microcontrollers are Intel80960 family and Motorola M683xx and Intel/Atmel 251
family. The performance and computing capability of 32 bit microcontrollers are
enhanced with greater precision as compared to the 16-bit microcontrollers.
WALL FOLLOWER
19
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 19
Introduction to 8051 microcontroller family:
There are a wide range of devices available in the 8051 family, differing in
terms of memory type and capacity, number of counter/timers, types of serial
interface, number of input/output ports, clock rates, frequency range, etc. However,
there is a commonality among all devices in that they have been developed from
the core 8051 device with modifications to produce the particular attributes of a
different family member. Each member of the 8051 microcontroller family has
been designed with improved device specifications in mind and to provide the
customer with a device to suit particular user requirements.
8051 Microcontroller internal Structure:
Introduction to Microcontroller AT89C2051:
The 2051 is a 20 pin version of the 8051. It is a low-voltage, high-
performance CMOS 8-bit microcomputer with 2K bytes of Flash programmable
and erasable read only memory. Atmel manufactures the chip using high-density
nonvolatile memory technology. The 2051 and is compatible with the industry-
standard MCS-51 instruction set. By combining a versatile 8-bit CPU with Flash
on a monolithic chip, the Atmel 2051 is a powerful microcontroller. It provides a
very flexible, cost-effective solution to many embedded control applications.
WALL FOLLOWER
20
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 20
Operational features of the 2051:
The 2051 features Compatibility with MCS-51 Products, 2K Bytes of
Reprogrammable Flash Memory with 1,000 Write/Erase Cycles. The
operating range of the 2051 is 2.7V to 6V. Among these features, the 2051 also
contains the following features:
Fully Static Operation: 0 Hz to 24 MHz
Two-level Program Memory Lock
128 x 8-bit Internal RAM
15 Programmable I/O Lines
Two 16-bit Timer/Counters
Six Interrupt Sources
Programmable Serial UART Channel
Direct LED Drive Outputs
On-chip Analog Comparator
Low-power Idle and Power-down Modes
Pin diagram of 2051 microcontroller:
Pin Description;
Pin Name: Purpose:
VCC Supplies voltage and power.
GND Ground.
WALL FOLLOWER
21
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 21
Port 1
Port 1 is an 8-bit bi-directional I/O port. Port pins P1.2 toP1.7 provide
internal pull-ups. P1.0 and P1.1 require external pull-ups. P1.0 and P1.1 also serve
as the positive input (AIN0) and the negative input (AIN1), respectively, of the on-
chip precision analog comparator. The Port 1 output buffers can sink 20mA and
can drive LED displays directly. When 1s are written to Port 1 pins, they can be
used as inputs. When pins P1.2 to P1.7 are used as inputs and are externally pulled
low, they will source current (IIL) because of the internal pull-ups. Port 1 also
receives code data during Flash programming and verification.
Port 3:
Port 3 pins P3.0 to P3.5, P3.7 are seven bi-directional I/O pins with internal
pullups.P3.6 is hard-wired as an input to the output of the on-chip comparator and
is not accessible as a general purpose I/O pin. The Port 3 output buffers can sink
20mA. When 1s are written to Port 3 pins they are pulled high by the internal pull-
ups and can be used as inputs. As inputs, Port 3 pins that are externally being
pulled low will source current (IIL) because of the pull-ups. Port 3 also serves the
functions of various special features of the AT89C2051 as listed below: Port 3 also
receives some control signals for Flash programming and verification.
RST:
Reset input. All I/O pins are reset to 1s as soon as RST goes high. Holding
the RST pin high for two machine cycles while the oscillator is running resets the
device.
Power-down Mode of 2051 microcontroller:
In the power down mode the oscillator is stopped, and the instruction that
invokes power down is the last instruction executed. The on-chip RAM and
Special Function Registers retain their values until the power down mode is
terminated. The only exit from power down is a hardware reset. Reset redefines the
SFRs but does not change the on-chip RAM. The reset should not be activated
before VCC is restored to its normal operating level and must be held active long
enough to allow the oscillator to restart and stabilize.
WALL FOLLOWER
22
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 22
Circuit diagramof 2051:

Where
+vcc = +5 volt
Gnd = 0volt
Addressing mode of 2051 microcontroller:
The CPU can access data in various ways. The data could be in a register or
memory. Data can be accessed immediately. Methods of accessing data are
called Addressing Modes Various addressing modes of a up are determined when
it is designed and therefore cannot be changed by the programmer. The 8051
provides a total of 4 distinct addressing modes.
1. Immediate
2. Register
3. Direct
4. Register Indirect
1. Immediate Addressing mode:
The first addressing mode is basically not an addressing mode; it is just a
method to pass the value to be executed as part of the instruction. The
immediate value is specified by placing a '#' character in front of the
immediate value to be passed. For example look at the following instruction:
Add A, #77;
Add77 to the accumulator
this instruction will add 77 (decimal) to the contents of the accumulator and
store the result in accumulator. This method is used when we are required to
pass certain integer values into calculation like multiplication and division.
WALL FOLLOWER
23
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 23
2. Direct Addressing mode:
It differs from register addressing in that any byte within the first 256
addresses can be accessed by specifying 8-bit address. When using this
mode, there is few things watch out for. The first RAM addresses (080h
to 0FFh, if the device you are using has RAM at these locations) cannot
be accessed by direct memory addressing. If you specify an instruction
like :
Mov A, 088h
you will load the accumulator with the contents of the TCON register
located at address 088h rather than the contents of RAM byte.
3. Resistor addressing mode:
Bank addressing mode allows programmer to access a byte in the current
register bank. This is most efficient (both in terms of clock cycle and control
store) method of accessing data. Most register instruction executes in one
register cycle and only requires one byte to execute the instruction. The 8
bytes are known as R0 through R7. For example
add A, R2; add content of R2 to accumulator and store result in accumulator.
4. Register Indirect Addressing mode:
As the name indicates it is an indirect mode of addressing. It user R0 or R1
as an 8-bit index register to access a byte in the first 256 addresses of the
data space. As: -
Orl A, @R0
The register indirect addressing mode is identified by the symbol '@' before
either R0 or R1. Using any other bank (R2 to R7) will result in an error.
Instruction set for assembly programming of 2051 microcontroller:
The instructions for the 8051 device are dependent on the clock frequency and are
completed in a number of clock cycles. The basic 8051 device operates on
minimum 12 clock cycles per instruction basis and this is reflected in the notes that
follow each type of instruction described below.
WALL FOLLOWER
24
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 24
A. Mov instruction
MOV A,Rn [A]
MOV A,direct [A]
MOV A,@Ri [A]
MOV A,#dat a [A]
MOV Rn,A [Rn]
MOV Rn,direct
B. Arithmetic instructions
ADD A,Rn [A] < ___ [A] +[Ri]
ADD A,direct [A] < ___ [A] + [direct]
ADD A,#data [A] < ___ [A] +data
SUBB A,Rn [A] < ___ [A] _ [Rn] _ C_
INC A [A] < ___ [A] +1
WALL FOLLOWER
25
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 25
6. H-BRIDGE
For most applications we want to be able to do two things with a motor:
Run it in the forward and backward directions.
Modify its speed.
An H-bridge is what is needed to enable a motor to run forward/backward. . In the
next section we will discuss a method called pulse width modulation to change
the motor speed. Figure 3.4 demonstrates the H-bridge setup, which received its
name from its resemblance to the letter H. We have a motor with two terminals a
And b and the power supply with + and -. Closing switches 1 and 2 will
connect a with + and b with -: the motor runs forward. In the same way,
closing 3 and 4 instead will connect a with - and b with +: the motor runs
backward.
The way to implement an H-bridge when using a microcontroller is to use a power
amplifier chip in combination with the digital output pins of the controller or an
additional latch. This is required because the digital outputs of a microcontroller
have very severe output power restrictions. They can only be used to drive other
logic chips, but never a motor directly. Since a motor can draw a lot of power (for
example 1A or more), connecting digital outputs directly to a motor can destroy
the microcontroller.
WALL FOLLOWER
26
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 26
Working:
The circuit diagram is shown in the fig 3-5 TIP 122 or TIP127 we can use for the
switching purpose. These can work at a higher voltage level because these are
power transistor. They require 3 V at there base for the purpose of switching then
only the transistor come in the active region. For the practical point of view most
of the people convert these 4 input into 2 input by combining the Q1, Q4 base &
Q2, Q3 base because of that the voltage coming from the controller is divided into
parts & because of that the not responds properly. So it is advised for using the 4
input insisted of two.
There are two ways shown in the table but it recommended that not to use the
brake condition because it short circuit the transistors and they burn it up. The
disadvantage for using that is they generally in from 4 transistor 2 transistor heat
up very much you cant touch it hence we use sink for them.
Q1 Q2 Q3 Q4 Direction of rotation
1 0 0 1 Clockwise
0 1 1 0 Anticlockwise
0 0 0 0 Stop
1 1 1 1 brake
WALL FOLLOWER
27
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 27
6.1 The L293D
Description:
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 solenoids, 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. This device is suitable for
use in switching applications at frequencies up to 5 kHz. The L293D is assembled in
a 16 lead
plastic
package
which
has 4 center
pins
connected together and used for heat sinking The L293DD is assembled in a 20 lead
surface mount which has 8 center pins connected together and used for heat sinking.

WALL FOLLOWER
28
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 28
Internal diagram of ln293d
Pin diagram of motor driver
WALL FOLLOWER
29
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 29
7. Pulse width modulation
Pulse width modulation or PWM for short is a smart method for avoiding analog
power circuitry by utilizing the fact that mechanical systems have certain latency.
Instead of generating an analog output signal with a voltage proportional to the
desired motor speed, it is sufficient to generate digital pulses at the full system
voltage level (for example 5V). These pulses are generated at a fixed frequency,
for example 20 kHz, so they are beyond the human hearing range.
By varying the pulse width in software (see Figure 3.6, top versus bottom),
we also change the equivalent or effective analog motor signal and therefore
control the motor speed. One could say that the motor system behaves like an
integrator of the digital input impulses over a certain time span. The quotient Duty
cycle ton/t period is called the pulse-width ratio or duty cycle.
8.
Differential
Drive:
The differential drive design has two motors mounted in fixed positions on the left
and right side of the robot, independently driving one wheel each. Since three
grounds contact points are necessary, this design requires one or two additional
passive caster wheels or sliders, depending on the location of the driven wheels.
Differential drive is mechanically simpler than the single wheel drive, because it
does not require rotation of a driven axis. However, driving control for differential
drive is more complex than for single wheel drive, because it requires the
coordination of two driven wheels.
WALL FOLLOWER
30
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 30
Differential drive technique
9. Led blinking test code
We are giving a test code for the eight leds connected to the port p1. In common
anode configuration, at random as last led off, next led on and so on .The assembly
language program for led blinking is as shown below:
$ mod 52;
Org #0000h;
Mov p1, #00h; make port 1 as output port
Start: mov p1, #01h;
Acall delay; wait for some time
mov p1, #02h;
Acall delay;
mov p1, #04h;
Acall delay;
mov p1, #08h;
Acall delay;
mov p1, #10h;
Acall delay;
mov p1, #20h;
Acall delay;
mov p1, #40h;
Acall delay;
mov p1,#80h;
Acall delay;
Ljmp start; repeat the above code
Delay: mov r1, #0ffh;
D1: djnz r1 ,d1;
WALL FOLLOWER
31
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 31
Ret;
End;
10. Wall Follower Robot
What is a wall follower?
WALL FOLLOWER
32
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 32
Wall follower is an autonomous robot which has the capability to follow a
wall by keeping a constant distance from it. It takes decision automatically when
the wall is detected by its sensors on the left and on the front side of the robot.
Why build a wall follower?
Sensing a wall on the left and the front side of the robot, the machine can be
protected by accident with the wall or any other obstacle .so we design a robot
capable to do this.

Practical applications of a wall follower:
Automated machine running with the wall can avoid the accident.
Prerequisites:
Knowledge of basic digital and analog electronics.
Knowledge of the microcontroller, motor driver, sensors.
Sheer interest, an innovative brain and perseverance!
Background:
By using the principle of the IR sensors and its application to design the line
follower, wall follower robot, I think that it is also possible to design a robot which
Can protect itself from an accident. So by modifying the edge avoider robot I
design this robot. Here
Sensor 1 left sensor
WALL FOLLOWER
33
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 33
Sensor 2 front sensor
Logic for wall follower robot:
We know the work of photo diode sensor (as given above) when the photo
diode receives the reflected light from the surface of table then its output is
logic 1 and when the light is not received by diode then the output of the sensor is
logic 0. When the surface is present then the sensor will give +5 volt (logic 1) as
output otherwise it give 0 volt (logic 0) at output.
Sensor 1 Sensor 2 Action taken
0 0 Forward
0 1 Rotate
1 0 forward
1 1 rotate
We give the output of these two sensors to the microcontrollers port 1 by making
it an input port.
The output is taken from the port p3, to control the motor driver IC l293d.
The assembly program for controlling the edge avoider robot when the sensor 1 is
connected to the p1.2 pin and sensor 2s output is given to p1.3.
The motor driver IC is connected to port p3 as;
P3.0 enable1
P3.1 input 1
P3.2 input2
P3.3 enable2
P3.4 input3
P3.5 input4
Program for this is as given below;
$mod52
org 0000h;
mov p1,#0ffh;
mov p3,#00h;
main:
mov r3,p1;
WALL FOLLOWER
34
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 34
cjne r3,#0f3h,case2;
sjmp right;
case2:cjne r3,#0f7h,case3;
sjmp right;
case3:cjne r3,#0fbh,case4;
sjmp fw;
case4:cjne r3,#0ffh,main;
sjmp left;
right:mov p3,#6bh;
acall delay;
acall delay;
acall delay;
mov p3,#00h;
acall delay;
sjmp main;
left: mov p3,#58h;
acall delay;
mov p3,#00h;
acall delay;
sjmp main;
fw: mov p3,#5bh;
acall delay;
mov p3,#00h;
acall delay;
mov p3,#58h;
acall delay;
mov p3,#43;
acall delay;
sjmp main;
delay: mov r0,#10h;
d2: mov r1,#0ffh;
d1: djnz r1,d1;
djnz r0,d2;
ret;
WALL FOLLOWER
35
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 35
end;
11.CONCLUSION
Thus we have successfully made a robot which has two degrees of freedom, & can
avoid its accident with wall on left or the front side of robot without any manual
monitoring.
WALL FOLLOWER
36
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 36
After some problems during the work at last I will successful to complete
this project at time and it works properly according to the condition.
It is avoided to run this robot in the presence of light because the photo
diodes are very sensitive to the outside light.
The above problem can be removed by using the IR sensor, or other sensors.

REFERENCES
1. www.google.com
2. www.nex-robotics.com
3. www.logicbrigade.com
4. www.8052projects.com
WALL FOLLOWER
37
WALL FOLLOWER ROBOT BY: TEAM VICTORY Page 37
5. The 8051 microcontroller and Embedded Systems by M.A.Mazidi
6. Www. Wikipedia.com
7. Introduction to Microcontrollers by Unther Gridling Bettina Weiss
8. www.cs.binghamton.edu/~reckert/
9. www.bipom.com
10. www.alldatasheets4u.com

Das könnte Ihnen auch gefallen