A LINE FOLLOWER ROBOT
The purpose of this document is to help you build a Line Following Robot.
Starting with an overview of the system the document would cover implementation
details like circuits and algorithms, followed by some suggestions on improving the
design.
BACKGROUND:
The
present condition in Industry is that they are using the crane system to carry
the parcels from one place to another, including harbor’s .Some times the
lifting of big weights may cause the breakage of lifting materials and will
cause damage to the parcels too.The robot movement depends on the track. Use of
this robot is to transport the materials from one place to another place in the
industry.
Practical applications of a line follower : Automated cars running on roads with embedded magnets ; guidance system for industrial robots moving on shop floor etc.
Knowledge of basic digital and analog electronics.
(A course on Digital Design and Electronic Devices & Circuits would be helpful), C Programming
WORKING PRINCIPLE:
This
simple robot is designed to be able to follow a black line on the ground
without getting off the line too much. The robot has five sensors installed
underneath the front part of the body, and two DC motors drive wheels moving
forward. A circuit inside takes an input signal from five sensors and controls
the speed of wheels’ rotation. The control is done in such a way that when a
sensor senses a black line, the motor slows down . Then the difference of
rotation speed makes it possible to make turns. For instance, in the figure on
the right, if the sensor somehow senses a black line, the wheel on that side
slows down and the robot will make a right turn.
Now we will discuss all blocks in detail..... and i 'll tell you the complete procedure to make all blocks separately and how to assemble them.
- SENSOR ARRAY
We have used IR sensors for making sensor array. IR sensor consists of a transmitter and a receiver as shown in above photo. The transparent led is transmitter while the black one is receiver. IR transmitter will transmit infra-red radiation which will fall on the surface and the reflected radiation will be received by the receiver. The reflection of radiation will depends upon the colour of the surface.as shown in photo below.
the orientation of sensors should be as like as shown in above photo so that robot can detect a sharp as well as curve tuns.
Most of the radiations will be reflected back from white surface but it is just opposite in case of black surfaces as shown in diagram below.
working of ir sensors |
circuit diagram of one pair of ir sensor |
This circuit diagram is showing only one ir sensor. we need to make 5 sensors on PCB board as shown in 1st photo of sensor array.
2. COMPARATOR
We used comparators(OP_AMPs) to convert the analog signals received from sensors in to digital signals
The op-amp IC we used is LM324 to give square wave as a output by comparing the sensor signal with a reference signal provided by us.
Theory :-
As you all know that in the world of electronics all the microcontrollers and microprocessors works on DIGITAL SIGNAL, but from the sources like battery we get a ANALOG SIGNAL. So in embedded systems it is mandatory to convert the analog signal into digital signal.
So for converting the analog signal into digital signal we use operational amplifiers(OP-AMP). We use operational amplifiers as a voltage comparator . A op-amp is shown in figure below :-
We fix a voltage at negative input with the help of variable resistor of 10k ohm and at the positive input we give our analog signal. If the analog signal is grater than the fix voltage at negative input then we get 1 in output(means +5V) and if the analog signal voltage is less than the voltage at negative input then we get 0 at output(means 0V).
Note :- Set the negative input voltage with the help of variable resistor according to your requirement.
you can see a A to D converter in below fig.
There are several OP-AMP ICs are available like :- lm358, 741, lm324 etc.Here we use LM324 which have 4 op-amps in it.
The reference voltage will be given to inverting terminal(2,6,9,13) . The value of Vcc will be equal to 5v or 6v so that output of opamp shold be less than 5v only otherwise micro-controller will not read the signal from opamp.
Sensitivity of IR sensor:
The sensitivity of sensor means that how much effectively the sensor senses the change that is
occurring in its surrounding. The sensitivity of the IR sensor is controlled by reference voltage at pin 2
using variable resistor.
· Large value of reference voltage – less sensitive.
· Small value of reference voltage – more sensitive.
3. MICRO-CONTROLLER
I am using ATMEGA 328 with ARDUINO UNO development board. it is very easy to programme and burn the same in to ur arduino.
Microcontroller
board used :- ARDUINO UNO
Technical specification:-
Microcontroller:- ATmega328
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limits) 6-20V
Digital I/O Pins 14 (of which 6 provide PWM output)
Analog Input Pins 6DC
Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB of which 0.5 KB used by bootloader
SRAM 2 KB
EEPROM 1 KB
Clock Speed 16 MHz
4.MOTOR DRIVER
L293D IC is a dual H-bridge motor driver IC. One H-bridge is capable to drive a dc motor in
bidirectional. L293D IC is a current enhancing IC as the output from the sensor is not able to drive
motors itself so L293D is used for this purpose. L293D is a 16 pin IC having two enables pins which
should always be remain high to enable both the H-bridges. L293B is another IC of L293 series having
two main differences with L293D.
PIN DIAGRAM OF LM293D |
CODES FOR LINE FOLLOWER
the following code is left priority code ie if all sensors will detect black line then it will go for left line. you can change the priority order by jst making slight change in code.
int motorLEFTpin1 = 5; //define digital output pin no.
int motorLEFTpin2 = 6; //define digital output pin no.
int motorRIGHTpin1 = 10;
int motorRIGHTpin2 = 11;
int irl2=2;
int irl1=4;
int irc=7;
int irr1=8;
int irr2=12;
int il2=0;
int il1=0;
int ic=0;
int ir1=0;
int ir2=0;
void setup () {
Serial.begin(57600);
pinMode(irl2,INPUT);
pinMode(irl1,INPUT);
pinMode(irc,INPUT);
pinMode(irr2,INPUT);
pinMode(irr1,INPUT);
pinMode(motorLEFTpin1,OUTPUT); //set pin 5 as output
pinMode(motorLEFTpin2,OUTPUT); // set pin 6 as output
pinMode(motorRIGHTpin1,OUTPUT); // set pin 10 as output
pinMode(motorRIGHTpin2,OUTPUT); // set pin 11 as output
delay(100);
}
void loop()
{
int c=0;
int r=0;
il2=digitalRead(irl2);
il1=digitalRead(irl1);
ic=digitalRead(irc);
ir2=digitalRead(irr2);
ir1=digitalRead(irr1);
Serial.print("Raw Ratel2: ");
Serial.println(il2);
Serial.print("Raw Ratel1: ");
Serial.println(il1);
Serial.print("Raw Rateic: ");
Serial.println(ic);
Serial.print("Raw Rater2: ");
Serial.println(ir2);
Serial.print("Raw Rater1: ");
Serial.println(ir1);
Serial.println("\t");
Serial.println("\t");
if(ir2==LOW)
r=1;
if(ir1==LOW)
r=2;
if(ic==LOW)
c=3;
if(il2==LOW || il1==LOW)
lft();
else if(c>r)
st();
else if(r>c)
rt();
else if(il1==HIGH && il2==HIGH && ic== HIGH && ir1==HIGH && ir2==HIGH)
lft();
}
void st()
{
digitalWrite(motorLEFTpin1,HIGH);
digitalWrite(motorLEFTpin2,LOW);
digitalWrite(motorRIGHTpin1,HIGH);
digitalWrite(motorRIGHTpin2,LOW);
}
void rt()
{
digitalWrite(motorLEFTpin1,HIGH);
digitalWrite(motorLEFTpin2,LOW);
digitalWrite(motorRIGHTpin1,LOW);
digitalWrite(motorRIGHTpin2,LOW);
}
void lft()
{
digitalWrite(motorLEFTpin1,LOW);
digitalWrite(motorLEFTpin2,LOW);
digitalWrite(motorRIGHTpin1,HIGH);
digitalWrite(motorRIGHTpin2,LOW);
}
thanq frnd
ReplyDeleteur welcome
Deleteawesome job yar........thoda dimag hume vi de do......electrical ka kuch kuch tha jo hume samajh me ni aya....but baki sab samajh me aya...aur seriouslly bht accha tha......ye talent hume vi pass kar do....
ReplyDeletethanq yar......isme koi talent nai h...... is article ko ek bar aur padho samajh jaogi,,,,,
Deletebaki to samajh me vi aa jayega par ye program kavi ni samajh me ayega.....
Deletetm to CS ka beizati kar dogi
Delete