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

Arduino UNO-Based Automatic Fire Extinguisher with Flame Sensor and I2C LCD

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Automatic Fire Extinguisher with Flame Sensor and I2C LCD

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

  1. 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
  2. KY-026 Flame Sensor

    • Description: A sensor module that detects flame and fire.
    • Pins: A0, GND, VCC, D0
  3. 1-Channel Relay (5V 10A)

    • Description: A relay module that can control high voltage devices.
    • Pins: NC, signal, C, power, NO, ground
  4. 16x2 I2C LCD

    • Description: A 16x2 character LCD display with I2C interface.
    • Pins: GND, VCC, SDA, SCL
  5. 5V Mini Water Pump

    • Description: A small water pump that operates at 5V.
    • Pins: positive pin, negative pin
  6. Fan

    • Description: A small fan that operates at 5V.
    • Pins: GND, 5V
  7. 9V Battery

    • Description: A 9V battery used to power the circuit.
    • Pins: -, +

Wiring Details

Arduino UNO

KY-026 Flame Sensor

1-Channel Relay (5V 10A)

16x2 I2C LCD

5V Mini Water Pump

Fan

9V Battery

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.