OBSTACLE AVOIDING
ROBOT
GROUP MEMBERS
 Rasheed Khan 14-ME-146
 Shahzaib Tahir 14-ME-154
 Shehzad Iqbal 14-ME-157
 Sumair Ansar 14-ME-159
What is Obstacle Avoidance ??
Our Robot
 The obstacle detection is primary requirement of this autonomous robot
 In this project our robot senses any obstacle in its path, avoids it and resume its
running
 Involves the pre-computation of an obstacle-free path which a controller guides
the robot
Hardware
 UNO Arduino
 U.R Sensor
 DC motor Driver
 Connecting wires
 USB programmer
1- UNO Arduino:
 Arduino is a software company, project, and user community that designs and
manufactures computer open-source hardware, open-source software, and
microcontroller-based kits for building digital devices and interactive objects
that can sense and control physical devices.


Sensors
 Some sensing devices used for obstacle detection like bump sensor, infrared
sensor, ultrasonic sensor etc.
 Ultrasonic sensor is most suitable for obstacle detection because of
 LOW COST
 HIGH RANGING CAPABILITY
2- Ultrasonic Sensor
 Emit a sound pulse that reflects off of objects entering the wave field
 The reflected sound, or “echo” is then received by the sensor
 Detection of the sound generates an output signal for use by an actuator, controller,
or computer
 The output signal can be analog or digital.
 The time for an ultrasonic sensor’s beam to strike the target and return is directly
proportional to the distance to the object
3- DC Motor Driver (L298N)
 L298N is a typical Motor driver or Motor Driver IC which allows DC motor to drive
on either direction.
 L298N is a 16-pin IC which can control a set of two DC motors simultaneously in
any direction.
 It means that you can control two DC motor with a single L298N IC.
Specifications:
 Double H bridge Drive Chip: L298N
 Logical voltage: 5V Drive voltage: 5V-35V
 Logical current: 0-36mA Drive current: 2A (MAX single bridge)
 Max power: 25W
 Dimensions: 43 x 43 x 26mm
 Weight: 26g
4- Connecting wires :
We are using these wires for making the connections.
 5- USB Programmer:
USB Programmer is basically use for uploading the code from computer to
Arduino.
Block Diagram
Circuit Diagram

Programe Coding
 #define trigPin
 #define echoPin
 #define MotorA_IN1
 #define MotorA_IN2
 #define MotorB_IN3
 #define MotorB_IN4
 #define MotorA_PWM
 #define MotorB_PWM
 void setup()
 {
 pinMode(MotorA_IN1, OUTPUT);
 pinMode(MotorA_IN2, OUTPUT);
 pinMode(MotorB_IN3, OUTPUT);
 pinMode(MotorB_IN4, OUTPUT);
 pinMode(MotorA_PWM, OUTPUT);
 pinMode(MotorB_PWM, OUTPUT);
 pinMode(trigPin, OUTPUT);
 pinMode(echoPin, INPUT);
 }
 float search(void)
 {
 float duration = 0.00;
 float CM = 0.00;
 digitalWrite(trigPin, LOW);
 delayMicroseconds(2);

 //Send 10us High Pulse to Ultra-Sonic Sonar Sensor "trigPin"
 digitalWrite(trigPin, HIGH);
 delayMicroseconds(10);
 digitalWrite(trigPin, LOW);
 duration = pulseIn(echoPin, HIGH);
 CM = (duration / 58.82);
 return CM;
 }
 void RobotForward()
 {
 digitalWrite(MotorA_IN1, HIGH);
 digitalWrite(MotorA_IN2, LOW);
 digitalWrite(MotorB_IN3, HIGH);
 digitalWrite(MotorB_IN4, LOW);
 }
 void RobotBackward()
 {
 digitalWrite(MotorA_IN1, LOW);
 digitalWrite(MotorA_IN2, HIGH);
 digitalWrite(MotorB_IN3, LOW);
 digitalWrite(MotorB_IN4, HIGH);
 }
 void RobotLeft()
 {
 digitalWrite(MotorA_IN1, LOW);
 digitalWrite(MotorA_IN2, HIGH);
 digitalWrite(MotorB_IN3, HIGH);
 digitalWrite(MotorB_IN4, LOW);
 }
 void RobotRight()
 {
 digitalWrite(MotorA_IN1, HIGH);
 digitalWrite(MotorA_IN2, LOW);
 digitalWrite(MotorB_IN3, LOW);
 digitalWrite(MotorB_IN4, HIGH);
 }
 void RobotStop()
 {
 digitalWrite(MotorA_IN1, LOW);
 digitalWrite(MotorA_IN2, LOW);
 digitalWrite(MotorB_IN3, LOW);
 digitalWrite(MotorB_IN4, LOW);
 }
 void loop()
 {
 float distance = 0.00;
 float RobotSpeed = 0.00;
 float RightDistance = 0.00;
 float LeftDistance = 0.00
 distance = search();
 if((distance <= 40)) .
 {
 RobotSpeed = 50;
 analogWrite(MotorA_PWM, RobotSpeed);
 analogWrite(MotorB_PWM, RobotSpeed);
 RobotStop();
 delay(10);
 RobotBackward();
 delay(400);
 RobotStop();
 delay(10);
 RobotRight();
 delay(500);
 RightDistance = search();
 delay(10);
 RobotLeft();
 delay(900);
 LeftDistance = search();
 delay(10);
 if(LeftDistance >= RightDistance)
 {
 RobotForward();
 }
 else
 {
 RobotRight();
 delay(800);
 RobotStop();
 delay(10);
 RobotForward();
 }
 }
 else if((distance > 40) && (distance <= 75))
 {
 RobotSpeed = 150;
 analogWrite(MotorA_PWM, RobotSpeed);
 analogWrite(MotorB_PWM, RobotSpeed);
 RobotForward();
 }
 else
 {
 RobotSpeed = 200;
 analogWrite(MotorA_PWM, RobotSpeed);
 analogWrite(MotorB_PWM, RobotSpeed);
 RobotForward();

Applications
 Automated Cars (Google Car)
 Toys
 Military
 Mines
Video

Obstacle avoiding Robot

  • 1.
  • 2.
    GROUP MEMBERS  RasheedKhan 14-ME-146  Shahzaib Tahir 14-ME-154  Shehzad Iqbal 14-ME-157  Sumair Ansar 14-ME-159
  • 3.
    What is ObstacleAvoidance ??
  • 4.
    Our Robot  Theobstacle detection is primary requirement of this autonomous robot  In this project our robot senses any obstacle in its path, avoids it and resume its running  Involves the pre-computation of an obstacle-free path which a controller guides the robot
  • 7.
    Hardware  UNO Arduino U.R Sensor  DC motor Driver  Connecting wires  USB programmer
  • 8.
    1- UNO Arduino: Arduino is a software company, project, and user community that designs and manufactures computer open-source hardware, open-source software, and microcontroller-based kits for building digital devices and interactive objects that can sense and control physical devices.
  • 9.
  • 10.
    Sensors  Some sensingdevices used for obstacle detection like bump sensor, infrared sensor, ultrasonic sensor etc.  Ultrasonic sensor is most suitable for obstacle detection because of  LOW COST  HIGH RANGING CAPABILITY
  • 11.
    2- Ultrasonic Sensor Emit a sound pulse that reflects off of objects entering the wave field  The reflected sound, or “echo” is then received by the sensor  Detection of the sound generates an output signal for use by an actuator, controller, or computer  The output signal can be analog or digital.  The time for an ultrasonic sensor’s beam to strike the target and return is directly proportional to the distance to the object
  • 14.
    3- DC MotorDriver (L298N)  L298N is a typical Motor driver or Motor Driver IC which allows DC motor to drive on either direction.  L298N is a 16-pin IC which can control a set of two DC motors simultaneously in any direction.  It means that you can control two DC motor with a single L298N IC.
  • 16.
    Specifications:  Double Hbridge Drive Chip: L298N  Logical voltage: 5V Drive voltage: 5V-35V  Logical current: 0-36mA Drive current: 2A (MAX single bridge)  Max power: 25W  Dimensions: 43 x 43 x 26mm  Weight: 26g
  • 17.
    4- Connecting wires: We are using these wires for making the connections.  5- USB Programmer: USB Programmer is basically use for uploading the code from computer to Arduino.
  • 18.
  • 20.
  • 21.
    Programe Coding  #definetrigPin  #define echoPin  #define MotorA_IN1  #define MotorA_IN2  #define MotorB_IN3  #define MotorB_IN4  #define MotorA_PWM  #define MotorB_PWM
  • 22.
     void setup() {  pinMode(MotorA_IN1, OUTPUT);  pinMode(MotorA_IN2, OUTPUT);  pinMode(MotorB_IN3, OUTPUT);  pinMode(MotorB_IN4, OUTPUT);  pinMode(MotorA_PWM, OUTPUT);  pinMode(MotorB_PWM, OUTPUT);  pinMode(trigPin, OUTPUT);  pinMode(echoPin, INPUT);  }
  • 23.
     float search(void) {  float duration = 0.00;  float CM = 0.00;  digitalWrite(trigPin, LOW);  delayMicroseconds(2);   //Send 10us High Pulse to Ultra-Sonic Sonar Sensor "trigPin"  digitalWrite(trigPin, HIGH);  delayMicroseconds(10);  digitalWrite(trigPin, LOW);  duration = pulseIn(echoPin, HIGH);  CM = (duration / 58.82);  return CM;  }
  • 24.
     void RobotForward() {  digitalWrite(MotorA_IN1, HIGH);  digitalWrite(MotorA_IN2, LOW);  digitalWrite(MotorB_IN3, HIGH);  digitalWrite(MotorB_IN4, LOW);  }  void RobotBackward()  {  digitalWrite(MotorA_IN1, LOW);  digitalWrite(MotorA_IN2, HIGH);  digitalWrite(MotorB_IN3, LOW);  digitalWrite(MotorB_IN4, HIGH);  }
  • 25.
     void RobotLeft() {  digitalWrite(MotorA_IN1, LOW);  digitalWrite(MotorA_IN2, HIGH);  digitalWrite(MotorB_IN3, HIGH);  digitalWrite(MotorB_IN4, LOW);  }  void RobotRight()  {  digitalWrite(MotorA_IN1, HIGH);  digitalWrite(MotorA_IN2, LOW);  digitalWrite(MotorB_IN3, LOW);  digitalWrite(MotorB_IN4, HIGH);  }
  • 26.
     void RobotStop() {  digitalWrite(MotorA_IN1, LOW);  digitalWrite(MotorA_IN2, LOW);  digitalWrite(MotorB_IN3, LOW);  digitalWrite(MotorB_IN4, LOW);  }  void loop()  {  float distance = 0.00;  float RobotSpeed = 0.00;  float RightDistance = 0.00;  float LeftDistance = 0.00  distance = search();
  • 27.
     if((distance <=40)) .  {  RobotSpeed = 50;  analogWrite(MotorA_PWM, RobotSpeed);  analogWrite(MotorB_PWM, RobotSpeed);  RobotStop();  delay(10);  RobotBackward();  delay(400);  RobotStop();  delay(10);  RobotRight();  delay(500);  RightDistance = search();  delay(10);  RobotLeft();  delay(900);
  • 28.
     LeftDistance =search();  delay(10);  if(LeftDistance >= RightDistance)  {  RobotForward();  }  else  {  RobotRight();  delay(800);  RobotStop();  delay(10);  RobotForward();  }  }
  • 29.
     else if((distance> 40) && (distance <= 75))  {  RobotSpeed = 150;  analogWrite(MotorA_PWM, RobotSpeed);  analogWrite(MotorB_PWM, RobotSpeed);  RobotForward();  }  else  {  RobotSpeed = 200;  analogWrite(MotorA_PWM, RobotSpeed);  analogWrite(MotorB_PWM, RobotSpeed);  RobotForward(); 
  • 30.
    Applications  Automated Cars(Google Car)  Toys  Military  Mines
  • 31.