Line following robot
Abstract
Line follower Robot is a machine which follows a line, it may be a black line or a white line.
Basically two types of line follower robots are: one is black line follower which follows black line
and second one is white line follower which follows white line. Line follower actually senses the
line and run over it. In our previous projects, we have made a black line follower robot using
arduino but this time we are going to make white line follower using 8051 microcontroller.
Working
We can divide the whole line follower robot into various sections like sensor section, control
section and driver section.
Sensor section: This section contains IR diodes, potentiometer, Comparator (Op-Amp) and
LED’s. Potentiometer is used for setting reference voltage at comparator’s one terminal and IR
sensors sense the line and provide a change in voltage at comparator’s second terminal. Then
comparator compares both voltages and generates a digital signal at output. Here in this circuit
we used two comparator for two sensors. LM358 is used as comparator. LM358 has inbuilt two
low noise Op-amp.
Control Section: 8051 microcontroller is used for controlling whole the process of line follower
robot. The outputs of comparators are connected to pin number P0.0 and P0.1 of 8051. 8051
reads these signals and send commands to driver circuit to drive line follower.
Driver section: Driver section consists motor driver and two DC motors. Motor driver is used for
driving motors because microcontroller does not supply enough voltage and current to motor. So
we added a motor driver circuit to get enough voltage and current for motor. Microcontroller
sends commands to this motor driver and then it drive motors.
Working of Line Follower Robot using 8051
Line follower robot senses white line by using sensor and then sends signals to microcontroller.
Then microcontroller drives the motor according to sensors' output.
Here in this project we are using two IR sensors pair. Suppose we are calling left sensor and
right sensor of IR sensor Pair, then both left and right sensors sense nothing or black line then
robot move forward.
And when left sensor senses white line then robot turn left side.
and when left sensor sense white line then robot turns to right side until both sensor comes at
black line or senses nothing surface.
And when both sensors comes on white line, robot stop.
Code
// C Program for line follower robot using 8051 microcontroller
#include<reg51.h>
sbit ls=P0^0;
sbit rs=P0^1;
#define motor P2
#define forward 0x06
#define turn_left 0x82
#define turn_right 0x14
#define stop 0x00
void main()
{
motor=stop;
while(1)
{
if(ls && rs)
motor=forward;
else if(!ls && rs)
motor=turn_left;
else if(ls && !rs)
motor=turn_right;
else
motor=stop;
}
}
Layout and circuit diagram: