Smart Alarm System for Gas Leakages

– 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 place where may occur a gas leakage.


I. INTRODUCTION
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 30 th 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.
II. SMART SYSTEMS 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; ii. 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; iii. Loads, actuators or outputs which are activated or deactivated in regards with the command received from the microcontroller.
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.

III. COMPONENTS OF THE ALARM SYSTEM
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.

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

C. 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: AT+CMGF=1\r -sending SMS to a number: AT+CMGS=PHONE_NUMBER -reading the n th 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. Moreover, the sendSMS() function was create to send the SMS. This function uses the above-mentioned AT commands.

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

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

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

G. 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. (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: Figure 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) SIM900A.println("AT+CMGS=\"+99361138453\"\r"); delay(1000); Serial.println ("Set SMS Content"); SIM900A.println("ALARM!!! GAS LEAKAGE!"); //This is messsage content delay(100); Serial.println ("Finish"); SIM900A.println((char)26); delay(1000); Serial.println ("Message has been sent -> Bayram"); } V. CONCLUSION 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 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.