Build a Disaster Rescue Robot with Arduino!
Learn robotics, coding, and electronics — by building a robot that can search through dangerous zones and avoid obstacles, just like real rescue robots!
Your Very Own Rescue Robot!
Real rescue teams use robots to search inside collapsed buildings, flooded areas, and fire zones — places that are too dangerous for people to go. Today, you're going to build one!
Your robot will:
Drive around on its own
Using two DC motors and wheels, your robot moves forward and explores.
Detect obstacles with a sensor
An ultrasonic sensor acts like bat sonar — bouncing sound waves to find walls and objects.
Dodge and avoid crashes
When it senses something in the way, it stops, turns, and finds a new path!
Flash a rescue signal LED
A blinking LED signals "I found a path!" just like a real rescue robot beacon.
🛒 What You Need
Collect all these parts before you start. Most are available at electronics shops or online!
🏗️ Assemble the Chassis
Your robot needs a body to carry all its parts. You can use a cardboard box, a plastic tray, or a proper robot chassis kit!
📐 Layout Plan
┌─────────────────────────────────┐ │ TOP VIEW OF ROBOT │ │ │ │ [Sensor] ← Front facing │ │ 📡 │ │ ┌─────────────────────────┐ │ │ │ Arduino Uno 🟦 │ │ │ │ + L298N Motor Driver │ │ │ │ + Breadboard │ │ │ └─────────────────────────┘ │ │ │ │ ⚙️ Motor L Motor R ⚙️ │ │ 🛞 Wheel L Wheel R 🛞 │ │ │ │ 🔵 Caster Wheel │ │ (Back/Front) │ │ │ │ 🔋 Battery (underneath) │ └─────────────────────────────────┘
🔨 Assembly Steps
Attach the motors
Stick or screw the two DC motors on the left and right sides of your chassis.
Add wheels
Push the wheels onto the motor shafts. Make sure they're tight!
Mount the caster
Attach a small caster wheel at the front or back — it helps the robot balance and turn smoothly.
Place your electronics
Stick the Arduino, L298N, and breadboard on top using double-sided tape or velcro.
Mount the sensor at the front
The HC-SR04 sensor should face forward like two robot eyes!
⚡ Circuit Wiring Guide
Now for the exciting part — connecting all the parts with wires! Follow the table carefully. Use different-coloured wires so it's easy to track.
📡 HC-SR04 Ultrasonic Sensor
| Sensor Pin | → Connect To | Colour Tip |
|---|---|---|
VCC | Arduino 5V | 🔴 Red |
GND | Arduino GND | ⚫ Black |
TRIG | Arduino Pin 9 | 🟡 Yellow |
ECHO | Arduino Pin 10 | 🟢 Green |
⚙️ L298N Motor Driver
| L298N Pin | → Connect To | Colour Tip |
|---|---|---|
IN1 | Arduino Pin 2 | 🔵 Blue |
IN2 | Arduino Pin 3 | 🟣 Purple |
IN3 | Arduino Pin 4 | 🔵 Blue |
IN4 | Arduino Pin 5 | 🟣 Purple |
ENA | Arduino Pin 6 (PWM) | 🟠 Orange |
ENB | Arduino Pin 11 (PWM) | 🟠 Orange |
12V | Battery + terminal | 🔴 Red |
GND | Battery – terminal + Arduino GND | ⚫ Black |
5V OUT | Arduino 5V (optional) | 🔴 Red |
OUT1 / OUT2 | Left Motor wires | Any |
OUT3 / OUT4 | Right Motor wires | Any |
🔴 LED Rescue Signal
| LED | → Connect To | Note |
|---|---|---|
Long leg (+) | Arduino Pin 13 via 220Ω resistor | Always use a resistor! |
Short leg (–) | Arduino GND |
📊 Full Circuit Diagram
┌────────────────────────────────────────────────────┐ │ ARDUINO UNO │ │ │ │ 5V ──────────────────────── HC-SR04 VCC │ │ GND ─────────────────────── HC-SR04 GND │ │ Pin 9 ──── [TRIG] ──────── HC-SR04 TRIG │ │ Pin 10 ─── [ECHO] ──────── HC-SR04 ECHO │ │ │ │ Pin 2 ──── [IN1] ───┐ │ │ Pin 3 ──── [IN2] ───┤ L298N Motor Driver │ │ Pin 4 ──── [IN3] ───┤ ┌──────────────────┐ │ │ Pin 5 ──── [IN4] ───┘ │ OUT1 ── Motor L │ │ │ Pin 6 ──── [ENA] ──────┤ OUT2 ──┘ │ │ │ Pin 11 ─── [ENB] ──────┤ OUT3 ── Motor R │ │ │ │ OUT4 ──┘ │ │ │ GND ───────────────────┤ GND │ │ │ │ 12V ─── Battery+│ │ │ └──────────────────┘ │ │ │ │ Pin 13 ─── [220Ω] ─── LED(+) │ │ GND ──────────────────LED(–) │ │ │ │ Power: 9V Battery ──► L298N ──► Arduino │ └────────────────────────────────────────────────────┘ ⚙️ Left Motor ←─ L298N OUT1/OUT2 ⚙️ Right Motor ←─ L298N OUT3/OUT4 📡 Sensor faces FORWARD 🔴 LED visible on TOP of robot
💻 Arduino Code
Open the Arduino IDE on your computer, paste the code below, select your board (Arduino Uno) and port, then click the ➡️ Upload button!
/* ================================================ 🤖 DISASTER RESCUE ROBOT — MakeMindz Obstacle-avoiding Arduino robot with ultrasonic sensor, dual motors & LED signal ================================================ */ // ── PIN DEFINITIONS ────────────────────────── #define TRIG_PIN 9 // HC-SR04 Trigger #define ECHO_PIN 10 // HC-SR04 Echo #define LED_PIN 13 // Rescue signal LED #define IN1 2 // Left Motor #define IN2 3 #define IN3 4 // Right Motor #define IN4 5 #define ENA 6 // Left Motor Speed (PWM) #define ENB 11 // Right Motor Speed (PWM) #define SAFE_DISTANCE 20 // cm — stop if obstacle closer #define MOTOR_SPEED 180 // 0–255 (PWM speed) // ── SETUP ──────────────────────────────────── void setup() { // Motor pins pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT); pinMode(IN3, OUTPUT); pinMode(IN4, OUTPUT); pinMode(ENA, OUTPUT); pinMode(ENB, OUTPUT); // Sensor pins pinMode(TRIG_PIN, OUTPUT); pinMode(ECHO_PIN, INPUT); // LED pinMode(LED_PIN, OUTPUT); Serial.begin(9600); Serial.println("🤖 Rescue Robot Online!"); } // ── MEASURE DISTANCE (Ultrasonic) ──────────── long getDistance() { digitalWrite(TRIG_PIN, LOW); delayMicroseconds(2); digitalWrite(TRIG_PIN, HIGH); delayMicroseconds(10); digitalWrite(TRIG_PIN, LOW); long duration = pulseIn(ECHO_PIN, HIGH); long distance = duration * 0.034 / 2; return distance; } // ── MOTOR CONTROL FUNCTIONS ─────────────────── void moveForward() { analogWrite(ENA, MOTOR_SPEED); analogWrite(ENB, MOTOR_SPEED); digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW); digitalWrite(IN3, HIGH); digitalWrite(IN4, LOW); } void stopMotors() { analogWrite(ENA, 0); analogWrite(ENB, 0); digitalWrite(IN1, LOW); digitalWrite(IN2, LOW); digitalWrite(IN3, LOW); digitalWrite(IN4, LOW); } void turnRight() { analogWrite(ENA, MOTOR_SPEED); analogWrite(ENB, MOTOR_SPEED); digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW); // Left forward digitalWrite(IN3, LOW); digitalWrite(IN4, HIGH); // Right backward } void turnLeft() { analogWrite(ENA, MOTOR_SPEED); analogWrite(ENB, MOTOR_SPEED); digitalWrite(IN1, LOW); digitalWrite(IN2, HIGH); // Left backward digitalWrite(IN3, HIGH); digitalWrite(IN4, LOW); // Right forward } // ── RESCUE SIGNAL LED ───────────────────────── void rescueSignal() { for (int i = 0; i < 3; i++) { digitalWrite(LED_PIN, HIGH); delay(100); digitalWrite(LED_PIN, LOW); delay(100); } } // ── MAIN LOOP ───────────────────────────────── void loop() { long dist = getDistance(); Serial.print("Distance: "); Serial.print(dist); Serial.println(" cm"); if (dist > 0 && dist < SAFE_DISTANCE) { // 🚨 OBSTACLE DETECTED! stopMotors(); rescueSignal(); // Flash LED alert delay(300); // Choose a random turn direction if (random(2) == 0) { turnRight(); } else { turnLeft(); } delay(600); // Turn for 600ms stopMotors(); delay(200); } else { // ✅ PATH CLEAR — move forward! moveForward(); digitalWrite(LED_PIN, HIGH); // Steady LED = moving } delay(100); }
🧠 The Science Behind Your Robot
Let's break down the cool science happening inside your robot!
Ultrasonic Sound Waves
The HC-SR04 sends out a pulse of sound (too high for humans to hear!) and waits for it to bounce back. The time it takes tells us how far away an object is — just like how bats navigate in the dark!
Distance Formula
The Arduino calculates: distance = duration × 0.034 / 2. Sound travels at 343 m/s, and we divide by 2 because the sound goes and comes back!
PWM Motor Control
Pulse Width Modulation (PWM) lets the Arduino control motor speed by switching power on and off very fast. 255 = full speed, 0 = stop. Pin 6 and 11 are PWM pins!
The L298N Motor Driver
The Arduino can't power motors directly (too weak!). The L298N acts as a power booster — it takes commands from Arduino and uses battery power to spin the motors.
The Resistor's Job
LEDs need limited current or they burn out! The 220Ω resistor acts like a tap — it controls how much electricity flows through the LED to keep it safe.
🧪 Time to Test!
Before setting your robot free, test it step by step:
Open Serial Monitor
In Arduino IDE, open Tools → Serial Monitor at 9600 baud. You should see distance readings printing live!
Test the sensor
Put your hand in front of the sensor. Distance should decrease. Move it away — distance increases. 🎉
Test motors off the ground
Hold the robot in the air and power on. Both wheels should spin forward. Check direction!
Test the full robot
Put it on the floor. It should move forward until it detects something, then flash the LED and turn!
🚀 Upgrade Your Rescue Robot
Once your basic robot is working, try these awesome upgrades to make it even more powerful!
Add a Camera
Use an ESP32-CAM module to add live video streaming — see what your robot sees!
Temperature Sensor
Add a DHT11 sensor to detect heat — real rescue robots look for survivors using heat signatures!
Bluetooth Control
Add an HC-05 Bluetooth module and control your robot from your phone using a free app!
Buzzer Alarm
Add a piezo buzzer that beeps when an obstacle is found — just like a real danger alarm!

Comments
Post a Comment