Intro: Line Follower Bot
A line follower robot is the one which follows a dark line drawn on a light colored (white) background. The working is explained with three sections, one is the input section where the lines are detected, the second one is the control part and the third one is the output part where motors are used. We use IR sensors in the input part and arduino board in the control part, the steps to be performed is programmed and uploaded into this board. A motor driver IC is also used to control the motion of the robot. A line follower robot finds its application in automatic cars, for domestic purposes like floor cleaning etc. We are now going to see the detailed working of the robot and how to build it.
Step 1: Requirements:
1. Arduino UNO board
2. IR Sensors-2
3. IC L293D
5. 9V Battery-1
6. 6V Battery-2
7. Bread board, jumper wires.
If you are making your own sensors then you need,
> photo diodes-2
> IR LED-2
> Op-amp LM358-1
> Resistors-150ohms,10kohms and 10k pot.
You can buy the Arduino Board from the below link:
Step 2: Working Principle:
The main concept we have to understand is how the lines are detected. The IR sensor has a photo diode and an IR led. The IR led emits IR light, the photo diode responds to the light falling on it. Photo diode is a semiconductor; it is operated in reverse bias. It acts as a Light Dependent Resistor (LDR) having very high resistance in the absence of light and the resistance drops when light falls on it. When the IR light is reflected from a surface (light color), the resistance of the photo diode drops and it conducts, the voltage across it also changes. this voltage change is measured and compared using a op-amp. When the IR light falls on a dark surface (black), maximum amount of light will be absorbed by the surface and hence there is minimum reflection on the photo diode. This drops the voltage across the diode and the op-amp now gives a low output. The op-amp gives a digital output which is used for further process.
You can also build your own sensors using the circuit shown. You need two photo diodes, IR LED's, Op-amp LM358 and some resistors.
Step 3: Motor Driver IC:
The L293D motor driver IC has a dual H-bridge connection which means two motors can be controlled simultaneously. The pin diagram of Motor driver L293D IC is shown above.
Pin no.1 and 9 are the enable pins. They are active high and are used to activate the IC. Pin no. 2, 7(for first motor) and pin no. 10,15(for second motor) are the inputs to the IC. Pin no. 3,6 and 11,14 are the outputs which are connected to the two terminals of the motor. Pin no. 4,5 and 12,13 are grounded. Pin no. 8 is given with the voltage required for the motor to run. Here i have used two 6V batteries to give a voltage of 12V required for the motor (I have used 12V motor). Pin no.16 is supplied with the voltage required for the IC operation (5Volts).
The inputs given to the IC follows the truth table. In the truth table A and B are considered as the two inputs to the IC.
While programming it is important to know that when any motor has to move forward/backward one of its inputs must be high and other must be low.
Step 4: Program:
The connections are made as shown in the diagram. A 9V battery is used to power the arduino board. Any of the digital I/O pins can be selected to assign the inputs and outputs. The Arduino software (Arduino IDE) has to be installed which is available in the arduino website. The program is as shown below,
if(abc==HIGH && xyz==HIGH)
else if(abc==HIGH && xyz==LOW)
else if(abc==LOW && xyz==HIGH)