it is our privilege to express our sincerest regards to our project coordinator

Upload: swathi-varadi

Post on 06-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    1/38

    It is our privilege to express our sincerest regards to our project coordinator,

    Miss. D. Anita 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 Head of Department Mr. Vijay

    Kumar for encouraging and allowing us to present the project on the topic

    Line Follower Robot With Continuous Path Sensing at

    our department premises for the partial fulfillment of the requirements

    leading to the award of B-Tech degree.

    This his is to certify that Sonali Mishra, Balaram Panda, SanyasiBarad, Pulkeshu Dash and Gaurav Singhdeo students of PadmanavaCollege of Engineering, Sector-4, Rourkela-002, have successfullycompleted a project on Line Follower Robot in 8th semester atDepartment of Electronics & Telecommunication Engineering.This report has not been submitted to any other Organization & does

    not form part of any Course undergone by then, for the award of B-Tech Degree Head of Dept (ETE) Project Guide

    Prof(Dr).K.C.Mohapatra Ms Madhusmita Nahak

    This Project Line Following Autonomous Robot is based on 8 bit Microcontroller

    AT89C8051. 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 theLines for the Robot.

    All the above systems are controlled by the Microcontroller. In our project we are usingthe popular 8 bit microcontroller AT89C8051. It is a 40 pin microcontroller.

    The Microcontroller AT89C8051 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 steppermotors are used to drive the robot.

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    2/38

    CONTENTS

    1. ABSTRACT2. INTRODUCTION3. HARDWARE IMPLEMENTATION3.1 Block Diagram3.1.1. Transmitter3.1.2 .Receiver3.2 Power supply3.2.1Transformer3.2.2 Bridge rectifier3.2.3 Filter3.2.4 Voltage regulator

    3.3 8051/AT89C51 microcontroller3.3.1 Introduction3.3.2 Necessity of micro controller3.3.3 Advantages of micro controller3.3.4 Introduction to 8051 micro controller3.3.5 Pin configuration3.3.6 Pin description3.3.7 Interrupts3.4 LEDS

    3.5 Relay interface3.6 DTMF-88703.6.1 General description3.6.2 Functional distribution3.6.3 Filter3.6.4 Decoder4. CIRCUIT DESCRIPTION

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    3/38

    5. SOFTWARE IMPLEMENTATION5.1 Kiel software5.2 Procedure for hex file dumping on to the target board6. CONCLUSION7. FUTURE SCOPEAPPENDIX AAPPENDIX B

    ABSTRACT

    LINE FOLLOWER ROBOT WITH CONTINOUS PATH SENSING

    Aim of the project is to build a Robotic System that can track a pre laid path. The heart of

    the system is a AT89C51 microcontroller. This is a 8 bit microcontroller manufactured by

    ATMEL. The microcontroller is programmed using a high level language (Embedded C).

    There are two IR transceivers mounted on either side of the tape.

    The Robotic Platform employs two stepper motors

    for the drive. Turning the motors clock wise causes the platform to move forward,

    similarly turning the motors counter clock wise causes the platform to move backwards.

    The Robotic Platform employs the principle of differential steering. The differential is

    usually found compiled to the rear wheels. The power from the engine is connected to the

    rear wheels through a differential. When making a turn the wheel that lies in the direction

    of turn moves less compared to the outer wheel. Since Robotic Platform is equipped with

    two motors for the drive, controlling the motors, i.e. when making a right turn, the right

    wheel can be stopped i.e. power to the stepper motor is switched off. This causes the

    system to take a right turn. Similarly for left turn, this scheme is bases on differential

    steering. The tape detector circuitry consists of two IR integrated detection. The detectorhouses the emitter as well as detector. They are placed such that they are just out of the

    tape. The moment any one sensor begins to intercept the tape, the differential steering

    logic comes into actions. The steering logic corrects the robot travel until neither of the

    sensor are seeing the laid tape. The two sensor outputs are fed to a Nand Gate 74LS20.

    The output of the gate is connected to the INT0 pin on the microcontroller. The moment

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    4/38

    any sensor see the tape it fires the interrupt. The main routines are halted and the ISR is

    serviced. The ISR actually issues the steering correction program. The system speed can

    be altered by pressing the appropriate speed control keys. The last set speed setting is

    stored in the EEPROM which works on IIC bus.

    2. INTRODUCTION

    This Project Line Following Autonomous Robot is based on 8 bit Microcontroller

    AT89C8051. 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 8 bit microcontroller AT89C8051. It is a 40 pin

    microcontroller. The Microcontroller AT89C8051 is used to control the motors. It gets

    the signals from the infrared sensors and it drives the motors according to the sensorinputs. Two stepper motors are used to drive the robot.Line follower is a machine thatcan 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. 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.

    3. HARDWARE IMPLEMENTATION

    3.1BLOCK DIAGRAM:

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    5/38

    In the line follower robot project we have used 3pairs of IR (infra-red) emitter/sensor. The sensor ongetting blocked or unblocked sends combination ofhigh/low signals to AT89C51 microcontroller whichare processed and appropriate signals are sent toL293D (motor driver chip) which switches on/off themotors so as to keep the robot moving in onedirection.

    Circuit model of Line Follower Robot

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    6/38

    BLOCK DIAGRAM OF LINEFOLLOWER ROBOT:-

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    7/38

    CIRCUIT DIAGRAM OF LINEFOLLOWER ROBOT:-

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    8/38

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    9/38

    The microcontroller receives signals from theInfrared Sensor circuit. The code burnt insidethe EEPROM processes the signal and send

    appropriate signals to the L293D and turnson/off the motors shown in the figure above. The program that processes the signalsreceived from the LM339 is given on the pagelater of this project report and the code hasbeen implemented using microcontrollerprogramming in assembly.

    IMPLEMENTATION

    Design of Microcontroller Programmer

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    10/38

    The circuit shown above is microcontroller

    programmer (AT89CXXseries). It burns the HEX codeof the microcontroller program in the EEPROM of themicrocontroller using the parallel port of thecomputer.

    The ISP programmer shown below sends the HEXcode to the programmer (hardware).

    Design of microcontroller programmer

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    11/38

    ISP (IN SYSTEM PROGRAMMING) PROGRAMMER

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    12/38

    PICTURE OF THE PROGRAMMER BOARD

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    13/38

    WHAT IS ISP?

    In-System Programming (abbreviated ISP) is theability of some programmable logic devices,microcontrollers, and other programmable electronicchips to be programmed while installed in a completesystem, rather than requiring the chip to beprogrammed prior to installing it into the system.

    The primary advantage of this feature is that itallows manufacturers of electronic devices to

    integrate programming and testing into a singleproduction phase, rather than requiring a separateprogramming stage prior to assembling the system.

    This may allow manufacturers to program the chipsin their own system's production line instead ofbuying preprogrammed chips from a manufacturer ordistributor, making it feasible to apply code or designchanges in the middle of a production run. Typically,

    chips supporting ISP have internal circuitry togenerate any necessary programming voltage fromthe system's normal supply voltage, andcommunicate with the programmer via a serialprotocol. Most programmable logic devices useproprietary protocols or protocols defined by olderstandards. In systems complex enough to requiremoderately large glue logic.

    DESIGN OF INFRARED SENSORCIRCUIT:

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    14/38

    Principle 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 strikesthe diode, it excites an electron thereby creating amobile electron and a positively charged electronhole. If the absorption occurs in the junction'sdepletion region, or one diffusion length away fromit, these carriers are swept from the junction by thebuilt-in field of the depletion region, producing a

    photocurrent. Photodiodes can be used under eitherzero bias ( photovoltaic mode) or reverse bias(photoconductive mode). Reverse bias induces onlylittle current (known as saturation or back current)along its direction. But a more important effect ofreverse bias is widening of the depletion layer(therefore expanding the reaction volume) andstrengthening the photocurrent when infrared falls

    on it. There isa 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 about5mm.

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    15/38

    POSITIONING OF SENSORS:-

    Infra-Red emitter sends out Ipulses.

    Position calculation is dthrough

    intensity of reflected received by

    the detector.Ambient interference is

    negligible.

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    16/38

    The resistance of the sensor decreases when IR(infrared) light falls on it. A good sensor will havenear zero resistance in presence of light and a verylarge resistance in absence of light. Whether thesensors are Light Dependent Resistors, laser diode,Infrared Sensors, Ultrasonic Sensors or anythingelse,the outputs of the sensor modules are fed to theNon-inverting input of a comparator . The referencevoltage of the comparator is fed to the invertinginput of the comparator by a trim pot or a tuningdevice connected between the supply lines. LM339 is

    a comparator IC that digitizes the analog signal fromthe sensor array. Since the output of LM339 is TTLcompatible it can be directly fed to the mastermicrocontroller.

    0.5cm

    EMITTER DETECT

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    17/38

    The generalized connection diagram of SensorInterfacing with microcontroller is shown below:-

    CONNECTING INFRARED MODULE WITH MICROCONTROLLER MCS-

    51

    When the sensor/emitter pair is on shiningsurface sensor is on i.e. in low impedancemode which one can easily view as L.E.D.corresponding to that sensor doesnt glow. The

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    18/38

    output of the opamp is HIGH SIGNAL and thisHIGH SIGNAL is given to the microcontrollerand when the sensor is on normal non-

    reflecting surface its off i.e. in HIGHIMPEDANCE state which one can easily viewas L.E.D. corresponding to that sensor glows upand LOW SIGNAL is given to themicrocontroller.

    Infra-Red Sensor Array

    Black Wire Output VoltageRed Wire - +5V

    Brown Wire - Gnd

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    19/38

    ANALOG TO DIGITALCONVERTER:-

    It is clear that the output of the potential divider is ananalog voltage. But Microcontroller does not acceptthe analog voltage. So we need to convert the analogvoltage to digital before we feed it to themicrocontroller.For this conversion we can use1. Comparators2. ADCs

    V0=Highwhen V+ > V-V0 = Low when V+ < V-

    LM339 COMPARATOR:-

    PIN DIAGRAM OF LM339:-

    -

    COMPARATOR LM339

    +

    V+

    V-

    V0 V0 = High when V+ > V0 = Low when V+ <

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    20/38

    This device consists of four independent precision

    voltage comparators with an offset voltagespecifications as low as 2mV. This comparator isdesigned to specifically operate from a single powersupply over a wide range of voltages. Operation fromsplit power supplies is also possible. This comparatoralso has a unique characteristic which is that theinput common-mode voltage range includes groundeven though operated from a single power supply

    voltage.This device consists of four independentprecision voltage comparators with an offset voltagespecifications as low as 2mV. This comparator isdesigned to specifically operate from a single powersupply over a wide range of voltages. Operation fromsplit power supplies is also possible. This comparator

    PIN DIAGRAM OF LM339

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    21/38

    also has a unique characteristic which is that theinput common mode voltage range includes groundeven though operated from a single power supplyvoltage.

    FUNCTION OF THECOMPARATOR:-

    V+

    V-

    V+> V-

    0 V

    HIGH

    -

    +

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    22/38

    V+

    V-

    V+< V-

    0 V

    LOW

    -

    +

    MICROCONTROLLER:-

    PIN DIAGRAM OF AT89C51:-

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    23/38

    PIN DIAGRAM OF AT89C51

    The AT89C51 is a low-power, high-performanceCMOS 8-bit microcomputer with 4Kbytes of FlashProgrammable and Erasable Read Only Memory(PEROM). The device is manufactured using Atmelshigh density nonvolatile memory technology and iscompatible with the industry standard MCS-51instruction set and pinout. The on-chip Flash allowsthe program memory to be reprogrammed in-system

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    24/38

    or by a conventional nonvolatile memoryprogrammer. By combining a versatile 8-bit CPU withFlash on a monolithic chip, the Atmel AT89C51 is apowerful microcomputer which provides a highly

    flexible and cost effective solution to manyembedded control applications. The AT89C51provides the following standard features: 4Kbytes ofFlash, 128 bytes of RAM, 32 I/O lines, two 16-bittimer/counters, five vector two-level interruptarchitecture, a full duplex serial port, on-chiposcillator and clock circuitry. In addition, theAT89C51 is designed with static logic for operation

    down to zero frequency and supports two softwareselectable power saving modes. The Idle Mode stopsthe CPU while allowing the RAM, timer/counters,serial port and interrupt system to continuefunctioning. The Power down Mode saves the RAMcontents but freezes the oscillator disabling all otherchip functions until the next hardware reset.

    PICTURE OF THE MICROCONTROLLER

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    25/38

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    26/38

    ONBOARD PIN CONNECTIONS:-

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    27/38

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    28/38

    BIPOLAR MOTOR DRIVER:-

    L293D is a bipolar motor driver IC. This is a high

    voltage, high current pushpull four channel drivercompatible to TTL logic levels and drive inductiveloads. It has 600 mA output current capability perchannel and internal clamp diodes.

    The L293 is designed to provide bidirectional drivecurrents of upto 1 A at voltages from 4.5 V to 36 V.

    The L293D is designed to provide bidirectional drivecurrents of up to 600-mA at voltages from 4.5 V to 36

    V. Both devices are designed to drive inductive loadssuch as relays, solenoids, dc and bipolar steppingmotors, as well as other high-current/high-voltageloads in positive supply applications. All inputs are

    TTL compatible. Each output is a complete totem-pole drive circuit, with a Darlington transistor sinkand a pseudo-Darlington source. Drivers are enabledin pairs, with drivers 1 and 2 enabled by 1,2EN and

    drivers 3 and 4 enabled by 3,4EN. When an enableinput is high, the associated drivers are enabled, andtheir outputs are active and in phase with theirinputs. When the enable input is low, those driversare disabled, and their outputs are off and in thehigh-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.

    PIN DIAGRAM OF L293D:-

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    29/38

    4 5 12 13

    16 8

    1

    2

    15

    9

    7

    10

    314

    6

    11

    VCC1- LOGIC

    SUPPLY= 5V

    LM+OUTP

    MO

    OUTP

    MO

    L_IN1

    L_ENL293D

    INPUTLINES

    R_EN

    L_IN2

    R_IN2

    R_IN1

    LM-

    RM+

    RM-

    PIN DIAGRAM OF L293D

    The Device is a monolithic integrated high voltage,high current four channel driver designed to acceptstandard DTL or TTL logic levels and drive inductiveloads (such as relays solenoides, DC and steppingmotors) and switching power transistors. To simplifyuse as two bridges each pair of channels is equippedwith an enable input. A separate supply input isprovided for the logic, allowing operation at a lowervoltage and internal clamp diodes are included. Thisdevice is suitable for use in switching applications atfrequencies up to 5 kHz.

    The L293D is assembled in a 16 lead plasticpackaage which has 4 center pins connected

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    30/38

    together and used for heatsinking The L293DD isassembled in a 20 lead surface mount which has 8center pins connected together and used forheatsinking.

    PIN CONNECTIONS:-

    MOTOR DRIVING:-

    CONNECTION DIAGRAM FOR DRIVING BIPOLAR DC MOTOR

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    31/38

    EN IN 1 IN 2 MoStatus

    0 X X Stopp

    1 0 0 Stoppe

    1 1 1 Stoppe

    1 1 0 CW

    1 0 1 CCW

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    32/38

    PICTURE OF BIPOLAR MOTOR DRIVER

    DC MOTORS:-

    These are very commonly used in robotics. DCmotors can rotate in both directions depending uponthe polarity of current through the motor. Thesemotors have free running torque and current ideallyzero. These motors have high speed which can bereduced with the help of gears and traded off fortorque. Speed Control of DC motors is done throughPulse Width Modulation techniques, i.e. sending thecurrent in intermittent bursts. PWM can be generated

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    33/38

    by 555 timer IC with adjusted duty cycle. Varyingcurrent through the motor varies the torque.

    SOURCE CODE:-

    PROGRAM FOR LINE FOLLOWER=======SYSTEMREGISTERS==============

    P0 EQU 080H

    PICTURE OF DC MOTOR USED

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    34/38

    P1 EQU 090HP2 EQU 0A0HP3 EQU 0B0H

    TH1 EQU 08DH TL1 EQU 08BH TCON EQU 088H TMOD EQU 089HIE EQU 0A8HSP EQU 081HFLAG1 EQU 0D0H

    ;======= PORT PIN DEFINITIONS ========SENSOR1 EQU P1.0SENSOR2 EQU P1.1LED_RED EQU P0.6LED_GREEN EQU P0.7L_EN EQU P0.2R_EN EQU P0.4L_MO1 EQU P0.1

    L_MO2 EQU P0.0R_MO1 EQU P0.3R_MO2 EQU P0.5

    ; X X X X M X L R

    ; X X X X 1 X 0 0 - FWD -- 03; 0 1 - TR 01

    ; 1 0 - TL 02; 00 - STOP 00

    ;========== HERE THE MAIN PROGRAM STARTS==========

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    35/38

    ORG 0000HAJMP START

    ORG 0050H

    START: MOV R1,#0FFHMOV R2,#004HMOV P2,#000H

    LOOP: MOV C,SENSOR1MOV LED_RED,CMOV C,SENSOR2MOV LED_GREEN,C

    MOV A,P1ANL A,#003H

    CJNE A,#000H,CHECK_LEFT ;////// GOFORWARD /////////

    SETB R_MO1CLR R_MO2

    SETB L_MO1CLR L_MO2MOV R1,#0FFHMOV R2,#004HAJMP LOOP

    CHECK_LEFT:

    CJNE A,#001H,CHECK_RIGHT ;////// TURNLEFT ///////////SETB R_MO1CLR R_MO2CLR L_MO1SETB L_MO2

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    36/38

    MOV R1,#0FFHMOV R2,#004H

    HERE_LEFT:

    MOV A,P1ANL A,#003HCJNE A,#003H,LEFT_CONTDJNZ R1,LEFT_CONTDJNZ R2,LEFT_CONTAJMP STOP

    LEFT_CONT:JB P1.0,HERE_LEFTAJMP LOOP

    CHECK_RIGHT:

    CJNE A,#002H,CHECK_STOP ;/////// TURNRIGHT ///////

    CLR R_MO1SETB R_MO2SETB L_MO1CLR L_MO2MOV R1,#0FFH

    MOV R2,#004HHERE_RIGHT:MOV A,P1ANL A,#003HCJNE A,#003H,RIGHT_CONTDJNZ R1,LEFT_CONT

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    37/38

    DJNZ R2,LEFT_CONTAJMP STOP

    RIGHT_CONT:JB P1.1,HERE_RIGHT

    AJMP LOOPCHECK_STOP:

    DJNZ R1,LOOPSTOP: SETB R_MO1

    SETB R_MO2SETB L_MO1SETB L_MO2

    HERE_STOP:AJMP HERE_STOPEND

    PROBLEMS ENCOUNTERED:-

    The ISP programmer requires dedicated supply of9V from the USB of your P.C. Extern supply of otherthan 9V generates error while writing the HEX codeto the Microcontroller. The programmer was soldered3 times before it could successfully program the chip. The program was difficult to implement as it wasour first encounter with microcontroller programming

    in assembly. The large number of interconnections in the circuitmade it too difficult to solder. The IR sensors burnt up on soldering so we have touse temperature controlled soldering iron.

  • 8/3/2019 It is Our Privilege to Express Our Sincerest Regards to Our Project Coordinator

    38/38

    In the model designed to show line follower robot,electric motors ought to be bidirectional and of lowwattage i.e. should draw lesser current otherwise themotor can draw current to such a level to burn up the

    entire circuit.