How To Make Line Follower Robot Using Arduino

When we talk about simple robotics technology that is operated through any kind of microcontroller, then a popular name is come out i.e a Line Follower Robot. Line follower robot is a self automation robotic technology that can detect a visual line on the floor. This is the line in which the robot can follow this and it should be a black line on a white surface (vice versa can be possible). At a certain advanced level, an upgraded line follower robot can follow a magnetic field as the following path.

Large line follower robots are used due to the automated production process in industries. It is not only used in industries but also in military applications, human assistance purposes, and also in delivery services, etc.

The line follower robot is the best robotics project in which a beginner level school and engineering students can easily build this. In this project, we will be going to build a simple Arduino based line follower robot with a few components.

Must Read Obstacle Avoiding Line Follower Robot


obstacle avoiding line follower robot using arduino
Line Follower Robot

Circuit Diagram

Line Follower Robot Circuit Diagram
Line Follower Robot Circuit Diagram

Components Required

  • Arduino Nano
  • L298 Motor Driver
  • Geared Motors (x4)
  • IR Sensor Module (x2)
  • Electrical Tape (Black)
  • Wires
  • Chassis
  • 12V Power supply

Note: Here we are using a ready-made IR Sensor module, but you can use your own IR Sensor module. Here is the link to “How to build an IR Sensor module

About Parts


line follower robot microcontroller

For the compact build, I choose Arduino Nano despite Arduino UNO. Arduino Nano is a small, flexible microcontroller board using an Atmega328p chip. It can also use as a substitute for UNO. All the functions are the same in these two boards. The size of its PCB is 18×45 mm. The clock speed is 16Mhz. Its input voltage is 5-12V. There are 30 pins including power pins, data pins, analog pins, serial pins on this board.

L298 Motor Driver

line follower robot motor driver

If you have selected the DC geared motors then you can either use the L298N driver module or an L293D driver module. Both are similar in work. The Difference is that L298N is more powerful than L293D. But in that case, we can use any of them.


robot motor

The best choice of motor that you can use for a line following robot, without a doubt will be a DC geared motor. Yes, it is not mandatory to have a costly motor; the bot works fine with these cheap yellow-coloured DC geared motors as well.


robot wheel

I had a tough time figuring out that the problem was with my wheels. So make sure your wheels have a good grip over the floor you are using. Watch closely, your grip should never allow your wheels to skit on the floor.



Another place where you should not compromise is with your robot’s chassis. You can use cardboard, wood, plastic anything that you are good with the line following robot. But, just make sure the chassis is sturdy and should not wiggle when the robot is trying to run. I have designed my own chassis with cardboard.

Note: The power supply to the motors must be given from the motor driver IC. Hence, choose the appropriate power supply which is sufficient for all the components including the motors.

PCB Design

For removing messy wiring and give a clean look, I designed a PCB prototype for this project. It is also helpful for troubleshooting that runs great without any errors. To design this PCB board, I used EasyEDA as it is too easy to use. For ordering PCB for this, I prefer PCBWay.

Gerber file for Line Follower Robot Gerber.

You can view the Gerber file from here Gerber File Viewer.

PCB View

Line Follower Robot 2D View
2D View
Line Follower Robot 3D View
3D View

Order PCB From PCBWay

There are so many forums or communities for electronics online in today’s technical world, and one of the famous ones for PCB manufacturing is the PCBWay. PCBWay is a place that brings manufacturers and customers together. They have more than a decade of experience in this field of fabrication, prototyping and assembling PCBs. PCBWay have proved their focus to their customers’ needs in terms of cost-effectiveness, delivery, and quality.

How PCB Manufacturing Process Done in PCBWay

Standard quality for any product needs to be maintained using some parameters. PCBWay gives that opportunity by quality control in designing and manufacturing. At first, they ensure accuracy, clarity, validity of the PCB files that we sent to them.

Then all the boards will go through the most stringent tests other than the basic visual check. They adopt most of the testing and inspecting equipment used in the industry, such as Flying Probe Tester, X-Ray Inspection Machine, Automated Optical Inspection (AOI) Machine. PCBWay are having 50+ new engineers on the daily basis around the world using PCBs for their work, who trust for their reliable quality. They produce high-quality pink, orange, grey, even transparent solder mask. Moreover, according to people’s needs, they can also provide Black core PCB. Check it out for a High-Quality PCB solder mask. There are some pictures below of the new colours of solder musks.

Features of PCBWay

PCB Prototyping & Manufacturing: PCBWay produces FR-4 and Aluminum boards and advanced PCBs like Rogers, HDI, Flexible and Rigid-Flex boards, at a very reasonable price. Just check this Instant Quote to order premium PCBs for your hobby projects.

PCB Assembly: It not only offers PCB Prototyping but also offers PCB Assembly service. You can order a full PCB board with attached components by uploading your file. SMT & THT assembly starts from only 30$ including free stencil and worldwide shipping. The components can be sourced and provided by PCBWay, or by clients themselves.

Open Source Community: It not only offers PCB Prototype & Assembly service but also gives opportunities to students for sponsorships. I think this is so great. They feature their projects on the website also.

3D Printing & CNC: It also produces Rapid Prototyping like 3D printing, CNC Machining, Sheet Metal Fabrication, and Injection Molding. The quality of the product is too premium and reliable. And also the best part is that you will receive your order within a minimum of 3 days.

PCBWay Store: More boutique gift modules are waiting for you to discover, giving your creativity wings. You can order all types of electronic equipment, components and many more with exciting offers. Go with the link and buy your needs, PCBWay Store.

Services: PCBWay offers great servicing of their products. It takes only 3 to 15 days according to courier service to deliver your products. Also, it has a live support facility. Whenever you have any problems, you can always reach a live customer service person to respond to your emails or messages. They have the “Return and Refund” principle, for every unusable board caused by PCBWay, they will rebuild and refund the order soon.

Guide for Ordering PCB From PCBWay

Working Principle of Line Follower Robot

In this project, we have built an Arduino based Line Follower Robot. The working principle of this line follower robot is too easy. It detects the black line on the surface and goes through that line. We explained a detailed description of this project.

As mentioned in the above circuit diagram, we need sensors to detect the line. For line detection logic, we used two IR Sensor modules, which consist of an IR Transmitter and an IR Receiver. So that whenever they come into proximity of a reflective surface, the light emitted by the IR Transmitter will be detected by the IR receiver.

As the reflectance of the light-coloured surface is high, the infrared light emitted by the IR Transmitter will be maximumly reflected and will be detected by the IR Receiver.

In the case of the black surface, which has a low reflectance, the black surface completely absorbs the IR rays and doesn’t reach the IR Receiver.

Using the same principle, we will set up the IR Sensors on the line follower robot such that the two IR Sensors are on either side of the black line on the floor.

When the robot moves forward, both the sensors wait for the line to be detected. For example, if the IR Sensor 1 detects the black line, it means that there is a right curve (or turn) ahead.

Arduino detects this change and sends a signal to the motor driver accordingly. In order to turn right, the motor on the right side of the robot is slowed down using PWM, while the motor on the left side is run at normal speed.

Similarly, when the IR Sensor 2 detects the black line first, it means that there is a left curve ahead and the robot has to turn left. For the robot to turn left, the motor on the left side of the robot is slowed down (or can be stopped completely or can be rotated in opposite direction) and the motor on the right side is run at normal speed.

Arduino continuously monitors the data from both the sensors and turns the robot as per the line detected by them.

Applications of Line Follower Robot

  • Line follower Robots are in use for the automation processes in industries, military applications, etc.
  • 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 driverless cars.

Arduino Code for Line Follower Robot

Leave a Comment