line following robot, line following robotic waiter, line following robot arduino, arduino line following code, line following robotic waiterHello friends, I hope you all are fine and having fun with your lives. Today, I am going to share a new project which is Line Following Robotic Waiter. I hope you guys are gonna enjoy it. I have shared all the details below so that if you wanna design it then you can easily do it. I have designed this project for a client and it worked quite perfectly so I thought to share it with you guys as well.

I have designed this Line Following Robotic Waiter using Arduino UNO board. I have also shared the code below and have given all the instructions but still if you got into any problem then ask in comments and I will solve your problems. I have also shared a video below which will show you the working of Line Following robotic Waiter. So, let’s get started with it:

Line Following Robotic Waiter

First of all, let’s have an overview of this Line Following Robotic Waiter:

Overview
  • In this project, I have designed an arena which has four tables on it as shown in below figure:

line following robot, line following robotic waiter, line following robot arduino, arduino line following code, line following robotic waiter

  • The robot will start from the Table 1 side and whenever someone call it from any table then it will reach that table and take the order.
  • After taking the order it will move back and will reach to the starting point again and wait for the next table call.
  • Now let’s have a look at the components required to design thi Line Following Robotic Waiter:
Components
  • Let’s have a look at the components list, which is required for designing this Robot. Here it is:
  • Arduino UNO
  • DC Motors
  • RF Module
  • 2 Relay Board
  • IR Sensors
  • These are the components required in order to design this Line following robotic waiter.
Mechanical Design
  • I have designed a three wheeler robot in which there were two wheels at the front side with DC motors while a free caster wheel at the back side.
  • I have used Acrylic Sheet as the body of the robot.
  • The DC Motor I have used for designing this project is shown in the below figure:

line following robot, line following robotic waiter, line following robot arduino, arduino line following code, line following robotic waiter

  • The caster wheel used is shown in below figure:

Line following Robotic Waiter 4

  • The coupled DC gear Motor with wheel is shown in below figure:

line following robot, line following robotic waiter, line following robot arduino, arduino line following code, line following robotic waiter

  • So I have designed two of such coupled motors and then combining all the above things together, we finally designed our Line Following Robotic Waiter as shown in below figure:

line following robot, line following robotic waiter, line following robot arduino, arduino line following code, line following robotic waiter

  • Now our mechanical Design is ready so let’s design the electronic hardware:
Electronic Circuit Design
  • First of all, I have designed the DC Motor Driver which is also called 2 Relay Board.
  • This circuit diagram is shown in below figure:

line following robot, line following robotic waiter, line following robot arduino, arduino line following code, line following robotic waiter

  • Now in order to apply the signals to move the Motors I have used Arduino UNO board.
  • Moreover I have placed four IR sensors below this robot.
  • Two of these IR sensors are used for line tracking while the remaining two were placed on the sides for detecting the tables on both sides.
  • I have also designed a power supply to convert 12V into 5V.
  • The circuit diagram of power supply is as follows:

line following robot, line following robotic waiter, line following robot arduino, arduino line following code, line following robotic waiter

  • So, now let’s have a look at the Arduino code required for Line Following Robotic Waiter:
Arduino Code
  • Here’s the Arduino Code requried for Line Following Robotic Waiter.
#define motorL1 8
#define motorL2 9
#define motorR1 10
#define motorR2 11

#define PwmLeft 5
#define PwmRight 6

#define SensorR 2
#define SensorL 3
#define Sensor3 A0
#define Sensor4 A1

#define TableA A4
#define TableB A2
#define TableC A5
#define TableD A3

int OriginalSpeed = 200;
int TableCount = 0;
int TableCheck = 0;
int RFCheck = 10;

void setup() 
{
  Serial.begin (9600);
 
  pinMode(motorR1, OUTPUT);
  pinMode(motorR2, OUTPUT);
  pinMode(motorL1, OUTPUT);
  pinMode(motorL2, OUTPUT);
  
  pinMode(PwmLeft, OUTPUT);
  pinMode(PwmRight, OUTPUT);
  
  pinMode(SensorL, INPUT);
  pinMode(SensorR, INPUT);
  pinMode(Sensor3, INPUT);
  pinMode(Sensor4, INPUT);
  
  pinMode(TableA, INPUT);
  pinMode(TableB, INPUT);
  pinMode(TableC, INPUT);
  pinMode(TableD, INPUT);
  
  MotorsStop();
  
  analogWrite(PwmLeft, 0); 
  analogWrite(PwmRight, 0);
  delay(2000); 
 // Serial.println("fghfg");
  
}

void loop() {
  MotorsForward();
if((digitalRead(Sensor3) == LOW) && (TableCheck == 0)){TableCount++; TableCheck = 1;}
if((digitalRead(Sensor3) == HIGH) && (TableCheck == 1)){TableCheck = 2;}

if((digitalRead(Sensor3) == LOW) && (TableCheck == 2)){TableCount++; TableCheck = 3;}
if((digitalRead(Sensor3) == HIGH) && (TableCheck == 3)){TableCheck = 4;}
if((digitalRead(Sensor3) == LOW) && (TableCheck == 4)){TableCount++; TableCheck = 5;}
if((digitalRead(Sensor3) == HIGH) && (TableCheck == 5)){TableCheck = 0;}

if(digitalRead(TableA) == HIGH){RFCheck = 1;}
if(digitalRead(TableB) == HIGH){RFCheck = 2;}
if(digitalRead(TableC) == HIGH){RFCheck = 3;}
if(digitalRead(TableD) == HIGH){RFCheck = 4;}

if(RFCheck == TableCount){Table1();}
PIDController();
}

void MotorsBackward()
{
    digitalWrite(motorL1, HIGH);
    digitalWrite(motorL2, LOW);
    digitalWrite(motorR1, HIGH);
    digitalWrite(motorR2, LOW);
}

void MotorsForward()
{
    digitalWrite(motorL1, LOW);
    digitalWrite(motorL2, HIGH);
    digitalWrite(motorR1, LOW);
    digitalWrite(motorR2, HIGH);
}

void MotorsStop()
{
    digitalWrite(motorL1, HIGH);
    digitalWrite(motorL2, HIGH);
    digitalWrite(motorR1, HIGH);
    digitalWrite(motorR2, HIGH);
}

void MotorsLeft()
{
    analogWrite(PwmLeft, 0); 
  analogWrite(PwmRight, 0);
    digitalWrite(motorR1, HIGH);
    digitalWrite(motorR2, HIGH);
    digitalWrite(motorL1, LOW);
    digitalWrite(motorL2, HIGH);
}

void MotorsRight()
{
      analogWrite(PwmLeft, 0); 
  analogWrite(PwmRight, 0);
    digitalWrite(motorR1, LOW);
    digitalWrite(motorR2, HIGH);
    digitalWrite(motorL1, HIGH);
    digitalWrite(motorL2, HIGH);
}

void Motors180()
{
    analogWrite(PwmLeft, 0); 
    analogWrite(PwmRight, 0);
    digitalWrite(motorL1, HIGH);
    digitalWrite(motorL2, LOW);
    digitalWrite(motorR1, LOW);
    digitalWrite(motorR2, HIGH);
}

void PIDController()
{
  if(digitalRead(SensorL) == HIGH){analogWrite(PwmRight, 250);analogWrite(PwmLeft, 0);}
  if(digitalRead(SensorR) == HIGH){analogWrite(PwmLeft, 250);analogWrite(PwmRight,0);}
  if((digitalRead(SensorL) == LOW) && (digitalRead(SensorR) == LOW)){analogWrite(PwmRight, 0);analogWrite(PwmLeft, 0);}
}

void Table1()
{
   TableCount = 0;
   MotorsRight();
   delay(4000);
   while(digitalRead(SensorR) == HIGH);
   while(digitalRead(SensorL) == HIGH);
   while(1)
   {
       MotorsForward();
       PIDController();
       if(digitalRead(Sensor3) == LOW){break;}
   }
   MotorsStop();
   delay(1000);
   Motors180();
   delay(2000);
   while(digitalRead(Sensor3) == HIGH);
   while(digitalRead(Sensor3) == LOW);
   while(digitalRead(SensorL) == HIGH);
   //delay(500);
   while(1)
   {
   MotorsForward();
   PIDController();
   if(digitalRead(Sensor3) == LOW){break;}
   }
   //delay(1000);
   MotorsLeft();
   delay(4000);
   while(digitalRead(SensorL) == HIGH);
   while(digitalRead(SensorR) == LOW);
   while(1)
   {
       MotorsForward();
       PIDController();
       if(digitalRead(Sensor3) == LOW){break;}
   }
   MotorsStop();
   delay(1000);
}
  • This code will not work for you exactly.
  • The robot is following the line so I have placed some value for IR sensors so that my robot can follow.
  • When right IR sensor is HIGH then right motor moves a little faster and left motor slows down.
  • In this way I am making it to follow the line so you have to change such values in the code.
  • If you got into any issue regarding this project then add us on Skype and we will help you out.
  • Here’s our final robot looks like:

line following robot, line following robotic waiter, line following robot arduino, arduino line following code, line following robotic waiter

  • Here’s the video of Line following Robotic Waiter which will give you the better idea of how it worked:

That’s all for today, I hope you have enjoyed today’s project. Will meet you guys in the next tutorial. till then take care and have fun !!! 🙂

13 Comments

  1. sensor 4 never used in the code!!!….may I ask you to provide me with arduino config + the brief explanation for the code..
    if that is possible to you sir…
    thanks in advanced
    yours naz

  2. hello sir,
    very impressive work can you help me to do such as this project using RFID Readers ???
    Waiting your replay A.S.A.P

  3. Designing a line follow robotic waiter is very interesting job but its also a hectic job because we have to follow some principles. After Arduino procedure here’s you mentioned IR Sensors .How these sensors help robot to detect the tables? Are your mentioned sensors used for right and left directions only or for moving forward also? Does these sensors have some connection with Arduino and motor?

  4. I appreciate your services which you have done for engineering students. Could you please share an easy diagram of electronic circuit for better understanding?

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment