Introduction: SIMPLE LINE FOLLOWER ROBOT(single Sensor)

Hello guys in this tutorial lets see how to make an simple line follower robot with single infra-red sensor.


Usually for beginners in Robotics this is your first robot to play with Since this robot has some basic functions and basic programming learning this is like learning the A,B,C,D.... of Robotics.

A line follower is an autonomous Robot which is able to follow a line (black or white) and alter its path based on the shape of the line.


  • Arduino UNO
  • one IR-sensor module
  • L293D motor driver
  • metal chassis
  • 2x BO motors
  • 1x caster wheel
  • 2x wheels
  • 2x 9v battery
  • 2x dc battery connectors
  • connecting wires

The chassis is the body of this Robot, Arduino is the brain of this robot and two dc motors produce motion.

Step 3: HOW IT WORKS?!

This is a simplest bot with a single sensor so its working principle is also as simple as follows..

  1. when the IR sensor sees the black line one wheel of the bot rotates and the bot turns away from the line.
  2. when the IR sensors sees the white background the other wheel rotates and the bot turns slightly towards the line.

The above two steps occurs one after other in a repeat mode very fastly in a very short time which gives us the movement of the bot in the path following the black line.

It just follows the Z pattern turning towards the line and turning away from the line.


Fix the wheels on the metal chassis and mount the DC BO motors on the back wheels and fix a caster wheel in the front.

connect the L293D motor driver with the arduino and dc motors.


3,6(l293d) to left motor(output)

11,14(l293d) to right motor(output)

2,7,10,15(l293d) to pins 10,11,5,6 of Arduino(inputs)

Step 5: Connect Your Arduino to Your IR Sensor:

  1. connect out pin of IR to pin 2 of Arduino
  2. connect vcc of IR to 5v of Arduino
  3. connect gnd of IR to gnd pin of Arduino.


Interface your arduino with arduino IDE software and upload the below program.

To get the program:click here


connect the power supply to your Arduino and motor driver....


check out my previous post Obstacle Avoiding Robot:click here



    • Creative Misuse Contest

      Creative Misuse Contest
    • Tiny Home Contest

      Tiny Home Contest
    • Water Contest

      Water Contest

    13 Discussions

    While giving connections,when i put vcc pin in arduino board,my arduino is not vetting on.why?...and when i remove that vcc pin,its working

    How to connect battery and how to get move speed?


    Guys I would like to give one hint by using separate 9v power supply to your Arduino and to your L293D motor driver you can actually increase the speed of your robot.

    1 reply

    I tried using two 9v batteries but my left motor just keeps on spinning, even when there is no black line. Could you help?

    Hi Karthik,

    i have also use two 9 volt batteries. But i am having trouble writing my code for my 4 sensors line following robot. Would you mind helping me out?

    Hi dear,

    Could you help me out with my robot?

    I am using 4 sensors along with L298N and some other components. But i am having trouble writing a simple code for my robot.

    Can i use 3 channel line tracker sensor?


    1 year ago

    i want circuit diagram for this single sensor line follower

    I hope you don't mind me saying this....but won't 2 IR sensors work better? Like both the sensors should be on the white part.....if the left sensor detects black meaning the bot has gone off course the left motor stops and the bot turns left until the sensor detects white again
    ....and the same thing with the right motor........i think that would make the bot's movement smoother

    Just my opinion though

    i don not have a l293d circuit board but have the individual IC chips. do i still require the 9V battery? Also i understand that the first battery powers the arduino via the power socket. but where is the second used?

    3 replies

    L293d IC is enough to run the motors. I have used L293d ready to use module to make it even more simpler and easy by avoiding breadboard connections.

    Hello...I used in conjunction Arduino Uno and Arduino Shield motor driver like on picture... how to connect these two Arduino to work as your robot. For sensor I use Arduino IR.Regards

    I have used the first battery to power the arduino and second one to power the l293d motor driver module. But it is not neccessary to use two batteries you can power your l293d IC using 5v vcc pin in the arduino.