Hey there, boys and girls welcome to our new blog How to Make Line Following Robot using Arduino UNO? So in this blog i will explain you that how to make this robot very easily at your home. Just follow our steps and do by yourself. So lets start this blog 👍👍
Components
- Chassis
- Gear Motor x 2 or 4 depends on you
- Jumper Wire
- Battery 12 v
- Arduino UNO
- L298N Motor Driver
- IR Sensor x 2
- Tyre Wheel
- Double Tape/Hot Glue Stick
So, now where to find the components, how will you purchase it? To purchase it go on Daraz.com.np or in himalayansolution.com or Amazon.com and purchase your product. If some products is not available here then simply ask to google baba to purchase your product. After collecting these all things go to next step on how to build line following robot.
First of all, fix your motor on the Chassis then fix your IR sensor on the front of robot then fix Arduino UNO and Motor Driver on the Chassis that’s all your Robots structure is ready now its time to wiring to the Robot and connect each components with each other for run the robot.

Circuit of Robot
So now how to wire the line following robot. That’s not a big problem its simple and easy just keep follow my steps. I have provided you the full wiring diagram/circuit diagram below see and exactly connect your wires accordingly else you will not be able to run the robot properly and will need to change the program which I will provide you.

Code
int a;
int b;
int in1=10;
int in2=11;
int ENA=6;
int SPEED=70;//speed of motor at white surface
int in3=9;
int in4=8;
int ENB=5;
void setup() {
// input pins declear
pinMode(in1,OUTPUT);
pinMode(in2,OUTPUT);
pinMode(in3,OUTPUT);
pinMode(in4,OUTPUT);
pinMode(ENA,OUTPUT);
pinMode(ENB,OUTPUT);
pinMode(12,INPUT);
pinMode(13,INPUT);
Serial.begin(9600);
}
void forward()
{
//forward function
digitalWrite(in4,HIGH);
digitalWrite(in3,LOW);
analogWrite(ENB,SPEED);
digitalWrite(in1,HIGH);
digitalWrite(in2,LOW);
analogWrite(ENA,SPEED);
}
void left()
{
// left function
digitalWrite(in4,HIGH);
digitalWrite(in3,LOW);
analogWrite(ENB,255);//speed control 1-255
digitalWrite(in1,LOW);
digitalWrite(in2,HIGH);
analogWrite(ENA,255);//speed control 1-255
}
void right()
{
//right finction
digitalWrite(in4,LOW);
digitalWrite(in3,HIGH);
analogWrite(ENB,255);//speed control 1-255
digitalWrite(in1,HIGH);
digitalWrite(in2,LOW);
analogWrite(ENA,255);//speed control 1-255
}
void stoped()
{
digitalWrite(in4,LOW);
digitalWrite(in3,LOW);
digitalWrite(in1,LOW);
digitalWrite(in2,LOW);
}
void loop() {
a=digitalRead(12);
b=digitalRead(13);
Serial.println(a);
Serial.println(b);
if (a==1 && b==1){forward();}
if (a==0 && b==1){left();}
if (a==1 && b==0){right();}
if (a==0 && b==0){stoped();}
}
// program ends here hope u learned something new
Now almost 80% of work is completed now its time to upload the code in Arduino UNO and your robot is ready to follow the black line, But after these all steps your bot is not detecting the line the please change the potentiometer value by putting the IR Sensor on black surface and white surface then your robot will definetly works properly.

Demo (Final Product😊)
After completing all these process and completing the robot you will get like this reasult which i have got and shared my robot small video for your trust. So enjoy this video also and tell us your experience about this.
Demo Link is here👇👇👇👇😒
Thanks for reading full blog post if you have any questions or query please let us know through comment box or contact me by email.