Introduction
This experiment demonstrates how to detect gas concentration using the MQ-8 sensor.

Components Needed
- MQ-8 Gas Sensor
- Arduino
- Jumper Wires
Circuit Setup
- Connect the VCC and GND pins of the MQ-8 to the 5V and GND on Arduino, respectively.
- Connect the analog output pin of the MQ-8 to an analog input pin (e.g., A0) on Arduino.
The sensor will measure the concentration of gases and output the corresponding analog signal to Arduino.

Code for Gas Concentration Measurement
Upload the following code to your Arduino to measure gas concentration:
const int gasPin = A0;
void setup() {
Serial.begin(9600);
}
void loop() {
int gasLevel = analogRead(gasPin);
Serial.print("Gas Concentration: ");
Serial.println(gasLevel);
delay(1000);
}
Explanation
The MQ-8 gas sensor detects the concentration of gases such as methane and outputs an analog value that is read by the Arduino and displayed on the Serial Monitor.
Troubleshooting
- Ensure the sensor is exposed to the gases you are measuring for accurate readings.
- If readings are inconsistent, check the wiring and sensor calibration.