The MQ series of gas sensors uses a small heater inside with an electrochemical sensor. They are sensitive to a variety of gases and are used indoors at room temperature. The output is an analog signal and can be read with an analog input of the Arduino. The MQ-2 gas sensor module is useful for detecting gas leaks in the home and industry. It can detect LPG, i-butane, propane, methane, alcohol, hydrogen and smoke.
Step 1: What you will need
For this tutorial you will need:
• Arduino one
• Breadboard
• MQ-2 gas sensor module
Step 2: The circuit
The connections are fairly easy:
• Vcc to Arduino pin 5V
• GNG to pin Arduino GND
• Output to Arduino Analog A0 pin
Note: The sensor gets very hot after a while, do not touch it!
Step 3: The code
Here is the code, embedded using Codebender!
Try to download the Codebender plug-in and click the Run button in Arduino to program your Arduino with this sketch. And that's it, you've programmed your Arduino board! Press the connect button to start serial communication with your Arduino board.
Take a lighter and press the button to release the gas near the sensor. Observe the values on the serial monitor.