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:
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.
Thus the logic for developing the code will be
- Right sensor hits the black track or giving logic low, turn Right.
- Left sensor hits the black track or giving logic low, turn left.
- Both sensors are in white floor go straight.
REQUIREMENTS:
- Robot Chassis
- Geared DC Motors
- Caster wheels
- Robot Wheels
- IR Sensor Cards (2 IR sensor module)
- IC L293D (Driver IC) , Read its working here
- 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:
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.
Sir if u have the hex code of this project…. Then please share
Sir if u have the hex code of this project…. Then please share
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?
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.
suggest some other color combinations for the tracks and also do tell me that this follower logic works under all luminosity conditions
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?
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