DIY Line follower Robot


Discover the fascinating world of robotics with our latest blog on DIY Line Follower Kits using Arduino! Dive into the Introduction of this innovative project, unlocking the secrets behind the Working of a Line Follower Robot. Explore the essential Components Required to assemble your own bot, followed by a step-by-step guide to Assembling and Coding. Whether you're a tech enthusiast or a beginner, this blog has something for everyone. Ready to embark on a journey of creativity and learning? Read on for insights and wrap up with a satisfying Conclusion. Your robotic adventure starts here.


This Line Follower Robot Using Arduino is an innovative robotic platform that allows users to program and customize their own robots. The robot is simple to assemble, requires minimal programming experience, and can be adapted for a wide range of applications including navigation between two points or following shapes like circles on the floor. It uses infrared sensors mounted beneath its body which detect black lines against light surfaces such as white tiles – allowing it to track pre-programmed paths with ease! With this high quality solution from Arduino, creating your perfect line follower has never been easier.



read more : Interfacing Proximity Sensors with Arduino

Working of Line Follower Robot

Line Follower Robot is a robotic device that has the capability to detect and track a line drawn on the ground. It can follow any type of surface, including straight or curved lines drawn directly onto surfaces such as drywall, carpets, wood floors and more. With advanced programming features built into its board logic circuit along with an Arduino microcontroller-based platform utilized for controlling input/output operations of sensors related components like motor drivers for motion control; it autonomously tracks paths regardless of size or shape accurately in real time.

Using fancy algorithms integrated within Line Followers' system design allows them to utilize light detection technique through various implementations like Photoresistor Arrays paired with Light Sensors programmed accordingly depending upon application requirements by providing direction information based off contrast between two different patterns given by black following white indicating left turns while vice versa being right turn indications or other labelled signals (e.g mirrors). These robots also come equipped powerful motors processing object proximity data further allowing their navigations at high speeds without obstruction incidents sans human intervention process exploiting wireless technologies such as Bluetooth enabling remote smartphone access via dedicated App which adds flexibility & portability layer making whole experience even smoother.

Components Required

read more : LED Interfacing with Arduino




We start off by the assembly of the two-wheeled drive DIY kit. We first connect the motors to the board by putting the fastener in the given slots and tightening them with M3*30 screws. Now, the wheels can be attached to the motors. Besides the two wheels, we are also provided with a hammer castor wheel which serves to support the motion of the robot by following the other two wheels while in motion.



The castor wheel is attached along with the spacers provided, this maintains the height of the castor and keeps the robot in a fixed horizontal plane. Now that all the moving parts are taken care of, we come to the power supply which is provided with the help of 4 AA batteries.


The battery container for the same is also provided with the DIY kit, it can be attached on the top. Note that the AA batteries are not necessarily the only power source to be used, we can use a 9V battery as well. If you have worked on with Arduino and motors, it will be conspicuous in your that using either 4 AA batteries or one 9V battery won’t last long. What can be done better is using the 9V battery to supply power to Arduino and the AA batteries for the motor driver, or you can use some good current rating AA batteries only.


 So, by now, we have one easily assembled two-wheel drive robot. We now come to the electronics part. Take the Arduino and screw it to the baseboard (or you can use a double-sided tape as well). When done, attach the L293D Motor Driver Shield on the top of Arduino, making sure that corresponding pins in both are correctly connected. Take two wires each from both the motors and connect them to the motor driver shield placed on Arduino (say, M1 and M2).


Check the connections for the same direction of motors as opposite polarity can cause counter motions. Now, we will shift our focus to the IR sensors which we place in the front. Two of them are used and both try to make bot move in such a way that the line it is traveling on is always in between the two. Connect the 5V and GND pins of the sensors to the 5V and GND points given in the shield. The input signal from the IR sensors is given through the Analog pins (here, we have used A0 and A1).


Through the serial monitor on Arduino IDE, we check the values of IR sensors when on the line and when not on the line. And, accordingly, we write a code with ‘if-else’ statements to make the bot move forward or turn left/right. The libraries for the motor driver shield can be downloaded online or directly go to this download URL: . Include the libraries for the DC motors, define an object for each and also declare pins for the sensor. You can see the complete program below:


read more :  Interfacing ACS712 with Arduino


Check out the video for step by step assembling instructions:




// Line-follower Robot using Arduino Uno and Motor Shield
// library for DC motor #include 
// defining the two motors
AF_DCMotor motor1(1, MOTOR12_64KHZ);
AF_DCMotor motor2(2, MOTOR12_64KHZ);
// declaring Sensor Pins.
int LeftSensor = A0;
int RightSensor = A1;
int L_sensor_val = 0; // To store value from sensors.
int R_sensor_val = 0;
int threshold = 500;
void setup() {
void loop() {
// set the speed to 200/255
L_sensor_val = analogRead(LeftSensor); // Reading Left sensor data R_sensor_val = analogRead(RightSensor); // Reading Right sensor data
if (L_sensor_val>threshold && R_sensor_val>threshold) {
if (L_sensor_valthreshold) {


After uploading the code, if your bot is not running in the right direction, then change the wiring of BO motors. Also, calibrate both IR sensors by varying their potentiometer.

The speed of the motor can be varied according to the requirement and the accuracy required and, similarly, the IR sensor values can also vary depending on the color of the path and can be utilized for multiple purposes.


read more : How NRF24l01 Arduino Nano Works


Diving into the world of robotics through the DIY Line Follower Kit using Arduino offers an exhilarating journey from inception to creation. By understanding the intricate working of the line follower robot, assembling the components with care, and crafting the code to guide its path, you've embarked on a hands-on learning adventure that blends technology and innovation. With this newfound knowledge, you're now equipped to explore endless possibilities in robotics and automation. So, what are you waiting for? Unleash your creativity and embark on your own robotics odyssey today!

Components and Supplies

You may also like to read

Frequently Asked Questions

1. What is line follower robot using Arduino?

A line follower robot using Arduino is a robotic device that can be programmed to follow the contour of a given path. This type of robotics system uses an array of sensors such as infrared light, and ultrasonic waves to detect changes in its environment and then take action accordingly. The Arduino open source platform allows users maximum flexibility as it supports multiple programming languages including C++, Java, Python etc., giving beginners the opportunity for quick prototyping development time with minimal overhead cost. It also provides tools like auto-code generation which reduces tedious manual coding hours significantly; letting even experts quickly get up and running without spending too much on learning resources or code implementation costs.

read more : How do I Power my Arduino?

2. How to make an Arduino line following robot?

Create your own line-following robot with Arduino! Get a basic starter kit and have the necessary components ready. Attach an L298N Motor Driver Module to control both of the motors, alongwith two DC Motors as well. Connect these two motors to pins 5/6 for motor A, 7/8 for motor B on arduino board and position them in front of each other so that their wheels turn together. Then attach Ultrasonic or IR Sensor right below it at 3cm (height) distance from ground surface; this is important because robotic movement depends upon sensor reading data obtained by using those sensors only. Lastly connect 12V battery power supply between power source terminal & Vcc GND terminals respectively of Motor Driver module which regulates current flow & finally write code accordingly based on algorithms when required depending upon its usage while debugging.

read more : Arduino Sensor types and Applications

3. How to calibrate line follower robot using Arduino?

Calibrating a line follower robot with Arduino is an essential step for achieving successful navigation. Follow these easy steps to properly calibrate your device: First, acquire the necessary components--an Arduino microcontroller and motor driver board. Next, attach them onto the base of the robot. Then connect all sensors on both sides of the robotic via jumper wires or end stops for precise alignment control. After this has been set up correctly, you can begin programming your bot using specific commands such as pin modes and pulse width modulation in order to achieve accurate movements while following lines or other shapes along its path . Finally upload it into the Arduino before testing out your settings; making any adjustments as needed until desired results are reached! With proper calibration your Line Follower Robot will be able traverse smoothly across various surfaces without needing constant readjustments - giving you more time spent enjoying observing Robots in action!

read more : Top 10 Arduino Projects for Beginners

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.

Components and Supplies

You may also like to read