Line follower robot (Type: Non programmed)


Line follower is an autonomous robot which follows either black line in white are or white line in black area. Robot must be able to detect particular line and keep following it.

For special situations such as cross overs where robot can have more than one path which can be followed, predefined path must be followed by the robot. In the following section, we will discuss the line follower robot which follows black line on white back ground and take right turn whenever cross overs or Y shaped turn arrives.However with some minor suitable changes, users can make robot for other possibilities also. An array of sensor is used to detect the line. Based on the status of sensors, special circuit or controller decides the position of line and also the required direction of motion required to follow the line. Motor driver circuit is used to ON/OFF the LEFT/RIGHT motors of the robot to provide desired motion.

Sensors are required to detect position of the line to be followed with respect to the robot’s position. Most widely used sensors for the line follower robot are PHOTOSENSERS. They are based on the basic observation that “the white surface reflects the light and the black surface absorbs it”. For more details, please read Sensor module article by me. There, you will find all information about working of IR sensor, and how i made custom sensor module.

To make line follower, you does not always need to do programming or deploy any programming device. I have divided this article into two paths. after completing all theory and construction of circuit and mechanical chassis of this line follower, we will have two branches, one will go to the way, where you will program the PIC microchip (or any other microcontroller) to run your line follower and other will go to a basic line follower, which will be less advance and autonomous than the one with programming.

There are various concepts which you at any cost must know before starting to make this line follower like DC motor controller, IR sensor module (or array in this case) and  Differential drive (chassis mechanics).  i will recommend you to read these articles before you go further. Differential drive, we will learn in this article only.

Why i chose line follower

I used line follower because its a nice eye catching robot, by which you can also learn various concept in one go. Its like a intelligent machine or a vehicle. This will lead to you on a path where you can go further advance and make various intelligent robotic vehicles. with this, You can also win so many prices in your college technical fest because its a famous competitive robot. Morever, This robot needs a very continous and fast cycle of input -> processing -> output continously to function properly.

After making this robot, you can ferquently convert and modify this system a little to make other robots like Object follower/repeller, Obstacle detector/avoider, Light follower and similar robots.


Lets, start with mechanics of robot. Hoping that you have already read about IR sensor module and I think that firstly, you should be given a brief information about the the term Differential drive. differential wheeled robot is a mobile robot whose movement is based on two separately driven wheels placed on either side of the robot body. It can thus change its direction by varying the relative rate of rotation of its wheels and hence does not require an additional steering motion.

To balance the robot, additional wheels or casters may be added, which is called castor wheel. If both the wheels are driven in the same direction and speed, the robot will go in a straight line. If both wheels are turned with equal speed in opposite directions, as is clear from the diagram shown, the robot will rotate about the central point of the axis. Otherwise, depending on the speed of rotation and its direction, the center of rotation may fall anywhere on the line defined by the two contact points of the tires. While the robot is traveling in a straight line, the center of rotation is an infinite distance from the robot. Since the direction of the robot is dependent on the rate and direction of rotation of the two driven wheels, these quantities should be sensed and controlled precisely.

A differentially steered robot is similar to the differential gears used in automobiles in that both the wheels can have different rates of rotations, but unlike the differential gearing system,a differentially steered system will have both the wheels powered. Differential wheeled robots are used extensively in robotics, since their motion is easy to program and can be well controlled. Virtually all consumer robots on the market today use differential steering primarily for its low cost and simplicity.

In the fourth turning, where its spinning, here the point of spin can vary again due to speed of motor running in opposite side. For an instances, i form another case, when Left motor is running and right motor is stopped. In that case also, robot will spin clockwise, but the center of circle will be right wheel instead of the center of robot.


Principal logic behind functionality

The main logic of functionality of a line follower robot is to controll the both motors with the input comming from Sensors reading line position continously.



Now, for both types of line follower robot (with or without program), motor driver and motor circuit will be same. Only first two blocks are changed.

Please note that, for line follower type-1 which is without programming, Its is compulsion to use digital IR sensor module because we are directly using the IR sensor module information into motor driver and building logic by electronic connection that robot follows a darker line (hard calibrated) on brighter surface.

These robots can't run directly on line, they needed to be calibrated to the ambient light and material of which line and background floor is made (reflective index). We can also use only 2 sensors for running this type and its very easy to construct.

On other hand, Type-II line follower will need a programming device (any microcontroller having ADC inbuilt or equipped). I have used PIC 18F4550 micrcontroller. There are several reason that i used this microcontroller over 8051 and AVR.

1. Its programmable by USB and hence laptop, no serial cable is required. (usually in line follower competitions, we have to burn programm again and again)

2. Its standard circuit can be easily made on bread board and hence cut overall cost

3. Most importantly,  it has ADC(Analog to digital conversion) inside inbuilt, so no overhead of interfacing another external ADC IC.

So now, after you have a microcontroller with ADC inside it, then you can use any amount of sensor, you can preconfigure calibrated value, such that outside, inside, intensity of lights and then select the profile before you run the robot to eliminate the need of calibrating the sensors.

I used 3 IR sensor array in my PIC powered line follower robot and it worked for me in any type of line (With varying width and colour).

To prepare, mechanical structure, take any metallic or plastic chassis. I preffer square in shape because of ease in differential drive system. With this, attaching the geared motor with high torque and lesser speed. It provide more control of electronics over the motion of robot during turns. Here, i have attached an image showing my own chassis of this robot, fixed with DC motors with gears.


Line F​ollower type-I

In this type of line follower robot, we build the logic by seeing the image above, Here, you can clearly observe that the motor on the side where the sensor is on black line has to be stopped so that the sensor comes again to the side of the line.

So cases are like this:

Both sensor on sides of line (brighter backgroud)  => Both motor run   Corresponds to [1st stage and 6th stage]

Right on line & left outside => right motor off & left motor runs resulting in right turning Corresponds to [ 2nd, 3rd and 5th stage]

Left on line & right outside => right motor runs & left motor stops resulting in left turning Corresponds to [4rth stage]

Both on Black line => Both motor stops

so putting all information and cases together, i got a formula by which we should connect the output of digital sensor to L293D motor driver and that is, firstly calibrate your IR sensor such that they are giving 5 volt or logic 1 on white surface and 0 logic on black line. After that just connect the output of each Digital sensor module to each motor respectively. Such that right side IR sensor will trigger the right side motor ON/OFF and left side sensor will trigger the left side motor ON/OFF with help of Motor driver IC L293D.

Please note that, we have two sensors and will be making two seperate digital IR sensor just by using one LM393 IC because it has two channels of comparision. So in actual output of LM393 IC will be connected to motor driver. To understand this, my IR sensor module article is compulsary to read.

Below is the video of this line follower working.

I hope this article helped you. Please feel free to comment below or contact me, for any query. :) In the next tutorial, i will tell you about line follower type-II which will be programmed by PIC18F4550 with 3 sensors and will work in various environmental condition without much calibrations.