fbpx

Wall Following Robot

Wall Following robot moves along the wall without hitting the wall, it uses the obstacle detecting sensor to find the path and travel along the wall, Wall following robot used to map the area.

Block Diagram

WALL FOLLOWING WORKING

Robot Uses IR Sensor as an eye to detect the obstacle, Robot has three IR sensor module one at left, one at the front, one at right. The wall follower robot follows the path based on the distance between the wall & IR sensor. The output of the IR sensor goes to high when it detects the wall and remain low when the robot away from the wall.

  • When the output of all three sensors is low then the robot stop.
  • When the output of the left & front sensor at high, the robot takes right turn.
  • When the output of the right & front sensor at high, the robot takes left turn.
  • When the output of all three sensors is high then robot moves forward.

Required Components

  1. Bread Board.
  2. Connecting wires.
  3. Castor wheel.
  4. Robot Wheel.
  5. Robot Chasis.
  6. Motor Driver l293d.
  7. DC Geared or BO motor
  8. Arduino
  9. Battery
  10. LM7805
  11. Switch
  12. Capacitors 470uf & 100uf
  13. IR sensor module

WALL FOLLOWING ROBOT LOGIC TABLE

PinMapping

Between Arduino and L293D

Between Motor and L293D

Between Arduino &  IR Sensors

Circuit Diagram

Software Requirements

1.Arduino ID

FLOW CHART

Program

#define RIGHT_MOTOR_ONE 8
#define RIGHT_MOTOR_TWO 9
#define LEFT_MOTOR_ONE 6
#define LEFT_MOTOR_TWO 7

#define L1 2
#define L2 3
#define C 4
#define R1 5
#define R2 6
char Received_Data;

void setup() {
/* IR SENSOR pin configuration */
pinMode(L1, OUTPUT);
pinMode(L2, OUTPUT);
pinMode(C, OUTPUT);
pinMode(R1, OUTPUT);
pinMode(R2, OUTPUT);
/* Motor pin configuration */
pinMode(RIGHT_MOTOR_ONE, OUTPUT);
pinMode(RIGHT_MOTOR_TWO, OUTPUT);
pinMode(LEFT_MOTOR_ONE, OUTPUT);
pinMode(LEFT_MOTOR_TWO, OUTPUT);
}

void loop()
{
if (digitalRead(L1) == LOW && digitalRead(L2) == LOW && digitalRead(C) == LOW && digitalRead(R1) == LOW && digitalRead(R2) == LOW)
{
STOP_ROBOT();
}
else if (digitalRead(L1) == HIGH && digitalRead(L2) == HIGH && digitalRead(C) == HIGH && digitalRead(R1) == HIGH && digitalRead(R2) == HIGH)
{
MOVE_ROBOT_FORWARD();
}
else if (digitalRead(L1) == LOW && digitalRead(L2) == LOW && digitalRead(C) == HIGH && digitalRead(R1) == HIGH && digitalRead(R2) == HIGH)
{
MOVE_ROBOT_FORWARD();
}
else if (digitalRead(L1) == HIGH && digitalRead(L2) == HIGH && digitalRead(C) == HIGH && digitalRead(R1) == LOW && digitalRead(R2) == LOW)
{
MOVE_ROBOT_FORWARD();
}
else if (digitalRead(L1) == HIGH && digitalRead(L2) == HIGH && digitalRead(C) == LOW && digitalRead(R1) == HIGH && digitalRead(R2) == HIGH)
{
MOVE_ROBOT_REVERSE();
MOVE_ROBOT_LEFT();
}
else if (digitalRead(L1) == HIGH && digitalRead(L2) == HIGH && digitalRead(C) == LOW && digitalRead(R1) == LOW && digitalRead(R2) == LOW)
{
MOVE_ROBOT_REVERSE();
MOVE_ROBOT_LEFT();
}
else if (digitalRead(L1) == LOW && digitalRead(L2) == LOW && digitalRead(C) == LOW && digitalRead(R1) == HIGH && digitalRead(R2) == HIGH)
{
MOVE_ROBOT_REVERSE();
MOVE_ROBOT_RIGHT();
}
else if (digitalRead(L1) == LOW && digitalRead(L2) == LOW && digitalRead(C) == HIGH && digitalRead(R1) == LOW && digitalRead(R2) == LOW)
{
MOVE_ROBOT_REVERSE();
MOVE_ROBOT_RIGHT();
}
}

/* MOVE ROBOT FORWARD */
void MOVE_ROBOT_FORWARD()
{
digitalWrite(RIGHT_MOTOR_ONE, HIGH);
digitalWrite(RIGHT_MOTOR_TWO, LOW);
digitalWrite(LEFT_MOTOR_ONE, HIGH);
digitalWrite(LEFT_MOTOR_TWO, LOW);
}

/* MOVE ROBOT U-TURN */
void MOVE_ROBOT_UTURN()
{
digitalWrite(RIGHT_MOTOR_ONE, HIGH);
digitalWrite(RIGHT_MOTOR_TWO, LOW);
digitalWrite(LEFT_MOTOR_ONE, LOW);
digitalWrite(LEFT_MOTOR_TWO, HIGH);
delay(3000);
}

/* MOVE ROBOT REVERSE */
void MOVE_ROBOT_REVERSE()
{
digitalWrite(RIGHT_MOTOR_ONE, LOW);
digitalWrite(RIGHT_MOTOR_TWO, HIGH);
digitalWrite(LEFT_MOTOR_ONE, LOW);
digitalWrite(LEFT_MOTOR_TWO, HIGH);
}

/* MOVE ROBOT LEFT */
void MOVE_ROBOT_LEFT()
{
digitalWrite(RIGHT_MOTOR_ONE, HIGH);
digitalWrite(RIGHT_MOTOR_TWO, LOW);
digitalWrite(LEFT_MOTOR_ONE, LOW);
digitalWrite(LEFT_MOTOR_TWO, HIGH);
}

/* MOVE ROBOT RIGHT */
void MOVE_ROBOT_RIGHT()
{
digitalWrite(RIGHT_MOTOR_ONE, LOW);
digitalWrite(RIGHT_MOTOR_TWO, HIGH);
digitalWrite(LEFT_MOTOR_ONE, HIGH);
digitalWrite(LEFT_MOTOR_TWO, LOW);
}

/* STOP ROBOT */
void STOP_ROBOT()
{
digitalWrite(RIGHT_MOTOR_ONE, LOW);
digitalWrite(RIGHT_MOTOR_TWO, LOW);
digitalWrite(LEFT_MOTOR_ONE, LOW);
digitalWrite(LEFT_MOTOR_TWO, LOW);
}

 

Leave a Reply

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