Demo
In this tutorial, we will learn how to use an MQ-136 gas sensor.
Components Needed
- MQ-136 gas sensor
- Jumper Cables
- Arduino Uno
- Breadboard
- USB cable
- A computer to run the program
What is an MQ-136 gas sensor and how does it work?
The MQ-136 Gas Sensor is a sensor that is sensitive to smoke, propane, methane, alcohol, hydrogen, etc. It has a built in potentiometer that allows you to adjust the sensor digital output (D0) threshold. This threshold sets the value above which the digital pin will output a HIGH signal.
The voltage that the sensor outputs, changes depending on the concentration of the smoke/gas. This means that the greater the concentration, the greater the output voltage, and the lower the concentration, the lower the output voltage.
The output can be an analog signal (A0) that can be read with an analog input of the Arduino or a digital output (D0) that can be read with a digital input of the Arduino.
Pin Connections
- Vcc – 5V pin
- GND – ground pin
- D0 – 8 (digital pin)
- A0 – A0 (Analog pin)
The Circuit
The circuit below is the completed circuit of the MQ-136 gas sensor

The Code
The program below is the completed program of the MQ-136 gas sensor
#define MQ2pin (A0)
float sensorValue; //variable to store sensor value
void setup()
{
Serial.begin(9600); // sets the serial port to 9600
Serial.println("Gas sensor warming up!");
delay(20000); // allow the MQ-6 to warm up
}
void loop()
{
sensorValue = analogRead(MQ2pin); // read analog input pin 0
Serial.print("Sensor Value: ");
Serial.print(sensorValue);
if(sensorValue > 300)
{
Serial.print(" | Smoke detected!");
}
Serial.println("");
delay(2000); // wait 2s for next reading
}
Let me explain the program.
Before setup function
Before the setup function, we are defining the analog pin of the gas sensor. We also created a variable called sensorValue which is defined to store sensor value.
The setup function
In the setup function, we are beginning serial communications and printing the text “Gas sensor warming up!”, in the serial monitor.
The loop function
In the loop function the sensor value is read by the analogRead() function and the value is displayed on serial monitor. If the value of the sensor is more than 300, the serial monitor will print, “Smoke Detected!”