Design of Combustible Gas Automatic Detection and Alarm System

With the social development, gas has been widely applied to various aspects of social life. However, the combustible gas has brought us great convenience, but also there is a considerable risk. Based on this, we designed a kind of "prevention" as the characteristics of the combustible gas automatic detection and alarm systems. The system is the choice of technology is mature and low-cost entry-level 52 series microcontroller as the control center, the whole system is divided into classification sensor detection, alarm distinguishes between sound and light alarm, force control bodies of three parts. The system will detect concentrations of flammable gases, scientific classification, for different grades of police intelligence, the appropriate device driver to send a loud sound and light alarm signal. When you reach the highest level but no one to lift the danger, the system will automatically cut off the gas supply to open the ventilation exhaust and other devices to prevent the occurrence of major accidents, to achieve "prevention first, combining prevention and control" of the human and automatic alarm control system. The automatic alarm control system available in the field of gas alarm has been widely used, it has certain extensibility, compatibility, and stability.


Introduction
With the improvement of people's living standards, most families have adopted gas life, and more and more people have higher requirements for the safety and comfort of living space. However, flammable gas brings excellent convenience to us, but there are also great hidden dangers. When combustible gas leakage reaches the explosion limit, once there is a fire source, it will cause combustion, explosion, and other accidents, causing severe economic losses, endangering people's life safety [1]. Therefore, it has become a significant subject to study the detection method of combustible gas, the humanized alarm method, and the simple control method [2].
Combustible gas alarm device on the market at present USES the standard way of alarm, alarm no characteristic, no principle, general industry tends to make people panic, primary industry is challenging to cause special attention, in this paper, the designed system can realize scientific classification alarm, according to different levels of industry, implementation of "prevention first and combining prevention and control of" humanized automatic alarm and control [3]. Let users do "primary risk is not panic; the high-level risk is prepared, emergency risk also has the greatest possible protection." [4] According to the data statistics, at present our country has many cities laid the gas pipeline, the use population approximately amounts to 200 million people [5], the gas production base and the transit station also amounts to several thousand. If the alarming rate of these household gas and gas bases and transfer stations is calculated at 10%, the demand for combustible gas detection alarms is more than 20 million. This number will continue to grow as the whole society attaches greater importance to fire and explosion prevention and personal safety [6]. It can be seen that this alarm system has a broad market. In addition, there are relatively few such products on the market. Besides, the alarm we designed has low cost and complete functions, which is expected to have a broad market space. When you reach the highest level but no one to lift the danger, the system will automatically cut off the gas supply to open the ventilation exhaust and other devices to prevent the occurrence of major accidents [7], to achieve "prevention first, combining prevention and control" of the human and automatic alarm control system. The automatic alarm control system available in the field of gas alarm has been widely used, it has certain extensibility, compatibility, and stability [8].

System Design
a) Basic requirements: it can realize real-time detection of the concentration of combustible gas in the surrounding environment, automatically conduct humanized alarm at three levels in case of danger, and force an automatic shutdown of the gas switch and opening of exhaust fan at the highest level. Gas and fan switches can be replaced by led emulation. b) Extension: it can be sent and received wirelessly at a long-distance or controlled by automatic SMS or phone call, to achieve a higher degree of humanized control. It can be used for product upgrades.

Design Ideas
The goal of this system design is to design a kind of alarm system for combustible gas detection, which is characterized by scientific classification and humanization. This system is an automatic detection and alarm system of combustible gas controlled by AT89S52 single-chip microcomputer, which is of mature technology and low cost [9].
When the gas sensor detects combustible gas, it can change the concentration of combustible gas into the change of the electrical signal, and conduct scientific classification. When the concentration reaches level 2 (close to the critical safety value), the system will issue a striking danger warning to remind the inspection of gas equipment and safety precautions; When the concentration reaches level 3 (the high danger value set), the system sends out sharp sound and light alarm signals to alert people! At this time, if there is no man to remove the danger, the system will automatically cut off the air source and open ventilation and exhaust devices to avoid the occurrence of major accidents, and realize the humanized automatic alarm and control system of "prevention first, prevention and control combined."

Program Demonstration and Comparison
One, the control part adopts a high-end ARM chips and FPGA chips as the main control chip, can quickly realize the function of high-speed real-time synchronization, but because at present the product market competitiveness will increase gradually, if in order to design simple and lost the most essential price advantage of the products, so our products will always stay in the lab [10]. Scheme 2, the control part of the use of cost-effective 89S52 single-chip microcomputer control, not only can achieve a stable system design but also can make the production cost control in a shallow range, so the use of scheme 2.

System Composition
The system is composed of the sensor detection circuit, A/D conversion circuit, single-chip microcomputer and sound, and light alarm. The leakage gas concentration detection circuit is converted to electrical signals, according to leaked gas concentration and the corresponding relation between the voltage signal, on the analog signal processing, and through the A/D conversion into digital signal input microcontroller, finally by the design of the microcontroller based on the program to drive signal indication light and buzzer alarm process. When the leakage gas concentration reaches a specific value, the ventilation and ventilation equipment can be started to exhaust, and the gas tube can be closed by the solenoid valve. When the gas concentration falls to a safe point, the ventilation and ventilation equipment can be closed, stop the alarm, and the gas pipeline can be opened to achieve the purpose of safety protection.

Partial Circuit of the Central Control Unit
The primary control unit circuit is shown in Figure 1, and the microprocessor adopts AT89S52. A/D conversion [11] chip adopts ADC0804, and the ADC0804 clock signal CLK is grounded by capacitor C1. The detected gas concentration signal, namely a voltage signal, is sent to the VIN at the analog input of ADC0804. Because the single-chip processor is 8-bit processor, when the input voltage is 5V, ADC0804 output value 255 (FFH), so the single-chip maximum numerical resolution is 0.0196v, the test of the voltage value of the general change in the voltage range of 0.02v. A 12-bit A/D converter should be used for higher accuracy, but for alarms this accuracy is entirely satisfactory [12]. According to the measured voltage value is 0.01 ~ 0.02v higher than the standard value, which can be solved by correcting the reference voltage of ADC0804, because the system design directly USES the power supply of +5V as the reference voltage so that the voltage may have deviated. Besides, Software can also be programmed to correct measurements. ADC0804 for l MΩ dc input impedance, which can meet the needs of the general voltage test, additional testing by ADC0804 can directly work under 2 ~ 5 MHZ clock frequency, so that can save frequency divider [13].
AT89S52 microprocessor receives digital conversion quantity from ADC0804, and then according to the received voltage semaphore and pre-set different alarm level voltage quantity comparison, to determine whether to send the command alarm, alarm level alarm and make the corresponding alarm, exclude alarm, and other operations. Its high real-time performance can meet the design requirements of the system. CS and WR are low, ADC0804 will clear, and the system will reset. When WR goes from 0 to 1 and CS = 0, ADC0804 will start signal conversion, and INTR is set to high. 4) PIN4, PIN19 (CLKIN, CLKR): frequency input/output.
The frequency input can be connected to the signal frequency range of 100kHz to 800kHz of the processing unit. However, the maximum frequency output frequency cannot be higher than 640KHz. Generally, the external or internal frequency can be used to provide the frequency. When resistors and capacitors are added to the CLKR and CLKIN, the timing sequence required for ADC operation can be generated. 5) PIN5 (INTR): interrupt request. The conversion period is high, and when the conversion is complete, INTR becomes low to inform other processing units that the conversion has been completed and the digital data can be read.

Gas Detection Circuit Design
Gas detection principle diagram is shown in Figure 3 below, by the gas sensor MQ -2 and resistor R1 = 1 k Ω Ω, R3, R2 = 10 k = 1 k Ω bridge consists of a single-arm work. Output voltage is to bridge the open-circuit voltage at the output, when meeting R1R2 = R3R4 bridge in equilibrium, the output voltage is equal to zero, when met combustible gas sensor, gas sensor resistance will change (and increased with the concentration of combustible gas of gas sensor resistance becomes smaller), thus breaking the bridge balance, output voltage value of the corresponding output end, the combustible gas concentration change into the change of the voltage signal, to realize real-time sampling and monitoring of combustible gas concentration. The experimental side, in the absence of combustible gas or flammable gas is shallow, the MQ output resistance of 20 k Ω -2, when the concentration of combustible gas is larger output resistance is 0.1 Ω, close to 0 Ω. Thus, the output voltage of this voltage is 0 ~ 4.76v, which fully meets the input requirements (0 ~ 5V) of the chip ADC0804 belonging to the switching circuit. After debugging and verification, the output of this circuit is unaffected by external circuit, and its output voltage is generally proportional to the resistance of the combustible gas sensor. The linear relationship between the output voltage and the resistance of the combustible gas sensor is nonlinear because the current through the bridge arm is not constant. If a constant current source is used instead of a voltage source for power supply, the nonlinear error can be reduced by half, but compared with this system. The voltage source can meet the requirements. If a higher precision measurement is needed, a constant current source can be used for the power supply of the detection part.

Gas Sensor (Probe)
Choose the gas sensor model MQ-2. It is a catalytic combustion sensor. This kind of sensor is mainly used to detect combustible gas. When combustible mixed gas is diffused to the detection element, there is a layer of catalyst on the surface of the gas element. The catalyst quickly burns with combustible gas without flame and generates heat. The temperature makes the resistance of the induction resistance change. According to this characteristic, a gas detection circuit can be set up. The sensor can be used in gas leak detection devices in homes and factories, suitable for detection of liquefied gas, butane, propane, methane, alcohol, hydrogen, smoke, etc. Figure.4 shows the standard working conditions, environmental conditions and sensitivity characteristics of the MQ-2 gas sensor. Figure 5 shows the characteristic sensitivity curve of the MQ-2 gas-sensitive sensor. It can be seen from this Figure that the sensor has different resistance values for different types and concentrations of gases. Therefore, sensitivity adjustment is very important when using this type of gas-sensitive sensor.

Sound and Light Alarm Circuits
The sound and light alarm circuit is shown in Figure 4. The P2.0 pin of the single-chip microcomputer is designed to control the two-level alarm sound alarm buzzer. Due to the limited driving capacity of the general, I/O port, here we use the audion S8550 to drive the buzzer. P2.3 foot control first-level alarm LED, P2.4 control second-level alarm LED, P2.5 foot control third-level alarm LED. These MCU output control pins are set at low power and effective at ordinary times, because the MCU on the power reset when I/O output is high level, if set to high level effectual, when the system starts to work, will make the alarm control circuit into a short period of work, produce wrong alarm. Three levels of warning LED lights are selected in three different colors. When the concentration reaches or exceeds the first level, the software will P2.3 sets 0, the first-level blue LED alarm light is on; When the concentration reaches or exceeds the second-level alarm, the software will set P2.4 to 0, the second-level yellow alarm will be bright, and the P2.0 foot will be placed to 0, then the buzzer will emit a sharp buzzer alarm sound. Yellow light and buzzer constitute alarm part. When the concentration reaches the third level, set P2.5=0 and P2.0=0, and the three-level alarm light, red LED, will continue to alarm. Besides, P2.0 can be programmed to set 1 or 0 at different times when different levels of alarm are issued, so that the buzzer can emit different beeping sound relative to different levels of alarm, to inform people of different alarm levels. If you need a better alarm, you can replace a better alarm. Indicator light: LEDs shall be used and shall be color-coded. Red, blue, and yellow indicate alarm signals. All indicators should be clearly marked with functions. In normal ambient light, the indicator should be visible 3m in front of it. Also, it can be extended as needed to better alarm effect like the warning lights of police cars.

Exhaust System and Gas Shutdown System
The control circuit of the relay is shown in Figure 5. The circuit consists of a relay K1 and K2, exhaust fan, solenoid valve and so on. The P2.1 and P2.2 feet of single-chip microcomputers are respectively used to control, which are both effective at low level. When the concentration of the leakage gas reaches or exceeds the allowable value of the highest concentration set, P2.1 and P2.1 are set to 0 by software. At this time, the audion VT and VT are all conducted, and the relays K1 and K2 work. Their ordinarily open contact is closed, the exhaust fan works to change air, and the solenoid valve circuit is connected to close the gas pipeline. When the gas concentration drops to a specific value, P2.1 and P2.2 can also be set to 1 by software. At this time, the audion VT and VT are cut off, the relay K1 and K2 stop working, and the normally open contact is disconnected. Close exhaust fan and solenoid valve circuit, exhaust fan stopped working, gas pipeline open. Electromagnetic relay: the contact should adopt double contact structure. The triode of the drive circuit is PNP S8550 triode with a resistance of 1K. A diode must be connected in parallel at both ends of the relay to prevent the triode from being broken down by the directional voltage of the relay in case of power failure. Switch and critical requirements: the switch and key should be robust, durable and marked its function. Non-combustible and refractory materials (oxygen index ≥32) should be selected for the detector shell.

Scientific Classification, Software Design
The software design of this system is based on the C language, and according to the explosion limit of combustible gas to be detected, the software is scientifically classified, so as to realize the corresponding alarm of different levels. Due to gas concentration is not at the same time the corresponding gas detection circuit output voltage value is different (the experimental side gas concentration and gas detection circuit of the output voltage is proportional to the relationship), thus can set different levels of voltage, is to realize the scientific classification, according to different levels of control commands issued by the main control circuit to drive the corresponding alarm devices, and to distinguish the acousto-optic alarm, forced control. The flow chart of the main program of the system is shown in Figure 6 below. Start to let the gas sensor preheat for some time, the time can be adjusted according to the different gas sensor (probe preheat for about 5 minutes in this design), the delay is realized by timer and interrupt. A/D converter is used to read the conversion value and the preset voltage value for comparison. According to the pre-established relationship between concentration and voltage, the alarm point is found when the voltage value corresponding to concentration is different. According to the different combustible gas explosion lower limit is different, set the alarm when the corresponding to the different levels of the combustible gas density, if greater than or equal to the first level, buy P2.3 = 0, level alarm warning lights, if greater than or equal to 2, buy P2.3 = 0, P2.4 = 0, P2.0 = 0, one, the secondary alarm lights, buzzer sound alarm, if greater than or equal to the third level, buy P2.3 = 0, P2.4 = 0, P2.5 = 0, P2.0 = 0, one, two, three-alarm lights, buzzer alarm. After another ten seconds, if there is no standard treatment, P2.1=0 and P2.2=0 will be set. The two relays will work, and the fan and the electromagnetic switch will be turned on. To achieve the function of grading alarm.

Circuit Debugging
In the debugging process, two LEDs are used to represent the operation of the fan and the electromagnetic switch, and the combustible gas is taken from the combustible gas of the lighter.
Debugging steps: 1) Visual inspection before debugging: check the welding situation of the circuit according to the circuit diagram, find some errors, and check again after correcting them to ensure the regular connection of the circuit and the standard installation of components. 2) Program debugging: now the computer simulation software proteus with single-chip microcomputer simulation test, debugging after meeting the design requirements. 3) Power on observation: the indicator light of normal circuit working is on. The work is initially standard, with no abnormal phenomenon. 4) Simulation debugging (gas detection is not included): sliding rheostat and a 1K resistor are connected in series at both ends of the 5V power supply. The voltage of 0 ~ 4.73v is generated by adjusting the sliding rheostat to simulate the ground voltage of the gas detection circuit. It is found that the function of the circuit is somewhat different from the design. After inspection, it was found that it was a programming problem. Some loops and jump statements were not designed very well, which made the effect in the simulation software slightly different from the actual circuit. Through several debugging programs and power simulations, the problem was finally solved, and the design goal was achieved. 5) Whole machine debugging: based on step 3, take the input voltage simulation part of the sliding rheostat, connect the gas detection circuit, and then conduct the whole machine debugging. Combustible gas from the lighter found an excellent effect. The whole machine meets the design requirements.

Advanced Function Extension
In real life, many householders are away from home most of the time, especially office workers in cities, who have to go to work most of the time and their children have to go to school. As a result, when no one is at the scene of a combustible gas leak, it poses a more significant security threat. Therefore, the extended function is to inform the homeowners or managers out of the house through the control system when the concentration of combustible gas reaches the first level of alarm, so that they can be informed of the danger in advance, to be dealt with timely. Avoid major accidents! This system is mainly composed of remote wireless transmission and reception. The wireless sending part is installed in the gas detection site, and the receiving part is carried by the householder. This advanced feature extension is still being tested.
The block diagram of the system is roughly as follows:

Conclusion
There is a long-distance between theoretical learning in class and practical product design and operation. Most of the examples in the book are circuit design under ideal circumstances. The primary purpose is to explain the knowledge point. However, in the actual design must consider many interference factors, must adopt the corresponding overcome method. This innovative activity made us deeply realize the importance of learning self-directed learning (that is, learning ability), learning to find problems, and learning to solve problems.