Objective
The goal of this experiment is to use the MQ-9 gas sensor to measure and monitor carbon monoxide (CO) levels in the air, displaying the data in real-time on a serial monitor. This project can serve as a foundation for creating CO detection systems for safety applications.
Required Components
- MQ-9 Gas Sensor
- Arduino Board (e.g., Arduino Uno)
- Jumper wires
- Breadboard
- USB cable for Arduino
- Optional: OLED display or LCD for real-time CO level display
- Computer with Arduino IDE installed
Ensure the MQ-9 sensor module includes the required pull-up resistors, or you may need to add them externally for proper functionality.
Working Principle
The MQ-9 gas sensor detects gases by using a chemical sensing element. When carbon monoxide or combustible gases are present, they interact with the tin dioxide (SnO2) material inside the sensor, causing its resistance to change. This change is translated into an analog voltage that the Arduino reads to determine gas concentration.
Key features of the MQ-9 sensor:
- High sensitivity to carbon monoxide and methane gases.
- Fast response time and low power consumption.
- Operates within a wide range of temperatures and humidity levels.
Circuit Wiring
Follow the steps below to connect the MQ-9 gas sensor to the Arduino board:
- Connect the VCC pin of the MQ-9 sensor to the 5V pin of the Arduino.
- Connect the GND pin of the MQ-9 sensor to the GND pin of the Arduino.
- Connect the AOUT (analog output) pin of the MQ-9 sensor to the A0 analog pin of the Arduino.
- If using the DOUT (digital output) pin, connect it to a digital pin on the Arduino (optional, for threshold-based detection).
Ensure all connections are secure and avoid short circuits by using a breadboard and jumper wires.
Sensor Calibration
The MQ-9 sensor requires calibration to ensure accurate measurements. Calibration involves exposing the sensor to a known concentration of carbon monoxide and adjusting the output values to match the reference levels.
Steps for basic calibration:
- Power on the sensor for 24-48 hours (preheating phase) to stabilize its readings.
- Expose the sensor to clean air and record the analog output value (this represents the base resistance).
- Expose the sensor to a known concentration of CO gas and record the output value.
- Calculate the ratio of gas resistance (Rgas) to air resistance (Rair) to fine-tune the Arduino code for accurate readings.
Arduino Code
/*
* Carbon Monoxide Detection using MQ-9
* This code reads the carbon monoxide concentration from the MQ-9 sensor.
*/
const int sensorPin = A0; // MQ-9 sensor connected to analog pin A0
int sensorValue = 0;
void setup() {
Serial.begin(9600); // Initialize serial communication
}
void loop() {
sensorValue = analogRead(sensorPin); // Read the sensor value
float voltage = sensorValue * (5.0 / 1023.0); // Convert to voltage
Serial.print("Analog Value: ");
Serial.print(sensorValue);
Serial.print(" | Voltage: ");
Serial.print(voltage);
Serial.println(" V");
delay(1000); // Wait for 1 second before the next reading
}
Note: Modify the code to include calibration data for more accurate gas concentration readings.
Results
The serial monitor will display the raw analog values and converted voltage output from the MQ-9 sensor. These values can be used to estimate carbon monoxide concentration after calibration.
Sample Output:
Analog Value: 512 | Voltage: 2.50 V Analog Value: 530 | Voltage: 2.59 V
Limitations
While the MQ-9 sensor is versatile, it has some limitations:
- Requires a long preheating time for accurate readings.
- Sensitivity can be affected by temperature and humidity.
- Cannot distinguish between different combustible gases.
- May require periodic recalibration for consistent performance.
Applications
- Home and industrial safety systems for CO detection.
- Air quality monitoring in enclosed spaces.
- Vehicle exhaust and emission monitoring systems.
- Smart IoT devices for environmental monitoring.
Conclusion
The MQ-9 sensor is an effective tool for detecting carbon monoxide and other combustible gases, offering a cost-effective solution for building safety and environmental monitoring systems. With proper calibration, it can provide reliable measurements for various applications.