Material Required:

  1. Arduino UNO
  2. Fire sensor or Flame sensor (3 Nos)
  3. Servo Motor (SG90)
  4. L293D motor Driver module
  5. Small Breadboard
  6. Robot chassis with motors and wheel (any type)
  7. A small can
  8. Connecting wires
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.



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.



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



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.





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, The whole page However, I have further explained some important bits and pieces here.
As we know the fire sensor will output a HIGH when there is a fire and will output a LOW when there is a fire. If there is any fire happened then If there is no fire is there we ask for the rest of the pins as 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 for the rotating the relative motor. Once it gets the fire and the sensor will not find the fire Now we use the variable name "fire" that will 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 will execute the code 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 out of 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;
}
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 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 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 ();
}
}




No comments

Theme images by Dizzo. Powered by Blogger.