IoT MQ-5 Gas Leakage Detector Using ESP-01

Gas leakage is a serious problem in households nowadays where LPG gas is used, therefore the gas leakage detection system is introduced. There are many methods available for booking a Gas Refill, methods include online booking, telephonic booking etc. It will be a difficult situation for the one who uses LPG gas for cooking regularly. The aim of this paper is to present a new system automatically books a cylinder when the gas is about to empty is by sending a notification to the gas agency using wifi using the Internet of Things approach. In addition that sensor is used to detect gas leakage at home. If the gas leakage is sensed automatically it will send an SMS to the user. wifi is one of the most used networks across the world. Hence, a load cell has been used to monitor the weight of the LPG gas regularly. The values are next fed to the microcontroller.

If the gas in the cylinder indicates a value where the remaining percentage level is crossed below the threshold level set for gas to be indicated as getting emptied, then a notification will be delivered to the gas enterprise automatically to book the new cylinder. Subsequently, a reply notification will be sent to the customer about the booking status. At the same time, application software is developed in the gas enterprise to inform and record the booking. This, work helps the society to specifically indicate gas leakage and also helps both customers and the agency to get the gas booking made automatically using the IoT technique.

A wide range of MQ sensors available in the market that has the ability to measure Methane, Butane, LPG, smoke, Alcohol, Ethanol, Carbon Monoxide, Hydrogen Gas, Ammonia, etc. These sensors are widely used in Smoke Detection, Gas Detection, and Air Quality Monitoring systems. Among these, we previously used the MQ4 gas sensor in the Food monitoring system and MQ135 in the Air Quality monitoring system.

Today we will use the MQ-5 sensor to build an LPG Leakage Detector using ESP8266-01. The ESP8266 will be programmed using the Arduino Uno, and after uploading the program, ESP8266 will be interfaced with the MQ-5 sensor. Here it will use IFTTT Webhooks to send Email warnings whenever the Gas sensor detects the LPG Gas.

Circuit Diagram

MQ-5 Gas Leakage Detector Circuit Diagram

Components Required

  • ESP8266-01 (ESP-01)
  • MQ-5 LPG Gas Sensor
  • 3.3 Volt Voltage Regulator (AMS1117)
  • 0.1µF Ceramic Capacitor
  • 47µF Electrolyte Capacitor
  • Push Button
  • Double Sided Veroboard
  • +5 Volt Power Supply

Programming ESP-01 Using Serial Converter

Instead of using the FTDI board, here I am using Arduino Uno to program the ESP8266-01. To Program ESP8266-01 using Arduino Uno make a circuit as per the given diagram.

Connect the VCC and GND of ESP8266 to 3.3V and GND of Arduino, then connect CH_PD to 3.3V and GPIO_0 to GND of Arduino. Also, connect RX and TX of ESP8266 to RX & TX of Arduino Uno respectively. GPIO_0 is grounded to enable the programming mode of ESP8266. After making the circuit as per the diagram connect the Reset pin of the Arduino to GND to bypass the Arduino. It will disable Arduino and upload code directly to the ESP8266 board.

Now power up the Arduino Uno and open the Arduino IDE. Select the “Generic ESP8266 Module” inboard type and upload the code.

LPG Leakage Detector Circuit Diagram

After uploading the code, remove the Arduino Uno and connect the MQ-5 gas sensor with ESP8266 as per the diagram. This system will work as an LPG leakage detector.

VCC and CH_PD pins of ESP8266 are connected to the output pin of AMS1117 while the GND pin is connected to –ve rail of the battery. The reset pin of ESP8266 is connected to GND through a push button. MQ-5 sensor is connected to the GPIO2 pin of ESP8266. The positive rail of the buzzer is connected to GPIO 0 of ESP8266 through a switch.

This complete setup will be powered by the Lithium polymer Battery. The AMS117-3.3V is used to regulate 3.3V for the ESP8266-01 board.

Here we have built a small module using ESP8266-01 on the perf board which can also be used in other projects:

PCB Design

After designing the schematic diagram of the IoT MQ-5 gas detector system, the assembled components and wiring are too clumsy and look unprofessional. In fact, the wiring also has a chance of loose connection. Then I realised that we need to design the whole system small so that it will fit in any area of the house. To give it a clean and professional look I decided to build its PCB prototype using EasyEDA software as it is so simple to use. Now come to the main part, where we need to order our PCB prototype. I always prefer PCBWay for their quality assurance, fastest delivery and also for 24/7 customer support.

Gerber file for IoT MQ-5 Gas Leakage Detector Gerber.

You can view the Gerber file here Gerber File Viewer.

MQ-5 Gas Leakage Detector 2D View
2D View
MQ-5 Gas Leakage Detector 3D View
3D View

Why I Choose PCBWay as My First Preference?

I’ve done several runs with PCBWay and am happy with the results, it’s good quality. The etching, solder mask, and hole sizes are all done well and that is what matters to me. It takes a few hours for a design to get approved and then a couple of days to finish and ship.

With more than a decade in the field of PCB prototypes and fabrication, PCBWay has proved its assurance from time to time. They always look at the needs of the customer from different regions in terms of quality, on-time delivery, cost-effectiveness and any other demanding requests. PCBWay is a place that brings manufacturers and customers together. As one of the largest and most experienced PCB manufacturers in China, PCBWay is proud to be the best business partner in any aspect of PCB needs.

Check it out for a High-Quality PCB solder mask. There are some pictures below of the new colours of solder musks.

Aspects of PCBWay

High Delivery Rate

In previous years, the on-time delivery rate was 99%. Rather than PCB quality, PCBWay knows that the other most important factor is the shortest possible lead time, which is critical for R&D engineers, especially in the prototyping phase. PCBWay keeps working to ensure PCBs will be delivered to customers as soon as possible and they’re delighted. It takes only 3 to 15 days according to the courier service to deliver your products. After PCBWay moved to the new factory, the production capacity of multi-layer PCB can be as high as tens of thousands of square meters per month. So on-time delay is also reduced for that. They have the “Return and Refund” principle, for every unusable board caused by PCBWay, they will rebuild and refund the order soon.

Quality Assurance

When talking about quality assurance, all the PCB prototypes go through the most stringent tests rather than the basic visual checks. They have most of the testing and inspecting types of equipment used in the PCB prototyping industry, such as Flying Probe Tester, X-Ray Inspection Machine, and Automated Optical Inspection (AOI) Machine.

PCB Prototyping & Manufacturing

PCBWay New solder mask

PCBWay can also make advanced PCBs which are high-quality PCBs and they are recommended for industrial types of equipment, instrumentation, automotive electronics, communication types of equipment, etc. They produce FR-4 and Aluminum boards and advanced PCBs like Rogers, HDI, and Flexible and Rigid-Flex boards, at a very reasonable price. Just check this Instant Quote to order premium PCBs for your hobby projects.

PCBWay different types of solder masks

Previously there have 9 different types of solder masks available in their company. But now recently they have launched extra 4 solder masks that are pink, grey, orange and transparent solder masks.

PCBWay new solder masks 1

Also, there is a piece of great news about the price reduction of PCB prototypes. From 5th August you can now buy 4-layers & 6-layers with upto 20% discounts. As the price dropped, don’t think they will compromise on the quality. Check out the link “4-layer & 6-layer PCBs” where you can find more about it.

PCB Assembly

It not only offers PCB Prototyping but also offers PCB Assembly service. You can order a full PCB board with attached components by uploading your BOM file. SMT & THT assembly starts from only 30$ including free stencil and worldwide shipping. The components can be sourced and provided by PCBWay, or by clients themselves.

There are three types of assembly services:

  • Turnkey where PCBWay supplies all PCB parts.
  • Kitted or Consigned where the customer is responsible for buying and sending all parts to PCBWay.
  • Combo, where the customer supplies some parts and PCBWay, completes the rest.

3D Printing & CNC

It also produces Rapid Prototyping like 3D printing, CNC Machining, Sheet Metal Fabrication, and Injection Molding. The quality of the product is too premium and reliable. And also the best part is that you will receive your order within a minimum of 3 days.

Guide for Ordering PCB from PCBWay

IFTTT Setup LPG Gas Leakage Detector

Here we are using IFTTT to send Email warnings when the MQ-5 gas sensor detects the LPG gas. IFTTT (If This Then That) is a web-based service by which we can create chains of conditional statements, called applets. Using these applets, we can send Emails, Twitter, and Facebook notifications. We previously used IFTTT to build many IoT-based projects using IFTTT.

To use the IFTTT sign in to your IFTTT account if you already have one or create an account.

Now search for ‘Webhooks’ and click on the Webhooks in the Services section.

Now, in the Webhooks window, click on ‘Documentation’ in the upper right corner to get the private key.

Copy this key. It will be used in the program.

After getting the private key, now create an applet using Webhooks and Email services. To create an applet, click on your profile and then click on ‘Create.’

Now, in the next window, click on the ‘This’ icon.

Now search for Webhooks in the search section and click on ‘Webhooks.’

Now choose the ‘Receive a Web Request’ trigger and in the next window, enter the event name as LPG_event and then click on create a trigger.

After this, click on ‘Then That’ and then click on Email.

Now in Email, click on ‘send me an email and enter the email subject and body and then click on create action.

Leave a Comment