Arduino UNO-Based Automatic Fire Extinguisher with Flame Sensor and I2C LCD
View and Edit Project In Cirkit Designer
Automatic Fire Extinguisher System
Summary
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.
Component List
Arduino UNO
- Description: A 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: A sensor module that detects flame and fire.
- Pins: A0, GND, VCC, D0
1-Channel Relay (5V 10A)
- Description: A relay module that can control high voltage devices.
- Pins: NC, signal, C, power, NO, ground
16x2 I2C LCD
- Description: A 16x2 character LCD display with I2C interface.
- Pins: GND, VCC, SDA, SCL
5V Mini Water Pump
- Description: A small water pump that operates at 5V.
- Pins: positive pin, negative pin
Fan
- Description: A small fan that operates at 5V.
- Pins: GND, 5V
9V Battery
- Description: A 9V battery used to power the circuit.
- Pins: -, +
Wiring Details
Arduino UNO
- 5V connected to power of 1-Channel Relay (5V 10A)
- GND connected to ground of 1-Channel Relay (5V 10A)
- GND connected to GND of KY-026 Flame Sensor
- Vin connected to VCC of KY-026 Flame Sensor
- A4 connected to SDA of 16x2 I2C LCD
- A5 connected to SCL of 16x2 I2C LCD
- D3 connected to signal of 1-Channel Relay (5V 10A)
- D2 connected to D0 of KY-026 Flame Sensor
KY-026 Flame Sensor
- GND connected to GND of Arduino UNO
- VCC connected to Vin of Arduino UNO
- D0 connected to D2 of Arduino UNO
1-Channel Relay (5V 10A)
- power connected to 5V of Arduino UNO
- ground connected to GND of Arduino UNO
- signal connected to D3 of Arduino UNO
- C connected to + of 9V Battery
- NO connected to positive pin of 5V Mini Water Pump and 5V of Fan
16x2 I2C LCD
- GND connected to GND of Arduino UNO
- VCC connected to 5V of Arduino UNO
- SDA connected to A4 of Arduino UNO
- SCL connected to A5 of Arduino UNO
5V Mini Water Pump
- positive pin connected to NO of 1-Channel Relay (5V 10A)
- negative pin connected to - of 9V Battery
Fan
- 5V connected to NO of 1-Channel Relay (5V 10A)
- GND connected to - of 9V Battery
9V Battery
- + connected to C of 1-Channel Relay (5V 10A)
- - connected to negative pin of 5V Mini Water Pump and GND of Fan
Code Documentation
Arduino UNO Code
/*
* 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
}
1-Channel Relay (5V 10A) Code
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
16x2 I2C LCD Code
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.