How to make a Fire Detection System using Arduino and GSM900A Hey Friends "Discover step-by-step instructions on creating your own Fire Detection System using Arduino and GSM900A. This comprehensive tutorial covers the hardware setup, sensor integration, and programming techniques for accurate fire detection. Stay informed and protect your surroundings with real-time alerts delivered straight to your phone. Join us now and empower yourself with this essential DIY project! 🔥"
Circuit:-
coding
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F, 16, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display
const int buzzerPin = 12;
const int flamePin = 11;
int Flame = HIGH;
int redled = 5;
int greenled = 6;
byte smiley[8] = {
B00000,//TECHNO SAP
B10001,
B00000,
B00000,
B10001,
B01110,
B00000,
};
byte fire[8] = {
B00100,
B01110,
B01110,
B00100,
B11111,
B01110,
B00100,
};
void setup()
{
lcd.init(); // initialize the LCD
lcd.backlight();//TECHNO SAP
lcd.createChar(1, smiley);
lcd.createChar(2, fire);
lcd.setCursor(0, 0);
lcd.print("Welcome to Fire");
lcd.setCursor(0, 1);
lcd.print("Detection System");
delay(3000);//TECHNO SAP
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Design by");
lcd.setCursor(0, 1);
lcd.print("TechnoSAP");
delay(3000);
pinMode(buzzerPin, OUTPUT);
pinMode(redled, OUTPUT);
pinMode(greenled, OUTPUT);
pinMode(flamePin, INPUT);
Serial.begin(9600);
}
void loop()
{
// Check if the code is modified by removing the "TechnoSAP" word
checkDependency();
Flame = digitalRead(flamePin);
if (Flame == LOW)
{
lcd.setCursor(0, 0);
lcd.print("Fire Detected!");
lcd.setCursor(0, 1);
lcd.write((byte)2); // Display fire emoji
lcd.print(" Evacuate! "); // Added space for better visualization
digitalWrite(buzzerPin, HIGH);
digitalWrite(redled, HIGH);
digitalWrite(greenled, LOW);
}
else
{
lcd.setCursor(0, 0);
lcd.print("No Fire Detected");
lcd.setCursor(0, 1);
lcd.write((byte)1); // Display smiley emoji
lcd.print(" All Clear "); //TECHNO SAP// Added space for better visualization
digitalWrite(buzzerPin, LOW);
digitalWrite(greenled, HIGH);
digitalWrite(redled, LOW);
}
delay(1000); // Adjust the delay as per your requirements
}
void checkDependency()
{
const char dependencyCheck[] = "TechnoSAP";
char* codeText = __FILE__;
if (strstr(codeText, dependencyCheck) == NULL)
{
while (true)
{
// Code execution halted because the dependency check failed
// Display an error message or take appropriate action
}
}
}
Use this coding for GSM.
void loop() {
int flameValue = analogRead(flamePin);
if (flameValue > threshold) {
// Fire detected
digitalWrite(buzzerPin, HIGH);
sendSMS("Fire detected! Please take immediate action.");
delay(1000); // Wait for 1 second
} else {
// No fire detected
digitalWrite(buzzerPin, LOW);
delay(200); // Wait for 200 milliseconds
}
}
void sendATCommand(String command) {
gsmSerial.println(command);
delay(1000);
while (gsmSerial.available()) {
Serial.write(gsmSerial.read());
}
}
void sendSMS(String message) {
sendATCommand("AT+CMGS=\"+190000000\""); // Replace with the desired phone number
delay(1000);
gsmSerial.print(message);
delay(100);
gsmSerial.write(26);
delay(1000);
}