Line Follow Robot with Atmega8 microcontroller

Line Follow Robot with Atmega8 microcontroller

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

blac line

The MCU reads the 2 line sensor outputs for the position of the left sensor and right sensor logic level. Here my robot follows the black line.

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.

r1
Chassis for two motors and Castor Wheel assembled.
r5
Wheel and Motor assembly.
r4
Assembled Chassis Top View.

r6
At Top of the chassis MCU board and motor drive circuits.
r7
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;
}
}
}

Subramanian
Subramanian

Subramanian MK, currently serving as a workshop instructor at Sakthi Polytechnic College, Erode Tamil Nadu. With a career spanning 25 + years, Subramanian MK has dedicated himself to advancing knowledge in Electronics and Communication Engineering (ECE). His passion for exploring new technologies has led to the development of numerous projects, showcasing expertise in IoT and PCB design.

Articles: 510

3 Comments

  1. The Coding is wrong for Black-line follower robot. In case of LS=1,RS=1..The Robot should go forward. but your code is different.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

×

Hi, How can I help you?

×