Line Follower

47
PROJECT REPORT (PROJECT SEMESTER JULY-DECEMBER 2011) TITLE:- LINE FOLLOWING ROBOT USING 8 SENSORS (Submitted By) YOGESH SHARMA Registration No.: - 10805459 Programme & section:- B-tech(ECE) E28T8B54 (Under the guidance of) KARAN SHARMA Embedded system & Project head Department of Electronics And Communication Lovely School of Engineering Lovely Professional University, Phagwara July-December

Transcript of Line Follower

Page 1: Line Follower

PROJECT REPORT

(PROJECT SEMESTER JULY-DECEMBER 2011)

TITLE:- LINE FOLLOWING ROBOT USING 8 SENSORS

(Submitted By)

YOGESH SHARMA

Registration No.: - 10805459

Programme & section:- B-tech(ECE) E28T8B54

(Under the guidance of)

KARAN SHARMA

Embedded system & Project head

Department of Electronics And Communication

Lovely School of Engineering

Lovely Professional University, Phagwara

July-December

Page 2: Line Follower

DECLARATION

I hereby declare that the project work entitled “LINE FOLLOWING ROBOT” is an

authentic record of my own work carried out at CETPA INFOTECH PVT. LTD,ROORKEE

as requirements of Major Project for the award of degree of Bachelors Degree In Electronic

and communication(ECE), Lovely Professional University, Phagwara, during (July to

December,2011).

(Signature of student)

YOGESH SHARMA

10805459

Date: 15th December 2011

Certified that the above statement made by the student is correct to the best of our knowledge

and belief.

Page 3: Line Follower

ACKNOWLEDGEMENT

All glory and honour to god all mighty who showered his grace on me to make this endeavor

a success.

There is always a sense of gratitude which one expresses to others for their helpful and needy

services they render during all phases of life. I would like to do it as I really wish to express

my gratitude towards all those who have been helpful tome in getting this mighty task of

Project Report. This one would not be possible without the support, enthusiasm and help

from many individuals.

Thanks, as always, goes to Mohammad Rafakat for his supports , ideas and helping me out

with my project. It was nice to have you lean on.

Finally, I would like to thank Karan Sharma for his sincere cooperation, support and

encouragement to develop this Major Project.

Last but not least, I would like to thank the entire faculty member of Cetpa Infotech for

helping to spur out the real me and appreciating me for my work. I still haven’t gotten to that

beach yet, but when i do, it will be so more sweeter.

Page 4: Line Follower

Context

1. Organisation overview2. Project Name and Description3. Profile of the problem4. Existing System

IntroductionExiting designWhat’s new in the system to be developed?

5. Problem AnalysisProduct definitionFeasibility Analysis

6. Software requirement AnalysisIntroductionGeneral Description

7. DesignBlock DiagramDetailed design FlowchartProgram code

8. TestingFunctional TestingStructural TestingTesting of the Project

9. Project LegacyCurrent status of project

10. User Manual11. Bibliography

Page 5: Line Follower

ORGANIZATION OVERVIEW:-

What is CETPA? CETPA Infotech Pvt. Ltd. is an ISO 9001:2008 Certified Multinational

Organization which deals in the field of Software Development & Embedded Products

Development, Placement Consultancy and Engineers Training Programs. CETPA Infotech has

combined unparalleled experience, comprehensive capabilities and extensive research, to

become one of the premier Training, Development & Consultancy Organization in India and

abroad.

CETPA is the mission, which is working for the promotion of latest technologies in India and

abroad. To achieve our goal, we have made collaboration with a number of institutions and

firms. CETPA deals in three different domains, first is education, second is development and

third is consultancy.

CETPA Education:

CETPA Education mainly deals in Engineers Training Programs in latest technologies for

Engineering students, corporate and other professionals. Some of the technologies offered for

training are .NET, VHDL, Embedded System, Advance Embedded System, CATIA,

MATLAB, J2EE, Verilog HDL, Linux, AutoCAD, PCB & Circuit Designing, and

Personality & Entrepreneurship Development.

CETPA Consultancy:

CETPA Consultancy helps to provide jobs for different fields students and professionals.

CETPA consultancy was started to provide jobs to CETPA Certified students, who are made

technologically strong by CETPA, are well placed by CETPA Consultancy. Hence the fresher

trained by us are well absorbed in companies.

CETPA Development:

CETPA development deals in software as well as embedded production development. In

software domains, CETPA offers customized software products, web development, web

hosting, search engine optimization and other related products.

Page 6: Line Follower

2. PROFILE OF THE PROBLEM:-

This report will outline the design, construction and testing of our line following robot. It will show

detailed sections on the design stage and how each individual’s tasks came together to make the

robot function.

The report will stress the difficulties that I have faced throughout the module as well as the

changes that we needed to make to achieve a functional product. Aims The aim of this module was

to work as a group to design and construct a robot capable of following a BLACK LINE. We will

be aiming to improve our knowledge of robotics as well as electronic circuit design and

construction. I along with my faculty staff will be working as a group, and thus should improve my

skills of working together to achieve goals.

This Project Line Following Autonomous Robot is based on a 8051 microcontroller

P89V51RD2 made by Philips.This Robot follows the black line which is drawn over the

white surface or it follows the white line which is drawn over the black surface. The infrared

sensors are used to sense the line. When the infrared signal falls on the white surface, it gets

reflected and if it falls on the black surface, it is not reflected this principle is used to scan the

Lines for the Robot.All the above systems are controlled by the Microcontroller.

In our project we are using the popular microcontroller P89V51RD2. It is a 40 pin

Microcontroller.

Page 7: Line Follower

EXISTING SYSTEMDESIGN

Page 8: Line Follower

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.

Prerequisites:

Knowledge of basic digital and analog electronics.

(A course on Digital Design and Electronic Devices & Circuits would be helpful)

Sheer interest, an innovative brain and perseverance!

Page 9: Line Follower

BLOCK DIAGRAM:-

Fig. 1 shows block diagram of Automated line following robot.It consist mainly of four parts:

SENSORS, COMPARATOR, DECISION MAKING DEVICE, TWO MOTOR DRIVERS.

The robot is built using a microcontroller P89V51RD2, Motor driver L293D, operational

amplifier LM355, IR pair sensors and few discrete components. In the circuit sensors are

used to dectect the black strip over the white background. The sensor output is given to the

microcontroller which takes decision and gives appropriate command to the motor driver

L293D so as to move the motor accordingly.

SENSOR: The sensor senses the light reflected from the surface and feed the output to

the comparator.When the sensor is above the white background the light falling from the

source reflects to the sensor, and when the sensor is above the black background light from

the source doesn’t reflect to it.Sensor senses the reflected light to give an output, which is fed

to the comparator.

Page 10: Line Follower

COMPARATOR: Comparator compares the analogue input from the sensor with a fixed

reference voltage. If this voltage is greater than the reference voltage,comparator outputs a

low voltage,and if it smaller the comparator generates a high voltage that act as an input for

decision-making device(microcontroller).

MICROCONTROLLER: The micro controller is programmed to make the robot

move forward, turn left or right based on input coming from the comparator. Output of the

microcontroller is fed to the motor driver. The Microcontroller P89V51RD2 is used to control

the motors. It gets the signals from the infrared sensors and it drives the motors according to

the sensor inputs. Two gear motors are used to drive the robot.

MOTOR DRIVER: The current supplied by the microcontroller to drive the motor is small. Therefore motor driver IC is used.It provides sufficient current to drive the motor.

It is clear that the drive train of this robot is differential type, meaning the rear wheels are

responsible of moving the robot forward and backward, but are also used to turn the robot in

any required direction depending the difference of speed between the right and left wheels.

The first thing that need some explanation is the fact that there are only 2 wheels, Well, while

not being the best thing to do, a caster wheel can sometimes be replaced with a skid, when the

robot weight and size are not important, and when the robot is designed for indoor

environment, where the robot can move on relatively smooth surfaces, where friction won’t

be a serious problem.

Obviously the line following robot will need to see the line, therefore we require a light

detector of some sort. We also would like it if the line following robot could do this

regardless of the ambient conditions (is the room dark or light? is it lit by sunlight or artificial

light?). So the robot will also need its own illumination source. The weapon of choice here

will be Infra Red (IR) light.

Page 11: Line Follower

To make this easy for ourselves the light only needs to be constant..if a white line is present

then it will reflect a lot of IR from our source. If the line is black then we see the opposite

effect.

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 microcontroller.

Left Center Right

Sensor Array

Starting from the center, the sensors on the left are named L1, L2, L3, L4 and those on the right are named R1, R2, R3, 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 microcontroller 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.

Page 12: Line Follower

Left Center Right

Desired State L1=R1=0, and Rest=1

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;

Left Center Right Here L=3 R=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.

Page 13: Line Follower

CIRCUIT DIAGRAM:-

Page 14: Line Follower

CODING:-

$mod51

org 0000H

mov p1,#0ffh

mov a,p1

anl a,#0fh

cjne a,#11111111b,h1

mov p2,#00001001b

sjmp h

h1:

mov a,p1

anl a,#0fh

cjne a,#11111110b,h2

mov p2,#00001010b

sjmp h

h2:

mov a,p1

anl a,#0fh

cjne a,#11111101b,h3

mov p2,#00000110b

sjmp h

Page 15: Line Follower

h3:

mov a,p1

anl a,#0fh

cjne a,#11111000b,h4

mov p2,#00000001b

sjmp h3

h4:

mov a,p1

anl a,#0fh

cjne a,#11111111b,h5

mov p2,#00000000b

sjmp h

h5:

mov a,p1

anl a,#0fh

cjne a,#00001001b,h6

mov p2,#00001000b

sjmp h

h6:

mov a,p1

anl a,#0fh

Page 16: Line Follower

cjne a,#00000001b,h7

mov p2,#00000001b

sjmp h

h7:

mov a,p1

anl a,#0fh

cjne a,#00001110b,h8

mov p2,#00000101b

sjmp h

h8:

mov a,p1

anl a,#0fh

cjne a,#00001110b,h9

mov p2,#00000101b

sjmp h

h9:

mov a,p1

anl a,#0fh

cjne a,#00001110b,h10

mov p2,#00000101b

sjmp h

Page 17: Line Follower

h10:

mov a,p1

anl a,#0fh

cjne a,#00001110b,h11

mov p2,#00000101b

ljmp h

h11:

end

Page 18: Line Follower

SOFTWARE/MACHINE REQUIREMNTS

Page 19: Line Follower

1.TOP VIEW SIMULATOR

REQUIREMENTS: - Works on Windows 2000, XP, Vista and 15Mb of disk space is required.

Topview Simulator gives an excellent simulation environment for the Industry's most popular

8 bit microcontroller family, MCS 51. It gives all the required facilities to enable the system

designers to start projects right from the scratch and finish them with ease and confidence.

Topview Simulator is the total solution giving many states of art features meeting the needs

of the designers possessing different levels of expertise. If you are a beginner, then you can

easily learn about 8031 based embedded solutions without any hardware. If you are an

experienced designer, you may find most of the required facilities built in the simulator that

enable you to complete your next project without waiting for the target hardware.

The simulator is designed by the active feedback from the demanding designers and when

you use this in your next 8031 project, you are assured of definite savings in time and

increase in productivity.

Device Selection - A wide range of device selection, including generic 8031 devices and

Atmel's AT89CXX series 8031 microcontrollers.

Program Editing - Powerful editing feature for generating your programs and the facility to

call an external assembler to process input programs.

Program Execution - A variety of program execution options include Single Stroke full

speed execution, Single Step, Step Over and Break Point execution modes give you total

control over the target program. Clear View updates all the windows with the correct and

latest data and it is a convenient help during your debugging operations. we may find how

this Top view Simulator simplifies the most difficult operation of the program development,

debugging, into a most simple task.

Page 20: Line Follower

2.Flash Magic

Flash Magic is the standard tool for programming NXP microcontrollers.Flash Magic is an

application developed by Embedded Systems Academy to allow you to easily access the

features of a microcontroller device. With this program you can erase individual blocks or the

entire Flash memory of the microcontroller.

This application is very useful for those who work in the electronics field. The main window

of the program is composed of five sections where you can find the most common functions

in order to program a microcontroller device. Using the “Communications” section you will

be able to choose the way a specific device connects to your computer. Select the COM port

to be used and the baud rate. It is recommended that you choose a low baud rate first and

increase it afterwards. This way you will determine the highest speed with which your system

works. In order to select which parts of the memory to erase, choose from the items in the

“Erase” section. The third section is optional. It offers you the possibility to program a HEX

file. In the next section you will be able to find different programming options, such as

“verify after programming”, “gen block checksums”, “execute” and others. When you’re

done, click the Start button that can be found in the “Start” section. The program will start

the device, and you will able to see the progress of the operations at the bottom of the main

window.

Using Flash Magic, you are able to perform different operations to a microcontroller device,

operations like erasing, programming and reading the flash memory, modifying the Boot

Vector, performing a blank check on a section of the Flash memory and many others.

REQUIREMENTS:-

Flash Magic works on Windows 2000, XP, Vista and 7. 10Mb of disk space is required.

Page 21: Line Follower

FLOWCHART:

Page 22: Line Follower

PRODUCT DESIGN

Page 23: Line Follower

CIRCUIT REALISATION ON A ZERO PCB:-

The picture above shows the actual circuitary that i designed for my robot. All connections

are clearly visible,it has a power supply circuit for power in the circuit a bridge rectifier is

being used using 4 diodes. It also has the motor driven I.C known as L293D.

RS232 is being used for serial communication through P.C and hence MAX232 is used to

make RS232 compatible with 8051 microcontroller as RS232 pins are not compatible with

8051.

In this module a Philips microcontroller is preffered instead of Atmel as because it does not

require any burner to burn programs and hence decreasing its cost of production and

complexity.A crystal oscillator of 11.0592 MHz is used to facilitate serial communication.

Page 24: Line Follower

Product design

The existing line follower can be modified or improved upon to perform multiple task

including obstacle detection,colour sensing etc.

Page 25: Line Follower

Prototype of the module shown with 4 sensors and a castor wheel.

Page 26: Line Follower

DESCRIPTION OF THE COMPONENTS USED.

1.Microcontroller

The P89V51RD2 is a 80C51 microcontroller with 64 kB Flash and 1024 bytes of data RAM.

A key feature of the P89V51RD2 is its X2 mode option. The design engineer can choose to

run the application with the conventional 80C51 clock rate (12 clocks per machine cycle) or

select the X2 mode (6 clocks per machine cycle) to achieve twice the throughput at the same

clock frequency. Another way to benefit from this feature is to keep the same performance by

reducing the clock frequency by half, thus dramatically reducing the EMI.

The Flash program memory supports both parallel programming and in serial In-System

Programming (ISP). Parallel programming mode offers gang-programming at high speed,

reducing programming costs and time to market. ISP allows a device to be reprogrammed in

the end product under software control. The capability to field/update the application

firmware makes a wide range of applications possible.

Features:

• 80C51 Central Processing Unit• 5 V Operating voltage from 0 MHz to 40 MHz• 64 kB of on-chip Flash user code memory with ISP (In-System Programming) and IAP (In-Application Programming)• Supports 12-clock (default) or 6-clock mode selection via software or ISP• SPI (Serial Peripheral Interface) and enhanced UART• PCA (Programmable Counter Array) with PWM and Capture/Compare functions• Four 8-bit I/O ports with three high-current Port 1 pins (16 mA each)• Three 16-bit timers/counters• Eight interrupt sources with four priority levels• TTL- and CMOS-compatible logic levels• DIP40 packages

Page 27: Line Follower

BLOCK DIAGRAM

PIN CONFIGURATION

Page 28: Line Follower

PIN DESCRIPTION

Port 0: Port 0 is an 8-bit open drain bi-directional I/O port. Port 0 pins that have ‘1’s written

to them float, and in this state can be used as high-impedance inputs. Port 0 is also the

multiplexed low-order address and data bus during accesses to external code and data

memory. In this application, it uses strong internalpull-ups when transitioning to ‘1’s. Port 0

also receives the code bytes during the external host mode programming, and outputs the

code bytes during the external host mode verification. External pull-ups are required during

program verification or as a general purpose I/O port.

Port 1: Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 pins are

pulled high by the internal pull-ups when ‘1’s are written to them and can be used as inputs in

this state. As inputs, Port 1 pins that are externally pulled LOW will source current (IIL)

because of the internal pull-ups. P1.5, P1.6, P1.7 have high current drive of 16 mA. Port 1

also receives the low-order address bytes during the external host mode programming and

verification.

Port 2: Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. Port 2 pins are pulled

HIGH by the internal pull-ups when ‘1’s are written to them and can be used as inputs in this

state. As inputs, Port 2 pins that are externally pulled LOW will source current (IIL) because

of the internal pull-ups. Port 2 sends the high-order address byte during fetches from external

program memory and during accesses to external Data Memory that use 16-bit address

(MOVX@DPTR). In this application, it uses strong internal pull-ups when transitioning to

‘1’s. Port 2 also receives some control signals and a partial of high-order address bits

duringthe external host mode programming and verification.

Page 29: Line Follower

Port 3: Port 3 is an 8-bit bidirectional I/O port withinternal pull-ups. Port 3 pins are pulled

HIGH by the internal pull-ups when ‘1’s are written to them and can be used as inputs in this

state. As inputs, Port 3 pins that are externally pulled LOW will source current (IIL) because

of the internal pull-ups. Port 3 also receives some control signals and a partial of high-order

address bits during the external host mode programming and verification.

External Access Enable: EA must be connected to VSS in order to enable the device to

fetch code from the external program memory. EA must be strapped to VDD for internal

program execution. However, Security lock level 4 will disable EA, and program execution is

only possible from internal program memory. The EA pin can tolerate a high voltage of 12 V.

Address Latch Enable: ALE is the output signal for latching the low byte of the address

during an access to external memory. This pin is also the programmingpulse input (PROG)

for flash programming. Normally the ALE is emitted at a constant rate of 1⁄6 the crystal

frequency and can be used for external timing and clocking. One ALE pulse is skipped during

each access to external data memory. However, if AO is set to ‘1’, ALE is disabled.

In-System Programming (ISP)

In-System Programming is performed without removing the microcontroller from the system.

The In-System Programming facility consists of a series of internal hardware resources

coupled with internal firmware to facilitate remote programming of the P89V51RD2 through

the serial port. This firmware is provided by Philips and embedded within each P89V51RD2

device. The Philips In-System Programming facility has made in-circuit programming in an

embedded application possible with a minimum of additional expense in components and

circuit board area. The ISP function uses five pins (VDD,VSS, TxD, RxD, and RST). Only a

small connector needs to be available to interface your application to an external circuit in

order to use this feature.

Page 30: Line Follower

CHASSIS:

The main frame of the robot, the body which holds the motor, wheels and the batteries. We

need to take care of the weight of the robot. In a robot with limited power supply (i.e. battery)

the power to weight ratio has to be kept maximum. This can be done by limiting the weight

of the chassis. There are many kinds of materials from which the copper plated boards are

made. Try to choose a relatively thick one for this chassis, to be able to bear the weight of the

motors and the batteries, all concentrated in four points, where the screws are fixed.

Chassis can be made out of:

1. Wood (using right angles to attach motors, drilling and attaching the front wheel is easy)

2. Plastic (not easily available, but if found makes a very light chassis).

3. Metal (Most common chassis available, not recommended because the motors can get misaligned very easily

resulting in poor turning).

4. Duct tape (alone can be used to attach the motors to each other, makes a fairly sturdy yet light chassis)

Page 31: Line Follower

3. DUAL OPERATIONAL AMPLIFIERS(LM 358):

LM358 is consists of four independent, high gain, internally frequency compensated

operational amplifierswhich were designed specifically to operate from a single power supply

over a wide range of voltage.Operation from split power supplies is also possible and the low

power supply current drain is independent of the magnitude of the power supply voltage.

Application areas include transducer amplifier, DC gain blocks and all the conventional OP

amp circuits, which now can be easily implemented in single power supply systems.

FEATURES

● Internally frequency compensated for unity gain

● Large DC voltage gain : 100dB

● Wide power supply range : 3V~32V(or±1.5V~16V)

● Input common-mode voltage range includes ground

● Large output voltage swing : 0V DC to VCC-1.5V DC

● Power drain suitable for battery operation

DATASHEET:

Page 32: Line Follower

4. MOTORS:

A high quality low cost DC geared motor is being used. It contains Brass gears and steel

pinions to ensure longer life and better wear and tear properties. The gears are fixed on

hardened steel spindles polished to a mirror finish. These spindles rotate between bronze

plates which ensures silent running. The output shaft rotates in a sintered bushing. The whole

assembly is covered with a plastic ring. All the bearings are permanently lubricated and

therefore require no maintenance. The motor is screwed to the gear box from inside.

Specifications

Total length: 46mm

Motor diameter: 36mm

Motor length: 25mm

DC supply: 4 to 12V

RPM: 100

Brush type: Precious metal

Torque: 0.25 to 7Kg/cm

Page 33: Line Follower

Selection of a geared motor:

A geared motor is selected according to the required usable power output.A geared motor

must have usable power equal to or greater than the power required to rotate the load.

corresponding to the required operating conditions (torque and speed output) is higher than

the nominal torque versus speed curve of the geared motor.

The required torque output of a geared motor must be within its maximum recommended

torque for continuous duty.

DIFFERENCE BETWEEN GEAR MOTOR AND COMMON D.C MOTOR

Common DC motor speed generally higher torque less the torque required for smaller

occasions. DC gear motor, the gear motor, is based on the common DC motor, coupled with

matching gear box. Gearbox's role is to provide a lower speed, the larger the torque.

Meanwhile, a different gear ratio gear box can provide different speed and torque. This

greatly improves the DC motor in the automation industry usage. By the power supply type:

can be divided into DC and AC motor. DC motor according to the structure and working

principle can be divided: brushless DC motors and brush DC motors. The brush DC motor

can be divided: permanent magnet DC motor and electromagnetic DC motor.

Page 34: Line Follower

5. L293D

Description

The L293D are quadruple high-current half-H drivers. The L293D is designed to provide

bidirectional drive currents of up to 600-mA at voltages from 4.5 V to 36 V. The device is

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 a pseudo-Darlington source. Drivers are enabled in pairs, with

drivers 1 and 2 enabled by 1,2EN and drivers 3 and 4 enabled by 3,4EN. When an enable

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 disabled 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 applications.

A VCC1 terminal, separate from VCC2, is provided for the logic inputs to minimize device power dissipation.

L293D are characterized for operation from 0°C to 70°C.

Page 35: Line Follower

Operating L293D:

Using the L293D motor driver, makes controlling a motor as simple as operating a buffer

gate IC. It totally isolates the TTL logic inputs from the high current outputs.Putting a logic 1

on the pin In1 will make Out1 pin go to Vpower (36 Volts MAX.), while a logic 0 will make

it go to 0V. Each couple of channels can be enabled and disabled using E1 and E2 pins.

When disabled a channel provide a very high impedance (resistance) to the motor, exactly as

if the motor wasn't connected to the driver IC at all, which makes this feature very useful for

PWM speed control.

Page 36: Line Follower

Photo diode:

A photodiode is a type of photodetector capable of converting light into either current or

voltage, depending upon the mode of operation. The common, traditional solar cell used to

generate electric solar power is a large Photosensors of all types may be used to respond to

incident light, or to a source of light which is part of the the same circuit or system. A

photodiode is often combined into a single component with an emitter of light, usually a

light-emitting diode (LED), either to detect the presence of a mechanical obstruction to the

beam (slotted optical switch), or to couple two digital or analog circuits while maintaining

extremely high electrical isolation between them, often for safety (optocoupler).

Page 37: Line Follower

Photodiodes are often used for accurate measurement of light intensity in science and

industry. They generally have a more linear response than photoconductors.

Photodiodes are similar to regular semiconductor diodes except that they may be either

exposed (to detect vacuum UV or X-rays) or packaged with a window or optical fiber

connection to allow light to reach the sensitive part of the device. Many diodes designed for

use specifically as a photodiode use a PIN junction rather than a p-n junction, to increase the

speed of response. A photodiode is designed to operate in reverse bias.

POWER SUPPLY:

The voltage regulator regulates the supply if the line voltage increases or decreases. The

series 78xx regulators provide fixed regulated voltages from 5 to 24 volts. An unregulated

input voltage is applied at the IC Input pin i.e. pin 1 which is filtered by capacitor. The out

terminal of the IC i.e. pin 3 provides a regular output. The third terminal is connected to

ground. While the input voltage may vary over some permissible voltage range, and the

output voltage remains constant within specified voltage variation limit. The 78xx IC�s are

positive voltage regulators whereas 79xx IC�s are negative voltage regulators.

These voltage regulators are integrated circuits designed as fixed voltage regulators for a

Page 38: Line Follower

wide variety of applications. These regulators employ current limiting, thermal shutdown and

safe area compensation. With adequate heat sinking they can deliver output currents in excess

of 1 A. These regulators have internal thermal overload protection. It uses output transistor

safe area compensation and the output voltage offered is in 2% and 4% tolerance.

IR LED

An IR LED is a special purpose LED when it is forward bias then electron and hole

recombination take place and energy is radiated in the form of photons. Made of gallium

arsenide or aluminium gallium arsenide. An IR LED, also known as IR transmitter, is a

special purpose LED that transmits infrared rays in the range of 760 nm wavelength. They,

along with IR receivers, are commonly used as sensors.

The appearance is same as a common LED. Since the human eye cannot see the infrared

radiations, it is not possible for a person to identify whether the IR LED is working or not,

unlike a common LED. To overcome this problem, the camera on a cellphone can be used.

The camera can show us the IR rays being emanated from the IR LED in a circuit.

Page 39: Line Follower

Object Detection using IR light:

The basic idea is to send infra red light through IR-LEDs, which is then reflected by any

object in front of the sensor. We use an IR emitter LED which emits infrared radiations. The

radiations are reflected by any object or obstacle in its path. IR has a property that it is

reflected by the white line and absorbed by the black surface. Using this principle we

construct a white line follower robot. A white line is drawn on a black surface. The emitted

IR is thus reflected back when sensor comes over a white surface; however no IR is reflected

back in case of black surface. The reflected IR is detected by an IR receiver photodiode. This

is an electrical property of receiver photodiode which is the fact that a photodiode produce a

voltage difference across its leads when it is subjected to light. When the IR is reflected by

white surface the voltage drop across the cathode of the receiver LED decreases.

We are going to use a very original technique: we are going to use another IR-LED, to detect

the IR light that was emitted from another LED of the exact same type! As if it was a photo-

cell, but with much lower output current. In other words, the voltage generated by the LED's

can't be - in any way - used to generate electrical power from light, it can barely be detected.

That�s why as you will notice in the schematic, we are going to use an Op-Amp (operational

Amplifier) to accurately detect very small voltage changes.

Page 40: Line Follower
Page 41: Line Follower

TESTING

Page 42: Line Follower

FUNCTIONAL TESTING:-

One thing I’ve learned about electronics and programming is that you never want to put

anything totally together without finding ways to test and make sure everything is going well

throughout the process. So, I decided to set up one sensor and verify that everything works

as expected before .My first task is to wire up one sensor on this board to test the circuit

parameters. Next i took a piece of white paper and filled in a ¾ inch black line to act as my

reflector. I then held the sensor pointing down and slowly passed it back and forth across the

black line to see the voltage change.

With the sensor held more than an inch above the paper, I recorded a fairly constant voltage

around 4.2 volts. This confirmed that the “switch was open” or that the phototransistor was

not getting any light (except perhaps some ambient light in the room), confirming the high

voltage reading for “no reflection”. With the sensor held about ½ inch above the paper, the

change was dramatic. Over the white paper I got consistent readings of about 0.12 volts,

confirming that the phototransistor was at saturation and conducting at a maximum. As the

sensor was moved slowly over the black line, the voltage jumped nicely to about 4.12 volts,

confirming that the black line was not reflecting much light back to the phototransistor,

exactly as expected.

I experimented with several heights and found that the sensors worked best (shifting from

about 0.12v to 4.1v and back because of the reflectivity of the paper and the line) between ¼

inch and ½ inch from the ground/paper. Since there could also be variations depending on

the light conditions in other rooms,

I decided to make sure I can mount the array in such a way that I could use spacers or

otherwise adjust the height of the array from ¼ in to ½ inch and maybe a little more. I wanted

the maximum number of sensors I could get. In my Google travels, I’d often seen 6 or 7

Page 43: Line Follower

sensors used, so that would be my minimum. Lastly, the ports on most microcontrollers have

a practical limit of eight, since many ports are numbered something like D0 through D7.

Although I’ve fooled with 10 bit DACs and other odd combinations of bits from 9 to 15, it

was clear to me that more than eight of any inputs would require an increased level of

complexity. So until I determine that much more complexity is warranted, I decided on 8

sensors. Since 8 sensors also fit conveniently on the standard small perf boards like I was

using, that clinched it.

THE MOTORS

The motors were and probably will be a big challenge for me. My Internet research had

shown that David Cook had won contests and achieved fame by breaking the one meter per

second barrier in robot line following speed. So the motor part seemed simple. Find a motor

that will do better than one meter per second and install it. The more I learned, the more

confused I got. I downloaded about 15 articles discussing motors, torque, stall torque and all

the rest. Good theory, but not one piece of advice I could convert into “What motor do I

purchase?” I did discover that I probably wanted a gearbox motor.

Structural Testing:-

1. The very first step of functional testing was to see that the ground pins and the vcc is properly connected.

2. Secondly check for the loose connections if any.

3. Structural testing involves testing the module that whether the robot detects and follows the line that is drawn on the floor correctly.

4. We should also ensure and check the speed of the motor, otherwise if the speed is more there may be probabilities that our Robot would be distracted out of line.

5. While testing it should also be kept in mind that the room in which the test is to be performed is well isolated from external light sources.

Page 44: Line Follower

IMPLEMENTATION:

If we implement a robotic arm along with the line follower then it can be used to pick and place the objects in its way and can be very useful in our day to day life.

APPLICATIONS

In todays world line follower find a wide range of applications such as Industrial automated equipments carriers.

Automated cars.

Tour guides in museums and other similar applications.

It can act as maze solver. Basically it follows a line, therefore it can be used in mining where the robots are used to find the way out of the mine.

Apparatus to control the automatic placing of material along a junction between surfaces with reference to the form and position of the junction including a tool controllably movable to deposit material progressivelyalong the junction in response to a control signal.

An imager linked to the movement of the tool to produce an image of the surfaces.

By modifying the position of the sensors, same principle can be used in obstacle

avoidance and edge detection.

Page 45: Line Follower

Limitations

Choice of line is made in the hardware abstraction and cannot be changed by software.

Calibaration is difficult, and is not easy to set a perfect value. Steering mechanism is not easily implemented in huge vehicles,and is impossible for

non-electric vehicles(petrol powered). Few curves are not made efficiently,and must be avoided. Lack of four wheel drive, makes it not suitable for rough terrain. Lack of speed control makes the robot unstable at times.

Possible Improvements

Software control of the line type(Dark or Light),to make automatic detection possible.

Obstacle detecting sensors to avoid physical obstacles and continue on the line.

Distance sensing and position logging and transmission.

Use of hysteresis in sensor circuit using LM335.

Use of ADC so that the exact position of the line can be interpolated.

USE of wheel chair or three wheel drive to reduce traction.

General improvements like using a low dropout voltage regulator,lighter chassis etc. This can reduce power consumption to a much lower level.

SONAR can be incorporated into the circuit to calculate distance from obstacle in its path. The overall efficiency of the Robot can be enhanced by increasing the number of sensors.

Page 46: Line Follower

CONCLUSION:

This is the first step of making intelligent robots capable of making their own decisions on

the situations provided. The design, implementation and testing of a working project proved

to be very challenging. The primary objective of detecting and following a specific coloured

line proved to be a great learning experience, as we did not have prior hands-on experience in

Embedded Systems. The difficulties in project management as well as those brought to light

during experimentation provided an opportunity to work on problem-solving abilities.

Despite many problems encountered, I found this experience a rewarding and educational

one.

This project can have many uses in practical fields, from teenagers� toy cars to robots

working in industries and even in wars. It can be further improved to have more decision

taking capabilities by employing varied types of sensors and thus could be used in big

industries for different applications.

Page 47: Line Follower

BIBLIOGRAPHY

http://www.8051projects.info/exp11_2.asp

http://www.datasheetcatalog.com/datasheets_pdf/M/-/8/8/M-8870.shtml

http://www.jaycar.com.au/images_uploaded/CD4050BC.PDF

http://www.datasheetcatalog.org/datasheets/90/109092_DS.pdf

http://www.datasheetcatalog.org/datasheet/texasinstruments/l293.pdf