Advanced Line Following Robot - Step 1: What it takes to build a fast line follower? Part: A

In this page I will be telling you what it takes to build a fast line follower. I will be talking about the design, steering mechanisms, sensors, algorithms, etc, which can be implemented.

Robot Design
The design of the robot plays an important role in deciding its speed and efficiency. The first thing you will want to decide in the design of your robot is the steering mechanism. The various steering mechanisms available are two wheel differential drive, four wheel differential drive, car-type steering mechanism, etc. From my experience, I can tell that two wheel differential drive is the best – it is easier to build, control and is cheap (requires only two motors).

Irrespective of the steering mechanism you use, the most important thing to keep in mind is to place the line sensors as far as possible from the steering wheel. This will give the robot, more time to react. Keeping the distance between the sensors and the steering wheel big, will largely reduce the number of over-shootings by the robot.

In my robot I kept the motor and the sensors at a distance of 12 cm


Another important thing is to keep the centre of mass as close to the ground as possible. This can be done by, placing all the heavy parts (batteries, motors) of the robot as close to the ground as possible. Keeping the centre of mass low will decrease the robot's moment of inertia enabling it to slow down quickly and then accelerate faster in curves. A robot with a high centre of mass will take a lot of time to slow down and a lot more time to accelerate afterwards owing to its high moment of inertia.

Sensors are the first requirement in the process of line following. There are many sensors one can use for line following – IR LED and a Photodiode, LED and LDR (photoresistor), etc. When selecting the type of sensor there are three things you need to keep in mind – response time, sensitivity and ambient light protection.

LDRs (photoresistors) are excellent in terms of sensitivity, they can sense not only between two contrasting colours(one dark and one light) but also between two primary colours. Some competitions make the line following tougher by having a white line on a coloured surface (blue, red, grey). In such cases LDRs are the sensors to be used. But there is one big disadvantage in using LDRs - their slow responce time. A LDRs reaction time is around 0.1s. This may not seem much, but if you have a robot using LDRs following a line with a speed of 1 m/s then it will be getting data from the sensor every (0.1 * 1 = 0.1m) 10 cm !

IR LED and photodiodes give good response time. But they have two drawbacks, both of which can be dealt with – they can sense only between two contrasting colours and they are easily affected by ambient light.

Sensitivity can be improved in two ways. One by using LED which emits light of any other color other than the surface color and using a suitable photodiode to sense the light. Basically, if there is a white line on a red surface, you can use any other color LED, say green, to emit light and photodiodes which react to green colour. What happens is the surface, being red, absorbs all the green light emitted by the LED and no light reaches the photodiode. The line on the other hand, being white, reflects all the green light falling on it back to the photodiode. Using this method significantly increases the sensitivity of the sensors. Another way of improving sensitivity is by making modifications to the sensor circuit. Just by varying the resistance of some of the resistors in the sensor circuit, you can tune it to sense between two particular colors. Take a look at .

The second draw back, that is, interference from ambient light, is much more difficult to deal with. IR photodiodes detect light of a particular wavelength, which usually between 700 - 850 nanometers. Unluckily, the wavelength of most of the IR radiations around us fall in this range. To the photodiode these radiations are same as the IR radiations emitted by the IR LED, and hence they get falsely triggered by them. Even red light (which comes just beyond the IR radiations in the electromagnetic spectrum) can affect these sensors. There are many methods you can employ to protect IR sensors from interference from ambient light. One of the easiest method is to physically shield the sensors from ambient light. You can also use sensors that provide ambient light protection like the TSOP 17** sensors.


To protect the sensors from ambient light, my robots chassis is completely closed and the sensors are placed inside where they are shielded from any ambient light interference.


The algorithm is the one thing that determines the performance of your robot more than anything else. The most basic algorithm I know is the one which uses only one sensor. The sensor is placed in a position that is a little off centered to one of the sides, say right. When the sensor is detects no line the robot moves to the left and when the sensor detects the line the robot moves to the right. A robot with this algorithm would follow the line like shown in the picture below


The drawback of this method is that the line following is not smooth. The robot keeps wavering left and right on the track, wasting battery power and time. A modification to this method is to add sensors on both sides of the robot and place them such that they just sense the line on either side. And the algorithm would be to move forward if both the sensors sense the line or to move left if only the left sensor senses the line and move right if only the right sensor senses the line. A robot with this algorithm would follow the line like shown in the picture below


This algorithm is faster than the previous algorithm but the robot will still wobble about the line and may not be fast enough.

A much better algorithm is to use the PID to follow the line. This will make line following process much more smoother, faster and efficient.

Explaining the PID control will take a lot of time and space hence I will be explaining about it in the next page.