Firefighters continuously run the risk of dying as the world progressively moves toward automated systems and self-driving cars. If a fire is not put out, it spreads quickly. Therefore, our system steps in to solve this problem and protect the life of our hero. The Arduino Uno development board powers this firefighting robotic system, which also has a fire flame sensor for spotting oncoming fires and a water tank and spray mechanism for putting out the flames. For optimal coverage, a water spraying nozzle is attached to a servo motor. A water pump is used to transfer water from the main water tank to the water nozzle.
So in this tutorial we are going to make a fire fighting robot with the help of Arduino, flame sensor and servo motors. Previously we build line following robot, surveillance robot car, obstacle-avoiding robot, light following robot.
What is Flame Sensor?
A flame sensor is a type of sensor that responds most strongly to ambient light. This sensor module is utilised in flame alarms as a result. This sensor picks up flames coming from the light source with wavelengths between 760 and 1100 nm. High temperatures have the potential to easily harm this sensor. So, a specific distance from the flame can be chosen for this sensor's placement. The flame can be detected from a distance of 100 cm. This sensor outputs either an analogue signal or a digital signal. These sensors serve as a flame alert in firefighting robots.
Flame Sensor Working Principle
Flame sensors identify flames using UV (Ultraviolet), IR (Infra-Red), or UV-IR technology. Simply detecting UV rays is how the UV flame sensor operates. Most fires produce UV radiation near the point of ignition, therefore in the event of a fire, the sensor would become aware of it and produce a series of pulses that are altered by the detector and produce an alarm.
Servo motor Pinout
The MG90S is a metal gear servo motor commonly used in RC applications. This servo motor is commonly used in RC applications which can rotate 90 degrees in both the direction or approximately 180 degrees in total.
L298N Pinout
Datasheet
Motor controller |
L298N, drives 2 DC motors |
Operating Voltage |
5- 35V |
Logic voltage |
4.5 – 7 V |
Max current |
2A per channel |
Voltage Regulator |
78M05 |
Module dimensions |
43 x 43 x 28 mm |
Junction operating temperature |
-25 to 130 o Celsius |
Components Required
- Arduino Board (UNO)
- USB – A to micro-USB cable
- Car chassis
- L298 motor driver module
- Flame sensor module
- Servo Motor
- L293D Motor Driver Module
- Mini DC Submersible Pump
- 12V Battery
- On-Off- Switch
- DC Female Connector Jack
- Connecting wires
- Soldering iron
- Solder wire
- Hot Melt Glue Gun
Software Required
- Arduino IDE
Circuit Diagram
Follow this table in order to make your connections.
L298N driver Pins |
Arduino Pins |
ENA |
3 |
IN1 |
12 |
IN2 |
4 |
IN3 |
7 |
IN4 |
2 |
ENB |
5 |
L293 module pins |
Arduino pins |
12v |
12v |
GND |
GND |
5v |
5v |
EN1 |
5v |
IN1 |
GND |
IN2 |
6 |
Servo pins |
Arduino pins |
Vcc |
5v |
GND |
GND |
Signal |
11 |
Flame sensor module |
Arduino pins |
Vcc |
5v |
GND |
GND |
DO (RIGHT) |
9 |
DO (FORWARD) |
8 |
DO (LEFT) |
10 |
For L298N motor driver module, motors are connected to the motor terminals of the motor driver module. The motor driver has another 3 terminals, in which one is 12Volt connected to the battery. The GND terminal is connected to the battery’s negative terminal and it is also connected to the Arduino board GND pin and 5v is connected to 5v of the Arduino board.
Arduino Source Code
Here is a code for Fire Fighting robot using Arduino. Simply copy the code and upload it to your Arduino board using Arduino IDE software.
#include <Servo.h> //include servo.h library
Servo myservo;
int pos = 0;
int motor_speed = 70;
boolean fire = false;
#define Left 9 // left sensor
#define Right 10 // right sensor
#define Forward 8 //front sensor
#define LM1 2 // left motor
#define LM2 7 // left motor
#define RM1 4 // right motor
#define RM2 12 // right motor
#define pump 6
void setup() {
pinMode(Left, INPUT);
pinMode(Right, INPUT);
pinMode(Forward, INPUT);
pinMode(LM1, OUTPUT);
pinMode(LM2, OUTPUT);
pinMode(RM1, OUTPUT);
pinMode(RM2, OUTPUT);
pinMode(pump, OUTPUT);
analogWrite(3, motor_speed);
analogWrite(5, motor_speed);
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) ==1 && digitalRead(Right)==1 && digitalRead(Forward) ==1) {
digitalWrite(LM1, HIGH);
digitalWrite(LM2, HIGH);
digitalWrite(RM1, HIGH);
digitalWrite(RM2, HIGH);
}
else if (digitalRead(Forward) ==0) {
digitalWrite(LM1, HIGH);
digitalWrite(LM2, LOW);
digitalWrite(RM1, HIGH);
digitalWrite(RM2, LOW);
fire = true;
}
else if (digitalRead(Left) ==0) {
digitalWrite(LM1, HIGH);
digitalWrite(LM2, LOW);
digitalWrite(RM1, HIGH);
digitalWrite(RM2, HIGH);
}
else if (digitalRead(Right) ==0) {
digitalWrite(LM1, HIGH);
digitalWrite(LM2, HIGH);
digitalWrite(RM1, HIGH);
digitalWrite(RM2, LOW);
}
delay(300);//change this value to increase the distance
while (fire == true) {
put_off_fire();
}
}
Troubleshooting
Robot is moving too fast?For this change value of motor speed in the code. Note that 1 is the minimum value and 255 is the maximum speed.
No Power Supply?
Try changing your batteries. Ensure that you must supply 12v to the L298 Motor Driver module. A Voltage rating less than this will not work.
Project not working?
Ensure that the circuit you have made is according to the circuit diagram. Check for loose connections. Cross-check for motor connections.
Motors are rotating in opposite direction?
For this, reverse the terminals of the motor connecting the Motor driver module.
Flame sensor is not responding?
Try adjusting POT provided on the Flame sensor module. Keep adjusting until you get the desired result.