TABLE OF CONTENTS
Chapter No
Chapter 11. Introduction .31.1. Line follower
................................................................................41.2.
Importance of line follower51.3. Background6Chapter 22. The ATMEGA
16 microcontroller72.1 IC L 293...102.2 LED..132.3 Component
used..142.4 Block diagram..21Chapter 33.Overview.223.1. The
Algorithm ...24Chapter 44.1 Implement sensor circuit264
Constructions284.1 Working.304.4 Motor Interface and Control
Circuit..31
Chapter 55. Possible Improvements41References and Resources
..42Books and Links
Chapter 1
Introduction
A line following robot is a mobile machine employed to sense and
follow the black lines that are drawn on the white surface. As this
robot is developed using a breadboard, it will be very simple to
construct. This technique can be incorporated into the Automated
Guided Vehicles (AGV) for providing the easy way of operation.
Generally, the AGV is integrated with the microprocessor and
computers for controlling its system. It also uses a position
feedback system for traveling in the desired path. In addition, the
electric signals and RF communication are needed for communicating
with the vehicle and system controller. Such awkward functions are
completely not required in this line following robot, and it just
uses the IR sensors to travel on the black lines
1.1 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. It is a machine that
follows a line, either a black line on white surface or vise-versa.
For Beginners it is usually their first robot to play with. In this
tutorial, we will teach you to make the line follower robot move on
the line with a type of feedback mechanism. Its the most basic
example of adding small intelligence to a robot, but its actually
the designers intelligence!!After reading this section completely
you will be playing with the one shown below. Moreover we will make
it modular so that it can be easily modified in future.The main
electronics/mechanical components that will be used in making this
line follower robot are two sensors made using LDRs, transistors as
motor driver circuit, acrylic sheet, General purpose board, Two DC
motors and battery. Line-following robots with pick-and-placement
capabilitiesare commonly used in manufacturing plants. These move
on a specified path to pick thecomponentsfrom specified
locationsand place them on desired locations.
Basically, a line-following robot is a self-operating robot
thatdetects and follows a line drawn on the floor. The path to be
taken isindicated by a white line on a black surface. The control
system usedmust sense the line and maneuver the robot to stay on
course whileconstantly correcting the wrong moves using feedback
mechanism,thus forming a simple yet effective closed-loop
system.
1.2Importance of line follower
Sensing a line and manoeuvring the robot to stay on course,
while constantly correcting Wrongmoves 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 embeddedmagnetsguidance system for industrial
robots moving on shop floor etc.
1.3Background:
We started with building a parallel port based robot which could
be controlled manually. 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. The drawbacks of using a
personal computer were soon clear Its 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 was hardwired logic circuit or an uC. Since I had no
knowledge of uC at that time, I implementeda 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. Line
Follower
Chapter 2
The ATMEGA 16microcontroller:
VCC: Digital supply voltage. (+5V) GND: Ground. (0 V) Note there
are 2 ground Pins. Port A (PA7 - PA0) Port A serves as the analog
inputs to the A/D Converter. Port A also serves as an 8-bit
bi-directional I/O port, if the A/D Converter is not used. When
pins PA0 to PA7 are used as inputs and are externally pulled low,
they will source current if the internal pull-up resistors are
activated. The Port apins are tri-stated when a reset condition
becomes active, even if the clock is not running. Port B (PB7 -
PB0) Port B is an 8-bit bi-directional I/O port with internal
pull-up resistors (selected for each bit). Port B also serves the
functions of various special features of the ATmega16 as listed on
page 58 of datasheet. Port C (PC7 - PC0) Port C is an 8-bit
bi-directional I/O port with internal pull-up resistors (selected
for each bit). Port C also serves the functions of the JTAG
interface and other special features of the ATmega16 as listed on
page 61 of datasheet. If the JTAG interface is enabled, the pull-up
resistors on pins PC5 (TDI), PC3 (TMS) and PC2 (TCK) will be
activated even if a reset occursPort D (PD7 - PD0) Port D is an
8-bit bi-directional I/O port with internal pull-up resistors
(selected for each bit). Port D also serves the functions of
various special features of the ATmega16 as listed on page 63 of
datasheet. RESET: Reset Input. A low level on this pin for longer
than the minimum pulse length will generate a reset, even if the
clock is not running XTAL1: External oscillator pin 1 XTAL2:
External oscillator pin 2 AVCC: AVCC is the supply voltage pin for
Port A and the A/D Converter. It should be externally connected to
VCC, even if the ADC is not used. If the ADC is used, it should be
connected to VCC through a low-pass filter. AREF: AREF is the
analog reference pin for the A/D Converter.
All 40 pin are output pins all pins are taking input as well as
output. port a has special use it can be use as analog to digital
convertor. ADC work by taking a reference value in between 0-5v any
value above the reference is considered 1 as high and 0 as low .Pin
10.30= 5vcc (input voltage)Pin 11.31= ground
Pin 12.13= crystal oscillator use for controlling frequency.Pin
32= it gives the reference voltage for ADC it isinternally set as
2.65v
Fig 1 At mega 16 pin diagramIC L293
L293D is a dualmotor H bridge driver integrated circuit (IC).
Motor drivers act signal. This higher current signal is used to
drive the motors.
L293D contains two inbuilt H-bridge driver circuits. In its
common mode of operation, two DC motors can be driven
simultaneously, both in forward and reverse direction. The motor
operations of two motors can be controlled by input logic at pins 2
& 7 and 10 & 15. Input logic 00 or 11 will stop the
corresponding motor. Logic 01 and 10 will rotate it in clockwise
and anticlockwise directions, respectively.
Enable pins 1 and 9 (corresponding to the two motors) must be
high for motors to start operating. When an enable input is high,
the associated driver gets enabled. As a result, the outputs become
active and work in phase with their inputs. Similarly, when the
enable input is low, that driver is disabled, and their outputs are
off and in the high-impedance state.
Fig: 2 L293D pin diagram
PIN 1 = enable pin for motor 1PIN 2 = input 1 for motor 1PIN 3 =
output 1 for motor 1PIN 4 = ground (0v)PIN 5 = ground (0v)PIN 6 =
output 2 for motor 1PIN 7 = input 2 for motor 1PIN 8 = supply
voltage for motors;9-12v(up to 36v)PIN 9 = enable pin for motor
2PIN 10 = input 1 for motor 1PIN 11 = output 1 for motor 1PIN 12 =
ground (0v)PIN 13 = ground (0v)PIN 14 = output 2 for motor 1PIN 15
= input 2 for motor 1PIN 16 = supply voltage; 5v(up to 36)
LED
LEDs are used for the testing of the circuits and as well for
debugging. In cases where the voltage changes from 0V to 5V and
back to 0V, LEDs are useful because a multimeter cannot be used for
such purpose and the circuits can be tested just by checking the
glowing of the LEDs. The Cathode terminal of the LED is connected
to the ground and anode to 5V. The cathode terminal can be
identified by looking into the LED and seeing which side is thicker
as can be seen in the figure.
Fig: 3 LED
2.1Component used
Chassis:
Chassis, basically the frame of the robot on which motors and
wheels are mounted and all the circuitry part is also placed on
it.
Fig 4
Caster wheel
A Caster wheel is an undriven, single wheel that is designed to
be mounted to the bottom of a larger object so as to enable that
object to be easily moved. They are available in various sizes, and
are commonly made of rubber, plastic, nylon, aluminum,or
stainlesssteel,etc.
Fig 6
Wheel:Wheel is a circular object that revolves on an axle and is
fixed below a vehicle or other object to enable it to move over the
ground.
Fig: 7
DC MOTOR
DC Motors convert electrical energy (voltage or power source) to
mechanical energy (produce rotational motion). They run on direct
current.
Fig 8
Source:
An ideal voltage source is a voltage source that maintains the
same voltage across the source's terminals no matter what current
is drawn from the terminals of the source or what current flows
into the terminals.
DC source:Direct current (DC) is the unidirectional flow of
electric charge. Direct current is produced by sources such as
batteries, solar cells, and commutator-type electric machines of
the dynamo type, etc.
Voltage Regulator
Usually the motors used in the bot require a supply voltage of
12V while most of the circuitry requires 5V. In order to avoid the
usage of two separate batteries an electronic component called
voltage regulator is used. Voltage regulator can be defined as a
component which is used to convert certain fixed voltage levels
into some other voltages. Thus in our case we will be using a
voltage regulator which can convert 12V into 5V. One such voltage
regulator is LM7805.
Fig 9
The top part of the figure above shows the LM7805 with the pins
1,2 and 3. In the schematic shown the input corresponds to Pin 1,
GND to Pin 2 and output to Pin 3. This implies that if 12V is
applied at pin 1(i.e. it is connected to the positive terminal of
the battery) and the pin 2 is grounded (i.e. it is connected to
negative terminal of the battery) pin 3 will give a 5V output. The
regulator works even without the capacitors but it is better if
capacitors are used as they cut down the voltage fluctuations.
IC7805
IC 7805 is a 5V Voltage Regulator that restricts the voltage
output to 5V and draws 5V regulated power supply.
Fig 10
SENSOR:
IR reflective sensors have one emitter (IR LED) and one receiver
(Phototransistor or photo diode. If we have white surface it
reflects the light and it will sensed by the receiver, similarly if
we have black surface it absorbs the light and receiver can not
sense light. Photo diode has property that if IR light fall on it
its electrical resistance comes down (i.e. it comes down from 150k
to 10k if no noise present).
Fig 11
The sensors use for line detecting in a line-follower bot are IR
sensors. These sensors have a pair of transmitter and receiver when
the sensor is on a reflecting surface (white) the light transmitted
by the transmitter is detected by the receiver and when the sensor
is on black surface or a non-reflecting surface exactly opposite
happens.. The figure on the right side shows the assembled sensor.
These readymade sensors are directly available in the market.
Making the sensor from the T-R pair will not be explained in this
tutorial.
Block Diagram
Fig 12The basic principle involved in this is it captures the
line position with IR sensors mounted at front end of the robot.
The block diagram of the line follower robot shows that, when the
sensor senses the path, output will be 0s or 1s which are then fed
to the microcontroller, and then the microcontroller decides the
next move according to the program. When both the sensors are
indicating low (0) then robot start moving on the black path, for
white if it indicates high (1) then it moves along the path.
Chapter 3
OVERVIEW
Fig 13
The robot uses IR sensors to sense the line, an array of 8 IR
LEDs (Tx) and sensors (Rx), facing The ground has been used in this
setup. The output of the sensors is an analog signal which Depends
on the amount of light reflected back, this analog signal is given
to the comparator to produce 0s and 1s which are then fed to the
uC.
L4 L3 L2 L1 R1 R2 R3 R4 Left Centre Right Sensor Array
Starting from the centre, the sensors on the left are named L1,
L2, L3, L4 and those on the right are named R1, R2, R3, and R4. Let
us assume that when a sensor is on the line it reads 0 and when it
is off the line it reads 1
The uC decides the next move according to the algorithm given
below which tries to position the robot such that L1 and R1 both
read 0 and the rest read 1.
L4 L3 L2 L1 R1 R2 R3 R4 1 1 1 0 0 1 1 1 Left Centre Right
Desired State L1=R1=0, and Rest=1 Line Follower
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:
Left centre Right Here L=3 R=0
Left centre Right Here L=2 R=4 2. If all sensors read 1 go to
step 3, else, If L>R Move Left If Lldev) move(R, 0,195+12*rdev);
if(rdev