Creating a Line Follower Robot using Arduino Nano

Well, guys this is one of the project that never gets old. This was the first thing I did when I started learning about Arduino. An Arduino Line Follower Robot – A Line Follower Robot Using Arduino UNO and IR Sensor, which follows a line without user interaction. A small autonomous robot which will “see” and follow the line and take decision when it sees a turn by itself.

New to Robotics?

We have a beginners guide on “Getting Started with Robotics” which will give you a kick start in this field. Check out our free video tutorial below for a brief introduction. 

Arduino Line Follower Robot

In this tutorial, we will discuss the working of an Arduino line following robot which will follow a black line in white background and take the correct turn whenever it reaches curves in its path.

Arduino Line Follower Components

Before jumping into line following robot tutorial, let’s get familiarized with the components used. If you are an expert and familiar with these components you can skip this section and straight away jump to the tutorial and start building Arduino Line Follower.

The Chasis of the Arduino Line Follower Robot

The first thing to do is build a chassis for WiFi Robot using Arduino. You can build it the way you like. The only thing you should keep in mind is, it should have enough space for Arduino, L293D Motor Driver, and a LIPO battery. For our project, I will be using a 12V LiPo Battery. You can use foam board or aluminum sheet or wood piece for building the base. These are some of the best robot chassis available for you to build this project. Check out the link below.

Get the Best Robot Chassis Online


You all might be familiar with Arduino; which is the most widely used and fastly evolving electronic platform with so many microcontroller boards and software. For our line following robot, I will be using Arduino UNO which is the most commonly used board. The Arduino Nano is the best option to get started with electronics and coding if this is your first experience with Arduino Platform. You can use any Arduino Board for this project.

IR Sensor

As mentioned earlier, our line following robot will be following a black line in a white background. So we need something that will ‘see’ the line and tell the line follower to follow the line or to turn around if it is going away from the line. For this purpose, we will be using an IR (Infra Red) Sensor

This IR sensor mainly consists of an IR transmitter (IR LED) and an IR receiver. IR LED always emits IR rays to the direction it is pointing to. When the IR rays hit a surface, some rays will be reflected back depending upon the color of the surface. Means, the brighter the color is, the more IR will be reflected back. Darker the color is, more IR will be absorbed by the surface and lesser IR rays will be reflected back.These reflected rays are sensed by the IR receiver and depending upon the received IR rays, the resistance of the receiver varies which will, in turn, varies the output voltage. Thus it is possible to sense the color of the surface where the robot is running by looking into the reflected IR rays. So it is very easy to measure how bright the surface is which will make it easy for us to track the line.

There are so many cheap IR sensors available online; you can purchase any of them. You will need at least two of them for making the line follower robot.

H Bridge and L293D Motor Driver

An H-bridge can be any switching circuit using Bipolar Junction Transistors (BJT) or Field Effect Transistors ( MOSFET or MESFET) which allows a voltage to be applied across a DC motor without making physical or hardware changes in the circuit. H Bridge circuits are widely used in the field of robotics to switch the direction of DC...

Read more »