fbpx

Line Follower Robot

One of the most  prominent  robot,  which follow particular path or line to reach destinaion,Robot uses infrared rays to follow the path. Application- Kiva Robots Amazon Warehouse Robot

Block Diagram

Line Follower Working

Robot Uses IR Sensor as a eye to follow the path, Robot has two IR sensor module ,one at right & one at left.Each IR sensor module consists of  IR transmitter and  receiver.In Line follower White Surface reflect the  IR ray where as Black surface observes the  IR ray based on this robot follows the desired path.When transmitter transmits the IR ray to white surface, it  reflects back the IR ray and that will be received by IR receiver so the output of IR sensor will be LOW.If transmitter transmits the IR ray to black surface then IR rays observed so output of IR sensor will be HIGH.Track made with Black line so based on the sensor output robot take decisions to follow the path.

  • When both sensors are on the white surface the robot moves forward.
  • When the left sensor on black line and right sensor on white,the robot takes a left turn. 
  • When the  right sensor on black line and left sensor on white,the robot takes a  right turn. 
  • When both sensors are on the black surface the robot stops.

Line Follower Robot Logic Table

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

PinMapping

Between Arduino and L293D

 Between Motor and L293D

Between Arduino and IR Sensor

CIRCUIT DIAGRAM

Software Requirements

1.Arduino ID.

Flow Chart

LINE FOLLOWER CONDITIONS

LINE FOLLOWER PATH

Program

/*
IR SENSOR PIN DEFINITION
|ARDUINO PIN NO| | IR SENSOR |
2 LEFT_SENSOR_INPUT
3 RIGHT_SENSOR_INPUT
*/
#define LEFT_SENSOR 2
#define RIGHT_SENSOR 3

/*
MOTOR PIN DEFINITION
|ARDUINO PIN NO| | IR SENSOR |
4 RIGHT_MOTOR_ONE_OUTPUT
5 RIGHT_MOTOR_TWO_OUTPUT
6 LEFT_MOTOR_ONE_OUTPUT
7 LEFT_MOTOR_TWO_OUTPUT
*/
#define RIGHT_MOTOR_ONE 4
#define RIGHT_MOTOR_TWO 5
#define LEFT_MOTOR_ONE 6
#define LEFT_MOTOR_TWO 7


void setup()
{
/* ir sensor pin configuration */
pinMode(LEFT_SENSOR, INPUT);
pinMode(RIGHT_SENSOR,INPUT);
/* 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 BOTH IR SENSOR IN BLACK SURFACE OUTPUT WILL BE HIGH STOP THE ROBOT*/
if( (digitalRead(LEFT_SENSOR) == HIGH ) && (digitalRead(RIGHT_SENSOR) == HIGH ) )
{
STOP_ROBOT();
}
/* IF LEFT IR SENSOR IN BLACK SURFACE & RIGHT IR SENSOR IN WHITE SERFACE MOVE ROBOT TO LEFT */
else if( (digitalRead(LEFT_SENSOR) == HIGH ) && (digitalRead(RIGHT_SENSOR) == LOW) )
{
MOVE_ROBOT_LEFT();
}
/* IF RIGHT IR SENSOR IN BLACK SURFACE & LEFT IR SENSOR IN WHITE SERFACE MOVE ROBOT TO RIGHT */
else if( (digitalRead(LEFT_SENSOR) == LOW) && (digitalRead(RIGHT_SENSOR) ==  HIGH ) )
{
MOVE_ROBOT_RIGHT();
}
/* IF BOTH IR SENSOR IN WHITE SURFACE OUTPUT WILL BE LOW MOVE ROBOT FORWARD */
else if( (digitalRead(LEFT_IR_SENSOR) == LOW ) && (digitalRead(RIGHT_IR_SENSOR) == LOW ) )
{
MOVE_ROBOT_FORWARD();
}
}

/* 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 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 *