top of page

Line Follower Bot using Arduino Uno

Updated: Dec 29, 2022

In this project based on black line follower and white surface.

The line follower is an automated self-driven vehicle in which follows the line. In general, there are two types of line follower. one is a black line follower which follows the black line and the second is a white line follower which follows the white line. Line follower actually senses the line and follows it. These types of line followers are used in the industries, food restaurants for food delivery, the medical field for transmitting the medicine to the required patients, etc.

Circuit Diagram:



Components:

Arduino Uno - 1

Infrared Obstacle Avoidance IR Sensor - 2

L298N Motor driver module - 1

2WD Car chassis kit -1

9V battery - 1


For Programmed ardunio Uno & Price:


Explanation

IR Sensor has three terminals, two terminals for power supply and one terminal for Output. Additionally, there is a potentiometer to calibrate the sensor.


An IR sensor contains IR LED and a photodiode. The IR LED will be continuously emitting the IR rays and the photodiode will act as a receiver to the IR rays emitted by the IR LED. Whenever the IR rays emitted by the IR LED hits an object (Note: the surface shouldn’t be black color), the rays are reflected back. If the photodiode receives the IR rays emitted by the IR LED, then the output of the IR sensor is digital high. If the photodiode doesn’t receive any IR rays emitted by the IR LED, then the output will be digital low. When it comes to the operating voltage of the IR sensor, it operates on 5V and the output of the IR sensor module is either 5V (high) or 0V (low).



The concept of working of line follower is related to light. We use here the behavior of light at the black and white surfaces. When light falls on a white surface it is almost fully reflected and in the case of a black surface light is completely absorbed. This behavior of light is used in building a line follower robot

Arduino UNO is the main controller in the project. The data from the sensors (IR Sensors) will be given to Arduino and it gives corresponding signals to the Motor Driver IC.

L293D Motor Driver module IC is used in this project to drive the motors of the robot. It receives signals from Arduino based on the information from the IR Sensors.


Program Code:

At first, we will define the pins, which will make our coding easy. The pins which are connected to enable pins of the L293D module is called en1 or en2. The pins connected to the input pins of the L293D are defined as Left motot T1, Left motor T2, Right motot T1,Right motor T2 pins.

The sensor, which is connected to the right side of the line follower is called Right sensor and the sensor which is connected to the left side is called the Left sensor.



Arduino code:


#define Leftsensor 9 // left sensor

#define Rightsensor 2 // right sensor

#define LeftMotorT1 10 // left motor

#define LeftMotorT2 11 // left motor

#define RightMotorT1 3 // right motor

#define RightMotorT2 4 // right motor


void setup()

{

pinMode(Leftsensor, INPUT);

pinMode(Rightsensor, INPUT);

pinMode(LeftMotorT1, OUTPUT);

pinMode(LeftMotorT2, OUTPUT);

pinMode(RightMotorT1, OUTPUT);

pinMode(RightMotorT2, OUTPUT);

}

void loop()

{

// Move Forward

if(digitalRead(Leftsensor) && digitalRead(Rightsensor))

{

digitalWrite(LeftMotorT1, HIGH);

digitalWrite(LeftMotorT2, LOW);

digitalWrite(RightMotorT1, HIGH);

digitalWrite(RightMotorT2, LOW);

}

// Turn right

if(!(digitalRead(Leftsensor)) && digitalRead(Rightsensor))

{

digitalWrite(LeftMotorT1, LOW);

digitalWrite(LeftMotorT2, LOW);

digitalWrite(RightMotorT1, HIGH);

digitalWrite(RightMotorT2, LOW);

}

// turn left

if(digitalRead(Leftsensor) && !(digitalRead(Rightsensor)))

{

digitalWrite(LeftMotorT1, HIGH);

digitalWrite(LeftMotorT2, LOW);

digitalWrite(RightMotorT1, LOW);

digitalWrite(RightMotorT2, LOW);

}

// stop

if(!(digitalRead(Leftsensor)) && !(digitalRead(Rightsensor)))

{

digitalWrite(LeftMotorT1, LOW);

digitalWrite(LeftMotorT2, LOW);

digitalWrite(RightMotorT1, LOW);

digitalWrite(RightMotorT2, LOW);

}

}


Applications of Line Follower Robot

  • Line follower Robots are commonly used for automation process in industries, military applications and consumer applications.

  • They are very useful as they can work without any supervision i.e. they work as automatic guided vehicles.

  • With additional features like obstacle avoidance and other security measures, line follower robots can be used in driver less cars. 

Demo:

Pay and get arduino code.



94 views1 comment
bottom of page