Description
MQ7 - Carbon Monoxide Gas Sensor Module
The MQ7 Gas Sensor Module is designed specifically to detect Carbon Monoxide (CO) in the air. It’s widely used in CO leak detection systems, home safety monitors, and indoor air quality projects. The sensor can measure concentrations of 20 to 10,000 ppm.
Technical Specifications:
-
Operating Voltage: 5V DC
-
Gas Detected: Carbon Monoxide (CO)
-
Detection Range: 10 to 10000 ppm CO
-
Output: Analog (A0), Digital (D0, threshold adjustable)
- Preheat Time: 60 seconds to several minutes (for accuracy)
Pinouts:
Connection with Arduino:
Module |
Arduino UNO |
VCC |
5V |
GND |
GND |
A0 |
A0 |
D0 |
D2(Optional) |
Sample code:
Analog reading:
int mq7Pin = A0; // MQ7 analog output connected to Arduino A0
void setup() {
Serial.begin(9600); // Start Serial Monitor
}
void loop() {
int sensorValue = analogRead(mq7Pin); // Read the analog value
Serial.print("CO Gas Level: ");
Serial.println(sensorValue); // Print the value
delay(1000); // 1-second delay
}
CO Alert with Buzzer
int mq7Pin = A0;
int buzzerPin = 8;
int threshold = 400; // Adjust based on testing environment
void setup() {
Serial.begin(9600);
pinMode(buzzerPin, OUTPUT);
}
void loop() {
int coLevel = analogRead(mq7Pin);
Serial.print("CO Level: ");
Serial.println(coLevel);
if (coLevel > threshold) {
digitalWrite(buzzerPin, HIGH); // Trigger buzzer
} else {
digitalWrite(buzzerPin, LOW); // Turn off buzzer
}
delay(500);
}