loading
I am twelve and I love making these instructables, I also love robotics, programming, DIY projects, as well as pets. I will show you how to make an arduino methane detector. Methane is in the gas from lighters, propane, and yes, farts. I will also provide the code. The detector will turn one of the LEDs to signal that there is not very much methane in the room. It will turn on the other LED to signal that the level of methane may be hazardous. You can also add a peizio speaker to make a buzz.

Step 1: Get the Materials!

You will need:
-An arduino (preferably an arduino uno )

-An arduino mq-4 gas sensor- $7 (http://amzn.to/1Q1sfdE)

-jumper wires for arduino

-mini arduino breadboards [found on Amazon] (you can also use a standard one)

-two different color LEDs

-1 9v battery

-1 arduino 9v battery connector (Amazon)

-a battery back for two AA batteries

Step 2: Set Up the Detector

You are going to set up the MQ4 detector like this.

GND to GND on the arduino (BLUE)

VCC to 5v on arduino (RED)

OUT to pin 8 on arduino (ORANGE)

Step 3: Set Up the LEDs

The "Safe" led (the one that will say that there is a safe amount of methane in the room)
The positive leg which is the longer one will go to the 12th pin and the other leg( the negative leg, the shorter one.) this will go to GND.

The "unsafe" led (the one that will safe that the amount of methane maybe unsafe) the positive leg (the longer one) will go to 12 and the other one with go to GND.

Step 4: The Code!

The some of the code was used from the Ardusniffer projects. I was revised by me.

<p>Very handy... without a code</p>
<p>I will post it by tommorow.</p>
<p>Where's the code?</p>
<p>i wrote a simple code for you.</p><p>lets go! Its just basic it reads high or low value and will set off a buzzer.<br><br>int MQsensor = 4; // set the DigitalPin on the Sensor to D4 on arduino<br>int Buzzer = 5; // set the buzzer pin to arduino D5</p><p>int val; //simply reading value high or low</p><p>void setup()<br>{<br>pinMode (Buzzer, OUTPUT);<br>pinMode (MQsensor, INPUT);<br>}</p><p>void loop()<br>{<br>val = digitalRead (MQsensor) ;<br>if (val == HIGH)<br>{<br>digitalWrite (Buzzer, HIGH);<br>}<br>else<br>{<br>digitalWrite (Buzzer, LOW);<br>}</p><p>}</p>
<p>Can you please tell me how to convert the mq 4 analog values to ppm.? I need it for my project </p>
<p>Thanks.</p>
<p>Otherwise check out my projects i got a MQ sensor project to. for the MQ9 but it will work for any gas sensor.</p>
<p>can i use mq-5 gas sensor replace with mq-4 gas sensor?</p>
<p>yes you add any MQ sensor</p>
Thanks! If you have any suggestions for future projects you can comment them!projects,
<p>Nice sensor project.</p>

About This Instructable

2,409views

43favorites

More by Captiansdg:Methane Detector 
Add instructable to: