Introduction: MQ2 Gas Sensor/Detector (for Arduino and Other Microcontrollers)

About: An electronics hobbyist

INTRODUCTION:Gas sensors are very much essential to measure gas concentration and detecttion of certain gases. Commerical smoke detectors use radioactive Americium to detect smoke. In our small project we will make a MQ2 based gas sensor which will detect smoke (CO2). Also by reading datasheet you may also get a very rough value of gas concentration (ppm).

WARNING- These sensors are only meant for DIY purposes. Not recommended for commerical purposes.

MQ gas sensors are commonly used for home and DIY projects and are available in cheap.Below a small list of MQ gas sensors: MQ-2 - Methane, Butane, LPG, smoke MQ-3 - Alcohol, Ethanol, smoke MQ-4 - Methane, CNG Gas MQ-5 - Natural gas, LPG MQ-6 - LPG, butane gas MQ-7 - Carbon Monoxide MQ-8 - Hydrogen Gas MQ-9 - Carbon Monoxide, flammable gasses MQ131 - Ozone MQ135 - Air Quality (CO, Ammonia, Benzene, Alcohol, smoke) MQ136 - Hydrogen Sulfide gas MQ137 - Ammonia MQ138 - Benzene, Toluene, Alcohol, Acetone, Propane, Formaldehyde gas, Hydrogen MQ214 - Methane, Natural gas.

Each sensor can detect certain gases as we can see here.

For our smoke sensor we will use MQ2. MQ2 can be easily used with an OPAMP as comparator to compare voltage levels and generate a high or low output. Follow below steps for circuit diagram.


MQ2 sensor

opamp UA741/LM358/5534 (any standard opamp can be used)

a DIP 8 pin socket (if necessary)

1kohm, 10ohm ,220 ohm resistor a 10k potentiometer


Male headers

Veroboard, solder kits, wire cutters, wire jumpers,etc

Step 2: Theory and Circuit

Opamp here acts as a comparator. Any standard inexpensive opamp will work here.Whole circuit to be powered by 5v. Circuit diagram is attached in this step.

Inside of the MQ sensor has a coil that has a chemical compund which is sensitive to that particular gas to be detected. The coil needs to be heated up for that chemical compund to work. The MQ sensors take certain time to heat up it's coil after it is powered up. When gas is detected, voltage level on the pin changes and it can be detected. Comparator's threshold voltage is set using a 10k potentiometer. An led can be used for observing the output. Threshold can be set by rotating the pot to your desired settings by a proper calibration. Power supply should deliver at least 500mA current. The MQ sensors are inductive coils which can draw higher current than other sensors.Use power supply capacitors for ripple filtering.

Circuit diagram drawn using Fritzing. You may check this site too:

Step 3: Soldering and Testing

Solder according to the circuit given here. Attach male headers at power pins, at opamp output pin 1, and if required at pin 3 for getting analog output of MQ2. Now power up the circuit with 5v 500mA supply and wait for the sensor to heat up. You can feel it by touching it's surface. When it is heated then place some gas with a gas lighter or generate smoke by burning paper ,near it. Adjust threshold and led should glow after it detects the gas. Adjust carefully threshold and your circuit is good to go.

As mentioned before do not use this in a commercial place. Feel free to comment here or mail me at