WALL FOLLOWER USING 8051 (iBOT)
Wall Follower using iBOT or 8051 is built using TSOP based infrared sensor
module. The Right module is used to detect the wall on the right of the iBOT.
Wall follower application can be built with only one module, but we are using
the other sensor to avoid obstacle in front of the robot. The Right module is
connected at approximately 45 degree to the board so as to detect the wall as
shown in the image.
For TSOP module circuit diagram click here
For Purchasing TSOP based infrared sensor module click here
iBoard available on TRI Roboshop : Click here
PROGRAM CODE IN TRIC
For Downloading TRIC click here
/*WALL FOLLOWER USING 8051
Here we are using 2 IR TSOP modules and iBOT will follow the wall on its right.
The right TSOP module is for detecting the wall and the left module is used to
avoid the iBOT from bumping into the front wall or obstacle. The Modules are
connected as shown in the image
Right Module is connected at P1_0
Left Module is connected at P1_1
Right Motor is connected at P2_0 & P2_1
Left Motor is Connected at P2_2 & P2_3*/
/*Working Principal
Here if BOT detects wall on right it goes away from the wall
If it does not detect wall on right it goes right until the wall is detected*/
_________________________________________________________________________
#include<P89V51RD2.h>
#include<delay.h>
#define fwd 0×05 // 01 01 Motor 1 and 2 in forward direction
#define left 0×04 // 01 00 Motor 2 in forward direction and Motor 1 at halt
#define right 0×01 // 00 01 Motor 1 in forward direction and Motor 2 at halt
void main()
{
P1= 0xFF; // Port 1 initialized as input
P2= 0×00; // Port 2 initialized as output
while (1)
{
if (P1_0==0 && P1_1==0) // if wall is present in front and on right
{
P2= left;
DELAY (250);
}
if (P1_0==0 && P1_1==1) // if wall is present on right and not in front
{
P2= left;
DELAY (50);
P2= fwd;
DELAY (50);
}
if (P1_0==1 && P1_1==1) // if wall is not present on either side
{
P2= right;
DELAY (50);
P2= fwd;
DELAY (50);
}
if (P1_0==1 && P1_1==0) // if wall is present in front but not on the side
{
P2= left;
DELAY (250);
}
}
}
