Smart Alarm System for Gas Leakages

DOI : 10.17577/IJERTV9IS050508

Download Full-Text PDF Cite this Publication

Text Only Version

Smart Alarm System for Gas Leakages

Serdar Nazarov, Bayram Jumayev

State Energy Institute of Turkmenistan Bayramhan str. 62, 745400, Mary, Turkmenistan

Abstract Nowadays, one of the main problems that human being encounter in their daily life is fire disaster which occurs due to the gas leakages. Therefore, the main objective of the article is to overcome this issue by designing automated or smart system. In order to achieve this goal, there was used a microcontroller. By the help of Arduino UNO microcontroller board, MQ5 type gas sensor and SIM900A GSM/GPRS module, there was designed the smart system that warns about the gas leakages either by calling or sending a short message service (SMS). Moreover, this system is also capable of closing the gas line by using solenoid valve in order to cut the gas leakage off. The proposed smart system can be mounted in living houses, industries, restaurants, hotels or in any other

  1. Microcontroller which acts as a brain or CPU (central processing unit) of the system which receives the signal from the sensors and commands the loads;

  2. Loads, actuators or outputs which are activated or deactivated in regards with the command received from the microcontroller.


    place where may occur a gas leakage.

    Keywords Smart alarm system, prevention of gas leakage disasters, cutting off gas support automatically, solenoid valve,







    SIM900A module.


      In the prosperous epoch of our powerful state, all sectors of our economy including education, science, communication and healthcare are being improved on digital basis. In fact, on 30th November, 2018, by the Decree of the Esteemed President of Turkmenistan, there was accepted a Conception of developing digital economy in Turkmenistan in between 2019-2025. Therefore, it is really important to learn and develop IT solutions and implement them in the various fields of our economy. Because digitalization makes it easier to share documents, to control systems and to carry out the works in a quicker, transparent and secure way. This century can be called as a century of smart systems due to the implementation of IT solutions in all sectors of the life. Automated or smart systems play a great role in the production and in our life as well. In this sense, there will be developed steps of smart alarm system to protect the living houses against the gas leakages. In case of any uncontrolled gas leakages, the smart alarm system will not only inform the owner of the house by calling or sending SMS, but also it will switch off the solenoid valve, connected to the microcontroller, and therefore, close the gas provision line.


      Smart systems are those systems in which the process is being carried out automatically by the help of integrated circuits. They include sensors, actuators, loads and other electrical elements that work by means of some logic. The logical steps that the microcontroller should follow are provided with the programming language that is uploaded into it. Such systems mainly consists of three important parts:

      i. Sensors, transducers or inputs which creates a signal due to some physical change or process and send the signal to the microcontroller;

      Figure-1. Feedback in closed-loop smart systems.

      Except the physical devices mentioned above, there is also a specific programming language for each type of the microcontroller. The feedback in Figure-1 somehow serves as an indicator for the automated or smart system whether it should continue its task or not to do so. The systems in which feedback is being maintained may be called closed-loop automated systems. Similarly, if there is no any correlation between the output and input signals, such systems may be called open-loop automated systems.

      Unlike classical automated systems with thousands of wirings, transistors, thyristors, resistors and capacitors, in microcontroller-based automated systems, except necessary sensors and actuators, in many cases there is no need for using so many supplementary electrical elements such as resistors and transistors. In other words, in microcontroller-based automated systems or in smart systems, it is enough to install necessary programming into the microcontroller. The programming of the microcontroller leads the integrated circuits (IC) to build necessary electrical circuits automatically. Therefore, one of the biggest advantages of using microcontrollers in automation and control engineering is that for each different circuits there is no need to use and connect necessary supplementary electrical elements such as resistors, capacitors and others. This opportunity gives engineers a big facility to build automated systems easily. Maybe that is why such systems are called smart systems as they can build up the necessary electrical circuit within IC as per the installed program.


      The components of this smart alarm system are Arduino UNO microcontroller board, MQ5 gas sensor, solenoid valve of 1,2 mm diameter, active buzzer, SRD-05VDC-SL-C type relay, SIM900A GSM/GPRS module and TMCELL local SIM card. As per the opportunity, the system can be improved further including the IoT solutions, however, in our case there is no

      need to use internet connections, because in case of gas leakages the necessary actions should be taken immediately independent of the network system.

      1. Arduino UNO microcontroller board

        Microcontrollers are used in automatically controlled products and devices, such as automobile engine control systems, smart home automation systems, implantable medical devices, remote controls, office machines, appliances, power tools, toys and industrial sectors where human interaction is hard or immediate solutions are inevitable. A microcontroller contains one or more CPUs along with memory and programmable input/output terminals or pins as in ATmega328 microcontroller of Arduino UNO board, which was selected as an appropriate board for the project. Therefore, in order to build more complicated systems of automation, using microcontrollers makes it easy and stable to build the intended circuits. Thus, the automation engineers have to have a solid background or knowledge of programming languages as well. The Arduino UNO microcontroller board is programmed with C++ programming language. There are 14 (0-13) digital input/output pins and 6 (A0-A5) analog pins in the Arduino UNO board.

        Figure-2. Arduino UNO board.

        The ATmega328 microcontroller is the brain of the Arduino UNO board. It is a tiny computer that contains a processor to execute instructions indicated or written in the program, and provides sending (TX) and receiving (RX) data. These functions are important to join the SIM900A GSM/GPRS module in order to establish a mobile communication. A significant feature of the microcontroller is that it operates or functions as per the final program uploaded to it through the USB cable. After uploading the program, the board is ready to run under 9V 2A DC supply.

      2. MQ5 type gas sensor

        Different types of sensors such as MQ2, MQ3 and MQ5 are being used to detect smoke, alcohol, LPG. MQ5 type gas sensor senses the change in the air concentration. This type of gas sensor has four terminals or electrodes: VCC, GND, AOUT and DOUT. As in other sensors, VCC and GND electrodes are intended to supply the sensor with 5V of voltage or DC source. While DOUT terminal is used only to find out if there is a gas or ot, in other words, to generate ON and OFF signals, AOUT electrode identifies the gas concentration. In other words, DOUT electrode is used to get

        digital output, whereas, AOUT terminal is for generating analog signals.

        Figure-3. MQ-5 type gas sensor.

        So it is so simple to connect the gas sensor to the pins of the board and detect the gas leakages. In our case, there is no need to use the DOUT terminal, because the air already contains some amount of gas. The gas sensor weighs only 8 grams and it has a high sensitivity. The AOUT electrode of the sensor was connected to the A0 pin of the board.

      3. SIM900A GSM/GPRS module

        This module will be sending or calling the owner of the house or the authorities to warn about the gas leakage. This module is useful for connecting to the Internet over GPRS network, sending and receiving SMS, calling and receiving calls. In the programming part, the SIM900A GSM/GPRS module was tested with AT commands in order to ensure if it works properly or not. Followings are some AT commands:

        • setting the SIM900A module to the text mode:


        • sending SMS to a number:


        • reading the nth SMS from the inbox: AT+CMGR=n\r

        • reading all SMS from the inbox: AT+CMGR=ALL\r

        • calling a number: ATD+PHONE_NUMBER

        • hanging up a call: ATH

        • receiving an incoming call: ATA

        In order to connect the module to the Arduino UNO board, it is important to assign to pins as RX and TX pins so as to establish a mobile communication.

        Figure-4. Connection of SIM900A GSM/GPRS module to the Arduino UNO board.

        In the coding part, we started by including the SoftwareSerial.h library and create a software serial port on pins 7 and 8. (Pin 7 is being set as RX and 8 as TX).

        Moreover, the sendSMS() function was create to send the SMS. This function uses the above-mentioned AT commands.

      4. Relay module

        Relay is one of the most important devices in automation which serves as a switch. It is useful to control electrical devices with low voltages such as 5 Volts. In fact, in order to control the solenoid valve by the help of microcontroller, it is necessary to use a 5V relay module which can be operated to allow the electrical current pass through the valve or not. The relay has two states: NO (normally open) and NC (normally closed). As their name implies, the electrical current flows through the normally closed terminal and when the digitalWrite() command is given to the relay, the states of the terminals switch or change. The SRD-05VDC-SL-C type relay module is used in the alarm system.

      5. Solenoid valve

        Informing the owner or authority about the gas leakage is not enough to prevent the possible disaster. Therefore, in the project the 12V DC solenoid valve was used to close the gas line and terminate the gas leakage. Solenoid valves are classified due to the characteristics of the electric current they use, the strength of the magnetic field they generate, the mechanism they use to regulate the fluid/gas, and the type and characteristics of fluid/gas they control. When used with the Arduino, the solenoid valve is operated together with the TIP120 Darlington transistor (NPN type), 5V relay module and 1N4001 type rectifying diode. The typical connection of the solenoid valve to the Arduino is shown in Figure-5 (taken and modified form the website enoid_wiring.html).

        Figure-5. Circuit diagram for connecting the solenoid valve with the microcontroller through relay.

        A relationship between the required solenoid force Fs, the gas pressure P, and the orifice area A for the solenoid valve may be formulated as below:


        = = 2 =


        Where r is the orifice radius and d is the orifice diameter. A

        digital output pin of the Arduino UNO board is connected to the base of the transistor which controls the current flowing form the collector to emitter and as a result, relay is opened

        and closed as per the command coming from the digital output of the board.

      6. Active buzzer

        In case of gas leakage, the active buzzer will also be turned on in order to inform about the leakage vocally. It is used as a sound making element. It has an inner vibration source and it is simply connected to any port of the microcontroller, in our case the active buzzer was connected to the port number 13. So whenever there is a gas leakage, the active buzzer will also be initiated.

      7. Liquid Crystal Display (LCD)

      In order to display the data received form the gas sensor, an LCD was used. In fact, 1602 Liquid Crystal Display was used in order to display the data in 2 rows with 16 symbols in each. 1602 LCD can directly communicate with Arduino UNO board. According to the product manual, it has two connection methods, namely 8-bit connection and 4-bit connection. In our case, we used 8-bit connection as in the Figure-6 below.

      Figure-6. Connection diagram of 1602 LCD to the Arduino UNO board.

      The microcontroller operates the LCD panel by applying the correct voltage and current levels to it.


      So the steps of the proposed solution are as follows:

      1. the system notices Methane, Butane and/or LPG leakage, or any such petroleum centered gaseous material;

      2. it generates sound alarm when gas outflow is noticed;

      3. it transmits SMS alert to the authorized person;

      4. the LCD will display gas outflow status that signifies if the gas is in normal stage or not;

      5. the gas source will be automatically closed using the solenoid valve.

      This device was designed for wall mounting. After mounting it on the wall or in any suitable place and supplying it with the electrical energy, the system will be ready for automatically calling or sending SMS to the owner in case of gas leakage.

      This system contains Arduino UNO board with ATmega328 microcontroller mounted on it, MQ5 type gas sensor, active buzzer for alarming, SIM900A GSM/GPRS module to establish the mobile communication, solenoid valve to close/open the gas provision and relay module which is operated by the help of the digital signal sent from the microcontroller.

      The final view of the main part of the project or smart system, excluding solenoid valve, is as shown below:




      Serial.println ("Set SMS Content"); SIM900A.println("ALARM!!! GAS LEAKAGE!"); //This is


      gas sensor

      Active buzzer

      Figure-7. Smart alarm system for gas leakage.




      Arduino UNO

      messsage content delay(100); Serial.println ("Finish");

      SIM900A.println((char)26); delay(1000);

      Serial.println ("Message has been sent -> Bayram"); }


      To sum up, the main objective of the project is to eliminate the fire disasters occurring due to the gas leakages by designing automated or smart system. In order to achieve this goal, there was used Arduino UNO boad with ATmega328 microcontroller. By the help of this microcontroller, MQ5 type gas sensor, solenoid valve and SIM900A shield, there was designed the smart system that warns about the gas

      Below is the programming part of the proposed smart system:

      #include <SoftwareSerial.h>

      #include <LiquidCrystal.h>

      const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2; LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

      SoftwareSerial SIM900A(7,8); void setup()


      lcd.begin(16, 2); SIM900A.begin(9600);


      Serial.println ("SIM900A Ready"); pinMode(13, OUTPUT); //Active buzzer pinMode(A0, INPUT); //Gas sensor pinMode(10, OUTPUT); //Solenoid valve delay(100);


      void loop()


      Serial.println(analogRead(A0)); lcd.setCursor(2s, 0); lcd.print("The amount of gas:"); lcd.setCursor(6, 1); lcd.print(analogRead(A0));

      if (analogRead(A0)>210)


      digitalWrite(13, HIGH); digitalWrite(10, HIGH); SendMessage();


      else {

      digitalWrite(13, LOW); digitalWrite(10, LOW); }

      delay(2000); }

      void SendMessage()


      leakages either by calling or sending a short message service (SMS) and closes the gas supply system or pipe. The proposed smart system can be mounted in living houses, in industrial sectors, in restaurants or in any place where is being consumed a natural gas.


  1. A.D.Rodic. Automation and control – Theory and Practice. Vukovar: In-Tech, 2009.

  2. Brian Evans. Beginning Arduino Programming Nýu Ýork: Springer Science, 2011.

  3. Don Wilcher. Learn electronics with Arduino. Apress, 2012.

  4. John Boxall. Arduino Workshop. San-Fransisko: No Starch Press, 2013.

  5. Hardik Tanti, Pratik Kasodariya, Shikha Patel, Dhaval H. Rangrej. Smart parking system based on IOT. // International Journal of Engineering Research & Technology (IJERT). Vol. 9 Issue 05, May- 2020.

  6. Lalit Mohan Satapathy, Samir Kumar Bastia, Nihar Mohanty. Arduino based home automation using Internet of things (IoT). // International Journal of Pure and Applied Mathematics. Volume 118, No. 17, 2018.

  7. S.Suresh, J.Bhavya, S.Sakshi, K.Varun and G.Debarshi. Home monitoring and security system, 2016. International Conference on ICT in Business Industry and Government (ICTBIG), Indore, 2016, pp. 1-5.

  8. Surinder Kaur, Rashmi Singh, Neha Khairwal, Pratyk Jain. Home automation and security system. // ACII, Vol.3, 2016.

  9. V. Sudharani, D. Siva, M. Vijaya Raju. Smart Home Automation System using Arduino and IOT. // International Journal of Science and Research (IJSR). ISSN: 2319-7064, 2016.

  10. Vinay Sagar K N, Kusuma S M. Home automation using Internet Of Things IRJET Vol. 2, Issue no.3, 2015.

Serial.println ("Sending Message"); SIM900A.println("AT+CMGF=1");


Serial.println ("Set SMS Number");

Leave a Reply