DIY – Means Do It yourself. Make simple and Low cost LFR-Line Following Robot using AT89c51 Micro controller IC.
A line follow robot is autonomous robot that follows here my robot either BLACK LINE IN WHITE BACKGROUND or WHITE LINE IN BLACK Background.
The motor drive circuit is used to ON/OFF the LEFT/RIGHT motors of the robot to provide desired motion. Here 2 sensors is used to detect the line and its logic level. Based on the status of the sensors, the comparative circuit gives output to input of micro controller circuit. MCU decides the position of line and also the required direction of motion required to follow the line.
BLACK LINE FOLLOWER ROBOT LOGIC STATUS.
STATUS | LEFT SENSOR | RIGHT SENSOR | MOTOR DIRECTION |
CASE-1 | ON | ON | Forward direction |
CASE-2 | OFF | ON | Left Turn |
CASE-3 | ON | OFF | Right Turn |
CASE-4 | OFF | OFF | Stop |
FORWARD Condition:
So that initially the left and right sensor outputs are HIGH. So that left and right motor starts forward direction.
TURN RIGHT Condition:
If robot turns left direction, the left sensor value goes to Low, then MCU stops left motor and start its right motor to forward direction.
TURN LEFT Condition:
If robot turns right direction, the right sensor value goes to Low, then MCU stops right motor and start its left motor to forward direction.
STOP:
If both sensors are on the black line, the left and right sensor logic output goes to low then left and right motor will OFF.
HOW TO ASSEMBLE Line Follow Robot.
Chassis for two motors and Castor Wheel assembled.
Wheel and Motor assembly.
Assembled Chassis Top View.
At Top of the chassis MCU board and motor drive circuits.
Complete assembled line Following Robot
PROGRAM FOR BLACK LINE FOLLOWING ROBOT.
#include<reg51.h>
sbit SR=P1^7; //right sensor
sbit SL=P1^6; //left sensor
sbit MRp=P1^4; //right motor positive terminal
sbit MRn=P1^3; //right motor negative terminal
sbit MLp=P1^2; //left motor positive terminal
sbit MLn=P1^1; //left motor negative terminal
void main()
{
SR=SL=1;
MRp=MLp=MRn=MLn=0;
while(1) // Long Loop
{
if(SR==0 && SL==0)
{
MRp=1; MRn=0; //forward
MLp=1; MLn=0;
}
if(SR==1 && SL==0)
{
MRp=1; MRn=0; //left turn
MLp=0; MLn=1;
}
if(SR==0 && SL==1)
{
MRp=0; MRn=1; //right turn
MLp=1; MLn=0;
}
if(SR==1 && SL==1)
{
MRp=0; MRn=0; //stop
MLp=0; MLn=0;
}
}
}