Arduino UNO-Based Smart Fire Detection and Sprinkler System with SMS Alerts
View and Edit Project In Cirkit Designer
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
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
KY-026 Flame Sensor
- Description: Sensor module for detecting flame or fire.
- Pins: A0, GND, VCC, D0
Sim800l
- Description: GSM/GPRS module for sending SMS and data communication.
- Pins: NET, RST, VCC, RXD, TXD, GND
5V Mini Water Pump
- Description: Small water pump powered by 5V.
- Pins: Positive pin, Negative pin
5V Battery
- Description: Power source providing 5V.
- Pins: Positive, Negative
1-Channel Relay (5V 10A)
- Description: Relay module for switching high power devices.
- Pins: NC, Signal, C, Power, NO, Ground
Buzzer
- Description: Simple buzzer for audible alerts.
- Pins: PIN, GND
Wiring Details
Arduino UNO
- 5V connected to Power of 1-Channel Relay and VCC of KY-026 Flame Sensor.
- GND connected to GND of Sim800l, Ground of 1-Channel Relay, GND of KY-026 Flame Sensor, and GND of Buzzer.
- A0 connected to A0 of KY-026 Flame Sensor.
- D5 connected to PIN of Buzzer.
- D4 connected to Signal of 1-Channel Relay.
- D3 connected to RXD of Sim800l.
- D2 connected to TXD of Sim800l.
KY-026 Flame Sensor
- VCC connected to 5V of Arduino UNO.
- GND connected to GND of Arduino UNO.
- A0 connected to A0 of Arduino UNO.
Sim800l
- GND connected to GND of Arduino UNO.
- RXD connected to D3 of Arduino UNO.
- TXD connected to D2 of Arduino UNO.
- VCC connected to Positive of 5V Battery.
5V Mini Water Pump
- Positive pin connected to C and NO of 1-Channel Relay.
- Negative pin connected to Negative of 5V Battery.
5V Battery
- Positive connected to VCC of Sim800l.
- Negative connected to Negative pin of 5V Mini Water Pump.
1-Channel Relay (5V 10A)
- Power connected to 5V of Arduino UNO.
- Ground connected to GND of Arduino UNO.
- Signal connected to D4 of Arduino UNO.
- C and NO connected to Positive pin of 5V Mini Water Pump.
Buzzer
- PIN connected to D5 of Arduino UNO.
- GND connected to GND of Arduino UNO.
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.