Share this

Development of a Multi-parameter Gas Detector Based on AT89S51

2026-04-06 08:16:09 · · #1
Abstract: This paper introduces the design and implementation method of a multi-parameter gas detector based on the AT89S51 microcontroller. Utilizing electrochemical and infrared gas sensors, it can simultaneously detect the concentrations of five gases in the air: oxygen, carbon monoxide, carbon dioxide, hydrogen sulfide, and methane. It features over-limit alarms, display, and printing functions, and can be widely applied in environmental monitoring, disease prevention and control, occupational safety, flammable and explosive materials monitoring, and safe production, demonstrating significant application value. Keywords: gas detector, gas sensor, hardware design, software design Abstract: This paper introduces the design method for a multi-parameter gas detector based on the AT89S51 microcontroller. Using a gas sensor, it can simultaneously measure the strength of five kinds of gases, including O2, CO, CO2, H2S, and CH4. It also has alarm, display, and print functions, making it suitable for environmental monitoring, hygiene and epidemic prevention, labor protection, detection of combustibles and explosives, and ensuring safe production. It has significant practical value. Key words: gas detector, gas sensor, hardware design, software design 0 Introduction The concentrations of oxygen, carbon dioxide, carbon monoxide, hydrogen sulfide, and methane in the underground working environment directly affect the safe production of coal mines and the lives of miners. Simultaneously, with the development and use of various natural gas, coal gasification, and liquefied petroleum gas, various flammable gases are released into workplaces and people's lives. Therefore, continuous and direct detection of toxic and flammable gases in the working and living environments is of paramount importance. Currently, most gas detection methods employ single-gas detection, meaning that a separate measuring instrument is required for each gas being measured. The development trend of gas detectors is to develop instruments capable of simultaneously detecting multiple different gases using a single instrument. This involves multi-parameter measurement, multi-gas detection, and the identification and concentration determination of various gas types, thereby providing a more comprehensive reflection of the characteristics of the measured gas in a specific environment. This paper introduces the design and implementation method of a multi-parameter gas detector based on the AT89S51 microcontroller. 1 Functions and Measurement Principles of the Multi-parameter Gas Detector 1.1 System Functions The system functions are shown in Figure 1. [align=center] Figure 1 System Functional Block Diagram[/align] As shown in Figure 1, the system consists of eight functional modules: an intake filtration system (including a sampling pump, filter membrane, gas chamber, and inlet/outlet pipelines), a sensor and signal processing unit (infrared sensor, electrochemical sensor), a main control circuit board (microprocessor, communication interface, data management, etc.), an LCD display, a human-machine interface unit (combination function keys, instruction light board), a power supply unit (DC regulated power supply, battery pack, voltage regulator circuit), and a clock input unit. 1.2 System Detection Principle The system detection principle is shown in Figure 2. [align=center] Figure 2 System Detection Principle Diagram[/align] Infrared gas sensors and electrochemical sensors detect five gases: oxygen, carbon monoxide, carbon dioxide, hydrogen sulfide, and methane, respectively. Carbon dioxide and methane are detected using infrared sensors, while oxygen, carbon monoxide, and hydrogen sulfide are detected using electrochemical sensors. The signals generated when the gas passes through the two types of sensors are amplified and converted from digital signals (A/D). The AT89S51 microprocessor then collects, calculates, and processes the data to generate concentration results. The microprocessor compares the data against limits. When the concentration of the gas exceeds the instrument's set alarm limit, the instrument generates an audible and visual alarm and displays the alarm status, fault status, time parameters, and other data information on the screen, while simultaneously saving the data results. In the air intake filtration system, at least one I/O port is required to control the sampling pump. In the sensor and signal processing unit, the gas concentration information generated by the sensor is converted into a digital signal that the microcontroller can recognize through the A/D conversion circuit, using an 8-channel ADC0809 chip. In the display module, a KS0713 LCD is used, requiring the microcontroller to provide three I/O control ports. The clock display system uses a DS12887 chip to communicate with the microcontroller, requiring one interrupt input and one I/O control port. Since the system needs to store at least 500 sets of test information, and the AT89S51 microcontroller only has 128KB of RAM, we expand with an 8KB external data memory 6264. Since the system can set alarm limits and change the time, five keyboard interfaces are needed to control setting, rising, falling, right shifting, and printing, requiring five I/O interfaces. Due to the limited interfaces of the AT89S51 microcontroller, the 8255A is used to expand the I/O interfaces. 2 Hardware Circuit Design The hardware circuit mainly includes: sensor and signal processing section, A/D conversion section, clock calibration input section, I/O expansion (keyboard input, micro printout), LCD display system, audible and visual alarm system, and suction pump control. 2.1 Sensor Sampling Circuit Design This paper introduces the sampling circuit design of an electrochemical sensor for measuring CO. The CO sensor is a 7E/F three-electrode electrochemical sensor manufactured by Beijing Kangpai Science and Trade Development Co., Ltd. This type of sensor has a wide linear range, stable linearity, a rated output of 0.1uA/ppm, a minimum resolution of 0.5ppm, and a minimum and maximum measurement range of 0-20ppm and 0-1000ppm, respectively. The CO measurement range is 0-150 mg/m³. The maximum CO measurement range converted to ppm is: Ymax = 150/1.25 = 120 (ppm). Converting this to the maximum current output by the sensor is: Imax = 0.1 * 120 = 12 (µA). The output current resolution is: Ii = 0.1 * 0.5 = 0.05 (µA). Therefore, the detection accuracy is: ε = 0.5ppm/120ppm * 100% = 0.42%. 2.2 A/D and Clock Circuit Design: The ADC0809 is used as the A/D converter chip. The system needs to detect and record the gas quality of the environment. The concentration of various gases in the recorded information is crucial. While recording data, it is necessary to save relevant time information so that users can analyze the data and take appropriate countermeasures. A DS12887 is added to provide a time reference for the system. 2.3 Display Circuit Design and I/O Expansion: The system uses a KS0713 LCD display. The KS0713 LCD module has 24 instruction control words. By writing different control words, the initial conditions and various operating conditions of the LCD can be set to realize the operating status and mode of the LCD. The I/O expansion uses the 8255A chip. The keyboard and mini printer are connected using the 8255A I/O expansion chip. The 8255A is set to operating mode 0, with the five keyboard inputs connected to PA0-PA4 as input ports; the printer's data port is connected to the PB port of the 8255A as an output port. The printer's status signal is input to PC0; when the printer is busy, BUSY=1. The printer's data input uses gating control, connecting PC4 to the printer's STB terminal; data is input when STB has a negative transition. The 2.4 drive circuit design uses NPN transistors for driving; when the port voltage is high, the load voltage can reach its maximum. The air pump used in the system has excellent performance; it can operate reliably with only +5V DC. For an LED requiring 10-20mA of current, its junction voltage drop and emitter voltage drop are both 0.7V. Therefore, the voltage divider resistor should have a voltage of 3.6V, resulting in a resistance value of approximately 180-360 ohms. This design uses a 310-ohm resistor as the voltage divider resistor. 3. System Software Design The system software is developed in a modular manner. The main program flowchart is shown in Figure 3. [align=center] Figure 3 Main Program Flowchart[/align] The keyboard scanning subroutine flowchart is shown in Figure 4. [align=center]Figure 4 Keyboard Scanning Subroutine Flowchart[/align] After the AT89S51 is reset, it runs its internal program, selects the analog channel for the first gas, and starts the A/D conversion. The conversion result is sent to the microcontroller. The conversion of the other four gases is started sequentially in the same way. Since each conversion requires at least 100µs of conversion time, the conversion data of the previous gas is compared with the over-limit value set in the program during the conversion of the next gas. If it exceeds the limit, an audible and visual alarm is triggered; if it is within the limit, the system waits for the next set of measurement results. After the last set of data conversion is completed, the gas concentration information on the display is updated, and then the five sets of measurement data, along with their gas type and time information, are written to the external data memory. 4. Conclusion The development of the multi-parameter gas detector solves the current problem that only single gases can be detected in China, with a detection accuracy of less than ±5% (full scale). The software design incorporates self-testing and digital filtering programs, further optimizing the detection data and enhancing the detector's anti-interference capabilities. It is lightweight, easy to maintain, repair, and carry, and can also be used for online fixed-point sampling and monitoring of gas concentration. The innovation of this paper lies in its use of an electrochemical principle and a multi-parameter selection and combination method to simultaneously detect the concentrations of oxygen, carbon dioxide, carbon monoxide, hydrogen sulfide, and combustible gases, overcoming the current limitation of detecting only a single gas. Depending on different industry requirements and monitoring points, different sensors can be used to monitor different types of gases with varying detection parameters, and different monitoring concentrations and resolutions can be set for different gases. References [1] Lin Xiumin, Chen Jie. GM-1 intelligent multi-parameter gas detector [J]. Jiangxi Coal Science and Technology, No. 1, 1999. [2] Pan Xiaoqing, Liu Qingcheng. Gas sensor and its development [J]. Journal of East China University of Technology, Vol 27 No.1. [3] FJF01 gas quality detector instruction manual. Chemical Defense Research Institute, 2005. [4] Sha Zhanyou. Intelligent sensor system design and application [M]. Beijing: Electronic Industry Press, 2004. [5] Liu Changchun, Cui Dafu. Electrochemical sensor and its application in chip laboratory [J]. Sensor Technology, 2003, (7). [6] Li Yuehong. Application of infrared remote control technology in single-chip microcomputer system [J]. Journal of Jiangsu Technical Teachers College, 2005, (2). [7] Gao Haisheng. Complete guide to single-chip microcomputer application technology [M]. Xi'an: Southwest Jiaotong University Press, 1996. [8] He Liming. Design of Single-Chip Microcomputer Application Systems [M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 1996. [9] Zhang Jing, Lu Yanhe, Zhao Xuebin. Application of TGS2600 Air Sensor in Air Quality Monitoring [J]. Microcomputer Information, 2006, 7-1: 201-203.
Read next

CATDOLL 130CM Kiki

Height: 130cm Weight: 27kg Shoulder Width: 31cm Bust/Waist/Hip: 64/60/72cm Oral Depth: 3-5cm Vaginal Depth: 3-15cm Anal...

Articles 2026-02-22