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 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 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.1uF Ceramic Capacitor
  • 47uF/16V Electrolyte Capacitor
  • Push Button
  • Prototype Board
  • +5V Power Supply

Programming ESP-01 Using Serial Converter

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

Connect the VCC and GND of ESP8266 to 3.3V and the GND of the Arduino. Then connect CH_PD to 3.3V and GPIO_0 to the GND of Arduino. Also, connect the RX and TX of ESP8266 to the RX and TX of Arduino Nano respectively. GPIO_0 is directly connected to the ground to enable the programming mode of ESP8266. After making the circuit as per the diagram, connect the reset pin of the Arduino Nano to the ground to bypass the Arduino. It will disable Arduino and upload the code directly to the ESP8266 board.

Now power up the Arduino Nano 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 Nano and connect the MQ-5 gas sensor with ESP8266 as per the diagram. This system will be ready to 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 the ground of the power supply. 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. 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 prototype board which is similar to Veroboard.

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.

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

Why do 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.

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 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.

  • 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 enter the email subject and body and then click on create action.

ESP-01 Code

Leave a Comment