Stufin
Home Quick Cart Profile

MQ-5 Gas Sensor For Methane(CNG), Propane, and Natural Gas Detector Module

Buy Now on Stufin

Component Name

MQ-5 Gas Sensor For Methane(CNG), Propane, and Natural Gas Detector Module

Overview

The MQ-5 Gas Sensor is a highly sensitive and reliable detector module designed to detect the presence of Methane (CNG), Propane, and Natural Gas in the air. This module is widely used in various applications, including industrial safety monitoring, gas leak detection, and air quality monitoring.

Functionality

The MQ-5 Gas Sensor module detects the concentration of combustible gases in the air and provides an analog output voltage proportional to the gas concentration. The module is based on a metal oxide semiconductor (MOS) sensor, which operates on the principle of catalytic combustion. When the sensor detects the presence of a combustible gas, the sensor's resistance changes, causing a variation in the output voltage.

Key Features

  • High Sensitivity: The MQ-5 Gas Sensor module has a high sensitivity to detect low concentrations of Methane (CNG), Propane, and Natural Gas.
  • Wide Detection Range: The module can detect gas concentrations ranging from 300 to 10,000 ppm (parts per million).
  • Analog Output: The module provides an analog output voltage (0-5V) proportional to the gas concentration, making it easy to interface with microcontrollers or other electronic devices.
  • Low Power Consumption: The module operates on a low power consumption of 5V DC, making it suitable for battery-powered applications.
  • Simple Interface: The module has a simple interface with only VCC, GND, and OUT pins, making it easy to integrate into various projects.
  • High Accuracy: The module provides accurate readings with a response time of less than 10 seconds.
  • Robust Design: The module is housed in a durable plastic body with a metal shield to protect the sensor from external interference and moisture.
  • Operating Temperature: The module operates in a wide temperature range of -20C to 50C, making it suitable for various environmental conditions.
  • Long Lifespan: The module has a long lifespan of up to 5 years, reducing the need for frequent replacements.
  • Compliance: The module complies with the RoHS (Restriction of Hazardous Substances) and CE (Conformit Europene) directives.

Typical Applications

  • Industrial safety monitoring
  • Gas leak detection systems
  • Air quality monitoring systems
  • HVAC (Heating, Ventilation, and Air Conditioning) systems
  • Automotive applications (e.g., gas tank leak detection)
  • Home automation systems
  • Environmental monitoring systems

Pinouts

| Pin | Function |

| --- | --- |

| VCC | Power supply (5V DC) |

| GND | Ground |

| OUT | Analog output (0-5V) |

Dimensions

The module dimensions are approximately 32mm x 22mm x 17mm (L x W x H).

Operating Conditions

| Parameter | Operating Condition |

| --- | --- |

| Operating Temperature | -20C to 50C |

| Operating Humidity | 20% to 80% RH |

| Power Supply | 5V DC |

| Response Time | < 10 seconds |

Note

The MQ-5 Gas Sensor module should be used in well-ventilated areas, and it is recommended to calibrate the module before use. Additionally, the module should be handled with care to avoid damage or contamination.

Pin Configuration

  • MQ-5 Gas Sensor Module Documentation
  • Pin Description:
  • The MQ-5 Gas Sensor Module has 6 pins, which are used to connect the sensor to a microcontroller or other devices. Here's a detailed description of each pin:
  • Pin 1: VCC
  • Function: Power supply voltage
  • Description: Provides power to the sensor module. Typically, a voltage between 4.5V to 5.5V is recommended.
  • Connection: Connect to the positive terminal of a power supply or a microcontroller's VCC pin.
  • Pin 2: GND
  • Function: Ground
  • Description: Provides a ground reference for the sensor module.
  • Connection: Connect to the negative terminal of a power supply or a microcontroller's GND pin.
  • Pin 3: DOUT
  • Function: Digital Output
  • Description: Provides a digital signal indicating the presence of gas. The output is high (near VCC) when the sensor detects gas and low (near GND) when no gas is present.
  • Connection: Connect to a digital input pin of a microcontroller or a logic-level converter.
  • Pin 4: AOUT
  • Function: Analog Output
  • Description: Provides an analog signal proportional to the concentration of gas. The output voltage increases as the gas concentration increases.
  • Connection: Connect to an analog-to-digital converter (ADC) pin of a microcontroller or a voltage-level converter.
  • Pin 5: HEAT
  • Function: Heater Power
  • Description: Provides power to the sensor's internal heater, which is used to heat the sensing element.
  • Connection: Connect to a power supply or a microcontroller's digital output pin that can provide the required current (typically around 50-100mA).
  • Pin 6: NC
  • Function: No Connection
  • Description: This pin is not internally connected and should be left unconnected.
  • Connection Structure:
  • To connect the MQ-5 Gas Sensor Module to a microcontroller or other devices, follow this structure:
  • 1. Connect Pin 1 (VCC) to a power supply or the microcontroller's VCC pin.
  • 2. Connect Pin 2 (GND) to a power supply or the microcontroller's GND pin.
  • 3. Connect Pin 3 (DOUT) to a digital input pin of the microcontroller or a logic-level converter.
  • 4. Connect Pin 4 (AOUT) to an analog-to-digital converter (ADC) pin of the microcontroller or a voltage-level converter.
  • 5. Connect Pin 5 (HEAT) to a power supply or a microcontroller's digital output pin that can provide the required current.
  • Important Notes:
  • Ensure the power supply voltage is within the recommended range (4.5V to 5.5V) to prevent damage to the sensor.
  • Use a suitable current-limiting resistor when connecting Pin 5 (HEAT) to a microcontroller's digital output pin to prevent overheating.
  • The sensor module requires a warm-up time of around 1-2 minutes before it can provide accurate readings.
  • Calibrate the sensor module according to the manufacturer's instructions to achieve optimal performance.

Code Examples

MQ-5 Gas Sensor Module Documentation
Overview
The MQ-5 Gas Sensor Module is a highly sensitive and accurate gas detector designed to detect the presence of methane (CNG), propane, and natural gas. This module is ideal for implementing gas detection systems in various applications, including industrial automation, environmental monitoring, and safety devices.
Pinout and Connections
The MQ-5 Gas Sensor Module has a simple 5-pin interface:
VCC: Power supply (5V)
 GND: Ground
 OUT: Analog output signal
 DOUT: Digital output signal (optional)
 AOUT: Analog output signal (optional)
Operating Principle
The MQ-5 Gas Sensor Module utilizes a tin dioxide (SnO2) sensing material, which changes its electrical conductivity in response to the presence of target gases. The sensor heats up to an optimal temperature, causing the sensing material to react with the gas molecules, resulting in a change in the electrical resistance. This change is converted into an analog output signal, which is proportional to the gas concentration.
Technical Specifications
Gas detection range: 200-10000 ppm (methane), 300-10000 ppm (propane), and 200-10000 ppm (natural gas)
 Sensitivity: 0.2-1.0 V/ppm
 Operating voltage: 5V
 Operating temperature: 20C to 50C
 Response time: <10 seconds
Example Code 1: Analog Gas Concentration Measurement using Arduino
In this example, we will use an Arduino Uno board to read the analog output signal from the MQ-5 Gas Sensor Module and display the gas concentration on the serial monitor.
```c
const int sensorPin = A0; // Analog input pin for MQ-5 sensor
void setup() {
  Serial.begin(9600);
}
void loop() {
  int sensorValue = analogRead(sensorPin);
  float gasConcentration = (sensorValue  5.0) / 1024.0; // Convert analog value to voltage
  gasConcentration = (gasConcentration - 0.2) / 0.01; // Calculate gas concentration in ppm
Serial.print("Gas Concentration: ");
  Serial.print(gasConcentration);
  Serial.println(" ppm");
delay(1000); // Take readings every 1 second
}
```
Example Code 2: Digital Gas Detection using Raspberry Pi
In this example, we will use a Raspberry Pi board to read the digital output signal from the MQ-5 Gas Sensor Module and trigger a warning when the gas concentration exceeds a certain threshold.
```python
import RPi.GPIO as GPIO
import time
# Set up GPIO library
GPIO.setmode(GPIO.BCM)
# Set up digital output pin for MQ-5 sensor
sensorPin = 17
GPIO.setup(sensorPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
def detect_gas():
  if GPIO.input(sensorPin) == 0:
    print("Gas detected!")
    # Trigger warning or alarm here
  else:
    print("No gas detected.")
while True:
  detect_gas()
  time.sleep(1) # Check for gas every 1 second
```
Example Code 3: IoT Gas Monitoring System using ESP8266 and MQTT
In this example, we will use an ESP8266 board to read the analog output signal from the MQ-5 Gas Sensor Module, send the gas concentration data to an MQTT broker, and display it on a remote dashboard.
```c
#include <WiFi.h>
#include <PubSubClient.h>
// MQTT broker details
const char mqttServer = "Your_MQTT_Broker_IP";
const char mqttTopic = "gas-monitoring";
WiFiClient espClient;
PubSubClient client(espClient);
void setup() {
  Serial.begin(9600);
  WiFi.begin("Your_WiFi_SSID", "Your_WiFi_Password");
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi...");
  }
Serial.println("Connected to WiFi");
  client.setServer(mqttServer, 1883);
}
void loop() {
  int sensorValue = analogRead(A0);
  float gasConcentration = (sensorValue  5.0) / 1024.0; // Convert analog value to voltage
  gasConcentration = (gasConcentration - 0.2) / 0.01; // Calculate gas concentration in ppm
char gasConcentrationStr[8];
  dtostrf(gasConcentration, 4, 2, gasConcentrationStr);
if (!client.connected()) {
    reconnect();
  }
  client.publish(mqttTopic, gasConcentrationStr);
delay(10000); // Send data every 10 seconds
}
void reconnect() {
  while (!client.connected()) {
    Serial.print("Attempting MQTT connection...");
    if (client.connect("ESP8266Client")) {
      Serial.println("Connected");
      client.publish(mqttTopic, "Connected");
    } else {
      Serial.print("Failed, rc=");
      Serial.print(client.state());
      Serial.println(" Try again in 5 seconds");
      delay(5000);
    }
  }
}
```
Note: In all examples, ensure to connect the MQ-5 Gas Sensor Module to the correct pins on your microcontroller board and adjust the code accordingly. Additionally, calibrate the sensor according to the manufacturer's instructions to achieve accurate gas concentration readings.