Stufin
Home Quick Cart Profile

MQ-7 Gas Sensor For Carbon Monoxide Detector Module

Buy Now on Stufin

Detection Gas

Carbon Monoxide (CO)

Detection Range

10-1000 ppm

Sensitivity

1.5 0.5 mV/ppm

Output Signal

Analog (0-5V)

Power Supply

5V 0.5V

Power Consumption

<15mA

Operating Temperature Range

-10C to 50C

Operating Humidity Range

30-90% RH

Dimensions

20.5mm x 13.5mm x 10.5mm

Applications

  • Indoor Air Quality Monitoring: The MQ-7 Gas Sensor Module can be used to monitor indoor air quality and detect carbon monoxide concentrations in homes, offices, and public buildings.
  • Industrial Safety: The module can be used to detect CO concentrations in industrial environments, such as factories, warehouses, and construction sites.
  • Automotive Emission Control: The module can be used to detect CO concentrations in vehicle exhaust emissions, helping to reduce emissions and improve air quality.

Conclusion

The MQ-7 Gas Sensor for Carbon Monoxide Detector Module is a highly sensitive and reliable gas detection component suitable for a wide range of applications. Its high sensitivity, wide detection range, and low power consumption make it an ideal choice for detecting carbon monoxide concentrations in various environments.

Pin Configuration

  • MQ-7 Gas Sensor For Carbon Monoxide Detector Module Documentation
  • Pin Description:
  • The MQ-7 Gas Sensor module has 6 pins, which are:
  • ### 1. VCC (Power Supply)
  • Pin Type: Power Input
  • Voltage Range: 5V
  • Description: This pin is used to power the sensor module. A stable 5V power supply is required for the module to operate correctly.
  • ### 2. GND (Ground)
  • Pin Type: Ground
  • Description: This pin is used to connect the ground of the power supply to the module.
  • ### 3. OUT (Analog Output)
  • Pin Type: Analog Output
  • Description: This pin provides an analog output voltage that corresponds to the concentration of Carbon Monoxide (CO) gas in the air. The output voltage increases as the CO concentration increases.
  • ### 4. DOUT (Digital Output)
  • Pin Type: Digital Output
  • Description: This pin provides a digital output that indicates whether the CO concentration exceeds a certain threshold. The threshold value can be adjusted using the potentiometer on the module.
  • ### 5. AOUT (Analog Adjust Pin)
  • Pin Type: Analog Input
  • Description: This pin is used to adjust the sensitivity of the sensor. Connecting a potentiometer or a resistive network to this pin allows you to adjust the analog output voltage range.
  • ### 6. H pin (Heater Pin)
  • Pin Type: Power Input
  • Voltage Range: 5V
  • Description: This pin is used to power the internal heater of the sensor, which is necessary for the sensor to operate correctly.
  • Connecting the Pins:
  • To connect the MQ-7 Gas Sensor module to a microcontroller or a development board, follow these steps:
  • Connect the VCC pin to a 5V power supply.
  • Connect the GND pin to the ground of the power supply.
  • Connect the OUT pin to an analog input pin on the microcontroller or development board to read the analog output voltage.
  • Connect the DOUT pin to a digital input pin on the microcontroller or development board to read the digital output.
  • If desired, connect a potentiometer or a resistive network to the AOUT pin to adjust the sensitivity of the sensor.
  • Connect the H pin to a 5V power supply to power the internal heater of the sensor.
  • Note:
  • Make sure to use a stable 5V power supply to power the module.
  • The sensor requires a certain warm-up time before it can provide accurate readings. Typically, it takes around 24 hours for the sensor to reach optimal performance.
  • The sensor is sensitive to temperature and humidity, so it is recommended to calibrate the sensor in the actual operating environment.
  • Always follow proper safety precautions when working with gas sensors, as they can be hazardous if not handled correctly.

Code Examples

MQ-7 Gas Sensor For Carbon Monoxide Detector Module Documentation
Overview
The MQ-7 Gas Sensor is a highly sensitive and accurate module designed to detect Carbon Monoxide (CO) gas in the air. This module is widely used in various applications, including industrial, domestic, and automotive settings, to detect and alert users to the presence of CO gas.
Pinout and Connections
| Pin | Description |
| --- | --- |
| VCC | Power supply (5V) |
| GND | Ground |
| AO | Analog Output |
| DO | Digital Output |
Operation
The MQ-7 Gas Sensor module operates by detecting the presence of CO gas in the air and outputting a corresponding analog signal. The sensor contains a heating element, a sensitive layer, and an electrode. When CO gas is present, it reacts with the sensitive layer, causing a change in the electrical resistance of the sensor. This change is then converted into an analog signal at the AO pin.
Programming Examples
### Example 1: Basic Analog Output Reading (Arduino)
In this example, we will connect the MQ-7 Gas Sensor to an Arduino board and read the analog output signal to detect CO gas.
Hardware Connection:
Connect VCC to Arduino's 5V pin
 Connect GND to Arduino's GND pin
 Connect AO to Arduino's Analog Input pin (e.g., A0)
Code:
```c++
const int sensorPin = A0;  // select the input pin for the sensor
void setup() {
  Serial.begin(9600);
}
void loop() {
  int sensorValue = analogRead(sensorPin);
  float CO_ppm = sensorValue  (5.0 / 1023.0); // convert analog value to CO concentration (ppm)
  Serial.print("CO Concentration: ");
  Serial.print(CO_ppm);
  Serial.println(" ppm");
  delay(1000);
}
```
### Example 2: Digital Output with Threshold Detection (Raspberry Pi)
In this example, we will connect the MQ-7 Gas Sensor to a Raspberry Pi and use the digital output to detect CO gas above a certain threshold.
Hardware Connection:
Connect VCC to Raspberry Pi's 5V pin
 Connect GND to Raspberry Pi's GND pin
 Connect DO to Raspberry Pi's GPIO pin (e.g., GPIO 17)
Code:
```python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN)  # set GPIO 17 as input
while True:
    if GPIO.input(17) == GPIO.HIGH:
        print("CO Gas Detected!")
    else:
        print("No CO Gas Detected.")
    time.sleep(1)
```
Note: In this example, we assume a threshold detection logic is built into the sensor module, where the digital output (DO) pin goes high when the CO concentration exceeds a certain threshold.
### Example 3: IoT-based CO Monitoring System (ESP32)
In this example, we will connect the MQ-7 Gas Sensor to an ESP32 board and create an IoT-based CO monitoring system that sends data to a cloud-based platform.
Hardware Connection:
Connect VCC to ESP32's 5V pin
 Connect GND to ESP32's GND pin
 Connect AO to ESP32's Analog Input pin (e.g., ADC1_0)
Code:
```c++
#include <WiFi.h>
#include <HTTPClient.h>
const char ssid = "your_wifi_ssid";
const char password = "your_wifi_password";
const char serverUrl = "https://your-cloud-platform.com/api/co-monitoring";
WiFiClient client;
HTTPClient http;
void setup() {
  Serial.begin(115200);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi...");
  }
  Serial.println("Connected to WiFi");
  http.begin(client, serverUrl);
}
void loop() {
  int sensorValue = analogRead(ADC1_0);
  float CO_ppm = sensorValue  (5.0 / 1023.0); // convert analog value to CO concentration (ppm)
  String payload = "{""co_ppm"": " + String(CO_ppm) + "}";
  int httpRequestCode = http.POST(payload);
  if (httpRequestCode > 0) {
    Serial.println("Data sent successfully!");
  } else {
    Serial.println("Error sending data:");
    Serial.println(http.getString());
  }
  delay(30000); // send data every 30 seconds
}
```
Note: In this example, we assume you have replaced the placeholders with your own WiFi credentials, cloud platform URL, and API endpoint for sending CO data.