Line Follower Bot using Arduino

Line Follower bot is an electronic machine which would follow black line or white line. In this tutorial, we will tell you how electronic bot would follow the black or white line. By using the proximity sensor, line follower bot would sense the signals of the black or white line and runs it over the colors. Proximity (IR) sensors have a receiver and transmitter to receive and transmits the light signals, when black surface detects light would be fully reflected and when white surface detects light would be absorbed.

Required Components:

  1. Arduino UNO
  2. Proximity (IR) Sensor -2
  3. BO- Motors -2
  4. L293D Motor Driver
  5. Power Supply
  6. Jumper Wires
  7. Chasis
  8. Caster Wheel
  9. Wheels -2

Circuit Diagram:

//LINE FOLLOWER ROBOT Code*//
//___________________________________________________________//
void setup(){
pinMode(6,OUTPUT);//LEFT MOTOR
pinMode(7,OUTPUT);//LEFT MOTOR
pinMode(6,OUTPUT);//RIGHT MOTOR
pinMode(7,OUTPUT);//RIGHT MOTOR
pinMode(2,INPUT);//LEFT SENSOR
pinMode(3,INPUT);//RIGHT SENSOR
}
//^^^^^^^^^^^^^^SETUP WAS COMPLETE^^^^^^^^^^^^^^^^^^
void loop(){
int l=digitalRead(2);//READING VALUE FROM LEFT IR SENSOR
int r=digitalRead(3);//READING VALUE FROM RIGHT IR SENSOR
if (l==0 && r==0){ //IF TWO SENSORS DETECT THE OBJECT IT WILL GO FORWARD
digitalWrite(6,HIGH); //LEFT MOTOR ON
digitalWrite(7,LOW); //LEFT MOTOR ON
digitalWrite(6,HIGH); //RIGHT MOTOR ON
digitalWrite(7,LOW); //RIGHT MOTOR ON
}
//————————————————————————————————
if (l==1 && r==0){ //IF RIGHT SENSOR DETECT THE OBJECT IT WILL GO RIGHT SIDE
digitalWrite(6,LOW); //LEFT MOTOR OFF
digitalWrite(7,LOW); //LEFT MOTOR OFF
digitalWrite(6,HIGH); //RIGHT MOTOR ON
digitalWrite(7,LOW); //RIGHT MOTOR ON
}
//————————————————————————————————
if (l==0 && r==1){ //IF LEFT SENSOR DETECT THE OBJECT IT WILL GO LEFT SIDE
digitalWrite(6,HIGH); //LEFT MOTOR ON
digitalWrite(7,LOW); //LEFT MOTOR ON
digitalWrite(6,LOW); //RIGHT MOTOR OFF
digitalWrite(7,LOW); //RIGHT MOTOR OFF
}
//————————————————————————————————
if (l==1 && r==1){ //IF TWO SENSORS DOES NOT DETECT ANY OBJECT IT WILL STOP
digitalWrite(6,LOW); //LEFT MOTOR OFF
digitalWrite(7,LOW); //LEFT MOTOR OFF
digitalWrite(6,LOW); //RIGHT MOTOR OFF
digitalWrite(7,LOW); //RIGHT MOTOR OFF
}
}
//^^^^^^^^^^^^^LOOP WAS COMPLETED^^^^^^^^^^^^^^^^^^^

4 thoughts on “Line Follower Bot using Arduino”

Leave a Reply

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