All Line follow Robot works with autonomous and which follow white line with black background or black line Robot with white background.
Here iam used 2 sensors like left sensor and right sensor to detect the line. For more details about IR Sensor and how to make PCB (Printed Circuit Board) for this circuits and how to add LCD display to indicate the movement of direction.
There are two types of line follower Robot.
1. Black Line Follower Robot.
2. White Line Follower Robot.
Based on sensor status, the MCU microcontroller (Here Iam used AT89C51) takes the position of the line with sensor and gives command to motors it moves like FORWARD, LEFT, RIGHT AND STOP action with help of motor drive IC L293D.
List of below-mentioned Components are needed to assemble a complete Robot.
1. AT89C51 Microcontroller -1.
2. L293D Drive Board -1.
3. 12V BOM (Battery operated Motor)-2 Nos.
4. Small Wheel -2 Nos.
5. IR Sensor Module -2 Nos.
Logic Table for Black Line Follower Robot.
CASE | RIGHT SENSOR | LEFT SENSOR | MOTOR DIRECTION |
1. | ON | ON | MOVE FORWARD |
2. | OFF | ON | LEFT TURN |
3. | ON | OFF | RIGHT TURN |
4. | OFF | OFF | STOP |
Complete C Program for Black line follower Robot. It is tested with KEIL compiler
#include <reg51.h> // Header File
sbit leftsensor = P1^0;
sbit rightsensor = P1^1;
sbit leftmotorp = P2^0;
sbit leftmotorn = P2^1;
sbit rightmotorp = P2^2;
sbit rightmotorn = P2^3;
sbit sound = P2^4;
void main() // Main program
{
P1=0xff;
P2=0x00;
leftsensor=1;
rightsensor=1;
leftmotorp = 0;
leftmotorn = 0;
rightmotorp =0;
rightmotorn =0;
sound = 0;
while(1) // Long loop
{
if(leftsensor==1 & rightsensor==1) // Move Robot Forward
{
leftmotorp = 1;
leftmotorn = 0;
rightmotorp =1;
rightmotorn = 0;
sound=0;
}
if(leftsensor==0 & rightsensor==1) // Move Robot left
{
leftmotorp= 0;
leftmotorn= 0;
rightmotorp=1;
rightmotorn = 0;
sound=1; // Left Turn Sound Indicator
}
if(leftsensor==1 & rightsensor==0) // Move Robot right
{
leftmotorp = 1;
leftmotorn = 0;
rightmotorp =0;
rightmotorn = 0;
sound =1; // Right Turn Sound Indicator
}
if(leftsensor==0 & rightsensor==0) // Stop Robot
{
leftmotorp = 0;
leftmotorn = 0;
rightmotorp =0;
rightmotorn = 0;
sound = 0;
}
}
}