Line Follower Robot LFR Using 8051 Microcontroller

Share on FacebookShare on Google+Tweet about this on TwitterShare on RedditShare on StumbleUponPin on Pinterest

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. This 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 working here
  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<reg52.h>
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.

Related Designs and Schematics

Share on FacebookShare on Google+Tweet about this on TwitterShare on RedditShare on StumbleUponPin on Pinterest
The following two tabs change content below.
I'm an electronics enthusiast, I have a master's degree in Electronics and communication engineering (ECE) from the christ college of engineeering ,pondicherry university I love to explain things in simple ways

Ask your query

5 Comments on "Line Follower Robot LFR Using 8051 Microcontroller"

Notify of
avatar
Sort by:   newest | oldest | most voted
Christina
Guest

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?

Christina
Guest

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

wpDiscuz