Object Avoider

Object Avoider

An Object Avoider Robot is an autonomous robot that detects obstacles in its path and changes direction to avoid collisions. In this project, we will use:
One IR sensor to detect obstacles
L298N motor driver to control the motors
Arduino Uno as the brain of the robot
Two DC motors for movement

How It Works

  1. The IR sensor continuously checks for obstacles.
  2. If no obstacle is detected, the robot moves forward.
  3. If an obstacle is detected, the robot stops and turns to avoid it.
  4. The process repeats, allowing the robot to navigate autonomously.

Components Required

  1. Arduino Uno – Main controller
  2. IR Sensor – Detects obstacles
  3. L298N Motor Driver – Controls the motors
  4. Two DC Motors – Moves the robot
  5. Power Source – 9V battery or Li-ion battery pack
  6. Chassis – Robot frame
  7. Jumper Wires – For connections

Connections

Programming

int IN1=9;

int IN2=10;

int IN3=11;

int IN4=12;

int IR_SENSOR=7;

void setup()

{

pinMode(IN1, OUTPUT);

pinMode(IN2, OUTPUT);

pinMode(IN3, OUTPUT);

pinMode(IN4, OUTPUT);

pinMode(IR_SENSOR, INPUT);

}

void loop()

{

int obstacle = digitalRead(IR_SENSOR);

if (obstacle == 0)

{

moveForward();

}

else

{

stopRobot();

delay(500);

turnRight();

delay(1000);

}

}

void moveForward()

{

digitalWrite(IN1, HIGH);

digitalWrite(IN2, LOW);

digitalWrite(IN3, HIGH);

digitalWrite(IN4, LOW);

}

void turnRight()

{

digitalWrite(IN1, HIGH);

digitalWrite(IN2, LOW);

digitalWrite(IN3, LOW);

digitalWrite(IN4, HIGH);

}

void stopRobot()

{

digitalWrite(IN1, LOW);

digitalWrite(IN2, LOW);

digitalWrite(IN3, LOW);

digitalWrite(IN4, LOW);

}

Working Mechanism

🔹 The IR sensor sends out infrared light.
🔹 If the light reflects back, it means an obstacle is detected.
🔹 The robot stops and turns right to avoid the obstacle.
🔹 If no obstacle is detected, the robot moves forward.

Applications of an Object Avoider Robot

Autonomous Navigation – Moves without human control
Smart Delivery Systems – Avoids obstacles while carrying items
Industrial Automation – Used in warehouses and factories
Self-driving Cars (Basic Concept) – Uses sensors to avoid crashes