Introduction
Build an autonomous firefighting robot that detects flames using IR sensors and extinguishes them with a water pump. This comprehensive guide covers everything from design through implementation, testing, and deployment.
Build an autonomous firefighting robot that detects flames using IR sensors and extinguishes them with a water pump.
Build an autonomous firefighting robot that detects flames using IR sensors and extinguishes them with a water pump. This comprehensive guide covers everything from design through implementation, testing, and deployment.
Flame sensors detect IR radiation in the 760–1100nm wavelength range emitted by fire. Three sensors (left, center, right) provide directional fire information. In darkness, analog value drops when flame detected. Digital output triggers below threshold. Algorithm: if center sensor detects flame → move forward. If left sensor → turn left. If right sensor → turn right. If all three detect flame (very close) → stop and activate extinguisher.
10 components required for this project.
| # | Component | Purpose | Qty |
|---|---|---|---|
| 1 | Arduino Mega | Main controller | x1 |
| 2 | Flame Sensor (YDJSB IR) | Fire detection in left, center, right zones | x3 |
| 3 | DC Water Pump (5V, 3L/min) | Water spray for extinguishing | x1 |
| 4 | Servo Motor for nozzle | Directing water spray | x1 |
| 5 | L298N Motor Driver | Drive motors | x1 |
| 6 | HC-SR04 Ultrasonic | Obstacle avoidance | x2 |
| 7 | 12V 4WD Robot Chassis | Stable off-road platform | x1 |
| 8 | Water Tank (500ml) | Water reservoir | x1 |
| 9 | Temperature Sensor (MLX90614 IR) | Measuring flame temperature | x1 |
| 10 | Fan (5V blower) | Alternative extinguishing for small flames | x1 |
Follow these 4 steps carefully.
Flame sensors detect IR radiation in the 760–1100nm wavelength range emitted by fire. Three sensors (left, center, right) provide directional fire information. In darkness, analog value drops when flame detected. Digital output triggers below threshold. Algorithm: if center sensor detects flame → move forward. If left sensor → turn left. If right sensor → turn right. If all three detect flame (very close) → stop and activate extinguisher.
Use a state machine: PATROL (wandering/searching with obstacle avoidance), DETECTED (flame sensor triggered, navigate toward), EXTINGUISH (within 20cm of flame, activate pump and servo). During navigation, use ultrasonic sensors to avoid walls. Implement proportional turning: flame sensor analog value guides turn sharpness — stronger signal → sharper turn toward fire.
Control pump via MOSFET transistor (relay alternative). Servo sweeps nozzle 45°–135° during extinguishing for coverage. Activate pump for 3 seconds, stop, re-check if flame still detected. Repeat up to 5 times (limited by water supply). If flame not extinguished after 5 attempts, retreat and alert (buzzer + LED). Monitor water tank level with a float sensor to prevent dry-pump damage.
Use MLX90614 IR thermometer for precise temperature reading. When flame detected, stop robot, sweep thermometer servo (if installed) left-right to find peak temperature direction. This is more accurate than broad-area flame sensors for precise positioning. Alternatively, use a camera with OpenCV fire detection algorithm for vision-based localization — identifies orange/yellow pixel clusters with flickering pattern analysis.
Core code for firefighter.ino:
#define FL A0 #define FC A1 #define FR A2
#define PUMP 12 #define SERVO_PIN 11
int flameL, flameC, flameR;
void loop() {
flameL = analogRead(FL); flameC = analogRead(FC); flameR = analogRead(FR);
bool l = flameL < 300, c = flameC < 300, r = flameR < 300;
if(!l && !c && !r) { patrol(); return; }
if(c) { // Center - go straight to flame
if(flameC < 100) { extinguish(); } // Very close
else { forward(150); }
} else if(l && !r) { turnLeft(); }
else if(r && !l) { turnRight(); }
}
void extinguish() {
stopMotors();
for(int a=60; a<=120; a+=10) { servo.write(a); delay(100); }
digitalWrite(PUMP, HIGH); delay(3000);
digitalWrite(PUMP, LOW);
}
Test Firefighting Robot by verifying each subsystem individually before full integration.
Verify power voltages, check ground connections, use serial monitor for debug.
An interactive simulator will be available here — simulate circuits and run code in-browser without hardware.