Arduino Based Fire Fighting Robot

Published  December 20, 2017   139
Aswinth Raj
Author
DIY Arduino Based Fire Fighting Robot Project

According to National Crime Records Bureau (NCRB), it is estimated that more than 1.2 lakh deaths have been caused because of fire accidents in India from 2010-2014. Even though there are a lot of precautions taken for Fire accidents, these natural/man-made disasters do occur now and then. In the event of a fire breakout, to rescue people and to put out the fire we are forced to use human resources which are not safe. With the advancement of technology especially in Robotics it is very much possible to replace humans with robots for fighting the fire. This would improve the efficiency of firefighters and would also prevent them from risking human lives. Today we are going to build a Fire Fighting Robot using Arduino, which will automatically sense the fire and start the water pump

In this project, we will learn how to build a simple robot using Arduino that could move towards the fire and pump out water around it to put down the fire. It is a very simple robot that would teach us the underlying concept of robotics; you would be able to build more sophisticated robots once you understand the following basics. So let’s get started...

 

Material Required:

  1. Arduino UNO
  2. Fire sensor or Flame sensor (3 Nos)
  3. Servo Motor (SG90)
  4. L293D motor Driver module
  5. Mini DC Submersible Pump
  6. Small Breadboard
  7. Robot chassis with motors (2) and wheels(2) (any type)
  8. A small can
  9. Connecting wires

Buy all the above required components for Arduino fire fighting robot.

Working Concept of Fire Fighting Robot:

The main brain of this project is the Arduino, but in-order to sense fire we use the Fire sensor module (flame sensor) that is shown below.

Fire or flame sensor module

As you can see these sensors have an IR Receiver (Photodiode) which is used to detect the fire. How is this possible? When fire burns it emits a small amount of Infra-red light, this light will be received by the IR receiver on the sensor module. Then we use an Op-Amp to check for change in voltage across the IR Receiver, so that if a fire is detected the output  pin (DO) will give 0V(LOW) and if the is no fire the output pin will be 5V(HIGH).

So, we place three such sensors in three directions of the robot to sense on which direction the fire is burning.

Flame sensor setup on fire fighting robot chasis

We detect the direction of the fire we can use the motors to move near the fire by driving our motors through the L293D module. When near a fire we have to put it out using water. Using a small container we can carry water, a 5V pump is also placed in the container and the whole container is placed on top of a servo motor so that we can control the direction in which the water has to be sprayed. Let’s proceed with the connections now

 

Circuit Diagram:

The complete circuit diagram for this Fire Fighting Robot is given below

DIY Arduino based Fire Fighting Robot circuit diagram

You can either connect all the shown connections for uploading the program to check the working or you can assemble the bot completely and then proceed with the connections. Both ways the connections are very simple and you should be able to get it right.

Based on the robotic chassis that you are using you might not be able to use the same type of container that I am using. In that case use your own creativity to set up the pumping system. However the code will remain same. I used a small aluminium can (cool drinks can) to set the pump inside it and poured water inside it. I then assembled the whole can on top of a servo motor to control the direction of water. My robot looks something like this after assembly.

DIY Arduino based Fire Fighting Robot Hardware setup

Water tank with water pump motor for fire fighting robot Attaching servo motor for water direction control

As you can see, I have fixed the servo fin to the bottom of the container using got glue and have fixed the servo motor with chassis using nuts and bolts.  We can simply place the container on top of the motor and trigger the pump inside it to pump water outside through the tube. The whole container can then be rotated using the servo to control the direction of the water.

 

Programming your Arduino:

Once you are ready with your hardware, you can upload the Arduino code for some action. The complete program is given at the end of this page. However I have further explained few important bits and pieces here.

 As we know the fire sensor will output a HIGH when there is fire and will output a LOW when there is fire. So we have to keep checking these sensor if any fire has occurred. If no fire is there we ask the motors to remain stop by making all the pins high as shown below

    if (digitalRead(Left_S) ==1 && digitalRead(Right_S)==1 && digitalRead(Forward_S) ==1) //If Fire not detected all sensors are zero
    {
    //Do not move the robot
    digitalWrite(LM1, HIGH);
    digitalWrite(LM2, HIGH);
    digitalWrite(RM1, HIGH);
    digitalWrite(RM2, HIGH);
    }

 

Similarly, if there is any fire we can ask the robot to move in that direction by rotating the respective motor. Once it reaches the fire the left and right sensor will not detect the fire as it would be standing straight ahead of the fire. Now we use the variable named “fire” that would execute the function to put off the fire.

    else if (digitalRead(Forward_S) ==0) //If Fire is straight ahead
    {
    //Move the robot forward
    digitalWrite(LM1, HIGH);
    digitalWrite(LM2, LOW);
    digitalWrite(RM1, HIGH);
    digitalWrite(RM2, LOW);
    fire = true;
    }

 

Once the variable fire becomes true, the fire fighting robot arduino code will execute the put_off_fire function until the fire is put off. This is done using the code below.

     while (fire == true)
     {
      put_off_fire();
     }

   

Inside the put_off_fire() we just have to stop the robot by making all the pins high. Then turn on the pump to push water outside the container, while this is done we can also use the servo motor to rotate the container so that the water is split all over uniformly. This is done using the code below

void put_off_fire()
{
     delay (500);
    digitalWrite(LM1, HIGH);
    digitalWrite(LM2, HIGH);
    digitalWrite(RM1, HIGH);
    digitalWrite(RM2, HIGH);  
   digitalWrite(pump, HIGH); delay(500);
    for (pos = 50; pos <= 130; pos += 1) {
    myservo.write(pos);
    delay(10); 
  }
 for (pos = 130; pos >= 50; pos -= 1) {
    myservo.write(pos);
    delay(10);
  }
  digitalWrite(pump,LOW);
  myservo.write(90);
    fire=false;
}

 

Working of Fire Fighting Robot:

It is recommended to check the output of the robot in steps rather than running it all together for the first time. You can build the robot upto the servo motor and check if it is able to follow the fire successfully. Then you can check if the pump and the servo motor are working properly. Once everything is working as expected you can run the program below and enjoy the complete working of the fire fighter robot.

DIY Arduino based Fire Fighting Robot working

The complete working of the robot can be found at the video given below. The maximum distance to which the fire can be detected depends on the size of the fire, for a small matchstick the distance is relatively less. You can also use the potentiometers on top of the modules to control the sensitivity of the robot. I have used a power bank to power the robot you can use a battery or even power it with a 12V battery.

 

Hope you understood the project and would enjoy building something similar. If you have any problems in getting this build, use the comment section below to post your quires or use the forums for technical help.

 

Check out our Robotics Section to find more cool DIY Robots.

Code
/*------ Arduino Fire Fighting Robot Code----- */
 
#include <Servo.h>
Servo myservo;
 
int pos = 0;    
boolean fire = false;
 
/*-------defining Inputs------*/
#define Left_S 9      // left sensor
#define Right_S 10      // right sensor
#define Forward_S 8 //forward sensor
 
/*-------defining Outputs------*/
#define LM1 2       // left motor
#define LM2 3       // left motor
#define RM1 4       // right motor
#define RM2 5       // right motor
#define pump 6
 
void setup()
{
  pinMode(Left_S, INPUT);
  pinMode(Right_S, INPUT);
  pinMode(Forward_S, INPUT);
  pinMode(LM1, OUTPUT);
  pinMode(LM2, OUTPUT);
  pinMode(RM1, OUTPUT);
  pinMode(RM2, OUTPUT);
  pinMode(pump, OUTPUT);
 
  myservo.attach(11);
  myservo.write(90); 
}
 
void put_off_fire()
{
    delay (500);
 
    digitalWrite(LM1, HIGH);
    digitalWrite(LM2, HIGH);
    digitalWrite(RM1, HIGH);
    digitalWrite(RM2, HIGH);
    
   digitalWrite(pump, HIGH); delay(500);
    
    for (pos = 50; pos <= 130; pos += 1) { 
    myservo.write(pos); 
    delay(10);  
  }
  for (pos = 130; pos >= 50; pos -= 1) { 
    myservo.write(pos); 
    delay(10);
  }
  
  digitalWrite(pump,LOW);
  myservo.write(90);
  
  fire=false;
}
 
void loop()
{
   myservo.write(90); //Sweep_Servo();  
 
    if (digitalRead(Left_S) ==1 && digitalRead(Right_S)==1 && digitalRead(Forward_S) ==1) //If Fire not detected all sensors are zero
    {
    //Do not move the robot
    digitalWrite(LM1, HIGH);
    digitalWrite(LM2, HIGH);
    digitalWrite(RM1, HIGH);
    digitalWrite(RM2, HIGH);
    }
    
    else if (digitalRead(Forward_S) ==0) //If Fire is straight ahead
    {
    //Move the robot forward
    digitalWrite(LM1, HIGH);
    digitalWrite(LM2, LOW);
    digitalWrite(RM1, HIGH);
    digitalWrite(RM2, LOW);
    fire = true;
    }
    
    else if (digitalRead(Left_S) ==0) //If Fire is to the left
    {
    //Move the robot left
    digitalWrite(LM1, HIGH);
    digitalWrite(LM2, LOW);
    digitalWrite(RM1, HIGH);
    digitalWrite(RM2, HIGH);
    }
    
    else if (digitalRead(Right_S) ==0) //If Fire is to the right
    {
    //Move the robot right
    digitalWrite(LM1, HIGH);
    digitalWrite(LM2, HIGH);
    digitalWrite(RM1, HIGH);
    digitalWrite(RM2, LOW);
    }
    
delay(300); //Slow down the speed of robot
 
     while (fire == true)
     {
      put_off_fire();
     }
}
Video

Have any question realated to this Article?

Ask Our Community Members

Comments

Submitted by harish on Mon, 12/25/2017 - 20:46

Permalink

i want video with explanation, step-by-step implementation of hardware, block diagram of the project and also study materials for the project of fire fighting robot using arduino uno. please help me............. for the final year project submission...

Submitted by Jothisree on Wed, 01/10/2018 - 12:01

Permalink

Can you tell me how the water can is connected...and wat is tat plastic thing below the can!!!
and how is the water controlled with the servo motor

He has used a 5V pump to pump the water out of the can. The whole can is mounter on top of a servo motor. The pump is placed inside the can (that is the white plastic thing)

Submitted by Mudasir on Tue, 01/16/2018 - 11:21

Permalink

Can you kindly tell me how to select water pump in Proteus and what is the component placed above flame sensors in the circuit diagram (round and have a digital meter on it),
Thanks

I'm assisting my son who is in middle school on a science project, and we are at a standstill and hoping you can assist us. I've came across your video and it seemed relatively close to what we hope to accomplish. We are trying to make a voice/(phrase) command volcano that erupts so far we found instructions to make the classic science fair volcano but have run into difficulty coding and assembling to make it erupt on command. How would you make the fire fighting bot shoot water on voice/phrase command. Can you please help us?

Hi alanna,

I assume you have used a pump inside your volcano which when activated would pump some water(Lava) outside the volcano. Now to turn on this pump using voice command is no easy task and would surely be an overkill for a science fair. 

However if you want to do it, you can follow this tutorial below where a Light is turned on using Voice command, you just have to replace the light with your pump

https://circuitdigest.com/microcontroller-projects/iot-based-voice-cont…

A more easy way would be to turn on the pump for the sound of a clap (or any large noise). This would be a lot more easy. The circuit for same is shared below. Instead of controlling led you can control your pump

https://circuitdigest.com/electronic-circuits/simple-led-music-light

Hope this would help you to assist your young champ. If you need more help please use the forums 

 

Submitted by Mostafa on Thu, 01/18/2018 - 17:50

Permalink

I want to make the same project but make the robot avoid obstacles using ultrasonic sensor ans use only one fire sensor

Submitted by Rashmi on Fri, 02/02/2018 - 02:00

Permalink

This project is interesting.i want to know why we use Arduino uno instead of any other kit here and will it work similar if i replace arduino with any other ic cheap set?

Submitted by akash on Sun, 02/04/2018 - 09:49

Permalink

hi,your project is amazing but my L293d motor driver module is having only 7 plugs how is your having 14 plugs?
i have also checked for L293d ic it is having 16 plugs

Submitted by MorFin on Thu, 02/08/2018 - 20:22

Permalink

arduinonun solundaki kırmızı(red) tahtanın üstündeki siyah(black) cisim nedir? ve arduinonun altındaki yeşil (green) şey nedir? URGENT!!!!

Submitted by Rachna on Sat, 02/10/2018 - 10:10

Permalink

What should I do if water pump is not working when connected to 6 number pin of arduino.but it is working when it is connected between +5V and ground. I guess the pump is not receiving enough voltage when connected to arduino.Is there any solution to solve this problem. Please reply as soon as possible.

Submitted by Laurice Dicksen on Sat, 02/24/2018 - 03:29

Permalink

in the concept of the project there is an op amp said back there, so does the op amp needed ? if needed what ic number will i use ? because im so confused thank you.

Submitted by Ezee Khushairi on Wed, 02/28/2018 - 07:17

Permalink

can you provide your materials picture? Because im new in coding and wiring things. So im afraid i buy the wrong items but have similar name

Submitted by Maria Mercedes on Sat, 03/03/2018 - 18:10

Permalink

Did you experience any problems regarding connecting of the servo motor? Ours keeps on moving even though there is no flame. The flame sensors however, lights up when there is a flame but both the motor and the servo is not working. Hoping for your kind reply asap. Thank you.

Hi,

I am having the same issue that Maria reported, robot does not stop at flame and no action from servo motor. Is there a fix?

From Maria...Maria Mercedes
reply
Did you experience any problems regarding connecting of the servo motor? Ours keeps on moving even though there is no flame. The flame sensors however, lights up when there is a flame but both the motor and the servo is not working. Hoping for your kind reply asap. Thank you.

The reason for you robot to move when there is no fire is because the flame sensors will react to IR rays. IF there is excess sunlight inside the room, the sensor would read the IR rays from sun and assume it to be fire.

IF your motors and servo are not working, the problem should be on the hardware. Try running a small servo sweep program (example program in arduino) and check if the motors are functional 

Submitted by sujay bhat on Sun, 03/04/2018 - 15:56

Permalink

in the connection circuit you have provided, you have not shown the connection between arduino and bred board, please help

Submitted by OMKAR patil on Mon, 03/05/2018 - 00:10

Permalink

It is not working .....I connect properly all the components also upload code in arduino...Bt it is not working....Plzz held me for getting output

Sir... I connect all components shown in diagram .....I give 9v power supply to ardino .... Upload the code you given...Bt the problem is that the ardino not get power to motor drive and fire sensor......Its not work .....I give 9v power supply to ardino bt the fire sensor also off

Submitted by surekha on Tue, 03/06/2018 - 10:52

Permalink

the power i give in is either enough to run the servo motor and sensors or the wheels..not both at the same time. what can be done to increase the input power. if one works the other stops

Submitted by sidharth on Sat, 03/10/2018 - 14:28

Permalink

hii ......i am building a similar project...wen im connecting the 9G servo motor and the pump together with the arduino, the servo does'nt sweep properly, instead it gets stuck to one position. the pump which i used is a 6V one. Any solutions for that ?????

Submitted by John on Sat, 03/17/2018 - 06:11

Permalink

Hi there,
Can i use the motorshield L293d? what supposed to be the pin out? will the sketch program for Arduino change? Need reply ASAP . Thank you for a great project!

Submitted by Archita on Thu, 03/22/2018 - 19:28

Permalink

Me and my friend are working on this fire fighting robot and are unable to run the code, as the bot is not working.

Submitted by Mayank Vyas on Fri, 03/23/2018 - 23:07

Permalink

HI,
i'v been working on the same since days. The sensors and the servomotor (below the can) seems working good. The LM and RM are not responding any how, is there any other way i can run my L&R motor except L293D? The 5v water pump is not receiving enough voltage form the arduino uno board. Please help.
Thank you.

Submitted by Chandan on Sun, 03/25/2018 - 00:14

Permalink

How much power supply u used ,u mentioned only 12v u didn't shown it in video.and I use 4wd chassis I have to use 4wd motor driver ,how to connect it . otherwise can it possible to connect another back wheels common with front is it works?

Submitted by Omkar patil on Tue, 03/27/2018 - 00:23

Permalink

How to define the distance between fire sensor and flame....what should I do for When fire detect an bot forward towords fire and stop in specific distance.....

Submitted by Kyle Lorenz on Wed, 03/28/2018 - 14:43

Permalink

Hi! What could be the problem if the wheels don't work when there is a fire? Also, the servo motor works right away when the arduino is connected to the laptop? Please reply ASAP, thank you very much!!

Submitted by Faisal on Sat, 03/31/2018 - 01:16

Permalink

In the components there was a breadboard and the fire fighter robot was maken by the breadboard. Then where is the connection of breadboard ? Is it possible to make the robot without breadboard help me please??

Submitted by Faisal Islam on Sat, 03/31/2018 - 01:21

Permalink

In the components there was a breadboard. The robot was also maken by breadboard. But in the circuit diagram there is no breadboard. Is there any need of using breadboard?

Submitted by Madhuri on Sun, 04/01/2018 - 16:13

Permalink

Water pump of 5v as only two wire red and black those are connected to 5v and ground....thn water will be pumped continuously...so how will the water pump knows Wen it has to pump

Submitted by Shrinidhi on Sat, 04/07/2018 - 08:50

Permalink

Hello sir..I have used 2 DC motors for chessy board for the motion of the fire brigade.Is there any variations we have to do? or the program you have given??

Submitted by Rajan on Sun, 04/08/2018 - 21:38

Permalink

please sir help me . my project is not working properly . when i connect audiuno to laptop, it will automatically rotating wheels and micro server. please send me its proper circuit diagram and program. i am very thankfull if you helping me.

Submitted by Mohamed wael on Tue, 04/10/2018 - 17:45

Permalink

i will replace the tip by much stronger nozzle , so what will i modify in the code to increase the range of the sensor ?
i want larger distance when the robot sense the fire move a bit and start the pump and the servo motor

Submitted by Shivam Sharma on Sat, 04/14/2018 - 12:09

Permalink

When I connect the pump, pump is not working but all robot does. Pump and servo motor are not working at same time. Help me.

Submitted by Syed Hassan Aa… on Sun, 04/15/2018 - 17:46

Permalink

My servo motor is not working for left and right sensor . For middle sensor its working fine . Can anyone give me any aolution ?

Submitted by EJ on Wed, 04/18/2018 - 11:11

Permalink

Hi There, It is my first time getting hands on this type of project it is really awesome and interesting.
I am working in a school project and since I do not have any experience at all I would like your expertise help to guide me through. I do have the robot car already just need help to connect the fire sensor and make them work.

Submitted by Mudasir on Fri, 04/20/2018 - 12:02

Permalink

I have uploaded the code and connection all the connections properly but the robot in not working properly, I have made following connections:
1. a 12v battery to supply enough current to the motors (i am using 4 tires chasing) through L239D.
2. Through this battery I have supplied voltages to arduino at "Vin" port.
3. L239D is also directly connected to 12V Battery (at 12v Dc terminal of L239D and ground obviously).
4. I have taken 5v from arduino 5v port and have supplied it to flame sensor (using a 5 channel flame sensor module) , servo motor and the water pump according to the diagram with the arduino.
I am facing the following issues:-
1. Robot is continuously moving forward(3 secs move, 3 secs stop then repeat)
2. Servo Motor is continuously rotating according to the code irrespective of flame detection.
3. Flame sensor is sensing the flame properly but pump is not spraying water (never).
Kindly guide me how to resolve the issues.
Thank you

Hi Mudasir,

Your connections are all correct. It should have worked properly. Was there direct sunlight inside the room in which you were testing? 

I suggest you to debug by yourself, it can be easily done by adding some Seril.println() lines inside the program to figure out why the bot is responding badly. Hope you get it working.

Submitted by EJ on Mon, 04/23/2018 - 09:14

Permalink

Hi B.Aswinth Raj,
I would like to ask for your help in where can I buy the correct L293D motor Driver module for this project. i have tried but there are a lot of options and no one looks like the one shown in the diagram.
Sorry for being so naive but it is the first project and I am helping my daughter to build this project that is due in a week have not tested yet either due to I am missing L293D motor Driver module to connect the final wires. do you happen to have a link where I can see a all the project step by step? the diagram its self explanatory but I am running out of time :(