Introduction
This experiment demonstrates how to detect carbon monoxide (CO) levels using an MQ-9 sensor with Arduino.

Components Needed
- MQ-9 CO Sensor
- Arduino
- Jumper Wires
Circuit Setup
- Connect the MQ-9 sensor's analog output pin to an analog input pin on the Arduino (e.g., A0).
- Connect the VCC and GND pins of the sensor to 5V and GND on the Arduino.
The MQ-9 sensor detects carbon monoxide levels and sends analog data to the Arduino for analysis.

Code for CO Detection
Upload the following code to your Arduino to detect CO levels:
const int coPin = A0;
int coLevel;
void setup() {
Serial.begin(9600);
}
void loop() {
coLevel = analogRead(coPin);
Serial.print("CO Level: ");
Serial.println(coLevel);
delay(1000);
}
Explanation
The MQ-9 sensor detects the concentration of CO in the air. The analog signal from the sensor is read by the Arduino and displayed on the Serial Monitor.
Troubleshooting
- If readings are unstable, allow the sensor to warm up before taking measurements.
- Ensure proper wiring and ensure the sensor is exposed to the air sample you want to test.