Friday, May 1, 2020

Arduino Line Follower Robot



This is the primary level robot that has been made for do some specific work. Large line follower robots are usually used in industries for assisting the automated production process. They are also used in military applications, human assistance purpose, delivery services etc.
Line follower Robot is one of the first robots that beginners and students would get their first robotic experience with. In this project, we have designed a simple Line Follower Robot using Arduino and some other components.


Block Diagram


Motor Driver



IR sensor




GEARED Motor






CONNECTION DIAGRAM






Code

int mot1=9;
int mot2=6;
int mot3=5;
int mot4=3;
int left=13;
int right=12;
int Left=0;
int Right=0;
void LEFT (void);
void RIGHT (void);
void STOP (void);
void setup()
{
pinMode(mot1,OUTPUT);
pinMode(mot2,OUTPUT);
pinMode(mot3,OUTPUT);
pinMode(mot4,OUTPUT);
pinMode(left,INPUT);
pinMode(right,INPUT);
digitalWrite(left,HIGH);
digitalWrite(right,HIGH);
}
void loop()
{
analogWrite(mot1,255);
analogWrite(mot2,0);
analogWrite(mot3,255);
analogWrite(mot4,0);
while(1)
{
Left=digitalRead(left);
Right=digitalRead(right);
if((Left==0 && Right==1)==1)
LEFT();
else if((Right==0 && Left==1)==1)
RIGHT();
}
}
void LEFT (void)
{
analogWrite(mot3,0);
analogWrite(mot4,30);
while(Left==0)
{
Left=digitalRead(left);
Right=digitalRead(right);
if(Right==0)
{
int lprev=Left;
int rprev=Right;
STOP();
while(((lprev==Left)&&(rprev==Right))==1)
{
Left=digitalRead(left);
Right=digitalRead(right);
}
}
analogWrite(mot1,255);
analogWrite(mot2,0);
}
analogWrite(mot3,255);
analogWrite(mot4,0);
}
void RIGHT (void)
{
analogWrite(mot1,0);
analogWrite(mot2,30);
while(Right==0)
{
Left=digitalRead(left);
Right=digitalRead(right);
if(Left==0)
{
int lprev=Left;
int rprev=Right;
STOP();
while(((lprev==Left)&&(rprev==Right))==1)
{
Left=digitalRead(left);
Right=digitalRead(right);
}
}
analogWrite(mot3,255);
analogWrite(mot4,0);
}
analogWrite(mot1,255);
analogWrite(mot2,0);
}
void STOP (void)
{
analogWrite(mot1,0);
analogWrite(mot2,0);
analogWrite(mot3,0);
analogWrite(mot4,0);
}

Note:
  • In order to increase the efficiency of black line detection, number of sensors can be increased. An array of sensors will be more accurate than just two sensors.
  • In this project (where two sensors are used), the positioning of the sensors is very important. The width of the black line plays a major role in the placement of the sensors.
  • The sensor to detect the line can also be constructed using an LED and LDR pair.

Applications of Line Follower Robot

  • Line follower Robots are commonly used for automation process in industries, military applications and consumer applications.
  • They are very useful as they can work without any supervision i.e. they work as automatic guided vehicles.
  • With additional features like obstacle avoidance and other security measures, line follower robots can be used in driver less cars. 

No comments:

Post a Comment