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

Arduino UNO R4 WiFi-Based Fire and Gas Detection System with SMS Alerts

View and Edit Project In Cirkit DesignerImage of Arduino UNO R4 WiFi-Based Fire and Gas Detection System with SMS Alerts

Circuit Documentation

Summary

This circuit is designed to monitor environmental conditions using various sensors and respond to specific events. It reads values from a DHT11 sensor, Flame sensor, and MQ-6 gas sensor. The temperature and humidity are displayed on an LCD screen. The circuit checks for fire presence and detects LPG gas. If fire is detected, it displays "Fire detected" on the LCD and sends an SMS. If LPG gas is detected, it displays "LPG Gas Detected", turns on a red LED, rotates a servo motor to 180 degrees, activates a buzzer, turns on a fan, and sends an SMS. If no gas is detected, it displays "LPG Not Detected" and the gas value on the LCD, and turns on a green LED.

Component List

Arduino UNO R4 WiFi

LED: Two Pin (red)

LED: Two Pin (green)

Buzzer

Servo

MQ-6 SENSOR LPG GAS

Fan

SIM900A

Sensor SHT113 Flame

KY-015 DHT11

16x2 I2C LCD

Wiring Details

Arduino UNO R4 WiFi

LED: Two Pin (red)

LED: Two Pin (green)

Buzzer

Servo

MQ-6 SENSOR LPG GAS

Fan

SIM900A

Sensor SHT113 Flame

KY-015 DHT11

16x2 I2C LCD

Code Documentation

/*
 * This Arduino sketch reads values from a DHT11 sensor, Flame sensor, and
 * MQ-6 gas sensor. It displays temperature and humidity on an LCD screen,
 * checks for fire presence, and detects LPG gas. If fire is detected, it
 * displays 'Fire detected' on the LCD and sends an SMS. If LPG gas is
 * detected, it displays 'LPG Gas Detected', turns on a red LED, rotates a
 * servo motor to 180 degrees, activates a buzzer, turns on a fan, and sends
 * an SMS. If no gas is detected, it displays 'LPG Not Detected' and the gas
 * value on the LCD, and turns on a green LED.
 */

#include <Servo.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <SoftwareSerial.h>
#include <DHT.h>

// Pin definitions
const int redLedPin = 12;
const int greenLedPin = 11;
const int buzzerPin = 3;
const int fanPin = A4;
const int mq6Pin = A0;
const int servoPin = A1;
const int gsmRxPin = 2;
const int gsmTxPin = 10;
const int flamePin = A2;
const int dhtPin = 13;

// LCD address and dimensions
LiquidCrystal_I2C lcd(0x27, 16, 2);

// Servo object
Servo myServo;

// GSM module
SoftwareSerial gsm(gsmRxPin, gsmTxPin);

// DHT sensor
#define DHTTYPE DHT11
DHT dht(dhtPin, DHTTYPE);

void setup() {
  // Initialize serial communication
  Serial.begin(9600);
  gsm.begin(9600);

  // Initialize pins
  pinMode(redLedPin, OUTPUT);
  pinMode(greenLedPin, OUTPUT);
  pinMode(buzzerPin, OUTPUT);
  pinMode(fanPin, OUTPUT);
  pinMode(mq6Pin, INPUT);
  pinMode(flamePin, INPUT);

  // Initialize servo
  myServo.attach(servoPin);

  // Initialize LCD
  lcd.init();
  lcd.backlight();
  lcd.print("System Ready");
  delay(2000);
  lcd.clear();

  // Initialize DHT sensor
  dht.begin();
}

void loop() {
  // Read DHT11