Line Follower Robot LFR Using 8051 Microcontroller

line-follower-robot-prototype-8051-microcontroller

Line Follower Robots are very familiar among robot enthusiasts and builders since almost everyone starts their journey with this simple project.And do not judge with their simplicity, these kinda robots proves extremely useful in industries, machinery and much.金宝搏188beat网登录appThis article will guide you to build your first line follower robot using 8051 family Atmel AT89S52 Microcontroller.

SCHEMATIC DESIGN OF LINE FOLLOWER ROBOT:

line-follower-robot-8051-microcontroller

This LFR uses two simple Infra red sensors comprising a IR led and a photodiode to detect the track laid on the surface.Since the black color is a great reflector of the IR beam it reflects back the beam to the diode and in turn it senses it.Do note that this LFR logic works only on black track laid on a white surface.

This Robot works based on a feedback signal sent by the Infra red sensors which is fixed on the sides of the chasis to the controller which processes the nature of track.This Infrared sensor output at a logic-low (L) state, when it detects a black color and vice versa.So in normal condition (white floor) sensor output is high. When these two sensors senses a white surface that is when there is no reflection the robot goes straight.But when Left sensor senses white and right one hits the black track the robot turns right and turns left when left sensors hits black track and right sensor in white.

typical-ir-sensor-module

Typical Infra red sensor

Thus the logic for developing the code will be

  1. Right sensor hits the black track or giving logic low, turn Right.
  2. Left sensor hits the black track or giving logic low, turn left.
  3. Both sensors are in white floor go straight.

REQUIREMENTS:

  1. Robot Chassis
  2. Geared DC Motors
  3. Caster wheels
  4. Robot Wheels
  5. IR Sensor Cards (2 IR sensor module)
  6. IC L293D (Driver IC) , Read its workinghere
  7. IC AT89S52 (8051 family)

And other stuffs such as Motor Clamps, Switches, Battery Holders, Batteries, Small Electronic Components, Screws & Nuts will be needed to build this.

SETTING UP TRACK:

track-setup-line-follower-robot

As i said before the track must be in black and should be laid on a white surface.Position the senors in chasis in such a way that it lies only about  to 6mm from the track surface.Also make sure that the distance between the sensors are wide enough so both the sensors will be in white surface when travelling straight.Refer to the above snap if you have doubts regarding the positioning of the sensors.

CODE:

#include
         
          sbit s1=P2^1;// sensor right  sbit s2=P2^2!// sensor left  sbit motor_pin_1 = P3^0!// connect motor pins to port 3  sbit motor_pin_2 = P3^1!sbit motor_pin_3 = P3^2!sbit motor_pin_4 = P3^3!void main ()  {  s1=0!s2=0!P3=0x00!//set Port 3 to low    while(1) //infinte loop  {  if((s1==1)&(s2==1)) //check sensor is high or not  {  // forward function  motor_pin_1 = 1!motor_pin_2 = 0!motor_pin_3 = 1!motor_pin_4 = 0!}    else if((s1==0)&(s2==1))  {  motor_pin_1 = 1!motor_pin_2 = 0!motor_pin_3 = 0!motor_pin_4 = 0!}    else if((s1==1)&(s2==0))  {  motor_pin_1 = 0!motor_pin_2 = 0!motor_pin_3 = 1!motor_pin_4 = 0!}    else if((s1==0)&(s2==0))  {  motor_pin_1 = 0!motor_pin_2 = 0!motor_pin_3 = 0!motor_pin_4 = 0!}  }  }
         

WORKING VIDEO:

Build this Cool Line Follower robot and get started with robotics.


7 Comments

  1. taha

    Sir if u have the hex code of this project….Then please share

    Reply
  2. Bishal

    Sir if u have the hex code of this project….Then please share

    Reply
  3. Christina

    actually i need this kinda set up in out door that is in a broad daylight.so will the sun light intensity affect the working of this robot also what are the colors that reflect IR beam?

    Reply
    1. Murugan Bala Murugan Bala(Post author)

      hi !Most widely used sensors for the line follower robot are PHOTOSENSERS.They are based on the basic observation that "the white surface reflects the light and the black surface absorbs it".Sensor circuit contains emitter, detector and comparator assembly.However IR light is also present in atmosphere but its intensity is much less than that of visible light, so IR light can give much reliable output.For better accuracy of the sensors, they must be covered properly for the isolation from the surrounding.)If the surface is white, more intensity of light gets reflected and for black surface very less intensity of light is reflected.

      Reply
  4. Christina

    suggest some other color combinations for the tracks and also do tell me that this follower logic works under all luminosity conditions

    Reply
    1. Murugan Bala Murugan Bala(Post author)

      hello christina,
      An IR sensor works based on reflection of beam by the surface.It will be useful if you explain a bit more about what you are actually trying to do?
      Are you trying to detect the presence or absence of light, or the reflectivity of some surface?

      Reply
      1. Christina

        i dont think you got my question.anyway thnks for the design and code i will try this with different conditions and let you know abt the result.thanks

        Reply

Leave a Comment

Your email address will not be published.Required fields are marked*

Baidu
map