How to make a line following robot using Arduino?


Hello-tech geeks


In this article, I am going to tell you about the “LINE FOLLOWER ROBOT” 
when I say the word line follower the following questions come into your mind immediately.
  • What is line follower bot?
  • Why do we need a line follower?
  • What are the things required to make a line follower?
  • How to make it?
·       Mechanical
·       Electronics
·       Programming
          
 Don’t worry! 
 I will answer all the above questions clearly in this article! 


What is a Line Follower robot?

A line follower is a bot that follows a specific path that is line to move forward without any guidance. It follows the black line in the white area or the white line in the black area. Generally, line Followers are designed to follow the black line path. This Line Follower is fully autonomous to move on the black line path. These Line Follower Bot can be used for a wide range of applications because of its special feature to detect the black line path.

Why do we need a Line Follower robot?

The unique feature of Line Follower Bot can be used to fulfill many applications in the modern world. It can be used as an autonomous robot at the basic level and even at the industrial level.


To build a Line Follower robot you'll need:

  1. Wood Chassis as per requirement.
  2. B O Motors * 2
  3. Wheel * 2
  4. Free/Caster wheel * 1
  5. IR Sensor module * 3
  6. L293d/L298 Motor driver * 1
  7. Arduino UNO * 1
  8. Li-Polymer battery * 1
  9. Jumper wires M/F, F/F, M/M
  10. Single strand wires

 Steps to be followed to make a Line Follower  Mechanical and Electronic Part 


Step 1:


Initially cut the wood and design the chassis as per the requirement. In this, you can cut the plywood of the 90*30mm size.



Step 2 :

Fix the electronic components like Motor Driver and the BO Motors along with wheels to the chassis as shown in the following image.

Step 2.1


Step 2.2


Step 3 :

Now make all the connections from the Motor Driver, Arduino, BO Motors, IR sensors, and Battery as shown in the following circuit diagram.


Circuit Diagram

With the completion of step 3 entire Mechanical and Electronic part of the Line, A follower Robot is completed. Now the final and most important programming part is discussed.

Step 4 :

The Arduino code given below has to be dumped into the Arduino UNO board using a cable from the system. After successfully compiling and dumping of the code is done, the programming part is successfully completed.


Programing code for arduino to run the robot:



_________________________________________________________________________________

int  l1=3; //To move left motor forward
int  l2=4; //To move left motor backward
int  r1=5; //To move right motor forward
int  r2=6; //To move right motor backward
int   l=8;  //Left line Sensor
int   c=9; //Center  line Sensor
int   r=10; //Right line Sensor

void setup()
{

            //Pins defined for motor Output

pinMode ( l1, OUTPUT); //left motor
            pinMode ( l2, OUTPUT); //left motor
            pinMode ( r1, OUTPUT); //right motor
            pinMode ( r2, OUTPUT); //right motor
            
            //Pins defined for IR sensors input

            pinMode ( l, INPUT);  //Left IR sensor
            pinMode ( c, INPUT); //Center IR sensor
            pinMode ( r, INPUT); //Right IR sensor
}

void loop()
 {
  if  ((digitalRead (l)==1) && (digitalRead (c)==0) && (digitalRead (r)==1))
            {
                        digitalWrite ( l1, HIGH);
                        digitalWrite ( l2, LOW);
                        digitalWrite ( r1, HIGH);
                        digitalWrite ( r2, LOW);
            }   

             if ((digitalRead (l)==0) && (digitalRead (c)==1) && (digitalRead (r)==1))
            {
                        digitalWrite ( l1, HIGH);
                        digitalWrite ( l2, LOW);
                        digitalWrite ( r1, LOW);
                        digitalWrite ( r2, LOW);
            } 
  
             if ((digitalRead (l)==0) && (digitalRead (c)==0) && (digitalRead (r)==1))
            {
digitalWrite ( l1, HIGH);
                        digitalWrite ( l2, LOW);
                        digitalWrite ( r1, LOW);
                        digitalWrite ( r2, LOW);
            }   

             if ((digitalRead (l)==1) && (digitalRead (c)==1) && (digitalRead (r)==0))
            {
                        digitalWrite ( l1, LOW);
                        digitalWrite ( l2, LOW);
                        digitalWrite ( r1, HIGH);
                        digitalWrite ( r2, LOW);
            }   

            if ((digitalRead (l)==1) && (digitalRead (c)==0) && (digitalRead (r)==0))
            {
                        digitalWrite ( l1, LOW);
                        digitalWrite ( l2, LOW);
                        digitalWrite ( r1, HIGH);
                        digitalWrite ( r2, LOW);
            }   

            if ((digitalRead (l)==0) && (digitalRead (c)==0) && (digitalRead (r)==0))
            {
                        digitalWrite ( l1, LOW);
                        digitalWrite ( l2, LOW);
                        digitalWrite ( r1, LOW);
                        digitalWrite ( r2, LOW);
            }  

}

//The program Ends up here 
//Just copy this code and upload this program to the Arduino using Arduino IDE 
//Connect the motors and sensors as defined at the beginning of the program

_________________________________________________________________________________


Conclusion:

The building of the Basic Line Follower robot is successfully done and this Bot can follow the path of the black line and works autonomously by fulfilling the need of a Line Follower Bot. This basic Line Follower Bot has three IR sensors and can detect the black line even at the sharp turns and has good efficiency to enhance the victory in the Line Follower competitions.



Thanks a lot for spending your time to read this article

Feel free to ask any questions you have. Just comment down your

 queries, we'll answer them as soon as possible OR send us your

 concern on our Email id:




 STAY SAFE! 

 JAI   *   HIND 






Post a Comment

0 Comments