Blogs Electronic Engineering Study Material Engineering Projects

Make Line Following Robot Using Arduino | Easy Steps|

Make Line Following Robot Using Arduino

Line Following Robot is very simple and logical robot, If you have interest in Electronics and Making Projects then you are at right place, my friend. Today in this tutorial I will tell you that how you can make Line Following Robot in Easy Way. Line Following Robot has become trendy for Beginners and for those who have interest in making Projects and New things. This is a very basic project and I am sure if you make this project then your interest level will be increased and it will give you the boost to make other projects too ūüėČ So let’s get Started.

Arduino_Logo

What is Line Following Robot?

A-Line Following Robot is toy car type robot which follows a particular line (Black or White Line) it is Autonomous Robot which is consist of Micro-Controller and Pair of IR (Infrared) Sensors and DC Gear Motors. We Will put Some Instructions into an Arduino( Micro-Controller) and that instruction will decide whether a Robot have to run in the forward direction or in the left direction or right direction. So I hope now you have an idea of Line Following Robot.

So let’s Move on another part which is Components Required for Making Line Following Robot.

Components Required:

  1. Arduino Uno R3
  2. Pair of IR (Infrared) Sensor (Approx: 2 to 5 will work great)
  3. Motor Driver IC LM293D
  4. Body for Robot (You can Make body from Plastic or Wood it Depends on you)
  5. Two DC Gear Motor
  6. Two Wheels
  7. Hot Glue and Cable Ties
  8. Connecting Wires.
  9. 9v Battery

Working of Line Following Robot

Line Following Robot Following Black Line

Working of Line Following Robot is Very simple and logical too. It is simple in that way it will follow the Black or White line. but to do that we have to make some logical operation into Arduino.In-Line Following Robot¬† we are using Two Dc Motors two IR modules which are consist of IR Transmitter and IR Reciever whenever the IR Transmitter emits the light than it strikes on the surface and then it reflects back toward the IR Reciever (Except Black line), then IR Reciever gives output proportional to the reflectance of the surface and Then Arduino gives instruction to the DC motor according to that Motors will go in forward direction or left or right. Quite Difficult nah? Don’t Worry Let me make it simple ūüėÄ

How will Line Following Robot Change Direction Autonomously?

If Line (Black or White) Goes Straight:

Line Following Robot forward

When Line goes straight we have to make IR pairs in such manner that it will be on the white surface and our motors will move in the Forward Direction.

If Right IR Sensor Goes On Black Line:

Line Following Robot right
Line Following Robot right

When Right IR Sensor Goes On Black Line then It will not receive any signal and the other IR Pair which is on the white surface will receive the signal and make the motor of right side to be stopped and the motor from the left side will be in the forward direction and that will produce turn on the right side.

If Line (Black or White) Goes Left:

Line Following Robot left
Line Following Robot left

When LEFT IR Sensor Goes On Black Line then It will not receive any signal and the other IR Pair which is on the white surface will receive the signal (same as Previously) and it will make the motor of the left side to be stopped and the motor from the right side will be in the forward direction and that will produce turn on the left side.

Line Following Robot Stop
Line Following Robot Stop

Assembling the Components of the Line Following Robot:

Line_following_robot with chassis
Line_following_robot with chassis

Take the plastic or wood chassis and put the two DC gear motors on the left and
right edges and stick them with Hot Glue. mount the Arduino UNO R3 and
Breadboard on the surface of the Chassis using Cable Tie and also connect
ICL293D on the breadboard and then connect the 9v Battery on the surface of
Chassis and now connect the pair of IR Module and make sure that the pair has
minimum distance towards the surface so they can work well. Now The
Assembling Part is Complete let’s go for Connection of Line Following Robot.

Connections of Line Following Robot:

Line Following Robot Circuit Diagram
Line Following Robot Circuit Diagram

Note:

  • All Red Wires are connected with Postive Supply (9v).
  • All Black Wires are connected with Negative Supply(Gnd).
  • And The Green Wires are connected with Digital Pins of Arduino (4,5,6,7).
  • All Blue Pins are connected to the Digital pin (2,3).
  • Zoom in Circuit Diagram for better Understanding.

Arduino Code For Line Following Robot:

To Upload the Code you Need an Arduino IDE Software click here to download that software.

If you want to learn about Arduino then Click here.

#define LS 2      // left sensor
#define RS 3      // right sensor

/*——-definning 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);
}
}

Or you can Donwload the code here.

Just Copy and Paste this code into Arduino IDE then upload the code your Line Following Robot is Ready to make a path try your robot and have fun. If you find this article helpful then comment below and appreciate the efforts and if you have any query regarding this post just comment below I will put my maximum efforts to help you out. Thanks For Visiting Stay Connected with Better and Best Stuff…

Sohailanwar

I am Sohail Anwar, a professional blogger from Hyderabad, Sindh. I am an Engineering Student, Studying In Electronic Engineering and I am enthusiastic Blogger, SEO expert and Hacker. As an author, I am trying my best to improve this platform day by day by Uploading fresh content daily.

http://www.studentsheart.com

Leave a Reply

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