This project is an automatic fire extinguisher system that uses an Arduino UNO microcontroller to interface with a KY-026 Flame Sensor, a 1-Channel Relay, a 16x2 I2C LCD, a 5V mini water pump, and a fan. When the flame sensor detects fire, the relay is activated to turn on the water pump and the fan. The LCD displays the status of the system.
Arduino UNO
KY-026 Flame Sensor
1-Channel Relay (5V 10A)
16x2 I2C LCD
5V Mini Water Pump
Fan
9V Battery
/*
* AUTOMATIC FIRE EXTINGUISHER
* This Arduino sketch interfaces with a KY-026 Flame Sensor, a 1-Channel Relay,
* and a 16x2 I2C LCD. When the flame sensor detects fire, the relay is activated
* to turn on a water pump and a fan. The LCD displays the status of the system.
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Pin definitions
const int flameSensorPin = 2;
const int relayPin = 3;
// LCD setup
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
// Initialize serial communication
Serial.begin(9600);
// Initialize pins
pinMode(flameSensorPin, INPUT);
pinMode(relayPin, OUTPUT);
// Initialize LCD
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Fire System Ready");
}
void loop() {
int flameState = digitalRead(flameSensorPin);
if (flameState == HIGH) {
// Fire detected
digitalWrite(relayPin, HIGH);
lcd.setCursor(0, 1);
lcd.print("Fire Detected! ");
Serial.println("Fire Detected!");
} else {
// No fire
digitalWrite(relayPin, LOW);
lcd.setCursor(0, 1);
lcd.print("No Fire ");
Serial.println("No Fire");
}
delay(500); // Delay for stability
}
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
This documentation provides a comprehensive overview of the automatic fire extinguisher system, including a summary, component list, wiring details, and code documentation.