The connections are pretty easy:
- Vcc to Arduino 5V pin
- GNG to Arduino GND pin
- Output to Arduino Analog A0 pin
Step 3: The Code
Here's the code, embedded using Codebender!
Try downloading the codebender plugin and clicking on the Run on Arduino button to program your Arduino with this sketch. And that's it, you've programmed your Arduino board! Press connect button to start serial communication with your Arduino board.
Step 4: Well Done!
You have successfully completed one more Arduino "How to" tutorial and you learned how to use the MQ-2 Gas sensor with Arduino.
Tip: You can use this tutorial to read values from all MQ gas sensors (MQ-2, MQ-3, MQ-4, MQ-5, MQ-6, MQ-7, etc)