Line Following Robot


Line following robot or LFR is an automatic robot which follows the given track (either black line on white surface of white line on black surface).There are many ways to construct a LFR.You will find many circuits on the internet for LFR using microcontrollers(MCU) like 8051,AVR,PIC,etc or Arduino board.But for Arduino or MCUs you need to learn programming languages like Embedded C or Assembly language.But the one that we are going to make is without a microcontroller and uses very few components.

The basic principle of a LFR is that it compares two values obtained from the two sensors and accordingly varies the speed of the motors. The sensors can be either a IR transmitter and photodiode pair or a LED and LDR pair.To compare the values of these sensors we use a circuit known as comparator. A comparator takes two values as input from the sensor and gives output according to the table( displayed later in the working section).


LM358 dual opamp - 1
BC547 transistors - 2
1K 1/4Watt resistor - 2
330 ohms 1/4Watt resistor - 2
470 ohms 1/4Watt resistor - 2
10K potentiometers - 2
Infrared LEDs(IR LEDs) - 2
IR sensors (Photodiode) - 2
DC geared motors 300 RPM or 60 RPM - 2

Circuit Diagram

Please read Construction for more details.


The back side of the sensor PCB

The front side of sensor PCB

The sensor module should me made on a separate general purpose PCB and it should not be soldered on the same PCB where you have soldered the opamp circuit. To make the sensor first take a small PCB

One LM358 IC has two opamps. In the above circuit diagram, I have shown the circuit only for one opamp which will give output to a single motor. You need to make another one same as above with the second opamp.Please note pin numbers for the second opamp are as follows-

Non-Inverting input - Pin 5

Inverting input - Pin 6

Output- Pin 7


We have used a IR LED and photodiode pair for this line follower. You can use LED and LDR also but this one is more efficient.The 470 ohms resistor limits the current to the IR LED. The photodiode and 1K resistor are used to bias the opamp. The input to the opamp is given from the junction of these two.

The main part of the circuit is the operational amplifier or opamp. The opamp is used as an comparator in this circuit. A comparator is a circuit which take two inputs, compares them and gives output. In this circuit pin 2 and 6 (inverting inputs) are connected to a potentiometer which will give the reference voltage. Now the comparator will measure all the inputs and give output in reference to this voltage set by the potentiometer.

When the voltage at pin 3 and 5 is higher that the reference voltage the output of the opamp will be high (at the output pins 1 and 7). This output terminal is connected to a BJT which amplifies the current and drives the motor.


We need to calibrate the sensors or it won't work properly.Connect the power supply to the circuit. To calibrate the sensors, first take a black tape or any black coloured material. Place the sensors at a distance from the black tape. Initially the motors maybe be running. Now adjust the potentiometer such that the motor JUST stops.