Introduction: Methane Detector

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 (

-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.