Arduino Obstacle Avoiding Robot

Arduino Obstacle Avoiding Robot Construction
In this blog post, we will discuss how to build an obstacle avoiding robot kit using Arduino Uno.
What is an Obstacle Avoiding Robot?
An obstacle avoiding robot prevents a moving vehicle from colliding with obstacles by controlling its surroundings with sensors. According to your software, it determines its own path without colliding with obstacles. Sensors like Hc-sr04 or Mz80 are ideal for this project. We will use hc-sr04 in our project.
Required Materials
- Arduino Uno
- 2-Wheel Transparent Chassis Car Kit
- L298N Voltage Regulated Dual Motor Driver Board
- Ultrasonic Sensor HC-SR04
- 6-Slot AA Battery Holder
- Battery (We recommend using a 2s lipo battery for rechargeable and high efficiency.)
- Jumper Cables
Circuit Diagram

Arduino Codes
#define echoPin 12 //Echo pin of the Ultrasonic sensor connected to pin 12 of Arduino
#define trigPin 13 //Trig pin of the Ultrasonic sensor connected to pin 13 of Arduino
#define MotorR1 7
#define MotorR2 6
#define MotorRE 9 // Define motor pins
#define MotorL1 5
#define MotorL2 4
#define MotorLE 3
long duration, distance; // Define two variables for duration and distance
void setup() {
// Since the ultrasonic sensor sends waves from the Trig pin, it is defined as OUTPUT,
// and since it receives these waves from the Echo pin, it is defined as INPUT.
pinMode(echoPin, INPUT);
pinMode(trigPin, OUTPUT);
pinMode(MotorL1, OUTPUT);
pinMode(MotorL2, OUTPUT);
pinMode(MotorLE, OUTPUT); // Define our motors as output.
pinMode(MotorR1, OUTPUT);
pinMode(MotorR2, OUTPUT);
pinMode(MotorRE, OUTPUT);
Serial.begin(9600
Share
Blog Latest Additions

The Code of Numbers on Drone Propellers: How to Read Propeller Measurements?
11.02.2026

Building a Portable Charging Station with Solar Panels
10.01.2026

Differences Between Li-ion and Li-Po Batteries: Which Battery is Suitable for Which Project?
12.12.2025

MPU-9250: 9-Axis Acceleration Sensor - A Comprehensive Beginner's Guide
28.10.2025

What is ULN2003 ?
13.10.2025

What are Serial Converter Cards (RS232, RS485, TTL)
16.09.2025
.png)