Back to: Robotics & Artificial Intelligence (Class IX)
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
- The IR sensor continuously checks for obstacles.
- If no obstacle is detected, the robot moves forward.
- If an obstacle is detected, the robot stops and turns to avoid it.
- The process repeats, allowing the robot to navigate autonomously.
Components Required
- Arduino Uno – Main controller
- IR Sensor – Detects obstacles
- L298N Motor Driver – Controls the motors
- Two DC Motors – Moves the robot
- Power Source – 9V battery or Li-ion battery pack
- Chassis – Robot frame
- 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