Stufin
Home Quick Cart Profile

MQ-5 Gas Sensor Module For H2, LPG, CH4, CO Detector Module

Buy Now on Stufin

Supply Voltage

5V

Current Consumption

150mA

Detection Range

100-1000ppm (H2), 200-2000ppm (LPG), 300-3000ppm (CH4), 10-100ppm (CO)

Output Signal

Analog (0-5V) and Digital (TTL)

Response Time

<10 seconds

Warm-up Time<1 minute

Dimensions

44mm x 22mm x 17mm

Applications

  • Home Automation: Monitoring gas levels in homes to ensure safety and prevent accidents.
  • Industrial Monitoring: Detecting gas leaks and monitoring gas levels in industrial settings.
  • Air Quality Monitoring: Monitoring air quality in public spaces, such as parks and shopping centers.
  • IoT Devices: Integrating the module into IoT devices, such as smart home systems and wearable devices.
The MQ-5 Gas Sensor Module is suitable for use in various IoT applications, including

Conclusion

The MQ-5 Gas Sensor Module is a highly reliable and sensitive gas detection module that provides accurate and real-time monitoring of four types of gases. Its compact design, low power consumption, and ease of integration make it an ideal component for various IoT applications.

Pin Configuration

  • MQ-5 Gas Sensor Module Documentation
  • Overview
  • The MQ-5 Gas Sensor Module is a highly sensitive and reliable gas detection module capable of detecting H2, LPG, CH4, and CO gases. This module is widely used in various applications, including gas leak detection, air quality monitoring, and industrial automation.
  • Pinout Description
  • The MQ-5 Gas Sensor Module has a total of 6 pins, each with a specific function. Below is a detailed description of each pin:
  • Pin 1: VCC
  • Function: Power supply pin
  • Description: Connect to a positive voltage source (typically 5V) to power the module.
  • Notes: Ensure the voltage supply is stable and within the recommended range to ensure accurate sensor operation.
  • Pin 2: GND
  • Function: Ground pin
  • Description: Connect to the ground (0V) of the system to provide a return path for the power supply.
  • Notes: Ensure a reliable ground connection to prevent noise and interference.
  • Pin 3: DOUT
  • Function: Digital output pin
  • Description: Provides a digital signal indicating the presence of gas. The output is high (logic 1) when gas is detected and low (logic 0) when no gas is detected.
  • Notes: Connect to a microcontroller or other digital circuitry to read the digital output signal.
  • Pin 4: AOUT
  • Function: Analog output pin
  • Description: Provides an analog signal proportional to the gas concentration. The output voltage increases as the gas concentration increases.
  • Notes: Connect to an analog-to-digital converter (ADC) or an op-amp circuit to read the analog output signal.
  • Pin 5: HEATER
  • Function: Heater pin
  • Description: Connect to a power source (typically 5V) to heat the sensor element. The heater is required for the sensor to operate accurately.
  • Notes: Ensure the heater pin is connected to a stable power source to maintain a consistent operating temperature.
  • Pin 6: NC
  • Function: No connection
  • Description: This pin is not connected to any internal component and should be left unused.
  • Connection Structure
  • To connect the MQ-5 Gas Sensor Module to your system:
  • 1. Connect the VCC pin to a 5V power source.
  • 2. Connect the GND pin to the system ground (0V).
  • 3. Connect the DOUT pin to a digital input pin on your microcontroller or other digital circuitry.
  • 4. Connect the AOUT pin to an analog input pin on your microcontroller or an ADC circuit.
  • 5. Connect the HEATER pin to a 5V power source.
  • 6. Leave the NC pin unconnected.
  • Important Notes
  • Ensure the sensor is operated within the recommended temperature and humidity range (typically 20C to 30C and 30% to 80% RH) for accurate gas detection.
  • Use a stable power supply to prevent noise and interference.
  • Follow proper safety precautions when handling the sensor module and gas detection systems.
  • By following this documentation, you should be able to correctly connect and interface the MQ-5 Gas Sensor Module with your system.

Code Examples

MQ-5 Gas Sensor Module Documentation
Overview
The MQ-5 Gas Sensor Module is a highly sensitive and reliable sensor designed to detect the presence of various gases, including Hydrogen (H2), Liquefied Petroleum Gas (LPG), Methane (CH4), and Carbon Monoxide (CO). This module is suitable for a wide range of applications, including industrial automation, air quality monitoring, and safety systems.
Technical Specifications
Operating Voltage: 5V
 Operating Current: 150mA
 Sensing Range:
	+ Hydrogen (H2): 100-1000 ppm
	+ Liquefied Petroleum Gas (LPG): 100-1000 ppm
	+ Methane (CH4): 100-1000 ppm
	+ Carbon Monoxide (CO): 10-1000 ppm
 Output Signal: Analog Voltage (0-5V)
 Response Time: <10 seconds
 Dimensions: 32mm x 22mm x 15mm
Pinout
VCC: Power supply pin (5V)
 GND: Ground pin
 OUT: Analog output pin
 DOUT: Digital output pin (optional)
Code Examples
### Example 1: Basic Analog Readings with Arduino
This example demonstrates how to read analog voltage output from the MQ-5 sensor using an Arduino board.
```c++
const int sensorPin = A0;  // MQ-5 sensor output pin connected to Arduino's analog input A0
void setup() {
  Serial.begin(9600);
}
void loop() {
  int sensorValue = analogRead(sensorPin);
  float voltage = sensorValue  (5.0 / 1023.0);
  Serial.print("Sensor Value: ");
  Serial.print(sensorValue);
  Serial.print(" Voltage: ");
  Serial.print(voltage);
  Serial.println(" V");
  delay(500);
}
```
### Example 2: Digital Output with Raspberry Pi (Python)
This example demonstrates how to use the digital output pin of the MQ-5 sensor with a Raspberry Pi board.
```python
import RPi.GPIO as GPIO
import time
# Set up GPIO pins
GPIO.setmode(GPIO.BCM)
MQ5_PIN = 17  # Digital output pin of MQ-5 sensor connected to GPIO 17
GPIO.setup(MQ5_PIN, GPIO.IN)
while True:
    if GPIO.input(MQ5_PIN):
        print("Gas detected!")
    else:
        print("No gas detected.")
    time.sleep(1)
```
### Example 3: Interfacing with an ESP32 Board (MicroPython)
This example demonstrates how to read analog voltage output from the MQ-5 sensor using an ESP32 board with MicroPython.
```python
import machine
# Initialize ADC pin for MQ-5 sensor output
adc = machine.ADC(machine.Pin(32))  # ESP32's ADC pin connected to MQ-5 sensor output
while True:
    sensor_value = adc.read_u16()
    voltage = sensor_value  3.3 / 65535
    print("Sensor Value: {}, Voltage: {:.2f} V".format(sensor_value, voltage))
    time.sleep_ms(500)
```
Note: These examples are for demonstration purposes only. In real-world applications, you should add proper calibration, noise filtering, and error handling to ensure accurate and reliable gas detection.