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