Line Follower Robline follerot

download Line Follower Robline follerot

of 30

Transcript of Line Follower Robline follerot

  • 8/13/2019 Line Follower Robline follerot

    1/30

    LINE FOLLOWER ROBOT

    A PROJECT REPORT

    By

    Neetu Bansal

    Sakshi Arora

    Salil Shiva

    MSc II (PHYSICS&ELECTRONICS)

    Department of Physics

    Panjab University

    Chandigarh

    MAY 2010

    Under the supervision of

    Dr. Navdeep Goyal

    __________________

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    2/30

    ACKNOWLEDGEMENT

    It is not until you undertake a project like this one that you realize how massive the effort it really is or how much you

    must rely upon the selfless efforts and goodwill of others. There are many who helped us in this project and I want to

    thank them all.

    We owe a special word of thanks to Dr. NAVDEEP GOYAL (OUR PROJECT GUIDE) for their vision, thoughtful

    counselling and encouragement at every step of project. We cannot forget to mention the moral support which all the

    teachers in the electronics branch provided to us.

    Lastly, but not the least we find no words to acknowledge the financial assistance and moral support rendered by our

    parents in making this effort a success. All this has become a reality because of their blessings and above all by the

    grace of God.

    Neetu Bansal

    Sakshi Arora

    Salil Shiva

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    3/30

    ABSTRACT

    The present study aims at developing a LINE FOLLOWER ROBOT or a LINE TRACING ROBOT which is

    programmed using microcontroller AT89C51. 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 AT89C51. It is a 40 pin microcontroller.

    The Microcontroller AT89C51 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 DC geared motors are used to drive the robot in forward, left or right

    direction.

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    4/30

    TABLE OF CONTENTS

    INTRODUCTIONPROBLEM DESCRIPTION

    BLOCK DIAGRAM OF LINE FOLLOWER ROBOTBASIC COMPONENTS REQUIREDINPUT SECTION

    OBJECT DETECTION USING IR LIGHT GENERAL WORKING OF OP-AMPS(LM324) MICROCONTROLLER(AT89C51)

    OUTPUT SECTION MOTORS FOR LOCOMOTION DC MOTOR H-BRIDGE(L293)

    CONTROL SECTION PROGRAMMING

    APPLICATIONSCONCLUSIONREFERENCEAPPENDIX

    DATASHEET:

    L293 LM324 AT89C51

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    5/30

    INTRODUCTION:A ROBOT IS:

    Avirtual or amechanicalartificial agent.In practice, it is usually anelectro-mechanical machine which is guided by

    computer or electronic programming, and is thus able to do tasks on its own.

    The guiding force behind the robot is an Embedded System. At the core of every Embedded System there is either a

    microprocessor or a microcontroller or any other programmable intelligent unit.

    Basically a robot consists of:

    A mechanical device, such as a wheeled platform, arm, or other construction, capable of interacting with itsenvironment

    Sensors on or around the device that are able to sense the environment and give useful feedback to the device Systems that process sensory input in the context of the device's current situation and instruct the device to

    perform actions in response to the situation.

    Sensors:

    A sensor is a device that measures a physical quantity and converts it into a signal which can be read by an observer

    and by an instrument.

    A transducer is a device that converts one type of energy to other. The conversion can be from electrical,

    electromechanical, electromagnetic, photonic or any other form of energy.

    Robots react according to a basic temporal measurement, requiring different kinds of sensors. The term transducer is

    often used interchangeably with sensors. A Transducer is the mechanism of the sensor that transforms the energy

    associated with what is being measured into another form of energy. A sensor receives energy and transmits a signal

    to display or computer. Sensors use transducers to change the input signal (sound, light, pressure, temperature etc,)

    into an analog or digital form capable of being used by a robot.

    Proximity sensors: A proximity sensor measures the relative distance between sensor and objects in theenvironment.

    Infrared (IR) sensors: Another type of active proximity sensor is IR sensor. It emits near infrared energy and

    measures whether any significant amount of IR light is returned. Infrared radiation is part of the electromagnetic

    spectrum, which includes radiowaves, microwaves, visible light, and ultraviolet light, as well as gamma rays and X-

    rays. The IR range falls between the visible portion of the spectrum and the radio waves. IR wavelengths are usually

    expressed in microns, with IR spectrum extending from 0.7 to 1000 microns. Because every object (except black

    body) emits an optimum amount of IR energy at a specific point along IR band, the emitted energy comes from an

    object and reaches the IR sensor through its optical system, which focuses the energy onto one or more photosensitive

    detectors. The detector then converts the IR energy into an electrical signal.

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

    http://en.wikipedia.org/wiki/Virtualhttp://en.wikipedia.org/wiki/Mechanicalhttp://en.wikipedia.org/wiki/Artificial_agenthttp://en.wikipedia.org/wiki/Electromechanicshttp://en.wikipedia.org/wiki/Electromechanicshttp://en.wikipedia.org/wiki/Artificial_agenthttp://en.wikipedia.org/wiki/Mechanicalhttp://en.wikipedia.org/wiki/Virtual
  • 8/13/2019 Line Follower Robline follerot

    6/30

    PROBLEM DESCRIPTION:

    This project aims at developing a LINE FOLLOWER ROBOT or a LINE TRACING ROBOT which is programmed

    using microcontroller AT89C51. The microcontroller has been used to program the ROBOT to turn in a direction

    followed by line.

    Line Following Robot (using AT89C51)

    This Project, Line Following Autonomous Robot is based on 8 bit Microcontroller AT89C51. 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 AT89C51. It is a 40 pin microcontroller.

    The Microcontroller AT89C51 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 DC geared motors are used to drive the robot in forward, left or right

    direction.

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    7/30

    BLOCK DIAGRAM OF LINE FOLLOWER ROBOT:

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    8/30

    BASIC COMPONENTS REQUIRED:

    1. Chassis2. Wheels3. Battery4. Power supply5. Electronic circuitry6. Motor

    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.

    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)5. Plastic Pipes.

    DIFFERENTIAL DRIVE MECHANISM:

    Differential drive is a method of controlling a robot with only two motorized wheels. Motors can be used to drive a

    car using differential turning mechanism. The term 'differential' means that robot turning speed is determined by the

    speed difference between both wheels, each on either side of your robot. For example: keep the left wheel still and

    rotate the right wheel forward and the robot will turn left.

    WHEELS:

    Wheels are mainly of two types in this basic car, one is the type attached to the motors at the back, which are used forsteering, and another castor wheel in front, which allows 360 degrees free rotation and avoids friction on the ground.

    The wheels can be put on the shafts either by using screws or by wrapping the shaft with masking tape first.

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    9/30

    BATTERIES:

    Used for supplying power to a robot, rechargeable batteries are usually the best ones. A standard 300-500 RPM motor

    runs well between 9 to 12 volts, and alkaline batteries, lithium ion, nickel cadmium or Zinc carbon batteries can be

    used. The appropriate series parallel combination can be used to provide more power than a standard battery can

    provide.

    POWER SUPPLY

    The voltage regulator regulates the supply if the line voltage increases or decreases. The series 78xx regulatorsprovide 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 ICs are positive voltage regulators whereas 79xx

    ICs are negative voltage regulators.

    These voltage regulators are integrated circuits designed as fixed voltage regulators for a 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.

    In our circuit, we are using 7809 and a 7805 voltage regulator. We obtain 9 V regulated DC voltage. It is further fed to

    7805 to obtain 5 V regulated DC voltage. 9V DC is fed to L293 to drive the motors. 5V DC is fed to the VCC pin of

    receiver circuit, OP-AMP (LM324), Emitter circuit, microcontroller and L293.

    We can provide input to 7809 using a 9-12 V battery.

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    10/30

    Below is the circuit diagram of POWER SUPPLY:

    ELECTRONIC CIRCUITRY

    It consists of three parts:

    Input Section:Provides interface of sensors with the microcontroller. Output Section:Provides interface of microcontroller with the motors. Control Section:Provides the programming and control using the microcontroller.

    These are discussed in detail next.

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    11/30

    INPUT SECTION

    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. Thatswhy as you will notice in the schematic, we are going to use an Op-Amp (operational

    Amplifier) to accurately detect very small voltage changes.

    The schematic has two sections:

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    12/30

    1.The Emitter section:The emitter is composed of an IR LED in series with a 330 Ohm resistor.

    2. The Receiver Section:The receiver part consists of 2 resistors R1 and R2 forming a voltage divider which

    provides 2.5V at the anode of the IR LED (act as a sensor). When IR light falls on the LED (D1), the voltage drop

    increases, the cathode's voltage of D1 may go as low as 1.7V depending upon the light intensity. This voltage drop can

    be detected using an OP-AMP (LM324). You will have to adjust the variable resistor (POT.) R3 so that the voltage at

    the positive input of the Op-Amp (pin No. 12) would be somewhere near 1.6 Volt. According to functioning of OP-

    AMP the output will be high when voltage drop at cathode of D1 drops under 1.6V.So, when IR is detected output of

    the OP-AMP will be high.

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    13/30

    GENERAL WORKING OF OPERATIONAL AMPLIFIER:

    The op-amp has 2 inputs, the positive input, and the negative input. If the positive input's voltage is higher than the

    negative input's voltage, the output goes High (5v, given the supply voltage in the schematic), otherwise, if the

    positive input's voltage is lower than the negative input's voltage, then the output of the Op-Amp goes to Low (0V). Itdoesn't matter how big the difference between the positive and negative inputs is, even a 0.0001 volts difference will

    be detected, and the output will swing to 0v or 5v according to which input has a higher voltage.

    Op-Amplifier (LM324)

    If the rays received by the IR- LED receiver are above a particular threshold then an amplified signal is generated by

    the amplifier (LM324). Note that the sensors cannot directly send a signal to the microcontroller as the signal voltage

    generated by them is too low and even when sensors are on white surface signal generated by them will interpreted

    low by the microcontroller.

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    14/30

    MICROCONTROLLER

    A microcontroller is a single computer chip that executes a user program, normally for the purpose of controlling

    some device hence the name microcontroller. Its design includes all the features that are in a microcomputer on a chip

    CPU: ALU, PC, SP, and registers. It also contains some additional features that are required to make a complete

    computer: ROM, RAM, parallel I/O, serial I/O, counters and clock circuit.

    Difference between microcontroller and microprocessor:

    A microcontroller is differed from microprocessor in many ways. Basically microprocessors are the devices which can

    process huge amount of data. Microprocessors contain no ROM, no RAM, and no I/O ports on the chip itself. That is

    why these are called as general purpose microprocessors. We can add RAM ,ROM,I/O ports ,timers externally to

    make general purpose processor functional .although the addition of such things make it bulkier and much more

    expensive. But this is not the case with microcontroller. A microcontroller has a CPU in addition to the fixed amount

    of RAM, ROM, I/O ports, timers that are all embedded together on chip. Therefore, designer cant add I/O ports and

    timers externally. The fixed amount of on chip RAM, ROM, I/O ports make it ideal for many applications.

    EXTERNAL INTERRUPTS

    TXD RXD

    INTERRUPT CONTROL

    ON-CHIP ROM for

    program code

    ON-CHIP RAM

    ETC.

    TIMER 1

    TIMER 0

    SERIAL

    PORT4 I/O ports

    BUS

    CONTROLOSC

    CPU

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    15/30

    Atmel AT89C51

    Features:

    4K Bytes of Reprogrammable Flash Memory

    Fully static operation: 0 HZ-24 MHZ

    1288-bit Internal RAM

    32 Programmable I/O lines

    Two 16-bit Timer/counters

    Six Interrupt Sources

    Programmable serial channel

    Low-power Idle and Power-down Modes

    Description:

    The AT89c51 is a lowvoltage, high performance CMOS 8-bit microcomputer with 4K bytes of Flash

    Programmable and erasable read-only Memory (PEROM).The device is manufactured using Atmels high-density

    non-volatile memory technology and is compatible with the industry standard MCS-51 instruction set. The ON-Chip

    Flash allows the program memory to be reprogrammed in-system. By combining a versatile 8-bit CPU with Flash on

    monolithic chip, the Atmel AT89C51 is a powerful microcomputer which provides a highly-flexible and cost-effective

    resolution to many embedded control applications.

    The 89C51 have a total of 40 pins that are dedicated for various functions such as I/O, RD, WR, address and

    interrupts. Out of 40 pins, a total of 32 pins are set aside for the four ports P0, P1, P2, and P3, where each port takes 8

    pins. The rest of the pins are designated as Vcc, GND, XTAL1, XTAL, RST, EA, and PSEN. All these pins except

    PSEN and ALE are used by all members of the 8051 and 8031 families. In other words, they must be connected in

    order for the system to work, regardless of whether the microcontroller is of the 8051 or the 8031 family. The other

    two pins, PSEN and ALE are used mainly in 8031 based systems.

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    16/30

    Pin Configuration of 89C51:

    ALE

    ALE (Address latch enable) is an output pin and is active high. When connecting a microcontroller to external

    memory, port 0 provides both address and data. In other words the microcontroller multiplexes address and data

    through port 0 to save pins. The ALE pin is used for de-multiplexing the address and data by connecting to the G pin

    of the 74LS373 chip.

    PSEN

    This is an output pin. PSEN stands for program store enable. It is the read strobe to external program

    memory. When the microcontroller is executing from external memory, PSEN is activated twice each machine cycle.

    EA

    All the 8051 family members come with on-chip ROM to store programs. In such cases, the EA pin is connected to

    the Vcc. For family members such as 8031 and 8032 in which there is no on-chip ROM, code is stored on an external

    ROM and is fetched by the 8031/32. Therefore for the 8031 the EA pin must be connected to ground to indicate that

    the code is stored externally. EA, which stands for external access, is pin number 31 in the DIP packages. It is input

    pin and must be connected to either Vcc or GND. In other words, it cannot be left unconnected.

    XTAL1 and XTAL2

    The 8051 have an on-chip oscillator but requires external clock to run it. Most often a quartz crystal

    oscillator is connected to input XTAL1 (pin 19) and XTAL2 (pin 18). The quartz crystal oscillator connected to

    XTAL1 and XTAL2 also needs two capacitors of 30 pF value. One side of each capacitor is connected to the ground.

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    17/30

    C2

    XTAL2

    C1

    XTAL1

    It must be noted that there are various speeds of the 8051 family. Speed refers to the maximum oscillator frequency

    connected to the XTAL. For example, a 12 MHz chip must be connected to a crystal with 12 MHz frequency or less.

    Likewise, a 20 MHz microcontroller requires a crystal frequency of no more than 20 MHz. When the 8051 is

    connected to a crystal oscillator and is powered up, we can observe the frequency on the XTAL2 pin using

    oscilloscope.

    RST

    Pin 9 is the reset pin. It is an input and is active high (normally low). Upon applying a high pulse to this pin, the

    microcontroller will reset and terminate all activities. This is often referred to as a poweron reset. Activating a

    power-on reset will cause all values in the registers to be lost. Notice that the value of Program Counter is 0000 upon

    reset, forcing the CPU to fetch the first code from ROM memory location 0000.

    I/O port pins and their functions

    The four ports P0, P1, P2, and P3 each use 8 pins, making them 8-bit ports. All the ports upon RESET are

    configured as output, ready to be used as output ports. To use any of these as input port, it must be programmed.

    Port 0:Port 0 is an 8-bit open drain bidirectional port. As an open drain output port, it can sink eight LS TTL loads.

    Port 0 pins that have 1s written to them float, and in that state will function as high impedance inputs. Port 0 is also the

    multiplexed low-order address and data bus during accesses to external memory. In this application it uses strong

    internal pull-ups when emitting 1s. Port 0 emits code bytes during program verification. In this application, external

    pull-ups are required.

    Port 1: Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. Port 1 pins that have 1s written to them are

    pulled high by the internal pull-ups, and in that state can be used as inputs. As inputs, port 1 pins that are externally

    being pulled low will source current because of the internal pull-ups. Port 1 also receives low order address bytes

    during flash programming and verification.

    Port 2: Port 2 is an 8-bit bidirectional I/O port with internal pullups. When 1s are written to Port2 they are pulled

    high by internal pull-ups and can be used as inputs. Port 2 emits the high-order address byte during accesses to

    external memory that use 16-bit addresses. In this application, it uses the strong internal pull-ups when emitting

    1s.Port 2 emits the contents of the P2 Special Function Register.

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    18/30

    Port 3:Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. When 1s are written to Port 3 pins they are

    pulled high by internal pull-ups and can be used as inputs. It also serves the functions of various special features of the

    80C51 Family as follows:

    Port Pin Alternate Function

    P3.0 RxD (serial input port)

    P3.1 TxD (serial output port)

    P3.2 INT0 (external interrupt 0)

    P3.3 INT1 (external interrupt 1)

    P3.4 T0 (timer 0 external input)

    P3.5 T1 (timer 1 external input)

    P3.6 WR (external data memory write strobe)

    P3.7 RD (external data memory read strobe)

    Port 3 also receives some control signals for flash programming and verification.

    VCC:Supply voltage

    VSS:Circuit ground potential.

    GND: 20 pin is grounded.

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    19/30

    OUTPUT SECTION

    MOTORS FOR LOCOMOTION:

    As your car needs an engine to run, similarly our robot also needs something to make it run. An actuator activated amechanical device and is basically anything that causes movement on your robot. Motors, such as the motors that

    drive a robot, are the most common type of actuator. Motors come in several varieties such as the gear motor and the

    servo motor. Motors vary in power, speed, accuracy and power consumption. Some motors have shaft that rotate

    continuously; other types turn less than a complete rotation. Motors can add a lot of weight to a robot. Light weight

    aluminium motors or even plastic motors might save your robot a lot of power in the long run. Some of the

    mechanical devices that are currently being used in modern robotics technology include:

    AC motor:AC motors cycle the power at the input leads, to continuously move the field. Given a signal, AC or DC

    motor perform their action to best of their ability.

    Stepper motor:These motors are like brushless AC or DC motors. They move the rotor by applying power to

    different magnets in the motor sequence (stepped). Steppers are designed for fine control and will not only spin on

    command and will not only spin on command, but can spin at any number of steps-per-second.

    Servo motors:Servomotors are closedloop devices. Given a signal, they adjust themselves until they match the

    signal. Servos are used in radio control airplanes and cars. They are simple DC motors with gearing and a feedback

    control system.

    DC MOTORS:

    A direct current motor is used to translate electrical pulses into mechanical movement. In DC motor we have + and

    leads. Connecting them to a DC voltage source moves the motor in one direction (i.e. clockwise rotation). By

    reversing the polarity, the DC motor will move in the opposite direction (i.e. counter clockwise rotation). The

    maximum speed of DC motor is indicated in rpm. The DC motor has two rpms: no load and loaded. The rpm is

    reduced when moving a load and decreases as the load is increased. DC motors also have voltage and current ratings.

    The nominal voltage is the voltage for that motor under normal conditions, can vary from 1 to 150V, depending on the

    motor .As we increase the voltage, the rpm goes up. The current rating varies from 25mA to a few amps. As the load

    increases, the rpm is decreased, unless the current or voltage

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    20/30

    provided to the motor is increased , which in turn increases the torque.

    DC GEAR MOTOR

    The two types of motors that you are likely to use in robotic adventure are DC motors and RC servo motors. The most

    common motor for robotics is DC gear motor , which works by gearing down a fast DC motor to make the motor turn

    at a slower speed and give the motor a higher torque suitable for robot locomotion.

    A dc gear motor is basically a regular dc motor with a special gear box attached to the output shaft. Your robot

    electrical drive circuitry can control the dc gear motor to rotate the wheels of your robot for locomotion.

    You can get a dc motor without a gear head, but generally these are too fast(around 15,000 RPM).For a robot to move

    at reasonable rate you have to gear down a DC motor to about 30 to 80 RPM. When you gear down a DC motor ,you

    get a slower speed and plenty of torque.

    H-bridge (L293B)

    The microcontroller sends a signal to the H-bridge that acts as a switch. If the signal received by the H-bridge is high

    it will rotate the motor or else it wont do so. Note that microcontroller only sends a signal to a switch which gives the

    voltage required by the motor to rotate. Here we are using L293B which can be used to control two motors.

    Pin connections for H-bridge:

    En1 & En2 are given logic 1 from microcontroller or give 5V from outside and are used to

    activate/deactivate one half of the H-bridge.V is the voltage that you want to supply to the motor(s) : 9 or 12V

    Vcc is the logic 1 or 5V

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    21/30

    To Derive DC motor Using H-Bridge:

    Here we have shown connection of H-Bridge using simple switches.

    1. When all the switches are open, the motor will not take any turn.

    2. When switches 1 and 4 are closed, current is allowed to pass through the motor i.e. motor will turn in one

    direction i.e. clockwise direction.

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    22/30

    3. To move the motor in opposite direction i.e. counterclockwise direction, switches 2 and 3 must be closed.

    4.If switch 1 and 3 are closed or switch 2 and 4 are closed. This will create a short circuit and current will flow to

    ground directly, but this case is invalid.

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    23/30

    The input we give at pins In1, In2 of L293 is the same as switch 1 and switch 2 of H-Bridge, respectively. However

    switch 3 and switch4 are complement of switch 1 and switch 2, respectively, such that when S1 = 0, S2 = 1 => S3 = 1,

    S4 = 0 and motor rotates anticlockwise.

    En 1 pin is used to enable Left motor.

    In1, In2 provide high/low signal to the motor.

    En2 pin is used to enable Right motor.

    In3, In4 provide high/low signal to the motor.

    Thus the logic required for controlling motion of the motor is as below:

    En1 In1 In2 En2 In3 In4 Type of motion of motor

    0 X X 0 x x No motion

    1 0 0 1 0 0 No motion

    1 1 0 1 1 0 Forward motion, both motors rotate clockwise

    0 0 0 1 1 0 Turn Left, left motor stops and right motor moves forward

    1 1 0 0 0 0 Turn Right, left motor moves forward and right motor stops

    Here we are using pins P1.0 and P1.4 for taking the inputs from the IR sensors after being amplified by LM324.

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    24/30

    The complete circuit diagram with all the integrated circuits required for making a line follower is

    shown below:

    Here we are using pins P1.0 and P1.4 for taking the inputs from the IR sensors after being amplified by LM324.

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    25/30

    CONTROL SECTION

    Microcontroller is used for the processing of the input data and controlling the output devices depending upon the

    input. We are taking input from the sensors, which is used to control the motion of the motors. The motors at the

    output section are used to run the Line Follower robot in a particular direction.

    The input to the microcontroller is fed as below:

    Pin 1_0 Left sensor status

    Pin1_4 Right sensor status

    This input is used to drive the left motor and the right motor through L293(motor deriver IC). For this, we need to

    provide six signals from microcontroller to L293, three for each motor, as below:

    P2_0 Enable(En1) signal for left motor

    P2_1 Switch1(In1) signal for Left motor

    P2_2 Switch2 (In2)signal for Left motor

    P2_3 Enable(En2) signal for Right motor

    P2_4 Switch1(In3) signal for Right motor

    P2_5 Switch2(In4) signal for Right motor

    We write the following program in a high level language ,C, which is compiled using Keil microvision3. Then we

    obtain the hex file using this compiler.

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    26/30

    PROGRAMMING

    //Program code for LINE FOLLOWER ROBOT

    #include

    sbit s1=P1^0; //declaring input pin from left sensor

    sbit s2=P1^4; //declaring input pin from right sensor

    #define in P1

    #define out P2

    void delay(unsigned int); // declaring a delay function

    void delay(unsigned int itime)

    {

    unsigned int i,j;

    for(i=0;i

  • 8/13/2019 Line Follower Robline follerot

    27/30

    out=0x1B; //1Bh = 00011011b

    break;

    case(1): //Turn Left

    out=0x18; //18h=00011000b

    delay(50); // Inserting a delay for 50ms

    break;

    case(16): // Turn Right, 16d=0x10

    out=0x03; //03h=00000011b

    delay(50); // Inserting a delay for 50ms

    break;

    }

    }

    }

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    28/30

    APPLICATIONS OF LINE FOLLOWER ROBOT

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

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

    3. Apparatus to control the automatic placing of material along a junction between surfaces with reference tothe form and position of the junction including a tool controllably movable to deposit material progressively

    along the junction in response to a control signal.

    4. An imager linked to the movement of the tool to produce an image of the surfaces. 5. By modifying the position of the sensors, same principle can be used in obstacle avoidance and edge

    detection.

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    29/30

    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 variedtypes of sensors and thus could be used in big industries for different applications.

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

  • 8/13/2019 Line Follower Robline follerot

    30/30

    REFERENCE

    THE 8051 MICROCONTROLLER AND EMBEDDED SYSTEMSBy Mohd. Ali Mazidi, Janice Gillispie Mazidi, Rolin D. McKinlay

    The 8051 MICROCONTROLLERBy Kenneth J. Ayala

    http://www.ikalogic.com http://www.roboticsindia.com http://www.electronicsforyou.com http://www.atmel.com www.fairchildsemi.com

    www.final-yearproject.com | www.troubleshoot4free.com/fyp/

    http://www.ikalogic.com/http://www.ikalogic.com/http://www.roboticsindia.com/http://www.roboticsindia.com/http://www.electronicsforyou.com/http://www.electronicsforyou.com/http://www.fairchildsemi.com/http://www.fairchildsemi.com/http://www.fairchildsemi.com/http://www.electronicsforyou.com/http://www.roboticsindia.com/http://www.ikalogic.com/