Final Project1

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 23

Mini project report On Line follower

Submitted in partial fulfillment of the requirement For the award of the degree of Bachelor of technology In Electronics and Communication Engineering

Guide : Submitted By: Prof. Monica Gupta Jain(04811502809)

Yatin Piyush

Gupta(11411502809) Vinod Pathak (11711502809) Praneet Pasbola (12111502809)

Bharati vidyapeeths college of engineering Affilated to guru gobind singh indraprastha university,delhi

A-4,pachim vihar ,new delhi-110063 2009-2013

Certificate
This is to certify that project report entitled Line Follower Robot submitted by Piyush Gupta (11411502809) , Vinod Pathak (11711502809) and Praneet Pasbola (12111502809) is authentic work carried by them at electronics and communication engineering branch in BVCOE,GGSIPU under my guidance.

Date:

Prof. Monica Gupta Bvcoe, New Delhi

Acknowledgement
We express my sincere gratitude and indebtedness to the project guide Prof. Monica Gupta for his valuable guidance, encouragement and affection for the successful completion of this work. Their sincere sympathies and kind attitude always encouraged us to carry out the present work firmly.

Yatin Jain(04811502809) Piyush gupta(11411502809) Vinod Pathak(11711502809) Praneet Pasbola(12111502809)

Abstract
The line follower robot is a mobile machine that can detect and follow the line drawn on the floor. Generally, the path is predefined and can be either visible like a black line on a white surface with a high contrasted color or it can be invisible like a magnetic field. Therefore, this kind of robot should sense the line with its infrared ray (ir) sensors that installed under the robot. After that, the data is transmitted to the processor by specific transition buses. Hence, the processor is going to decide the proper commands and then it sends them to the driver and thus the path will be followed by the line follower robot.In this report, we have illustrated the process of design, implementation and testing of line follower, a small line follower robot designed for the line follower robots competition.

Index
Page no

List of figures 1.Introduction 1.1 Line follower 1.2 Motivation 2.Overview of At89s52 2.1 Microcontroller
02 2.2 2.3 2.4 2.5 Atmel 89s52 Features Description Pin Diagram and Description of At89s52 3.1 Hardware Impementation 3.1.1 Infrared Sensor Circuit 3.1.2 Motor Driver:-L293d 3.1.3 Geared Motors 3.1.4 Motor Interface And Control Circuit 3.1.5 Block And Circuit Diagram Of Line Follower Robot 3.2 Software Implementation 3.2.1 Software 3.2.2 Program Code

i 01 01 01

02 03 03 04

3.Implementation
06 06

06

08 09 10 11 12 12 12

4.Future Scope

15

List of Figures

Figure 2.0 Figure 3.1 Figure 3.2 Figure 3.3 Figure 3.4 Figure 3.5 Figure 3.6 Figure 3.7

Pin diagram of at89s52


Operation of infrared led Sensor module Pin diagram of L293d Geared motor Motor interfacing with microcontroller Block diagram of Line Follower Circuit diagram of Line Follower

04
06 08 08 09 10 11 11

1.Introduction

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

Motivation:
I started building up the robot firstly by using analog parts. The next version of the robot is to implement the robot using microcontroller. So I implement the robot using 89s52 microcontroller.I fed first the basic program to check the uC is working or not. Then I implement the robot alone with sensors and motor driving IC. And at the end I interface the two sensors and motor driving IC with the uC.

2 Overview of 89s52
2.1 Microcontroller:
A microcontroller is a single-chip microcomputer that contains all the componentssuch as the cpu, ram, some form of rom, i/o ports, and timers. Unlike a generalpurpose computer, which also includes all of these components, a microcontroller is designed for a very specific task to control a particular system. Microcontrollers are sometimes called embedded microcontrollers, which just means that they are part of an embedded system. A microprocessor is a general-purpose digital computer with central processing unit (cpu), which contains arithmetic and logic unit (alu), a program counter (pc), a stack pointer (sp), some working registers, a clock timing circuit, and interrupts circuits. The main disadvantage of microprocessor is that it has no on-chip memory. So we are going for micro controller since it has on-board programmable rom and i/o that can be programmed for various control functions.

2.2 Atmel 89s52 At89s52 microcontroller


The microcontroller development effort resulted in the 8051 architecture, which was first introduced in 1980 and has gone on to be arguably the most popular micro controller architecture available. The 8051 is a very complete micro controller with a large amount of built in control store (rom & eprom) and ram, enhanced i/o ports, and the ability to access external memory. The maximum clock frequency with an 8051 micro controller can execute instructions is 20mhz. Microcontroller is a true computer on chip. The design incorporates all of the features found in a microprocessor: cpu, alu, pc, sp and registers. It also has the other features needed to, make complete computer: rom, ram, parallel i/o, serial i/o, counters and a clock circuit. The 89c51/89c52/89c54/89c58 contains a non-volatile flash program memory that is parallel programmable. For devices that are serial programmable (in-system programmable (isp) and in-application programmable (iap) with a boot loader)all three families are single-chip 8-bit microcontrollers manufactured in advanced cmos process

and are derivatives of the 80c51 microcontroller family. All the devices have the same instruction set as the 80c51.

2.3 Features
8k bytes of in-system reprogrammable flash memory endurance: 1,000 write/erase cycles fully static operation: 0 hz to 33 mhz three-level program memory lock 256 x 8-bit internal ram 32 programmable i/o lines three 16-bit timer/counters eight interrupt sources programmable serial channel low-power idle and power-down modes

2.4 Description
The at89s52 is a low power, high performance cmos 8-bit micro computer with 8k bytes of flash programmable and erasable read only memory(perom).The Device is manufactured using atmels high density nonvolatile memory technology and is compatible with the industry standard 80c51 and 80c52 instruction set and pin out. The on-chip flash allows the program memory to be reprogrammed insystem or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit cpu with flash on a monolithic chip, the atmel at89s52 is a powerful microcomputer which provides a highly flexible and cost effective solution to many embedded control applications. The main advantages of 89s52 over 8051 are: 1.software compatibility 2.program compatibility 3.rewritability

The 89s52 microcontroller has an excellent software compatability, i.e. The software used can be applicable to any other microcontroller. The program written on this microcontroller can be carried to any base. 3 Program compatibility is the major advantage in 89s52. The program can be used in any other advanced microcontroler. The program can be reloaded and changed for nearly 1000 times.

2.5 Pin Diagram and Description

Fig 2 Pin diagram of at89s52

Pin description: Vcc


Supply voltage.

Gnd
Ground.

Port 0
Port 0 is an 8-bit open drain bi-directional i/o port. As an output port, each pin can sink eight ttl inputs. When 1s are written to port 0 pins, the pins can be used as high impedance inputs. Port 0 can also be configured to be the multiplexed lower order address/data bus during accesses to external program and data memory. In this mode, p0 has internalpullups.Port 0 also receives the code bytes during flash programming and outputs the code bytes during program verification. External pullups are required during program verification.

Port 1
Port 1 is an 8-bit bi-directional i/o port with internal pull-ups. The port 1 output buffers can sink/source four ttl inputs. When 1s are written to port 1 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, port 1 pins that are externally being pulled low will source current (iil) because of the internal pull-ups. In addition, p1.0 and p1.1 can be configured to be the timer/counter 2 external count input (p1.0/t2) and the timer/counter 2.

Port 2
P2 acts similarly to p0 when external memory is used. Pins of this port occupy addresses intended for external memory chip. This time it is about the higher address byte with addresses a8-a15. When no memory is added, this port can be used as a general input/output port showing features similar to p1.

Port 3 All port pins can be used as general i/o, but they also have an alternative function. In order to use these alternative functions, a logic one (1) must be applied to appropriate bit of the p3 register. In tems of hardware, this port is similar to p0, with the difference that its pins have a pull-up resistor built-in. 5

PIN P3.0-RXD P3.1-TXD P3.2-INT0 P3.3-INT1 P3.4-T0 P3.5-T1 P3.6-WR P3.7-RD

ALTERNATE USE Serial data input Serial data output External interrupt 0 External interrupt 1 External timer 0 input External timer 1 input External memory write pulse External memory read pulse

SFR SBUF SBUF TCON.1 TCON.3 TMOD TMOD --

3.Implementation
3.1 Hardware Implementation 3.1.1 Infrared Sensor Circuit:
Principle of operation of the i.r l.e.d . And phototransistor: -

Fig 3.1 Operation of infrared led

6 A photodiode is a p-n junction or p-i-n structure. When an infrared photon of sufficient energy strikes the diode, it excites an electron thereby creating a mobile electron and a positively charged electron hole. If the absorption occurs in the junction's depletion region, or one diffusion length away from it, these carriers are swept from the junction by the built-in field of the depletion region, producing a photocurrent. Photodiodes can be used under either zero bias (photovoltaic mode) or reverse bias (photoconductive mode). Reverse bias induces only little current (known as saturation or back current) along its direction. But a more important effect of reverse bias is widening of the depletion layer (therefore expanding the reaction volume) and strengthening the photocurrent when infrared falls on it. There is a limit on the distance between i.r. L.e.d. And infrared sensor for the pair to operate in the desired manner. In our case distance is about 5mm. Infra-red emitter sends out ir pulses. Position calculation is done through intensity of reflected light received by the detector.Ambient Interference is negligiblethe resistance of the sensor decreases when ir (infrared) light falls on it. A good sensor will have near zero resistance in presence of light and a very large resistance in absence of light. Whether the sensors are light dependent resistors, laser diode, infrared sensors, ultrasonic sensors or anything else,the outputs of the sensor

modules are fed to the non-inverting input of a comparator . The reference voltage of the comparator is fed to the inverting input of the comparator by a trim pot or a tuning device connected between the supply lines. Connecting infrared module with microcontrollerWhen the sensor/emitter pair is on shining surface sensor is on i.e. In low impedance mode which one can easily view as l.e.d. Corresponding to that sensor doesnt glow. The output of the opamp is high sign al and this high signal is given to the microcontroller and when the sensor is on normal non-reflecting surface its off i.e. In high impedance state which one can easily view as l.e.d. Corresponding to that sensor glows up and low sig nal is given to the microcontroller.

Fig 3.2 sensor module

3.1.2 Motor Driver(L293d)

Fig 3.3 Pin diagram of L293d


8 The l293 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. L293d is a bipolar motor driver ic. This is a high voltage, high current pushpull four channel driver compatible to ttl logic levels and drive inductive loads. It has 600 ma output current capability per channel and internal clamp diodes. The l293 is designed to provide bidirectional drive currents of upto 1 a at voltages from 4.5 v to 36 v. The l293d is designed to provide bidirectional drive currents of up to 600-ma at voltages from 4.5 v to 36 v. 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 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.

3.1.3 Geared Motors

Fig 3.4 Geared motor 9

Specifications
100rpm /12v plastic geared dc motor various rpm is available in same size This motor is best suited for basic educational robotics Features: 6mm shaft diameter with internal hole 125gm weight 100rpm 12v dc motors with plastic gearbox 5kgcm torque No-load current = 60 ma(max), load current = 300 ma(max)

3.1.4 Motor Interfacing And Control Circuit

Fig 3.5 Motor interfacing

10

3.1.5 Block And Circuit Diagram Of Line Follower

Fig 3.6 Block diagram of Line follower

Fig 3.7 Circuit diagram of Line Follower

11

3.2 Software Implementation


3.2.1 Software used
The software programs for the microcontroller have been developed using c programming language. The vision4 ide is a window-based software development platform that combines a robust and modern editor, project manager, and make facility. vision4 integrates all the tools you need to develop embedded applications including c/c++ compiler, macro assembler, linker/locator, and a hex file generator. vision4 helps expedite the development process of your embedded application by providing the following:
Full-featured source code editor,

Device database for configuring the development tool Project manager for creating and maintaining your projects Integrated make utility functionality for assembling, compiling, and linking your

embedded applications Dialogs for all development environment settings True integrated source-level and assembler-level debugger with high-speed cpu and peripheral simulator, Advanced gdi interface for software debugging in the target hardware and for connecting to the keil ulink adapter family Flash programming utility for downloading the application program into flash rom Links to manuals, on-line help, device datasheets, and user guides.

3.2.2 Program Code


C code for line follower with kiel software
#include <reg52.h> Sbit sensor_op1 = p3^0; Sbit sensor_op2 = p3^1; 12 Sbit rotate_1 = p2^0; Sbit rotate_2 = p2^1; Void delay(); Void main() { p3=0xff; P2=0x00;

While(1) { if((sensor_op1==0) && (sensor_op2==1)) { rotate_1=0; rotate_2=1; delay(); } Else if((sensor_op1==1) && (sensor_op2==0)) { rotate_1=1; rotate_2=0; delay(); } Else if((sensor_op1==1) && (sensor_op2==1)) { rotate_1=1; rotate_2=1; delay(); }

13 Else { rotate_1=0; rotate_2=0; delay(); } }

Void delay() { Unsigned int i; For(i=0;i<500;i++); }

14

4.Future Scope
Future improvements to this system may include the addition of more intelligence to the line follower. One possible improvement is that, we could allow the phone to operate different activities. For example, the bluetooth mobile phone will function as per our instruction and robot movements can be controlled by it.Initially Robot will get selective instructions from the mobile phone .

The line follower system can also be further improved by designing it as a distributed system.Later that robot will control other slave robots as well. We can extend our project to achieve following: 1. For disabled, semi automated mechanism wheel chair can help in finding the obstacles automatically and can move omni directionally or operated manually when required. 2. Detection of obstacles or blockages cracks in tunnels where human reach ability is impossible.

15

References
[1] Adel s. Sedra and kenneth carless. Smith ,Microelectronic circuits oxford university press, 2003,ISBN:0-19-806225-7

[2] muhammad ali mazidi, janice gillispie the 8051 microcontroller and embedded systems using assembly and c mazidi & ro lin d. Mckinlay , 2006. [3] p. Heyrati , a. Aghagani , "science of robot disgn and build robot", azarakhsh publication, 2008.[3]m. Mashaghi, "robotic guide", kanone oloum publication, 2008. [4] b. Kuipers, j. Modayil, p. Beeson, m. Macmahon, and f. Savelli, local metrical and global topological maps in the hybrid spatial semantic hierarchy, in proc. Ieee int. Conf. On robotics and automation, 2004, pp. 4845-4851. [5] f. Yasutomi, d. Takaoka, m. Yamada and k. Tsukamoto, cleaning robot control, proceedings of ieee international conference on robotics and automation , vo1.3 , pp. 1839-1841, 1988. [6] c. Hofner and g. Schmidt, path planning and guidance techniques for an autonomous mobile cleaning robot, proceedings of ieee/rsj international conference on intelligent robots and systems, vol.1, pp. 610-617, 1994. [7] betke, margrit. Gurvits, leonid. Mobile robot localization using landmarks, ieee transactions on robotics & automation. Vol. 13 no. 2 apr 1997. P251-263. [8] fukuda, t., Yokoyama, y. Arai, navigation system based on ceiling landmark recognition for autonomous mobile robot, proceedings of the 1996 13" ieee international conference on robotics and automation, minneapoils, mn, usa, pp. 1720- 1725.

You might also like