Phone

    00852-6915 1330
  • Contents

catalog

introduction

Components Required

Block Diagram

Description

Hardware

Working

Arduino Code

Applications

Future Work

Introduction

A Line Follower Robot is an autonomous vehicle that follows a visual line on the floor or ceiling. The path of the line follower robot is typically a black line on a white surface, but it can also be a white line on a black surface. More advanced line follower robots use invisible magnetic fields as their guide.

Large line follower robots are often utilized in industrial settings to aid in automated production processes, as well as in military, human assistance, and delivery services.

The Line Follower Robot is often the first robotic project that beginners and students undertake, and in this project, we have developed a simple Line Follower Robot using Arduino and other components.

 

Components Required

  • Arduino UNO
  • L293D Motor Driver IC
  • Geared Motors x 2
  • Robot Chassis
  • IR Sensor Module x 2
  • Black Tape (Electrical Insulation Tape)
  • Connecting Wires
  • Power supply
  • Battery Connector
  • Battery Holder

 

Block Diagram

 

Block diagram

 

Hardware:

Figure 3

Circuit Diagram of Arduino Based Line Following Robot


The primary controller utilized in this project is the Arduino UNO, which receives input data from the IR sensors and subsequently provides corresponding signals to the Motor Driver IC.
The L293D Motor Driver IC is responsible for driving the motors of the robot, receiving signals from the Arduino based on the information obtained from the IR Sensors.
It is important to note that the power supply provided to the motors must be from the motor driver IC, and thus it is necessary to select an appropriate power supply capable of powering all components, including the motors.
Two geared motors have been implemented at the rear of the line follower robot, providing increased torque and the capability of carrying a load.

 

Working

We have created a Line Follower Robot using Arduino, which operates by detecting a black line on a surface and following it. The project's operation is relatively straightforward and is explained in more detail below.
As indicated in the diagram, sensors are necessary to detect the line. We utilized two IR Sensors for line detection, which include an IR LED and a Photodiode. The sensors are positioned side by side in a reflective manner so that when they come into contact with a reflective surface, the light emitted by the IR LED is detected by the Photodiode.
The picture below demonstrates the operation of a typical IR Sensor (IR LED - Photodiode pair) in front of a light-colored surface and a black surface. The infrared light emitted by the IR LED will be mostly reflected and detected by the Photodiode since the reflectivity of the light-colored surface is high.

Figure 3

 

If the surface is black and has low reflectivity, the light is completely absorbed by the black surface and doesn't reach the Photodiode.
To apply the same principle, we will install the IR Sensors on the Line Follower Robot in such a way that the two sensors are on either side of the black line on the floor. The arrangement is depicted below.

 

Figure 4

As the robot moves forward, both sensors are active and waiting to detect the line. If IR Sensor 1 detects the black line as shown in the image above, it implies that there is a right curve or turn ahead.
Arduino UNO detects this variation and sends a signal to the motor driver to adjust accordingly. To turn right, the motor on the right-hand side of the robot is slowed down via PWM, while the motor on the left-hand side continues to operate at the normal speed.

Figure 5

 

If the IR Sensor 2 detects the black line first, it indicates that there is a left curve ahead, and the robot must turn left. To execute a left turn, the motor on the left-hand side of the robot is slowed down (or can be halted entirely or turned in the opposite direction), while the motor on the right-hand side continues to operate at the normal speed.
The Arduino UNO continually monitors information from both sensors and directs the robot to follow the line detected by them.

 

Arduino Code

int mot1=9;
int mot2=6;
int mot3=5;
int mot4=3;

int left=13;
int right=12;

int Left=0;
int Right=0;

void LEFT (void);
void RIGHT (void);
void STOP (void);

void setup()
{
  pinMode(mot1,OUTPUT);
  pinMode(mot2,OUTPUT);
  pinMode(mot3,OUTPUT);
  pinMode(mot4,OUTPUT);

  pinMode(left,INPUT);
  pinMode(right,INPUT);

  digitalWrite(left,HIGH);
  digitalWrite(right,HIGH);
  
  
}

void loop() 
{
 
analogWrite(mot1,255);
analogWrite(mot2,0);
analogWrite(mot3,255);
analogWrite(mot4,0);

while(1)
{
  Left=digitalRead(left);
  Right=digitalRead(right);
  
  if((Left==0 && Right==1)==1)
  LEFT();
  else if((Right==0 && Left==1)==1)
  RIGHT();
}
}

void LEFT (void)
{
   analogWrite(mot3,0);
   analogWrite(mot4,30);
   
   
   while(Left==0)
   {
    Left=digitalRead(left);
    Right=digitalRead(right);
    if(Right==0)
    {
      int lprev=Left;
      int rprev=Right;
      STOP();
      while(((lprev==Left)&&(rprev==Right))==1)
      {
         Left=digitalRead(left);
         Right=digitalRead(right);
      }
    }
    analogWrite(mot1,255);
    analogWrite(mot2,0); 
   }
   analogWrite(mot3,255);
   analogWrite(mot4,0);
}

void RIGHT (void)
{
   analogWrite(mot1,0);
   analogWrite(mot2,30);

   while(Right==0)
   {
    Left=digitalRead(left);
    Right=digitalRead(right);
    if(Left==0)
    {
      int lprev=Left;
      int rprev=Right;
     STOP();
      while(((lprev==Left)&&(rprev==Right))==1)
      {
         Left=digitalRead(left);
         Right=digitalRead(right);
      }
    }
    analogWrite(mot3,255);
    analogWrite(mot4,0);
    }
   analogWrite(mot1,255);
   analogWrite(mot2,0);
}
void STOP (void)
{
analogWrite(mot1,0);
analogWrite(mot2,0);
analogWrite(mot3,0);
analogWrite(mot4,0);
  
}

 

Applications

  • Line follower robots have a wide range of applications, including industrial automation, military uses, and consumer applications.
  • Their capability to operate without human intervention, functioning as automatic guided vehicles, makes them highly beneficial.
  • With the addition of features such as obstacle avoidance and other safety measures, line follower robots have the potential to be utilized in driverless cars.

 

Future Work

  • To improve the accuracy of black line detection, it is possible to add more sensors. An array of sensors is more precise than just two sensors.
  • In this project, where only two sensors are utilized, their placement is critical for optimal performance. The size of the black line also influences the sensor placement.
  • An alternative way to construct a line-detecting sensor is by using an LED and LDR pair.

 

 

 

Karty

Karty is a seasoned writer with over 6 years of experience in the semiconductor electronics industry. She possesses a wealth of knowledge in the field, and her writing is characterized by a strong technical foundation and a keen eye for detail. Karty is also a creative thinker with a unique perspective, and her work often offers fresh insights into complex topics.

Join our mailing list!

Be the first to know about new products, special offers, and more.

Leave a Reply

We'd love to hear from you! Feel free to share your thoughts and comments below. Rest assured, your email address will remain private.

Name *
Email *
Captcha *
Rating:

Kynix

  • How to purchase

  • Order
  • Search & Inquiry
  • Shipping & Tracking
  • Payment Methods
  • Contact Us

  • Tel: 00852-6915 1330
  • Email: info@kynix.com
  • Follow Us

authentication

Kynix

© 2008-2026 kynix.com all rights reserved.