Mutligas Detector (i-butane, Propane, Methane, Alcohol, Hydrogen and Smoke) Using Arduino and MQ2

Introduction: Mutligas Detector (i-butane, Propane, Methane, Alcohol, Hydrogen and Smoke) Using Arduino and MQ2

About: Project Manager ,Networking and Telecommunication Engineer

Domestic gas, butane, propane ... are of great importance in our daily lives. We use them for heating houses in the cold period and daily to cook or reheat our food and heat water for different uses. Others such as carbon dioxide and carbon monoxide, are released when we burn something intentionally or by accident.

However these gases are usually very dangerous especially when they emerge in a local as a bedroom, a little airy house. It there's a risk of explosion at the slightest spark for fuel gas (butane, ...) and a risk of suffocation and fainting in the case of others such as carbon monoxide.

Studies have shown that 90% of explosions due to domestic heating gas came from a flexible tube connecting devices worn, perforated, torn or improperly installed. Indeed according to the same study, 5% of the volume of the room is enough to trigger an explosion. It is therefore necessary to have good control of the gas for any leaks in time to avoid disaster.

It is in this perspective that fits this project, to develop a simple prototype of a gas leak detector. This device must be calibrated as needed and placed in the area where this could happen probable leak. Once the associated sensor detects a certain concentration of gases and strange exceeding a threshold, the audible and visual alarm is triggered to warn users.(i'll add the GSM communication so soon so stay tuned)

I think it's nice to give a name to this project ,so i named it DEGALT(it was my favorite movie ;p! )

Step 1: Materials

For the realization of our assembly we will use the following components:

The Arduino board: main element

The Buzzer: who will play the role of active alarm alerting when the leak is detected

The LED (Light Emitting Diode): a green LED that illuminates when all is well and a red LED will flash at a certain frequency as the alarm as soon as there's some leakage.

Resistance: They ensure the protection of the various elements of the assembly against damage that may occur during use

The fundamental component MQ2 sensor will be powered by direct current and will give us the information either in analogue or digital form.

The card can be powered by either an external generator or by a computer USB port through a USB cable.

and finally i used some pieces of wood to make this small package

Step 2: Specifications

Note that the sensor module used (MQ2 )has two outputs (DOUT and AOUT), to provide information in two forms .An analog signal to the leg in AOUT and a digital signal DOUT.

I chose to work with the analog output to directly apply the value captured on one of the analog inputs of the Arduino board. This value will not be converted to not introduce any noise due to sampling or quantification. For that a protective resistor (22K) is required, it is connected between the output in AOUT and circuit ground (GND).

-I select as input, analog input A0 of the Arduino board. It is connected to the output of AOUT MQ2 sensor that directly transmit the analog value captured in the map. For reasons of protection, resistance is placed between this junction and ground.

-Outputs 6, 7 and 8 of the card are used to control respectively: the red LED, the green LED and buzzer. The other respective legs are grounded

-The line V + of the carrier plate is used as a common ground for all of the mounting components.

Step 3: Code Description

the integer variable SensorValue represents the current value at the sensor, it has been initialized to zero. By visualizing through the serial monitor, we can choose a decision threshold at which the gas will be assumed rate sufficient to trigger the alarm.

It places the analog value sent by the sensor on the A0 sensorValue variable. This allow to display it on the monitor with Serial.println function (sensorValue, DEC) stating that the display should be in decimal. From this view we fix our decision threshold
After some tests with a simple lighter we noted that the value 300 well suited as a threshold. Indeed one hand, if the threshold is too low, the alarm may trigger oddly without good cause. On the other hand if it is too high, it will take much more gas for our system to detect it. However remember that it will take more rigor on bench-marking for efficiency and reliability of my system. It then sets the conditions and the corresponding commands:

-If the sensorValue value is below the 300 threshold decision then the gas rate is normal, everything is fine and the green LED is lit while the other components are off.

-If, against the sensorValue value increases and reaches or exceeds 300 then the red LED and audible alarm are activated and the green LED is off it there's leakage. These two components are illuminated nearly simultaneously and intermittently.

Step 4: Tests

The system test phase has been satisfactory; everything works well once the program flashed on the board. The green LED illuminates when all is well and the sensor monitor series gives the value 127

Using a lighter to present a little gas around the sensor while viewing the value read with the serial monitor. Note while the value increases more and more and as soon as the value 300 (threshold) is reached the green LED turns off and the red LED will flash and the buzzer sounds: " there's leak detection ! ;p "

Step 5: Scalability and Potential Next Versions

The advantage of this system is among others its moderate consumption and even lower in energy terms. However, it is the first version of a work that can still evolve. Besides reliability and detection accuracy could be improved, the alert system can be made more efficient.

We can think in particular to a remote warning system in case of leakage. A GSM module can be added to send a message to the user informing him of a possible gas leak at home. We can also, with some effort, add to our system a controlled relay switch mechanism for carrying the torch of the part affected under high impedance, preventing any risk of ignition. Indeed, if the leak is large and has a short duration, the 5% of the room necessary for a possible explosion are likely to be achieved. So it would be very dangerous for the user, on his arrival had the reflex to light the lamp, a high risk of a boooom !!!

I'll update this system soon,,so just stay tuned

Be the First to Share


    • Cold Challenge

      Cold Challenge
    • Baking Contest

      Baking Contest
    • Make it Glow Contest

      Make it Glow Contest



    4 years ago

    May i know what is the purpose tht u put a protective resistor of 22kohm in between the A0 and ground of the MQ sensor?

    Mohammed BENHADINE
    Mohammed BENHADINE

    Reply 4 years ago

    I don't really know , i found it in the MQ2 recommendations . I know that in digital inputs it's named a pull down resistor to be sure about the state of the pin if there's fluctuations.


    6 years ago

    Does it detect CO? That could be handy :-)

    Mohammed BENHADINE
    Mohammed BENHADINE

    Reply 6 years ago

    i guess yes,,in the datasheet of the MQ2 they mention that but i didn't tested

    for the others gas it's tested ;)