Click here to load reader

Line Follower Using 89s52

  • View
    581

  • Download
    0

Embed Size (px)

Text of Line Follower Using 89s52

by:-

Submitted

Ankur khurana (07EI407) AcknowledgementIt is our privilege to express our sincerest regards to our project coordinator, Mr Jitender Singh Saggu for their valuable inputs, able guidance, encouragement, whole-hearted cooperation and constructive criticism throughout the duration of our project. We deeply express our sincere thanks to our teacher Dr Vishnu for encouraging and allowing us to present the project on the topic Line Follower Robot at our department premises for the partial fulfillment of the requirements leading to the award of B-Tech degree.We take this opportunity to thank all our lecturers who have directly or indirectly helped our project. We pay our respects and love to our parents and all other family members and friends for their love and encouragement through out our career. Last but not the least we express our thanks to ourfriends for their cooperation and support.

FOREWORD:The word robot was coined by the Czech writer Kapek in his play Rossum's Universal Robots. Since then countless devices have been created and have been associated with the word Robot. The works of Isaac Asimov have laid the foundation of sociology pertaining to the use of robots instead of humans and the word Robotics was also coined by him. In todays world, work on robots, that resemble and look almost human, and others which dont resemble humans in any way, progresses in leaps and bounds. The world has forerunners in this technology like MIT, CMU, Sony, Honda etc. In this world of ASIMO, AIBO, Packbot etc., we have made an attempt to create machines which we dare call Robots. In this era where organizations like ABU Asia Pacific Broadcasting Union are organizing robot contests like Robocon we have made an attempt to make robotic systems which could send and receive communication signal amongst them and complete the task assigned to them with coordinated efforts. Today when technology is developing faster then a blink of an eye and the competition is tough to win at any stage may it be national or international, we have put in tireless efforts to implement the technology in simpler and effective form to compete against some of the best in field of robotics in the country.

Table of contents:1: Introduction 2: Microcontroller 2.1: definition 2.2 2.3 2.4 2.5 2.6 2.7 ATMEL 89S52 FEATURES DESCRIPTION 89S52 PROCESSOR ARCHITECTURE PIN DESCRIPTION PIN DIAGRAM OF AT89S52

2.8 2.9

DESIGN OF INFRARED SENSOR CIRCUIT POSITIONING OF SENSORS

2.10 SENSOR ARRAY 2.11 MOTOR DRIVER:-L293D2.12 COMPARATOR 2.13 DC MOTORS

2.14 BIPOLAR MOTOR DRIVER:2.15 PIN CONNECTIONS 2.16 Multipurpose Schematics and PCB Designs 2.17 Line Following and Turning 2.18 WHAT IS ISP? 2.19 BLOCK DIAGRAM OF LINE FOLLOWER ROBOT 2.20 ONBOARD PIN CONNECTIONS

2.21 SOFTWARE 2.22 SOURCE CODE 2.23 HEX CODE GENERATED FOR THE CODE 2.24 PROBLEMS ENCOUNTERED 2.25 REFERENCES AND RESOURCES

INTRODUCTIONWhat 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 viceversa) 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. Prerequisites: Knowledge of basic digital and analog electronics. Assembly Programming Sheer interest, an innovative brain and perseverance!

MICROCONTROLLER:-

2.1:-DefinationA 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 Software Compatibility Program Compatibility 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. 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:- 89S52 PROCESSOR ARCHITECTURE:

The AT89s52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full-duplex serial port, on-chip oscillator, and clock circuitry.

In addition, the AT89s52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next hardware reset. 2.6:- 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

2.7:- PIN DIAGRAM OF 89S52

2.8:- DESIGN OF INFRARED SENSOR CIRCUIT:Pr inciple of operation of the I.R L.E.D . and Phototransistor: -

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