• Sun. Oct 24th, 2021

    • Introduction: A Line Follower Robot, as the name suggests, is an automated guided vehicle, which follow a visual line embedded on the floor or ceiling. Usually, the visual line is the path in which the line follower robot goes and it will be a black line on a white surface but the other way (white line on a black surface) is also possible. Certain advanced Line Follower Robots use invisible magnetic field as their paths. Large line follower robots are usually used in industries for assisting the automated production process. They are also used in military applications, human assistance purpose, delivery services etc.
    • Materials:
      • Chassis (including motors and wheels )
      • Arduino UNO
      • L293D Motor Shield
      • IR Proximity Sensors (pair)
      • Jumper Wires
      • Switch
      • 4AA Battery Holder
    • Tools:
      • Soldering Iron
      • Hot Glue Gun
      • Screw Driver
    • Working of Line Follower Robot

    The line follower robot senses a black line by using a sensor and then sends the signal to Arduino. Then Arduino drives the motor according to sensors’ output.

    Here in this project, we are using two IR sensor modules namely the left sensor and the right sensor. When both left and right sensor senses white then the robot moves forward.

    If the left sensor comes on a black line then the robot turn the left side.

    If the right sensor sense black line then robot turn right side until both sensors comes at the white surface. When the white surface comes robot starts moving on forward again.

    If both sensors come on the black line, the robot stops.

    • How To Make:

    Circuit Diagram

    Now, assemble your robot body. Everyone may have a different chassis. So assemble your chassis accordingly. Most of the chassis come with an instruction manual. Then, attach the components to the chassis. Arduino, with the motor shield attached to it and also the holder must be fixed on the chassis.

    Also, attach the proximity sensors at the front on either side, facing down. Make sure that they are attached at the corners… Attach the switch too…

    • Sensor Connections:
      • Left Sensor >> Arduino:
        • Vcc >> 5v
        • Gnd >> Gnd
        • Out >> A4
      • Right Sensor >> Arduino:
        • Vcc >> 5v
        • Gnd >> Gnd
        • Out >> A5

    Connect the motors to the motor shield and plug the motor shield onto the Arduino board. Connect the battery holder to the shield through a switch. That’s it for the connections, let’s move on to the next step

    Code

    /*------ Arduino Line Follower Code----- */
    /*-------defining Inputs------*/
    #define LS 2      // left sensor
    #define RS 3      // right sensor
    /*-------defining Outputs------*/
    #define LM1 4       // left motor
    #define LM2 5       // left motor
    #define RM1 6       // right motor
    #define RM2 7       // right motor
    void setup()
    {
      pinMode(LS, INPUT);
      pinMode(RS, INPUT);
      pinMode(LM1, OUTPUT);
      pinMode(LM2, OUTPUT);
      pinMode(RM1, OUTPUT);
      pinMode(RM2, OUTPUT);
    }
    void loop()
    {
      if(digitalRead(LS) && digitalRead(RS))     // Move Forward
      {
        digitalWrite(LM1, HIGH);
        digitalWrite(LM2, LOW);
        digitalWrite(RM1, HIGH);
        digitalWrite(RM2, LOW);
      }
      
      if(!(digitalRead(LS)) && digitalRead(RS))     // Turn right
      {
        digitalWrite(LM1, LOW);
        digitalWrite(LM2, LOW);
        digitalWrite(RM1, HIGH);
        digitalWrite(RM2, LOW);
      }
      
      if(digitalRead(LS) && !(digitalRead(RS)))     // turn left
      {
        digitalWrite(LM1, HIGH);
        digitalWrite(LM2, LOW);
        digitalWrite(RM1, LOW);
        digitalWrite(RM2, LOW);
      }
      
      if(!(digitalRead(LS)) && !(digitalRead(RS)))     // stop
      {
        digitalWrite(LM1, LOW);
        digitalWrite(LM2, LOW);
        digitalWrite(RM1, LOW);
        digitalWrite(RM2, LOW);
      }
    }
    

    Leave a Reply

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