Introduction: Intel Edison Gas Sensor System to Detect Biogas / LPG Leakage

Picture of Intel Edison Gas Sensor System to Detect Biogas / LPG Leakage

I am one of those 300+ instructables community members who received the Intel Edison Board and specialty Intel IoT development kit offered by instructables under the theme Environmental & Agriculture. One of the proposal submitted by me was a Biogas leakage detection system using Intel Edition and the IoT development kit. I am quite new to Intel Edison and Arduino Programming and it took me more than a month to learn the basics. I have made this project as simple as possible so that anybody can follow the steps in making one at their home.

Most of us use Liquefied Petroleum Gas (LPG) at home for cooking. I have also installed a Biogas plant which supplements about 40% our gas requirement. LPG and natural gas like Methane are odorless gases. However, Ethanethiol, commonly known as Ethyl mercaptan, which possesses a distinctive odor is added to LPG which makes it possible for us to easily detect in the event of any gas leakage. It is impossible to detect the presence of pure Methane as it is odorless, colorless and non-toxic. If you inhale Methane you will feel little suffocation as it displaces Oxygen in the lungs, other than that inhaling small amount of Methane does no harm. However, Methane is extremely flammable and can explode at concentrations as low as 5% in air.

The aim of this project is to detect the presence of Methane in case of any leakage from the Biogas stove and the gas pipe line inside home. This system can also be used to detect LPG leakage.

Please watch the video to see how the system detects Methane leakage and activates the buzzer.

Step 1: What You Need to Build the System

Picture of What You Need to Build the System

You need the following accessories to build the gas detection system :

  • Intel Edison with Breakout board - provided with the kit
  • Grove Base Shield V2 for Arduino - Not provided with the kit. it is optional and makes it easier for connecting the sensors with the Intel Edison Board. If you do not have one not to worry, I will show you how to connect the Gas Sensor with the Edison Board.
  • Grove Gas Sensor MQ-5 with connector wires - provided with the kit. the Grove Gas Sensor MQ-5 module works on 5 volts and can detect presence of LPG, Methane, Iso-butane, and Propane at the concentration levels between 200 - 10000 ppm. The Gas Sensor consists of circuits to fetch signal as well as heater coil to provide a working environment. The components are enclosed in an Anti-explosion network so that the heater element inside the sensor will not cause an explosion. the gas sensor can be connected to any of the analogue Grove connectors or directly to the Edison board using jumper wires
  • A Buzzer - Not provided with the kit. The buzzer is a must to sound alarm in case of any gas leakage is detected. You can buy the Grove Buzzer module which can be directly connected to the Grove Base Shield. I have ordered one but yet to receive it as it is out of stock here in India. So, I have opted out for the 5 volt buzzer shown in the picture above. The buzzer has two pins, the longer one is the +ve pin and the shorter one is the -ve pin. You can use male - female jumper wires to connect the buzzer to the Edison board.
  • Jumper Wires - Not provided with the kit, but you need them to prototype your system. I have ordered both male-male and male-female jumper wires from an online store.
  • 12 Volt Power Adapter - Provided with Edison board, but it works on 110 volt AC. if you live in a country where the power supply is 230-240 volts, then you need a step-down transformer to convert the voltage from 230-240 to 110-120. Otherwise buy one suitable for the power supply in your country. Also make sure that the rated power is minimum 1.5 ampere and the inner pin is the +ve pole.

Step 2: Getting Started With Intel Edison Board

Picture of Getting Started With Intel Edison Board

Easy to follow step-by-step clear instructions on getting started with Intel Edison board is provided in the following link :

https://software.intel.com/en-us/articles/assemble...

Please follow these steps to assemble, install necessary device drivers, flash Edison Board and installing the Programming language of your choice. I preferred Arduino as it is very easy to learn and also there are lots of sample codes for the sensor modules available online. Some times the flash tool may fail and you may need to flash the board manually. In case of any problem or doubt please make a comment and I will be very happy to help to the best of my knowledge.

Once you finished installing the Board, please remember to note down the Virtual Com Port number and the USB Serial Port number from the Control Panel - Device Manager menu.

Step 3: Connecting the Grove Base Shield, Gas Sensor and Buzzer With Edison Board

Picture of Connecting the Grove Base Shield, Gas Sensor and Buzzer With Edison Board

Once you completed assemble, install necessary device drivers, flash Edison Board and install the Programming language, you are ready to connect Grove Base Shield, Grove Gas Sensor Module and the Buzzer to the Edison Board.

  • Connecting the Grove Base Shield - The Grove Base Shield V2 is compatible with most of the Arduino boards available. Some boards work with 5 volts power supply and some with 3.3 volts. Intel Edison Breakout board is based on Arduino Uno Board which works on 5 volt power supply. You can find the power selector switch on the Base Shield near the Analogue Connector A0. Slide the power selector switch towards 5 Volts. The number of pin out on Grove Base Shield is same that of Arduino Uno board, so it can be directly inserted on the Edison Breakout Board.
  • Connecting the Grove Gas Sensor Module MQ-5 - Using the connector wires provided with the module, connect one end of the connector to Gas Sensor module and the other end to Analogue connector A0 on the Grove Base Shield. The connectors can be connected one way only so there is no worry of wrong connection.
  • Connecting the buzzer - Select two male-female jumper wires of different colors, say Red and Black. Insert the female end of red wire to the long pin of the buzzer and the male end to number 13 pin out on the Base Shield. There is an onboard LED which is connected to Pin 13. Most probably the first Arduino program you have uploaded is "Blink LED". we are going to use the same pin out for the buzzer. Connect the female end of black jumper wire to the short pin of buzzer and the other male end to Ground, marked as "GND" which is adjacent to pin out 13.

Step 4:

Picture of

Detailed instructions along with Arduino codes are provided at the following Seeedstudio wiki page for setting up the Gas Sensor module but the code did not work for me. It just returned a value of 'nanV' in all conditions even when the sensor is exposed to gas. You can test it on your system if you like. I have created my own version of code after going through many demo codes online.

http://www.seeedstudio.com/wiki/Grove_-_Gas_Sensor...

Step 5: Arduino Code for the Gas Sensor

Picture of Arduino Code for the Gas Sensor

The following is the Arduino code for the gas detection system. I have compiled this code going through many demo codes and examples available online. you can find description of each line of code alongside after // (couple of forward slashes)

The first part of the code tells the system that pin 13 is used for the Buzzer and Analogue pin 0 for the Gas Sensor Module. I have also set the Initial value of the Gas Sensor to "0".

The second part initializes the pin 13 as output to Buzzer and also the serial communication between the Edison Board and the computer at the baud rate of 9600.

The third part of the code tells the system to read the sensor value from the gas sensor and if the sensor value is more than 200 activate the buzzer connected to pin 13. If the value is less than 200, the buzzer will be deactivated. The sensor values can also be monitored through serial monitor if the Edison Board is connected to the computer using the Micro USB cables.

You can copy and paste the code directly in your Arduino IDE. Make sure to select the Board as Intel Edison and Port as the virtual com port number you have noted down earlier. You can verify the code and then upload to your Edison. You can monitor the sensor values in the serial monitor which you can access under 'Tools' menu in Arduino IDE.

/* Gas Sensor MQ 5 with Intel Edison to detect Biogas Leakage

* A Buzzer will sound alarm when gas leakage is detected

*/

int buzzer = 13; // 'Buzzer' will be connected to Digital pin 13

int sensor = A0; // Gas Sensor MQ 5 will be connected to Analog pin 0

int sensorValue = 0; // The initial gas sensor value will be set to 0

// The setup routine runs once when you press reset

void setup() {

pinMode(buzzer, OUTPUT); // Initialize the digital pin 13 as buzzer output

Serial.begin(9600); // Initialize serial communication at 9600 bits per second

}

// The loop routine runs over and over again forever

void loop() {

sensorValue = analogRead(sensor); // Read the input on analog pin 0 ('sensor')

Serial.println(sensorValue, DEC); // Print out the value on serial monitor

if (sensorValue > 200) { // If sensorValue is greater than 200

digitalWrite(buzzer, HIGH); // Activate digital output buzzer and sound alarm

}

else {

digitalWrite(buzzer, LOW); // Deactivate buzzer - the buzzer will not sound

}

}

Step 6: Testing the Gas Sensor at Different Conditions

Picture of Testing the Gas Sensor at Different Conditions

I have tested the gas sensor at different conditions with LPG and Biogas very near to the burner with gas on, little away from the burner, during gas burning, at the Biogas Plant, outlet valve of the Biogas plant, at the output slurry collection point, inside room and in open air. The Edison board has been connected to the computer and the results have been monitored on serial monitor. You can see screen shots of some of the sensor values in the next step

Step 7: Screenshots of Sensor Value at Different Conditions

Picture of Screenshots of Sensor Value at Different Conditions

The first screenshot shows the sensor value inside home and the second one is in open air. the sensor value slightly increased to near 100 in open air.

The third picture shows the results of gas sensor values slightly away from the burner with partially opened gas valve. The last picture shows the values of gas sensor which has been kept close to the LPG and Biogas burners fully opened

Step 8: Protective Case for the Gas Sensor System

Picture of Protective Case for the Gas Sensor System

As the Gas sensor system will be place above the stove, we need some short of protective covering for the sensor system to prevent oil vapors damaging it.

Placed the Edison Board inside a suitable plastic case, drilled holes and fixed the board with screws to the case. I have also made necessary openings for the power adapter and USB cables. The Gas sensor module and the buzzer can be connected from the top.

A word of caution here... The WiFi antenna of the Edison is located under the board. If you enclose the system with a protective case, you may not be able to use WiFi with Intel Edison.

Step 9: Installing the System

Picture of Installing the System

I have installed the system above the Biogas stove near the ceiling on a niche provided for ventilation. You can watch the video in the introductory part of this instructable on the functioning of the system.

Step 10: Testing the Gas Sensor at Different Heights

Picture of Testing the Gas Sensor at Different Heights

I have also tested the gas sensor placing it at different heights above the Biogas stove. The tests showed that the best location to place the gas sensor is near the ceiling. Biogas is lighter than air and it rises up to the ceiling immediately on release from the gas stove. watch the video here where the gas sensor is placed just two feet above the Gas stove and compare it with the video in introductory part and you will know the difference. Gas sensor placed at intermediate levels took long time to detect the gas leakage where as the sensor placed near the ceiling detected it in about 10 seconds

Step 11: Connecting the Grove Gas Sensor Module Without the Base Shield

Picture of Connecting the Grove Gas Sensor Module Without the Base Shield

If you do not have the Grove Base Shield, there is nothing to worry. you can connect gas sensor module using jumper wires directly to the Breakout board pin outs.

See the markings on Analogue connector A0 in picture one. There are four wires, Black, Red, White and Yellow. The gas sensor uses three wires only, Red for + 5 volts, Black for Ground and Yellow for Signal.

Connect one end of the connector wire to the gas sensor module. On the other end connect male-male red jumper wire to red pin out, Black to black and yellow to yellow.

Now look at the markings on the Edison board in the second picture. You can find markings of '5 volt' and 'GRD' under power. Insert the free end of red wire to 5 volts and black wire to GRD. The yellow wire goes to 'A0' under 'ANALOG IN' on the right hand side. The buzzer can be connected as usual to pin out 13 and GRD on the other side.

Step 12: Conclusion

Picture of Conclusion

Hope I have explained everything in detail. if you have any doubts or clarifications please post a comment with your query. Suggestions for improvement of the system or the code is highly appreciated.

Comments

daksharajkamal (author)2016-03-17

is there any tool to find out the compounds percentage in any gas(petrochemical)

tytower (author)2015-11-01

I see you have another instructable now too but you have not addressed my concern that LPG being a cooled liquid in the bottle comes out cold and falls to the floor until it heats up,It is only at this point it rises or floats up in air . You really need two sensors . One under and one over the gas source.

antoniraj (author)tytower2015-11-05

I am using this system to detect Biogas (Methane) leakage which is lighter than air. So I have installed it above the biogas stove near the vent. For LPG you can have sensors above and below as you mentioned

Victorv32 (author)2015-10-19

que buen trabajo!

antoniraj (author)Victorv322015-10-19

gracias... thank you

Saiyam (author)2015-10-12

Nice work sir! Feels good to see you taking interest in electronics and programming :). Truly you are an all-rounder!

antoniraj (author)Saiyam2015-10-12

Thank you Saiyam... I am a learner, if you teach me something which I do not know I will learn from you

deba168 (author)antoniraj2015-10-13

Sir you can ask me ,if you find any difficulties. I will help you.

antoniraj (author)deba1682015-10-14

thank you Deba, sure I will mail you in case of any doubt

deba168 (author)2015-10-11

Great work sir..You are really an all rounder.. Unfortunately I am not able to help you.

Good luck..
antoniraj (author)deba1682015-10-11

Thank you Deba... Code, prototyping and testing for my next project is ready. Only I need to assemble everything in place. You might have seen the testing video in Google +

antoniraj (author)2015-10-11

Thank you deba... Code, prototyping and testing for my next project is ready. Now I need to assemble everything in place. I hope you have seen the testing video in Google +

chrisjlionel (author)2015-10-09

Well done sir. voted for both contest. Try using Codebender insted of sketch.

antoniraj (author)chrisjlionel2015-10-09

Thank you chrisjlionel... It took me more than a month to go through lot of documents and demos to learn basics of Arduino and sketch. My sketch for next project with Edison is ready and successfully tested. Anyhow I will try Codebender also for future projects.

howtoraju (author)2015-10-08

My best wishes, keep rocking...

antoniraj (author)howtoraju2015-10-08

Thank you very much...

About This Instructable

5,758views

83favorites

License:

Bio: I like to make things more simple with easily available resources. My favorite quote: A human being should be able to change a diaper, plan ... More »
More by antoniraj:Home-made Incubator From Reclaimed Desktop Computer CaseHome Remedy : Papaya Leaf Oinment for Muscle Pain and Twisted JointsSore Throat Lozenges and Decoction With Plectranthus Amboinicus Leaves
Add instructable to: