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

Arduino Nano-Based LPG Gas Detector with Alert System

View and Edit Project In Cirkit DesignerImage of Arduino Nano-Based LPG Gas Detector with Alert System

Circuit Documentation

Summary

This document describes a simple LPG (liquefied petroleum gas) detection circuit that utilizes an Arduino Nano as the central processing unit, an MQ6 gas sensor to detect the presence of LPG, an LED to visually indicate the detection of gas, and a buzzer to provide an audible alarm. The circuit is designed to monitor the analog output of the MQ6 sensor and activate the LED and buzzer when the gas concentration exceeds a predefined threshold.

Component List

Arduino Nano

MQ6 Gas Sensor

LED: Two Pin (red)

Buzzer

Wiring Details

Arduino Nano

MQ6 Gas Sensor

LED: Two Pin (red)

Buzzer

Documented Code

#define GAS_SENSOR_PIN A0   // MQ-6 analog output pin
#define BUZZER_PIN 2        // Buzzer output pin
#define LED_PIN 3           // LED output pin

int gasThreshold = 300;  // Set a threshold for LPG detection
int gasValue;

void setup() {
  pinMode(BUZZER_PIN, OUTPUT);
  pinMode(LED_PIN, OUTPUT);

  Serial.begin(9600);
  Serial.println("LPG Detector Initialized");
}

void loop() {
  // Read gas sensor value
  gasValue = analogRead(GAS_SENSOR_PIN);

  // Print gas value to Serial Monitor
  Serial.print("Gas Value: ");
  Serial.println(gasValue);

  // Check if gas level exceeds threshold
  if (gasValue > gasThreshold) {
    digitalWrite(BUZZER_PIN, HIGH);  // Turn on buzzer
    digitalWrite(LED_PIN, HIGH);     // Turn on LED
  } else {
    digitalWrite(BUZZER_PIN, LOW);   // Turn off buzzer
    digitalWrite(LED_PIN, LOW);      // Turn off LED
  }

  delay(500);  // Delay to reduce sensor reading frequency
}

The code is written for the Arduino Nano and is responsible for initializing the system, reading the analog value from the MQ6 gas sensor, and activating the buzzer and LED when the gas concentration exceeds the set threshold. The Serial Monitor outputs the gas value for debugging purposes.