Avoids obstacles on its own and raises an alarm when it finds dangerous gas.
Built and tested by Shahan Fathima K · Industrial Robotics Institute

A search-and-rescue helper for disaster zones such as collapsed buildings or fires. It drives forward on its own, turns away from obstacles using an ultrasonic sensor, and uses an MQ-2 gas sensor to warn of smoke or gas leaks with an LED and buzzer, keeping human rescuers out of danger.
| Component | Qty |
|---|---|
| Arduino Uno | 1 |
| L298N Motor Driver Module | 1 |
| DC Motors with Wheels | 2 |
| Robot Chassis | 1 |
| Ultrasonic Sensor (HC-SR04) | 1 |
| Gas Sensor (MQ-2) | 1 |
| Buzzer | 1 |
| LED | 1 |
| Battery Pack | 1 |
| Jumper Wires | As needed |
| From | Connect to |
|---|---|
| Ultrasonic TRIG | Pin 2 |
| Ultrasonic ECHO | Pin 3 |
| Ultrasonic VCC / GND | 5V / GND |
| MQ-2 AOUT | A0 |
| MQ-2 VCC / GND | 5V / GND |
| L298N IN1 | Pin 8 |
| L298N IN2 | Pin 9 |
| L298N IN3 | Pin 10 |
| L298N IN4 | Pin 11 |
| L298N VCC | Battery + |
| LED + | Pin 6 |
| Buzzer + | Pin 7 |
Complete, tested Arduino C++ code for this project. Copy it into Arduino IDE and upload it to the Arduino Uno.
#define trigPin 2
#define echoPin 3
#define in1 8
#define in2 9
#define in3 10
#define in4 11
#define ledPin 6
#define buzzer 7
#define gasPin A0
long duration;
int distance;
int gasValue;
void forward() { digitalWrite(in1, HIGH); digitalWrite(in2, LOW); digitalWrite(in3, HIGH); digitalWrite(in4, LOW); }
void rightTurn() { 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); }
void setup()
{
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
pinMode(ledPin, OUTPUT);
pinMode(buzzer, OUTPUT);
}
void loop()
{
// Measure distance
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2;
// Read gas sensor
gasValue = analogRead(gasPin);
if (distance < 20)
{
stopRobot();
delay(500);
rightTurn();
}
else
{
forward();
}
if (gasValue > 400)
{
digitalWrite(ledPin, HIGH);
digitalWrite(buzzer, HIGH);
}
else
{
digitalWrite(ledPin, LOW);
digitalWrite(buzzer, LOW);
}
delay(200);
}A search-and-rescue helper for disaster zones such as collapsed buildings or fires. It drives forward on its own, turns away from obstacles using an ultrasonic sensor, and uses an MQ-2 gas sensor to warn of smoke or gas leaks with an LED and buzzer, keeping human rescuers out of danger.
You need: Arduino Uno (1), L298N Motor Driver Module (1), DC Motors with Wheels (2), Robot Chassis (1), Ultrasonic Sensor (HC-SR04) (1), Gas Sensor (MQ-2) (1), Buzzer (1), LED (1), Battery Pack (1), Jumper Wires. Software: Arduino IDE.
It is rated intermediate and takes about 3–4 hours to build, using the Arduino Uno. The guide on this page explains every connection and step.
The complete, tested Arduino C++ code is free on this page. Copy it into Arduino IDE and upload it to the board.
Yes. IRI sells a kit with the parts for this project (PRJ-072). Message IRI on WhatsApp at +91 86060 82634 for the kit price and delivery details.