Introduction: Gas Detector / Indicator (USB Powered) With Arduino

ArduSniffer
This Instructable shows how to build a gas detector / indicator using an arduino.
The finished product is USB powered and displays the amount of detected gas on a led display.
In this design the reset button on the arduino is also working.

This project will cost you between €25,- and €65,- depending on the quality of the parts you want to use, the links to order the parts are included in step one.
Luckily, the arduino (which is the biggest investment here) can be easily reused for other projects.

Step 1: Materials & Tools


The first thing you need to do is gathering the required materials,
for starters it is advised to use the electronics described here.
Ofcourse when you are more experienced you could display the data in a completely diffent way,
the arduino has great oppertunities for this.

Tools
- hot glue gun
- sharp knife
- metal ruler
- some drawing tools
   (depending on your personal preference)

Materials
- arduino nano
   €39,95 http://iprototype.nl/products/arduino/boards/nano
   or €11,44 http://www.dealextreme.com/p/nano-v3-0-avr-atmega328-p-20au-module-board-usb-cable-for-arduino-118037?item=92 (this includes cable!)

- usb cable
   €3,95 http://iprototype.nl/products/accessoires/cables-wires/mini-usb-cable

- usb powerplug (optional)
   €8,95 http://iprototype.nl/products/accessoires/power/usbadapter

- gas sensor
   €5,95 http://iprototype.nl/products/components/sensors/methane-CNG-gas-sensor-MQ-4

- led display
   €1,39 http://iprototype.nl/products/components/led-lcd/led-display-red

- cardboard or other material for the exterior (you can use the included drawing and print it on thick paper)
   or order the 3D printed exterior

    * parts are also available at sparkfun.com *

Step 2: Mounting the Parts


Next, you have to mount the parts into the housing.
Use the drawing provided in the previous step or create something yourself,
The 3D printed exterior has a mounting clip for the arduino built in.

The pictures illustrate how to mount the parts using the hot glue gun.
As you can see I used some small pieces of cardboard glued together for spacers and mounting supports,
this is particularly important if you want the reset button on the arduino to work properly.
Make sure to securely glue the parts into place but still keep the electronic contact points and button clean.

Step 3: Wiring


Once you have all the parts in place you can wire them.
connect the arduino to the sensor and led display according to the documents below.
If you have doubts, feel free to send me a message.

In the picture I used quite long wires that have female headers on them,
for a permanent version you could choose to solder the wires.

Sensor wiring
http://wiring.org.co/learning/basics/airqualitymq...

Led display wiring

http://www.learningaboutelectronics.com/Articles/A...

http://iprototype.nl/docs/led-display-red-technisc...

Step 4: Uploading Code


The arduino needs to be programmed,
this is very easy to do.

Use the software provided on www.arduino.cc
- go to the site
- click on 'download'
- download and unpack the 0023 version (needs no installation)

Now you can open the included code file and upload it to the arduino.
The file needs to be in a folder with the same name tag.
(the arduino software will create this for you when you try to open the file)
For instructions check the arduino website.

Step 5: Testing


Now you can test your gas detector!

Change the thresholds in the code if you are not satisfied with the reaction of the sensor.
Instructions can be found on the www.arduino.cc website.

Comments

author
russeljamesragmac made it!(author)2015-08-22

I have a question. can arduino uno is capable to replace the arduino nano in this project? reply me please. I really need the answer for our project. thank you so much.

author
rohit_gaidhane made it!(author)2016-10-24

Yes its works.

author
slwthr made it!(author)2015-03-22

does this sensor detect refrigerant r410a gas leak?

author
ssevalingam made it!(author)2016-03-21

you need to change the gas module for that

author
russeljamesragmac made it!(author)2015-09-04

Excuse me sir, I'm about to modify this project and I add some other materials like buzzer and LED. can you help on how to put the schematic of these materials? I badly need it. :( thanks.

author
ashwa+lohit made it!(author)2015-05-19

author
KOTSOS5 made it!(author)2014-12-01

Hi, i have a rookish question, i made the circuit and it works but anytime the sensor senses gas and let's say number 4 is displayed, after some secs the gas evaporates and the blinking loop starts again number 4 is displayed again!! If the gas will be heavier and let's say number 6 is on the display after a while the blinking loop comes up but this time number 6 comes up again! how can i change it? i know it has something to do with the sum-break routine. P.s. the same happens to your video because you haven't put any delay before breaks it's not visible but if you pause it you will see that you have the same problem!

author
GianlucaS1 made it!(author)2014-11-20

Hi ! your project looks great but I made this with an arduino uno and I have a problem with the display:

When I connect all pins to the arduino starting by the first on the left bottom (of the display) to the digital pin 2 until the tenth to the pin 9 and the third and the eighth to the positive and ground, the arduino doesn't work and it turns off. Are all the connections right ? Can you help me please ? The display needs a resistor? Thanks.

Sorry for my bad english but I'm an italian student and I don't speak english very well.

author
StijnID made it!(author)2014-11-25

sounds like you are short-circuiting something. does this help:

http://www.learningaboutelectronics.com/Articles/Arduino-7-segment-LED-display.php

author
gstrafile made it!(author)2014-11-25

I have this kind of segment display is this different from your display ? I understood that my display works only with 5v connection and a 330 ohm resistor in the two wiring display connections. Please can you help me ? If you want could you help me by email ? Thanks for the link but the wiring doesn' t work but I could learn a lot of informations with that link. I appreciate your attention to much. :)

temp_-1314622819.jpgtemp_72566709.jpg
author
gstrafile made it!(author)2014-11-25

I am GianlucaS1 and I posted that comment on the top

author
kiara2398 made it!(author)2014-11-25

Can you send me something how to wire the gas sensor?

author
vaitot made it!(author)2014-11-18

The 3D printed exterior is broken!

author
StijnID made it!(author)2014-11-25

sorry, the link is not working anymore since this is an old project.

author
kiara2398 made it!(author)2014-11-18

Can you send me a video of how to do the wiring?

author
kiara2398 made it!(author)2014-11-17

Can you send me a video of how to the wiring

author
kiara2398 made it!(author)2014-11-02

How did you make the reset button?

author
StijnID made it!(author)2014-11-03

Hi, arduino's have a standard reset pin. Connect a button to both the reset pin and ground, pushing the button will completely reset the arduino.

author
kiara2398 made it!(author)2014-11-03

So do I have to buy a button for reset?

author
StijnID made it!(author)2014-11-04

On the arduino nano there already is a reset button, you can use this as shown in the template.

author
kier_great made it!(author)2014-09-25

is the vcc of the sensor connected to the 5v power source of arduino...? if yes,,,,, does the current produce by the sensor wont burn the arduino?

author
StijnID made it!(author)2014-10-26

Hi, if you take a look at the link in step 3, there needs to be a 10K resistor going from the sensor to the ground. Hooked up the right way, this sensor will not burn your arduino.

author
carl.tumala made it!(author)2014-09-18

hi? can you give me the schematic diagram for wiring's for this project please

:(

author
StijnID made it!(author)2014-10-26

Hi Carl, the links in step 3 explain the wiring, look at the arduino code to connect the right pins to it. I have no complete schematic of this exact project, but it is quite simple.

author
Aravindan+Sridhar made it!(author)2014-07-14

Hi! Great work. Can you tell me how to create a gas detector with the same components but with a arduino uno. How to build it without any connection to computer(i.e using a battery pack to power the board.

Thanks in advance

author
StijnID made it!(author)2014-08-25

Hi, the arduino Uno works the same, just upload the provided code to your board. The pin configuration remains the same. (you can change it manually) Using a battery pack is quite simple, use the DC power connector to plug in a 9V battery, or use the Vin pin and the GND pin to hook up a 5V battery.

Good luck with your project!

author
naglasnats made it!(author)2013-03-26

Sir, nevermind it. What is the pin configuration of gas sensor? Is it symmetry? Thanks.

author
StijnID made it!(author)2013-08-20

Pin configuration can be found using the link in step 3.

author
SSBurton made it!(author)2013-08-19

Does this code work the same with the CO sensor?

author
StijnID made it!(author)2013-08-20

I'm not sure about that. Maybe there's a code on Arduino Playground you can use? If i get a chance to try it out i'll post it here.

author
nodoubtman made it!(author)2013-08-01

no schematic?
thank you!
marC:)

author
StijnID made it!(author)2013-08-03

You're welcome, schematics can be found using the links on page 3.

author
nodoubtman made it!(author)2013-07-13

Thank you! :)

author
naglasnats made it!(author)2013-03-23

sir, can I use shortcuts here? Can I use lower resistor? Thanks.

author
StijnID made it!(author)2013-03-24

Hello,
What do you mean with shortcuts?
The manufacturer of the sensor module reccomends a 10K resistor,
it might work with another one but try to stay close to 10K.
(Maybe you can use multiple smaller resistors in a serial circuit?)
good luck, have fun

author
jatinbatra made it!(author)2013-01-02

creative! yea i m....one suggestion put it to pocket size contest

author
jatinbatra made it!(author)2012-12-28

What is the advantage..i mean where it can be exploitated

author
StijnID made it!(author)2013-01-02

Be creative! It can be used in anyway you like, that's what instructables.com is for man. :)

author
jatinbatra made it!(author)2012-12-23

Can it made with uno?

author
StijnID made it!(author)2012-12-28

sure, the arduino uno is too big to fit the exterior i posted though. the coding should work the same.

author
StijnID made it!(author)2012-12-23

because the threshold values can be altered very easy in the code, this is a very easy way to calibrate the detector. Also, because it is a detector/indicator it does not have to be super accurate. But feel free to write your own arduino code...

author
jatinbatra made it!(author)2012-12-21

man u didn't do anything to calibirate the sensor ....why?

author
Tomahawk92 made it!(author)2012-10-23

if only it told us what type of gas as well. lol.

author
Husham+Samir made it!(author)2012-06-17

cool project!!!!

About This Instructable

103,118views

212favorites

License:

More by StijnID:tilt switch activated, glowing paper model, LED lightGas detector / indicator (USB powered) with arduino
Add instructable to: