Line Following Robot
-
Upload
anon759379338 -
Category
Documents
-
view
77 -
download
5
Transcript of Line Following Robot
Different ics:-
L293
Description
The L293 and L293D are quadruple high- current half H- current half -H
drivers.
The L293 is designed to provide bidirectional drive current of up to 1 A
at voltage from 4.5V to 36V.
The L293D is designed to provide bidirectional drive current of up to
600-mA at voltage from 4.5V to 36V.
Both devices are designed to drive inductive loads such as relays,
solenoids, dc and bipolar stepping motors, as well as other high-current/high-
voltage loads in positive- supply applications.
All inputs are TTL compatible
Each output is a complete totem-pole drive circuit, with a Darlington
transistor sink and as pseudo-Darlington source.
Drivers are enabled in pairs, with driver 1 and 2 enabled by 1,2EN and
driver 3 and 4 enabled by 3,4EN.
When an enabled input is high, the associated drivers are enabled and
their outputs are active and in phase with their inputs.
When the enable input is low, those drivers are disabling and their
outputs are off and in the high-impedance state.
With the proper data inputs, each pair of drivers forms a full-H (or
bridge) reversible drive suitable for solenoid or motor application.
On the L293, external high –speed output clamp
ACKNOWLEDGEMENT
We take this opportuni ty to humbly express our thankfulness to a l l those
concerned with our project ent i t led l ine fol lowing robot using microcontrol ler .
We express very s incere thanks to Mr.D.M.MODI for providing us an opportuni ty
to works on such an interest ing project , wi thout whose help we could not have
completed pt sat isfactor i ly his invaluable guidance has proved to be a key tour
success pin overcoming chal lenges.
We faced during the course of the project work. We are a lso obl iged to
Mr.R.J .PATEL, HOD Electronics & Communicat ion department , for a l lowing us
to do project in this par t icular organizat ion. We are special thanks Mr.D.M.MODI
lecturer of the EC department for guide this project and good suggest ion.
Introduction
What is a line follower?
Line follower is a machine that can follow a path. The path can be visible like a black line on a white
surface (or vice-versa) or it can be invisible like a magnetic field.
Why build a line follower?
Sensing a line and maneuvering the robot to stay on course, while constantly correcting wrong moves
using feedback mechanism forms a simple yet effective closed loop system. As a programmer you get
an opportunity to ‘teach’ the robot how to follow the line thus giving it a human-like property of
responding to stimuli. Practical applications of a line follower: Automated cars running on roads with
embedded magnets; guidance system for industrial robots moving on shop floor etc.
Background:
I started with building a parallel port based robot which could be controlled manually by a keyboard.
On the robot side was an arrangement of relays connected to parallel port pins via opto-couplers.
The next version was a true computer controlled line follower. It had sensors connected to the status
pins of the parallel port. A program running on the computer polled the status register of the parallel
port hundreds of times every second and sent control signals accordingly through the data pins.
It’s difficult to control speed of motors. As cable length increases signal strength decreases and
latency increases. A long multi core cable for parallel data transfer is expensive. The robot is not
portable if you use a desktop PC. The obvious next step was to build an onboard control circuit; the
options a hardwired logic circuit or a uC. Since I had no knowledge of uC at that time, I implemented
a hardwired logic circuit using multiplexers. It basically mapped input from four sensors to four
outputs for the motor driver according to a truth table. Though it worked fine, it could show no
intelligence – like coming back on line after losing it, or doing something special when say the line
ended. To get around this problem and add some cool features, using a microcontroller was the best
option.
Algorithm:
1. L= leftmost sensor which reads 0; R= rightmost sensor which reads 0.
If no sensor on Left (or Right) is 0 then L (or R) equals 0;
Ex:
L4 L3 L2 L1 R1 R2 R3 R4
1 0 0 1 1 1 1 1
Left Center Right
Here L=3 R=0
L4 L3 L2 L1 R1 R2 R3 R4
1 1 0 0 0 0 0 0
Left Center Right
Here L=2 R=4
2. If all sensors read 1 go to step 3,
else,
If L>R Move Left
If L<R Move Right
If L=R Move Forward
Goto step 4
3. Move Clockwise if line was last seen on Right
Move Counter Clockwise if line was last seen on Left
Repeat step 3 till line is found.
4. Goto step 1.
Implementation
Sensor Circuit:
Description: These simple devices operate at 940nm and work well for generic IR systems
including remote control and touch-less object sensing. Using a simple ADC on any microcontroller
will allow variable readings to be collected from the detector. The emitter is driven up to 50mA with
a current limiting resistor as with any LED device. The detect is a NPN transistor that is biased by
incoming IR light.
Applications:
IR Schematic - Basic object detection schematic
Seattle Robotics - Infrared object detection
Robot Room - Excellent website with lots of goodies
Motor Interface and Control Circuit:
The 8 sensors are connected to PORTA.
You need not connect anything to AVCC and AREF, it is required only if ADC is used.
The L298 Motor Driver has 4 inputs to control the motion of the motors and two enable inputs which
are used for switching the motors on and off. To control the speed of the motors a PWM waveform
with variable duty cycle is applied to the enable pins. Rapidly switching the voltage between Vs and
GND gives an effective voltage between Vs and GND whose value depends on the duty cycle of
PWM. 100% duty cycle corresponds to voltage equal to Vs, 50 % corresponds to 0.5Vs and so on.
The 1N4004 diodes are used to prevent back EMF of the motors from
disturbing the remaining circuit. Many circuits use L293D for motor control, I chose L298 as it has
current capacity of 2A per channel @ 45V compared to 0.6 A @ 36 V of a L293D. L293D’s package
is not suitable for attaching a good heat sink, practically you can’t use it above 16V without frying it.
L298 on the other hand works happily at 16V without a heat sink, though it is always better to use
one.
Truth Table for controlling the direction of motion of a DC motor
COMPONENT DESCRIPTION
PREPARATION OF PCB
It is called printed circuit board consists of conducting circuit pattern applied to one or both side of an
insulating base depending upon that it is called single side P.C.B. or double side P.C.B. conductive
materials available are silver, brass Aluminum and copper. Copper is most widely used. The thickness of
conducting materials depends upon the current carrying conductor’s capacity of circuit. Thus a thicker
copper layer will have more capacity.
PRINTED CIRCUIT BOARD
Printed Circuit Board is piece of plastic insulating board on the one side of which a complete layout
diagram of an electronics circuit consisting of copper conducting paths is printed by a special photo
engraving process on other side of PCB electronics components like resistor, capacitors, transistors,
diodes etc. are mounted suitable holes are provided in the PCB for mounting the components.
These components are connected to the conducting patch by soldering. PCBs are used for assembling
electronic circuit assembly more compact uniform and stable. PCB used for transmitter and receiver.
8051-MICROCONTROLLER
A microcontroller is a small computer on a single integrated circuit consisting internally of a
relatively simple CPU, clock, timers, I/O ports and memory. As in every embedded systems we are
having controller to control or process all the activities and devices.
FEATURES OF 8051 MICROCONTROLLER
8-bit program status word.
Internal ROM.
Internal RAM of 128 bytes.
Two 16 bit timer/counter: To and T1.
32 input/output pins arranged as four 8-bit ports: P0, P1, P2, and P3.3
Serial function register’s: IE, IP, TCON, TMOD, SCON, SBUF, TH0, TH1.
8-bit arithmetic logic unit.
8-bit Accumulator register.
8-bit program status word.
16-bit program counter.
16-bit stack pointer.
Three internal intterupt: T0, T1, RI or TI.
Two external interrupt: INTO and INT1.
Clock circuit and reset circuit.
Crystal oscillator
CRYSTAL OSCILLTOR:-
A miniature 4 MHz quartz crystal enclosed in a hermetically sealed HC-49/US package, used as the
resonator in a crystal oscillator. A crystal oscillator is an electronic circuit. That uses the mechanical
resonance of a vibrating crystal of piezoelectronic material to create an electrical signal with a very
precise frequency.
OPERATION
A crystal is a solid in which the constituent atoms, molecules, or ions are packed in a regularly
ordered, repeating pattern extending in all three spatial dimensions.
Almost any object made of an elastic material could be used like a crystal, with appropriate
transducers, since all objects have natural resonant frequencies of vibrations. The resonant frequency
depends on size, shape, elasticity, and the speed of sound in the material. High frequency crystals are
typically cut in the shape of a simple, rectangular plate
When a crystal of quartz is properly cut and mounted, it can be made to distort in an electric field by
applying a voltage to an electrode near or on the crystal. This property is known as piezoelectricity.
When the field is removed, the quartz will generate an electric field as it returns to its previous shape,
and this can generate a voltageThe result is that a quartz crystal behaves like a circuit composed of an
inductor, capacitor and resistor, with a precise resonant frequency.
CAPACITOR
Capacitors are electronic components used for storing charge and energy. In their simplest form,
Capacitors consist of two conducting plates separated by an insulating material called the dielectric
Applications
Automotive
Diesel ECU and Fuel Injector Drivers
EPS Electric Power Steering
HID Headlight AFL
HVAC Climate Control
Capacitance
Capacitance is the ability of a capacitor to store energy in an electric field. Capacitance is also a
measure of the amount of electric potential energy stored (or separated) for a given electric potential.
A common form of energy storage device is a parallel-plate capacitor. In a parallel plate capacitor,
capacitance is directly proportional to the surface area of the conductor plates and inversely
proportional to the separation distance between the plates. The SI unit of capacitance is the farad; 1
farad is 1 coulomb per volt. The energy (measured in joules) stored in a capacitor is \capacitor of
capacitance C, holding a charge +q on one plate and −q on the other. Moving a small element of
charge dq from one plate to the other against the potential difference V = q/C requires the work dW:
WhereW is the work measured in joules, q is the charge measured in coulombs and C is the
capacitance, measured in farads. A capacitor is a passive electrical component that can store energy in
the electric field between a pair of conductors. The process of storing energy in the capacitor is
known as “charging”, and involves electric charges of equal magnetic, but opposite polarity, building
up on each plate. A capacitors ability to store charge is measured by its capacitance, in units of farads.
Capacitors are occasionally referred to as condensers. This term is considered archaic in English, but
most other languages use a cognate of condenser to refer to a capacitor. A wide variety of capacitors
have been invented, including small electrolytic capacitors used in electronic circuits, basic parallel
plate capacitors, mechanical variable capacitors, and the early Leyden jars, among numerous other
types of capacitors.
RESISTOR
Resistors consist of a resistance track with connections at both ends and a wiper which moves along
the track as you turn the spindle. The track may be made from carbon, ceramic and metal mixture or a
coil of wire.
Resistors may be used as a rheostat with a two connections (the wiper and the track) or as a
potentiometer with all three connections in use. Some resistors are designed to be mounted directly
on the circuit board.
Resistance is a property of a resistor. Resistance is a property of conductor that depends upon of it in
dimension, material, temperature and which determine the current resolution from given potential
difference across resistance. Resistor is used to reduce a voltage or reduce power.
The two limits or value in which the resistance value can fall or increased due to temperature, time
moisture and heat dissipation, resistor are available in many types, but in our case we use a carbon
cracked film resistor.
This resistor in different voltage ranges of 1/10, 1/3, 1/4 or 2 watts. The value normally ranges
between 1017 to 20MH.
LIGHT EMITTING DIODE
A light emitting diode is a semiconductor diode that emits light when an electric current is applied in
the forward direction of the device, as in the simple LED circuit. The effect is a form of electronic,
where incoherent and narrow spectrum light is emitted from the p-n junction. The color of the emitted
light depends on the composition and condition of the semiconducting material used.
LEDs are widely used as inductor lights on electronic devices and increasingly in higher power
applications such as flashlights and area lighting. An LED is usually a small area light source, often
with optics added to the chip to shape its radiation pattern and assist in reflection.
The refractive index of most LED semiconductor materials is quite high, so in almost all cases the
light from the LED is coupled in to a much lower-index medium. The large index difference makes
the reflected back in to the semiconductor, where it may be absorbed and turned in to additional heat;
this is usually one of the dominant causes of LED inefficiency. Often more then half of the emitted
light is reflected back at the LED package and package air interfaces.
The reflection is most commonly reduced by using a half sphere package with the diode in the center,
so that the outgoing light rays strike the surface perpendicularly, at which angle the reflection is
minimized.
RESET CIRCUIT
The PIC 16F84A differentiates between various kin Ds of RESET:
Power on reset
MCLR during normal operation
MCLR during SLEEP
WDT Reset
WDT Wake-up
The MCLR Reset path has a noise filter to ignore small pulses Some registers are not affected in any
RESET condition, their status is unknown on a POR and unchanged in any other RESET. Most other
registers are reset to a “RESET state” on POR, MCLR or WDT Reset during normal operation.
RELAY
It closes the voltage less point of contact while the door lock works to control the electromagnetic
door lock or equipment outside. A relay is an electrically operated switch. Current flowing through
the coil of the relay creates a magnetic field which attracts a lever and changes the switch contacts.
The coil current can be on or off, so relay have two switch positions and most have double throw
switch contacts.
Relays allow one circuit to switch a second circuit which can be completely separate from the first.
For example a low voltage battery circuit can use a relay to switch a 230v AC mains circuit. There is
no electrical connection inside the relay between the two circuits; the link is magnetic and
mechanical.
Most relays are designed for PCB mounting but you can solder wires directly to the pins providing
you take care to avoid melting the plastic case of the relay. The relay’s switch connections are
usually labeled COM, NC and NO.
Advantages of relays:
1. Relays can switch AC and DC, transistors can only switch DC.
2. Relays can switch higher voltages than standard transistors.
3. Relays are often a better choice for switching large currents.
4. Relays can switch many contacts at once.
Disadvantages of relays:
1. Relays are bulkier than transistors for switching small currents.
2. Relays cannot switch rapidly; transistors can switch many times per second.
3. Relays use more power due to the current flowing through their coil.
DC motor driver
Basic circuit of using L293 forms an H- bridge driver is shown in figure.
As shown for such inductive load as DC motor, external dioodes for suppressing back EMF must be
connected.
The inboard uses L293D instead, the L293Dhas internal diodes, however providing a bit less driving
capacity,i.e,[email protected]. From the truth table, we see that direction of the motor cn control by
pin C and D.
VINH enable/ disable power to the motor, thus for speed regulation, we than use this pin for PWM
singling. External diode must be connecting for L 293.
Motors and wheels
They fit nicely and provide enoromes torque at low speed exatly matching the needs for the meticules
floor examination. A brass tube couples the d shape motor shaft to a LEGO wheel. Because the
LEGO BAR connects with friction to all standard compatible LEGO wheels a wide selection of high
quality production prescion tires are available and quickly interchangeable.
A screw hole is drilled and tapped to lock the brass to the gear head shaft. Since the shaft is off center
on the motor, the moter bodies are purposely misaligned with each other so other, so that the wheels
actual line up. Be sure to center punch holes before drilling a center punch looks like a solid metal
pencil with a hardnededtip. Aim the tip against the location for the hole slightly with a hammer.
LINE TRACKING SENSOR
Since there is no ADC for 89c51 chip, each competitor may build their own Line tracking sensor,
some may use LM Quad comparator with ir transmitter and receiver, some may use LDR as described
in LINE FOLLOWER ROBOT.
APPLICATIONS
BIBLIOGRAPHY
The 8051/8052 Microcontroller: Architecture, Assembly Language