Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO-Based Smart Fire Detection and Sprinkler System with SMS Alerts

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Smart Fire Detection and Sprinkler System with SMS Alerts

Smart Fire Detection and Sprinkler Activation with Mobile Alert Integration

Summary

This circuit is designed to detect fire using a KY-026 Flame Sensor and activate a water pump through a 1-Channel Relay. Additionally, it sends an SMS alert using a Sim800l module and triggers an audible alert with a buzzer. The entire system is controlled by an Arduino UNO.

Component List

  1. Arduino UNO

    • Description: Microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  2. KY-026 Flame Sensor

    • Description: Sensor module for detecting flame or fire.
    • Pins: A0, GND, VCC, D0
  3. Sim800l

    • Description: GSM/GPRS module for sending SMS and data communication.
    • Pins: NET, RST, VCC, RXD, TXD, GND
  4. 5V Mini Water Pump

    • Description: Small water pump powered by 5V.
    • Pins: Positive pin, Negative pin
  5. 5V Battery

    • Description: Power source providing 5V.
    • Pins: Positive, Negative
  6. 1-Channel Relay (5V 10A)

    • Description: Relay module for switching high power devices.
    • Pins: NC, Signal, C, Power, NO, Ground
  7. Buzzer

    • Description: Simple buzzer for audible alerts.
    • Pins: PIN, GND

Wiring Details

Arduino UNO

KY-026 Flame Sensor

Sim800l

5V Mini Water Pump

5V Battery

1-Channel Relay (5V 10A)

Buzzer

Documented Code

/*
 * Smart Fire Detection and Sprinkler Activation with Mobile Alert Integration
 *
 * This Arduino sketch interfaces with a KY-026 Flame Sensor to detect fire, a
 * 1-Channel Relay to control a water pump for sprinkler activation, and a
 * Sim800l module to send SMS alerts. Additionally, a buzzer is used for
 * audible alerts.
 */

// Pin definitions
const int flameSensorPin = A0;
const int relayPin = 4;
const int buzzerPin = 5;
const int sim800lTxPin = 2;
const int sim800lRxPin = 3;

void setup() {
  // Initialize serial communication for Sim800l
  Serial.begin(9600);
  Serial.println("Initializing...");

  // Initialize pins
  pinMode(flameSensorPin, INPUT);
  pinMode(relayPin, OUTPUT);
  pinMode(buzzerPin, OUTPUT);

  // Ensure relay and buzzer are off initially
  digitalWrite(relayPin, LOW);
  digitalWrite(buzzerPin, LOW);
}

void loop() {
  // Read flame sensor value
  int flameValue = analogRead(flameSensorPin);

  // Check if flame is detected
  if (flameValue > 100) { // Adjust threshold as needed
    // Activate relay to turn on water pump
    digitalWrite(relayPin, HIGH);

    // Activate buzzer
    digitalWrite(buzzerPin, HIGH);

    // Send SMS alert
    sendSMSAlert();
  } else {
    // Deactivate relay and buzzer
    digitalWrite(relayPin, LOW);
    digitalWrite(buzzerPin, LOW);
  }

  // Small delay to avoid rapid switching
  delay(500);
}

void sendSMSAlert() {
  Serial.println("AT+CMGF=1"); // Set SMS mode to text
  delay(1000);
  Serial.println("AT+CMGS=\"+1234567890\""); // Replace with actual phone number
  delay(1000);
  Serial.print("Fire detected! Activating sprinkler system.");
  delay(1000);
  Serial.write(26); // ASCII code for CTRL+Z to send SMS
  delay(1000);
}

This documentation provides a comprehensive overview of the circuit, including a detailed component list, wiring details, and the embedded code for the Arduino UNO.