Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino Nano-Based LPG Gas Detector with Alert System

Image 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

  • Description: A small, complete, and breadboard-friendly board based on the ATmega328 (Arduino Nano 3.x).
  • Purpose: Acts as the central controller for the LPG detection system, reading sensor data, and controlling the LED and buzzer.

MQ6 Gas Sensor

  • Description: A gas sensor designed for detecting LPG, butane, propane, methane, alcohol, hydrogen, and smoke.
  • Purpose: To detect the presence of LPG and provide an analog output proportional to the gas concentration.

LED: Two Pin (red)

  • Description: A basic red LED with two pins: anode and cathode.
  • Purpose: To visually indicate when the gas concentration exceeds the threshold.

Buzzer

  • Description: An electronic buzzer capable of producing a tone when powered.
  • Purpose: To emit an audible alarm when the gas concentration is above the threshold.

Wiring Details

Arduino Nano

  • D2: Connected to the buzzer.
  • D3: Connected to the anode of the LED.
  • A0: Connected to the A0 pin of the MQ6 gas sensor for analog input.
  • GND: Common ground shared with the MQ6 sensor, LED, and buzzer.
  • 5V: Provides power to the MQ6 sensor.

MQ6 Gas Sensor

  • VCC: Connected to the 5V output of the Arduino Nano.
  • GND: Connected to the common ground.
  • A0: Connected to the A0 analog input on the Arduino Nano.
  • DO: Not connected in this circuit.

LED: Two Pin (red)

  • Anode: Connected to the D3 pin on the Arduino Nano.
  • Cathode: Connected to the common ground.

Buzzer

  • PIN: Connected to the D2 pin on the Arduino Nano.
  • GND: Connected to the common ground.

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.