Tuesday, 5 April 2016

Line Follower Robot





Line follower Robot is a machine which follows a line, either a black line or white line. Basically there are two types of line follower robots: one is black line follower which follows black line and second is white line follower which follows white line. Line follower actually senses the line and run over it.
The line Follower works with two motors for driving the real wheels while the front wheels are free it uses more than 2 infrared sensors for detecting the line that it has to follow. Microcontroller (Arduino is best for beginners) is used in the project for instructing the robot to move according to the sensors input. The motor driving circuit is made with L293D, which is an H-bridge IC. It  can control the two motors simultaneously. The code is written in C and is a fully functional code. Care must be taken while choosing the motors. It should be a high torque motor so that it can take the weight of your robot. Otherwise the wheels would work fine while in the air but would not move once the robot is set down. The sensor circuits as well as the control circuit is givens below and the C code can be downloaded as a word file.

Block Diagram of line Follower Robot:



Required component for building line follower robot:
·      2 IR module
·      Motor Driver (L293D)
·      Arduino Board (UNO, Mega, Pro mini etc.)
·      2 DC motor
·      Battery
·      Chassi

IR Module:


In this arduino based line follower robot we have used IR Module. They are used for sending and receiving light. IR transmits infrared lights. When infrared rays falls on white surface, it’s reflected back and catched by photodiodes which generates some voltage changes. When IR light falls on a black surface, light is absorb by the black surface and no rays are reflected back, thus photo diode does not receive any light or rays. Here in this line follower robot when sensor senses white surface then arduino gets 1 as input and when senses black line arduino gets 0 as input.

Arduino Board:

In our Project we have used a microcontroller to control whole the process of system that is ARDUINO. Arduino is an open source hardware and very useful for project developments. There are many types of arduino like Arduino UNO, arduino mega, arduino pro mini, Lilypad etc. available in the market. Here we have used arduino uno in this project as arduino uno is small and so breadboard compatible.

Connections:
 Connect IR sensor module 1 and 2  to arduino digital pin number 2 and 3. And motor driver’s input wires connected to arduino's digital pin number 4 and 5 (Left motor), 6 and 7 (Right Motor)  respectively. And both  motors are connected at output side of motor driver.


Program:

There are four conditions in this line following robot that we read by using arduino. We have used two sensor namely left sensor and right sensor.
Left sensor connected to Arduino’s digital pin no.2
Right sensor  to Arduino’s digital pin no.3
Left motor connected to Arduino’s digital pin no.4 and 5
Right motor connected to Arduino’s digital pin no.6 and 7

Left Sensor
Right Sensor
Left Motor
Right Motor

0
0
0
0
Stop
0
1
0
1
Turn Left
1
0
1
0
Turn Right
1
1
1
1
Forward



/* Program for line following robot */
void setup()
{
//initialization of digital pins as an input or output
pinMode(2, INPUT);
pinMode(3, INPUT);
pinMode(4, OUTPUT);
pinMode(5,OUTPUT);
pinMode(6, OUTPUT);
pinMode(7,OUTPUT);
}
void loop() //the loop function runs over and over again forever
{
if(digitalRead(2)==HIGH && digitalRead (3)==HIGH)
{
digitalWrite(4,HIGH);
digitalWrite(5,LOW);
digitalWrite(6,HIGH);
digitalWrite(7,LOW);
}
else if(digitalRead(2)==HIGH && digitalRead(3)==LOW)
{
digitalWrite(4,HIGH);
digitalWrite(5,LOW);
digitalWrite(6,LOW);
digitalWrite(7,HIGH);
}
else if(digitalRead(2)==LOW && digitalRead(3)==HIGH);
{
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,LOW);
}
else()
{
digitalWrite(4,LOW);
digitalWrite(5,LOW);
digitalWrite(6,LOW);
digitalWrite(7,LOW);
}
delay(500);
}
//end of program

Copy and paste above program in to Arduino Software (IDE)
And Upload the program in to Arduino board.

Click HERE to know how to download and install Aurdino IDE and how upload program on microcontroller