Arduino UNO Smart Obstacle Avoiding Robot with Ultrasonic Sensor, IR Sensor, GSM Module & L298N Motor Driver

 

Arduino UNO Smart Obstacle Avoiding Robot with Ultrasonic Sensor, IR Sensor, GSM Module & L298N Motor Driver

Arduino UNO Smart Obstacle Avoiding Robot Using Ultrasonic Sensor, IR Sensor, GSM & L298N Motor Driver

The Arduino Uno Smart Obstacle Avoiding Robot is an advanced robotics and IoT-based project that integrates multiple sensors, motor drivers, communication modules, and environmental monitoring components into a single autonomous system.

This Arduino-based robotic vehicle uses an ultrasonic sensor, IR obstacle sensor, L298N motor driver, GSM module, MQ gas sensor, LCD display, and buzzer to create a smart safety and surveillance robot capable of autonomous navigation and remote alerts.

It is ideal for engineering students, robotics enthusiasts, and IoT developers.


 Project Overview – Arduino Smart Robot System

This Arduino obstacle avoiding robot project includes:

  • Arduino UNO microcontroller

  • HC-SR04 for distance measurement

  • IR Obstacle Detection Sensor

  • L298N motor driver

  • Two DC gear motors with wheels

  • GSM communication module (SIM800L compatible)

  • 16x2 LCD display (I2C)

  • MQ-series gas sensor

  • 7805 voltage regulator IC

  • Buzzer for alerts

  • Lithium-ion battery power supply

This setup forms a multi-functional smart robotic vehicle capable of obstacle detection, gas monitoring, and remote communication.


 How the Arduino Obstacle Avoiding Robot Works

1️⃣ Ultrasonic Distance Measurement

The HC-SR04 ultrasonic sensor continuously measures the distance between the robot and obstacles in front of it.

If the distance is less than the predefined threshold (20 cm), the robot stops and changes direction.

2️⃣ IR Obstacle Detection

The IR sensor provides short-range detection to enhance obstacle avoidance accuracy.

3️⃣ Motor Control Using L298N

The Arduino sends control signals to the L298N motor driver, which controls the two DC motors using PWM signals for:

  • Forward movement

  • Reverse movement

  • Right turn

  • Stop

4️⃣ Gas Detection & Alerts

The MQ-series gas sensor monitors harmful gases. If gas levels exceed the threshold:

  • Buzzer activates

  • LCD displays warning

  • GSM module can send SMS alerts

5️⃣ GSM Communication

The GSM module enables remote notifications, making this robot suitable for industrial safety and smart surveillance applications.

6️⃣ LCD Monitoring

The 16x2 LCD displays real-time:

  • Distance readings

  • System status

  • Alert messages


Key Features of Arduino Smart Robot

  • Autonomous obstacle detection and avoidance

  • Dual sensor integration (Ultrasonic + IR)

  • GSM-based remote alert system

  • Gas leak detection capability

  • Real-time LCD monitoring

  • PWM motor speed control

  • Stable regulated 5V power supply

  • Expandable IoT-ready architecture


Applications of Smart Obstacle Avoiding Robot

  • Arduino obstacle avoiding robot project

  • IoT-based safety monitoring system

  • Gas leakage detection robot

  • Smart surveillance robotic vehicle

  • Industrial safety automation prototype

  • Engineering final year robotics project

  • STEM robotics learning model


 Technical Concepts Demonstrated

This project demonstrates:

  • Embedded systems integration

  • Sensor interfacing with Arduino

  • Ultrasonic distance calculation

  • Motor driver control using PWM

  • Serial communication with GSM module

  • Voltage regulation using 7805 IC

  • LCD interfacing using I2C protocol

  • Robotics automation fundamentals


Why This Arduino Robot Project is Important

The Arduino UNO Smart Obstacle Avoiding Robot combines robotics, IoT, environmental monitoring, and communication systems into one comprehensive embedded project.

It is perfect for:

  • Engineering students

  • Robotics hobbyists

  • IoT system developers

  • Smart city research projects

  • Industrial safety monitoring solutions

This project provides hands-on experience in automation systems, robotics programming, sensor fusion, and real-time monitoring applications.

Code:

/*
  Arduino UNO Smart Obstacle Avoiding Robot
  - Uses an HC-SR04 Ultrasonic Sensor for distance measurement
  - Uses an IR sensor for obstacle detection
  - Controls two motors via an L298N Motor Driver
  - Communicates via a SIM800L GSM module
  - Alerts with a buzzer and LEDs
*/

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Pin definitions
#define TRIG_PIN 8
#define ECHO_PIN 7
#define IR_SENSOR_PIN A1
#define BUZZER_PIN 12
#define MOTOR_ENA 6
#define MOTOR_IN1 2
#define MOTOR_IN2 3
#define MOTOR_IN3 4
#define MOTOR_IN4 5
#define MOTOR_ENB 9
#define LED_RED_PIN 10
#define LED_GREEN_PIN 11

// Constants
const int distanceThreshold = 20; // cm

// LCD setup
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {
  // Initialize serial communication
  Serial.begin(9600);

  // Initialize pins
  pinMode(TRIG_PIN, OUTPUT);
  pinMode(ECHO_PIN, INPUT);
  pinMode(IR_SENSOR_PIN, INPUT);
  pinMode(BUZZER_PIN, OUTPUT);
  pinMode(MOTOR_ENA, OUTPUT);
  pinMode(MOTOR_IN1, OUTPUT);
  pinMode(MOTOR_IN2, OUTPUT);
  pinMode(MOTOR_IN3, OUTPUT);
  pinMode(MOTOR_IN4, OUTPUT);
  pinMode(MOTOR_ENB, OUTPUT);
  pinMode(LED_RED_PIN, OUTPUT);
  pinMode(LED_GREEN_PIN, OUTPUT);

  // Initialize LCD
  lcd.begin();
  lcd.backlight();
  lcd.print("Smart Robot");
}

void loop() {
  // Measure distance using ultrasonic sensor
  long duration, distance;
  digitalWrite(TRIG_PIN, LOW);
  delayMicroseconds(2);
  digitalWrite(TRIG_PIN, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIG_PIN, LOW);
  duration = pulseIn(ECHO_PIN, HIGH);
  distance = (duration / 2) / 29.1;

  // Read IR sensor
  int irValue = digitalRead(IR_SENSOR_PIN);

  // Display distance on LCD
  lcd.setCursor(0, 1);
  lcd.print("Dist: ");
  lcd.print(distance);
  lcd.print(" cm   ");

  // Obstacle avoidance logic
  if (distance < distanceThreshold || irValue == LOW) {
    // Obstacle detected
    digitalWrite(LED_RED_PIN, HIGH);
    digitalWrite(LED_GREEN_PIN, LOW);
    digitalWrite(BUZZER_PIN, HIGH);
    stopMotors();
    delay(500);
    reverseMotors();
    delay(500);
    turnRight();
    delay(500);
  } else {
    // Path is clear
    digitalWrite(LED_RED_PIN, LOW);
    digitalWrite(LED_GREEN_PIN, HIGH);
    digitalWrite(BUZZER_PIN, LOW);
    forwardMotors();
  }
}

void forwardMotors() {
  digitalWrite(MOTOR_IN1, HIGH);
  digitalWrite(MOTOR_IN2, LOW);
  digitalWrite(MOTOR_IN3, HIGH);
  digitalWrite(MOTOR_IN4, LOW);
  analogWrite(MOTOR_ENA, 255);
  analogWrite(MOTOR_ENB, 255);
}

void reverseMotors() {
  digitalWrite(MOTOR_IN1, LOW);
  digitalWrite(MOTOR_IN2, HIGH);
  digitalWrite(MOTOR_IN3, LOW);
  digitalWrite(MOTOR_IN4, HIGH);
  analogWrite(MOTOR_ENA, 255);
  analogWrite(MOTOR_ENB, 255);
}

void stopMotors() {
  digitalWrite(MOTOR_IN1, LOW);
  digitalWrite(MOTOR_IN2, LOW);
  digitalWrite(MOTOR_IN3, LOW);
  digitalWrite(MOTOR_IN4, LOW);
}

void turnRight() {
  digitalWrite(MOTOR_IN1, HIGH);
  digitalWrite(MOTOR_IN2, LOW);
  digitalWrite(MOTOR_IN3, LOW);
  digitalWrite(MOTOR_IN4, HIGH);
  analogWrite(MOTOR_ENA, 255);
  analogWrite(MOTOR_ENB, 255);
}


 

IOT & SMART SYSTEM PROJECTS

  1. IoT Weather Monitoring System (NodeMCU ESP8266 + DHT11 + Rain Sensor)
  2. ESP8266 NodeMCU Smart Health & Environment Monitoring System with Pulse, Temperature and Motion Sensors
  3. ESP32 Wi-Fi Weight Sensor with HX711
  4. Smart RFID Access Control System Using ESP32 Dev Board and UHF RFID Reader Module
  5. Smart IoT Motor Control System Using ESP32 Dev Board and L298N Motor Driver Module
  6. Smart Waste Management System Using Arduino Nano, Ultrasonic Sensor & GSM Module – Solar Powered IoT Solution
  7. Raspberry Pi Zero W and GSM SIM900 Based Ultrasonic Distance Measurement System
  8. Arduino UNO Smart Surveillance System with ESP8266 WiFi, PIR Motion Sensor & Camera Module
  9. Arduino UNO Environmental Monitoring System with OLED & 16x2 I2C LCD Display
  10. Arduino UNO-Based Smart Home Automation System with Flame and IR Sensors 
  11. Arduino Nano-Based Landslide Detection System with GSM Alerts – Smart Disaster Monitoring Project
  12. Arduino Nano Rain-Sensing Stepper Motor System
  13. Arduino Based Automatic Tire Inflator Using Pressure Sensor, Relay Module and LCD Display
  14. Arduino-Based Automatic Cooker Using Servo Motors, DC Stirrer Motor, Temperature Sensor and Relay-Controlled Heater
  15. Arduino Sketch for Plastic Bottle and Can Reverse Vending Machine

 TRAFFIC & SMART CITY PROJECTS
  1. RFID-Based Smart Traffic Control System (Arduino Mega)
  2. Arduino UNO Traffic Light Control System – Smart LED Signal Project
  3.  Arduino UNO Controlled Traffic Light System with Joystick Interface

ROBOTICS PROJECTS
  1. Arduino UNO Smart Obstacle Avoiding Robot (Ultrasonic + IR + GSM)
  2. Arduino-Powered Autonomous Obstacle Avoidance Robot with Servo Control
  3. Arduino Nano Bluetooth Controlled Line Follower Robot Using L298N Motor Driver
  4. Arduino UNO Bluetooth Controlled 4WD Robot Car Using L298N Motor Driver
  5. Arduino UNO Multi-Sensor Obstacle Avoidance & Bluetooth Controlled Robot Car Using L298N
  6. Raspberry Pi Motor Control Robot (L298N + Li-ion)
  7. RC Car Simulation with L298N Motor Driver and Joystick Control using Arduino (CirkitDesign Simulation)
  8. Raspberry Pi Robotic Arm Control System with Camera Module and Motor Driver – Smart Automation & Vision-Based Robotics Project
  9. ESP32-Based 4WD Robot Car Using Dual L298N Motor Drivers – Circuit Diagram and IoT Control Project

LORA & WIRELESS COMMUNICATION PROJECTS
  1. Arduino LoRa Communication Project Using Adafruit RFM95W LoRa RadioArduino Nano with RFM95 SX1276 LoRa
  2. Arduino Nano with RFM95 LoRa SX1276 Module – Long Range Wireless Communication Project
  3. Arduino Nano Digital Clock Using DS3231 RTC and TM1637 4-Digit Display – Circuit Diagram and Project Guide

 LED, LIGHTING & DISPLAY PROJECTS
  1. Arduino UNO Controlled NeoPixel Ring Light Show
  2. Wi-Fi Controlled NeoPixel Ring (ESP8266)
  3. Chained NeoPixel Rings with Arduino – Addressable RGB LED Control Project
  4. Arduino Nano-Controlled Lighting System with Gesture and Sound Interaction
  5. Raspberry Pi GPIO Multi-LED Control System – Beginner-Friendly Embedded Electronics Project
  6. 4 Channel Relay Module with Arduino UNO

 SENSOR & DETECTION PROJECTS
  1. Arduino UNO Color Sensor + Proximity System (TCS3200 + Inductive)
  2. Arduino Color Detection Project Using Adafruit TCS34725 RGB Color Sensor
  3. Arduino Gas Leakage Detection and Safety Alert System Using MQ-2 Gas Sensor
  4. MQ-135 Air Quality Detector Using Arduino | Cirkit Designer Simulation Project
  5. Pulse Sensor Using Arduino – Complete Guide with Simulation 
  6. HX711 Load Sensor Demo Using Arduino | Digital Weight Measurement Project
  7. Track Time with DS1307 RTC and Display on Arduino Uno with 16x2 LCD | Cirkit Designer Project
  8. Parking Sensor Simulator using Arduino Uno and HC-SR04 Ultrasonic Sensor

 FUN & INTERACTIVE PROJECTS
  1. Pong Game with Arduino UNO and OLED Display – Project Explanation
  2.   Arduino UNO Bluetooth-Controlled Servo Motor System
  3. Arduino UNO-Based Interactive Touch and Distance Sensing System with LED Indicators and Servo Control

 INDUSTRIAL / AUTOMATION PROJECTS

  1. Arduino UNO Smart Waste Sorting System Using Ultrasonic Sensor, Moisture Sensor, Servo, Stepper Motor and LCD
  2. Arduino-Based Smart Waste Segregation System Using Metal, Plastic and Moisture Sensors with Stepper and Servo Control
  3. ESP32-Based Digital Weighing Scale Using 50kg Load Cell, HX711 Module and 16x2 LCD Display
  4. Arduino-Based Smart Toll Gate Automation System with RFID, GSM, Ultrasonic Sensor and LCD Display

  5. Arduino-Based Automatic Pill Dispenser Machine with LCD Display, Servo Motor and Buzzer Reminder

  6. Arduino UNO Smart Water Quality Monitoring System with pH Sensor, Turbidity Sensor and LCD Display

  7. Arduino-Based Ocean Cleaning Boat Robot with Dual IBT-2 Motor Drivers and Conveyor Belt System

  8. IoT-Based Accident Detection and Health Monitoring System Using Raspberry Pi with GSM, GPS and Camera Integration

  9. Raspberry Pi RFID and Keypad Based Smart Door Lock System with LCD Display and L298N Motor Driver

  10. Smart Shopping Trolley Using Arduino UNO & RFID | Automatic Billing System

  11. Arduino UNO Based Automatic Liquid Hand Sanitizer & Soap Dispenser System

  12. Arduino Based Robotic Weeding Machine with Ultrasonic Obstacle Detection and L298N Motor Driver

  13. Arduino UNO Based Biometric Electronic Voting System with LCD Display and Fingerprint Authentication

  14. Arduino UNO Based Electronic Voting System with ILI9341 TFT Display

Comments