Follow us:-
0

ESP32-Based Autonomous Fire Extinguisher Bot

  • 17-06-2025

๐Ÿ”ฅ FIRE BOT – Bluetooth Controlled Fire Extinguisher Robot

Welcome to the FIRE BOT project! This robot is designed to detect and extinguish small fires using a flame sensor and a water pump. It is fully controllable via Bluetooth, making it ideal for educational or experimental firefighting applications.


๐Ÿง  Features

  • ๐Ÿ”ฅ Flame detection

  • ๐Ÿ’ง Water pump activation

  • ๐ŸŽฎ Bluetooth remote control (with mobile app)

  • ๐Ÿ›ž Motor movement: Forward, Reverse, Left, Right

  • ๐Ÿ” Servo motor to aim the water spray

  • ๐Ÿงช Manual + Automatic mode supported


๐Ÿ“ฆ Hardware Used

  • Arduino Uno (or compatible board)

  • L298N Dual H-Bridge Motor Driver

  • 2 DC Motors (for movement)

  • Bluetooth module (HC-05/HC-06)

  • Flame sensor

  • Water pump

  • Servo motor (SG90 recommended)

  • Power source (Li-ion battery pack or similar)

  • Jumper wires and chassis


๐Ÿ“œ Arduino Code Breakdown

#include <Servo.h>
#include <L298NX2.h>

#define LED_BUILTIN 2

  • Servo.h: Controls the servo motor.

  • L298NX2.h: Custom library to control two motors via L298N.

  • LED_BUILTIN: Unused, default Arduino LED.


๐Ÿงฉ Pin Definitions

#define IN_1 2
#define IN_2 3
#define IN_3 4
#define IN_4 5
#define F1 10
#define PUMP 6
#define SERVO 9
Component Arduino Pin Description
Motor A 2, 3 L298N IN1 & IN2
Motor B 4, 5 L298N IN3 & IN4
Pump Relay 6 Controls water pump
Servo Motor 9 Spray aiming
Flame Sensor 10 Input from flame sensor

๐Ÿš€ Setup Function

void setup() {
myservo.attach(SERVO);
Serial.begin(9600);
pinMode(PUMP, OUTPUT);
pinMode(F1, INPUT);

// Motor & Pump Test
mybot.forward();
delay(5000);
mybot.stop();
mybot.backward();
delay(5000);
mybot.stop();

myservo.write(90); // center
delay(1000);
myservo.write(180); // right
digitalWrite(PUMP, HIGH); // test spray
}

  • Initializes serial, servo, motors, and flame sensor.

  • Performs a full functional test at startup.


๐Ÿ”„ Main Loop

Flame Detection (Optional Auto Mode)

 
f1 = digitalRead(F1); Serial.print(f1);

Optional logic for auto mode:

 
if (f1 == 1)
 digitalWrite(PUMP, HIGH);
 else
digitalWrite(PUMP, LOW);

Uncomment for automatic spraying based on flame sensor.


๐Ÿ”— Bluetooth Command Handling

 
while (Serial.available() > 0
{
bdata = Serial.read();
switch (bdata) {
...
}
}

๐Ÿ“ฑ Bluetooth Commands

Command Action Description
F Move Forward Both motors move forward
B Move Backward Both motors move backward
L Turn Left Left spin using motor logic
R Turn Right Right spin using motor logic
S Stop Stops all motors
V Pump ON Activates pump to spray water
v Pump OFF Turns off the pump
W Servo Move Right Servo rotates from 0 to 90
w Servo Move Left Servo rotates back from 90 to 0

๐Ÿ–ผ๏ธ How It Works

  1. Use a Bluetooth app (like "Bluetooth RC Controller") to send commands.

  2. The robot responds with motor control, pump activation, and servo aiming.

  3. Optionally, the flame sensor detects fire and triggers the pump automatically.

  

HOW TO OPERATE

#include <Servo.h>
#include <L298NX2.h>

#define LED_BUILTIN 2

//-------------L298---------------------------------------------------
// Motor 1 settings
#define IN_1 2 //rx2
#define IN_2 3 //tx2

// Motor 2 settings
#define IN_3 4 //d4
#define IN_4 5 //d5

#define F1 10


L298NX2 mybot(IN_1, IN_2, IN_3, IN_4); // for full speed


//---------Bluetooth RC Controller Define----
#define PUMP 6   //D6
#define SERVO 9  //D9


char bdata; // for bluetooth command store

Servo myservo;
int f1;

void setup() {
  myservo.attach(SERVO);
  Serial.begin(9600);

 
  pinMode(PUMP, OUTPUT);
  pinMode(F1, INPUT);



  // Testing
  mybot.forward();
  delay(5000);
  mybot.stop();
  mybot.backward();
  delay(5000);
  mybot.stop();
  myservo.write(90);
  delay(1000);
  myservo.write(180);
  digitalWrite(PUMP, HIGH);
  // Test done
}

void loop() {
  f1 = digitalRead(F1);
 

  Serial.print(f1);
  Serial.print("\t");

//  if automatic then remove comment

  // if (f1 == 1)
  //   digitalWrite(PUMP, HIGH);
  // else
  //   digitalWrite(PUMP, LOW);

 

  while (Serial.available() > 0) {
    bdata = Serial.read();
    Serial.println(bdata);

    // Make condition based on BLE data
    switch (bdata) {
      case 'F':
        Serial.println("Forward");
        mybot.forward();
        break;

      case 'B':
        Serial.println("Reverse");
        mybot.backward();
        break;

      case 'L':
        Serial.println("Left");
        mybot.forwardA();
        mybot.backwardB();
        break;

      case 'R':
        Serial.println("Right");
        mybot.forwardB();
        mybot.backwardA();
        break;

      case 'S':
        Serial.println("Stop");
        mybot.stop();
        break;

      case 'V':
        Serial.println("PUMP ON");
        digitalWrite(PUMP, HIGH);
        break;

      case 'v':
        Serial.println("PUMP LOW");
        digitalWrite(PUMP, LOW);
        break;

      case 'W':
        Serial.println("SERVO MOVE");
        for (int pos = 0; pos < 90; pos++)
          myservo.write(pos);
        break;

      case 'w':
        Serial.println("SERVO BACK");
        for (int pos = 90; pos >= 0; pos--)
          myservo.write(pos);
        break;
    }
  }
}

ESP32-Based Autonomous Fire Extinguisher Bot

Related Post

How do I run a script at Pico on boot?

How do I run a script at Pico on boot?

As per official documentation Step by step process for pico program run after power on:Save your pyt...

ESP32 Setup in Arduino IDE

ESP32 Setup in Arduino IDE

ESP32 Board are so popular? Mainly because of the following featuresLow-costBluetoothWiFiLow PowerDu...

Node MCU ESP8266 Setup in Arduino IDE

Node MCU ESP8266 Setup in Arduino IDE

Node MCU ESP8266 Board are so popular? Mainly because of the following features.Its true Arduino Kil...

ESP32 with L298N DC Motor Driver

ESP32 with L298N DC Motor Driver

๐Ÿ”ง Basic IntroductionL298N is a dual H-Bridge motor driver IC that allows controlling the direction...

MotorBot with Esp32

MotorBot with Esp32

๐Ÿ”ง Components Needed:ComponentQuantityESP32 Dev Board1L298N Motor Driver Module1DC Gear Motors (TT o...

ESP32 with ADXL335 Accelerometer

ESP32 with ADXL335 Accelerometer

The ADXL335 is a small, thin, low-power 3-axis analog accelerometer manufactured by Analog Devices....

ESP32 with Ultrasonic Sensor (HC-SR04)

ESP32 with Ultrasonic Sensor (HC-SR04)

๐Ÿง  What is an Ultrasonic Sensor?An ultrasonic sensor is a device that uses sound waves to detect how...

ESP32 with DHT11 Temperature & Humidity Sensor

ESP32 with DHT11 Temperature & Humidity Sensor

๐Ÿ“Œ What is the DHT11 Sensor?The DHT11 is a basic, low-cost digital temperature and humidity sensor....

ESP32 with BMP180 Pressure & Temperature Sensor

ESP32 with BMP180 Pressure & Temperature Sensor

BMP180 Sensor: Digital Barometric Pressure SensorThe BMP180 is a digital barometric pressure sensor...

ESP32 with 1.8" TFT LCD Display (ST7735S)

ESP32 with 1.8" TFT LCD Display (ST7735S)

๐Ÿ”ง 1. Hardware Overview: 1.8" TFT DisplayMost 1.8" TFT modules are based on the ST7735 driver and co...

Smart Display Interface Using SSD1306 OLED & ESP32

Smart Display Interface Using SSD1306 OLED & ESP32

The SSD1306 is a popular controller used in OLED (Organic Light Emitting Diode) displays, most commo...

ESP32 with Servo Motor

ESP32 with Servo Motor

A servo motor is a type of motor designed for precise control of angular position, making it ideal f...

ESP32 with Gravity Voice Recognition Module

ESP32 with Gravity Voice Recognition Module

The Gravity Voice Recognition Module is a user-friendly module developed by DFRobot that allows micr...

ESP32 with APDS-9960 Gesture Sensor

ESP32 with APDS-9960 Gesture Sensor

The APDS-9960 is an advanced, compact sensor from Broadcom (formerly Avago Technologies) that offers...

Smart Control: Stepper Motor with ESP32

Smart Control: Stepper Motor with ESP32

๐Ÿ” What is the 28BYJ-48 Stepper Motor?The 28BYJ-48 is a 5V unipolar stepper motor with a built-in re...

Smart Farming : ESP32 with Soil Moisture Sensor

Smart Farming : ESP32 with Soil Moisture Sensor

How Soil Moisture Sensor Works and Interface it with Esp32ย When you hear the term โ€œsmart garden,โ€ on...

Control in Your Hands: ESP32 with 2-Axis Joystick

Control in Your Hands: ESP32 with 2-Axis Joystick

๐Ÿ”ง What is an Analog Joystick?An analog joystick typically has:2 potentiometers (one for X-axis, one...

ESP32 with NEO-8M GPS Module

ESP32 with NEO-8M GPS Module

๐Ÿ“ก What is the NEO-8M GPS Module?The NEO-8M is a high-precision GNSS GPS receiver by u-blox, capable...

ESP32 with WS2812 NeoPixel LED

ESP32 with WS2812 NeoPixel LED

๐Ÿ”ง What is a NeoPixel?NeoPixel is Adafruitโ€™s name for individually addressable RGB LEDs using the WS...

Motion Detected: ESP32 with PIR Sensor (HC-SR501)

Motion Detected: ESP32 with PIR Sensor (HC-SR501)

๐Ÿง  What is a PIR Sensor?PIR = Passive Infrared SensorA PIR sensor detects motion by measuring change...

ESP32 with AI Thinker GP-02 GPS Module

ESP32 with AI Thinker GP-02 GPS Module

โœ… What is AI Thinker GP-02?The AI Thinker GP-02 is a GNSS (GPS) module, designed to work with satel...

ESP32 with SIM900A GSM Module

ESP32 with SIM900A GSM Module

๐Ÿ“ก What is SIM900?The SIM900 is a GSM/GPRS module from SIMCom. It allows microcontrollers like ESP32...

Button with ESP32

Button with ESP32

๐Ÿง  What is a Push Button?A push button is a simple mechanical switch that connects two points in a c...

Tilt Sensor Module SW520D

Tilt Sensor Module SW520D

๐Ÿค” What is a Tilt Sensor?A tilt sensor (also called a ball switch or mercury switch) is a digital sw...

ESP32 with TCS34725 RGB Sensor

ESP32 with TCS34725 RGB Sensor

๐ŸŽจ What is the TCS34725?The TCS34725 is a color sensor made by AMS (now part of Renesas).It detects...

ESP32 + I2C LCD for Real-Time Feedback

ESP32 + I2C LCD for Real-Time Feedback

๐Ÿ“˜ What is an I2C LCD?An I2C LCD is a Liquid Crystal Display that uses the I2C communication protoco...

MPU6050 Accelerometer and Gyroscope Sensor

MPU6050 Accelerometer and Gyroscope Sensor

๐Ÿง  What is MPU6050?The MPU6050 is a 6-axis motion tracking device made by InvenSense. It combines:โœ…...

Digital Temperature Monitoring: ESP32 + DS18B20 Sensor System

Digital Temperature Monitoring: ESP32 + DS18B20 Sensor System

๐ŸŒก๏ธ What is DS18B20?The DS18B20 is a digital temperature sensor from Maxim Integrated (now Analog Dev...

ESP32 with DS1307 RTC Module

ESP32 with DS1307 RTC Module

โฐ What is DS1307 RTC?The DS1307ย is a real-time clock IC by Maxim Integrated that keeps track of:Sec...

DFPlayer Mini with Esp32

DFPlayer Mini with Esp32

๐ŸŽต What is DFPlayer Mini?The DFPlayer Mini is a tiny, standalone MP3 audio player module. It can pla...

IR Receiver VS1838B with ESP32

IR Receiver VS1838B with ESP32

๐Ÿ“ก What is an IR Receiver?An IR (Infrared) Receiver module receives signals from an IR remote contro...

Rotary Encoder with Esp32

Rotary Encoder with Esp32

๐Ÿ“Œ What is a Rotary Encoder?A rotary encoder is an electro-mechanical sensor that converts the angul...

ESP32 with Dot Matrix Display (MAX7219)

ESP32 with Dot Matrix Display (MAX7219)

๐Ÿ“Œ What is the Dot Matrix Display with MAX7219?A Dot Matrix Display is an arrangement of LEDs in a g...

ESP-NOW with ESP32

ESP-NOW with ESP32

๐Ÿ“Œ What is ESP-NOW?ESP-NOW is a wireless communication protocol developed by Espressif, allowing ESP...

ESP32 Joystick Controlled Robot Using ESP-NOW Protocol & L298N Motor Driver

ESP32 Joystick Controlled Robot Using ESP-NOW Protocol & L298N Motor Driver

๐Ÿค– ESP32 Joystick Controlled Robot Using ESP-NOW Protocol & L298N Motor DriverWireless bot control w...

ESP32 with MAX30100 HEART SENSOR

ESP32 with MAX30100 HEART SENSOR

โค๏ธ Heart Rate & SpOโ‚‚ Sensor (MAX30100/MAX30102)๐Ÿ”ฌ Pulse Sensor | SpOโ‚‚ Monitor | Wearable Health Tech...