Gas Sensor Module

Z2M Parts: EMS-00010-A to G, EDT-00001-A to G

Detect smoke or gas using MQ-series gas sensor.

Circuit Diagram
Circuit diagram for Gas Sensor Module
Wire Connections & Pin Configuration

Wire Color Connections:

Yellow → A5 to Gas sensor A0, Pin 12 to LED
Red → 5V to Gas sensor VCC
Black → GND to Gas sensor, LED cathode

Pin Configuration:

Arduino Analog Pin A5 → Gas sensor A0 output
Arduino Digital Pin 12 → LED anode (via 220Ω resistor)
Arduino 5V → Gas sensor VCC
Arduino GND → Gas sensor GND, LED cathode
Arduino Code
Edit
#define led 12     // LED connected to pin 12
#define smoke A5   // Gas sensor connected to analog pin A5

int threshold = 400; // Threshold limit for smoke detection

void setup() {
  pinMode(led, OUTPUT);   // Set LED pin as output
  pinMode(smoke, INPUT);  // Set smoke sensor pin as input
  Serial.begin(9600);     // Initialize serial communication
  Serial.println(\"Gas Sensor Module Initialized...\");
}

void loop() {
  int value = analogRead(smoke); // Read analog sensor value
  Serial.print(\"Sensor Reading: \");
  Serial.println(value);         // Display reading on Serial Monitor

  if (value > threshold) {
    digitalWrite(led, HIGH);     // Turn ON LED if gas concentration exceeds threshold
    Serial.println(\"Status: Smoke Detected!\");
  } else {
    digitalWrite(led, LOW);      // Turn OFF LED if safe
    Serial.println(\"Status: Air Clear.\");
  }

  delay(1000); // Wait for 1 second before next reading
}

Instruction Details

Wiring: Connect gas sensor VCC to 5V, GND to GND, A0 output to Analog Pin A5. Connect LED anode to Digital Pin 12 via 220Ω, cathode to GND.
Library: Not required (built-in).
Upload Code: Tools → Board → Arduino Uno. Tools → Port → select your COM port. Click Upload button.
View Output: Open Serial Monitor (Tools → Serial Monitor) at 9600 baud. Analog values and status display. Heat sensor 24–48 hours before first use. Detects LPG, CO, smoke.

How to Use

  1. Connect the required components as per the Pin Configuration above
  2. Open Arduino IDE and create a new sketch
  3. Copy and paste the code above
  4. Select your Arduino board and COM port from Tools menu
  5. Click the Upload button to upload the code to your Arduino
  6. Open Serial Monitor (if applicable) to see the output

Components Required

  • Arduino Uno
  • MQ-2 or MQ-135 Gas Sensor Module
  • LED
  • 220Ω Resistor
  • Breadboard
  • Jumper Wires

Category: Sensors