Research on Indoor Multifunctional Detector Based on Microcontroller
2026-04-06 05:59:20··#1
Abstract: This design enables the detection and display of indoor temperature and humidity, and provides alarms for excessive levels of CO and methane. A digital temperature and humidity sensor LTM-8901 is selected for measuring indoor temperature and humidity, and a semiconductor gas sensor SB-500 is used for measuring CO and methane. The power supply requirements of the SB-500 are met by setting the internal timer parameters of the microcontroller, programming, and using a reasonable drive circuit. A microcontroller controls an analog switch to achieve alternating measurement and alarm for CO and methane. The paper also describes a method for formaldehyde measurement. Keywords: Indoor temperature and humidity, digital display, safety alarm Abstract: This design realizes indoor examination and demonstration, and will issue an alarm if the content of CO and CH4 exceeds the allowable limit. The design uses a digital temperature and humidity sensor LTM-8901 to measure indoor temperature and humidity, and a semiconductor gas sensor SB-500 to measure the content of CO and CH4. Power is supplied to the SB-500 by setting the internal parameters of a Monolithic Processor, programming, and a proper driving electric circuit. The design uses a Monolithic Processor to control an analog switch to measure CO and CH4 alternately and issue an alarm. This thesis also describes the method for measuring formaldehyde. Key words: indoor temperature, temperature and humidity, digital demonstration, safety, alarm 0 Introduction: With the improvement of people's living standards and the increasing expansion of fully furnished residences, the control of indoor environmental quality has attracted widespread attention from all sectors of society. At the same time, people also need safe and comfortable homes. Currently, there are indoor environmental testing instruments on the market, but they suffer from drawbacks such as large size, high price, and limited functionality. Market research indicates a strong need for home-use indoor safety, temperature, humidity, and formaldehyde testing instruments. This paper designs a multi-functional portable testing instrument for home use that integrates environmental pollution (formaldehyde), safety, temperature, and humidity measurements. Urban residents primarily use liquefied petroleum gas (LPG), coal gas, and natural gas. LPG's main component is propane, coal gas's main components are CO and H2, and natural gas's main component is methane. This design mainly includes two functions: first, air quality testing, including temperature, humidity, and formaldehyde detection; second, indoor safety measurement, including CO and methane. 1 Overall Structural Design The overall structural diagram is shown in Figure 1: [align=center] Figure 1[/align] This instrument uses a microcontroller as its core, employing the inexpensive 8031 microcontroller, which has functions for measuring and alarming CO and methane concentrations; measuring and displaying temperature, humidity, and formaldehyde content; and features manual automatic reset, automatic power-on reset, and a hardware watchdog circuit. The microcontroller is connected to an external 8255A parallel interface chip, which is connected to the keyboard, display, and formaldehyde measurement circuit. Alarm values for indoor methane and CO can be set via the keyboard. Temperature and humidity measurement uses an LTM-8901 digital temperature and humidity sensor, with a 4.5-digit LCD display showing temperature, humidity, and formaldehyde values. The outputs of the CO and methane measurement circuits are connected to the microcontroller's external interrupts INT0 and INT1, respectively, enabling real-time monitoring of CO and methane. Additionally, a data memory and an ultraviolet-erasable EPROM memory are included. 2. Temperature and Humidity Module Design The temperature and humidity sensor uses the LTM-8901, a new digital temperature and humidity sensor suitable for indoor temperature and humidity measurement. It requires no A/D conversion and can be directly connected to the microcontroller, resulting in a low system failure rate and easy maintenance. In humidity measurement, it is a fusion of a traditional humidity-sensitive element and a humidity transmitter, possessing strong anti-static, anti-interference, and reverse connection protection capabilities, as well as strong condensation recovery capabilities and a certain degree of resistance to corrosive gases. The LTM-8901 features built-in filtering and protection circuits, extremely low power consumption, and temperature compensation calibrated during production testing. This intelligent correction method enables accurate measurement of temperature and humidity across the entire range. As shown in Figure 1, the digital sensor LTM8901 is connected to the parallel I/O terminal of the microcontroller via an optocoupler 4N35 and a drive circuit to achieve input-output isolation and improve the system's anti-interference capability. The speed of the optocoupler 4N35 is basically sufficient for the LTM8901; if a DS18BO2 is selected, a faster optocoupler should be used. 3. CO and Methane Measurement Module The SB-500 semiconductor gas sensor is used to measure CO and methane. When the SB-500 operates during high and low temperature cyclic changes, the sensor output signal is affected by temperature. At high temperatures, it senses methane gas, and at low temperatures, it senses CO gas. The voltage is 0.9V for 5 seconds at high temperatures and 0.2V for 15 seconds at low temperatures. Therefore, the operating voltage is a square wave with a high level of 0.9V and a low level of 0.2V, a duty cycle of 1:3, and a period of 20 seconds. The square wave is output from the parallel port of the microcontroller by setting the parameters of the internal timer T0, and then amplified by a 12V power supply amplifier circuit. The output of the semiconductor gas sensor SB-500 is connected to the external interrupt of the microcontroller. When the CO concentration exceeds the standard, the resistance of SB-500, which is heated by high and low levels, will decrease. After voltage division and adjustment of the voltage divider resistor, the external interrupt request level is reached to request an interrupt from the microcontroller. The interrupt handling program realizes the over-limit alarm. Since the resistance of SB-500 is different when heated by high and low levels, different voltage divider resistors are used to achieve the interrupt request level. Therefore, the microcontroller needs to control the electronic switch to automatically switch the CO and methane testing and alarm. As shown in Figure 2: [align=center] Figure 2[/align] 4. Formaldehyde Measurement Module Design Indoor formaldehyde pollution has a significant impact on human health. The methods specified in the standards are mostly chemical analysis methods, using laboratory analytical instruments, mainly colorimeters, spectrophotometers, chemical titration, gas chromatography, and liquid chromatography. However, these methods are difficult to implement in real-time on-site control, are labor-intensive and time-consuming, involve complex processes, and are mostly manual, resulting in high costs and low automation. With the continuous development of sensor and computer technology, portable formaldehyde testers based on electrochemistry are now available, and their testing range, resolution, accuracy, and stability are approaching standard requirements. Therefore, this design can use a formaldehyde sensor based on electrochemical principles. The principle is that formaldehyde in the air undergoes an oxidation reaction under electrodes, and the resulting diffusion electrode current is proportional to the formaldehyde concentration in the air. Through detection and amplification circuits and adjustments to the amplification factor, the signal is sent to a microcontroller after A/D conversion. The microcontroller automatically controls the detection and display of the formaldehyde concentration on-site. In actual production, considering the high cost of formaldehyde testing, the formaldehyde test can be made into a separate module, with an external plug installed at the instrument end for connection when needed. 5. Software Design The software adopts a modular design, written in a mixture of assembly language and C language. It includes a main program and interrupt programs, with initialization modules, data acquisition and processing modules, display modules, interrupt modules, and system testing and alarm modules. Initialization initializes external interfaces, timers, and other components; the data acquisition and processing module completes the measurement and analysis of temperature, humidity, and formaldehyde; the display module cyclically displays temperature, humidity, and formaldehyde content; the interrupt control module completes alarms for excessive CO and methane levels; the system testing module checks the normality of each system module, including the temperature and humidity module, and provides a self-diagnostic function to detect abnormal alarms. The flowchart is as follows: [align=center] Figure 3[/align] 6 Conclusion This instrument is a portable instrument suitable for home environmental measurement and safety alarms. With the decreasing price of formaldehyde sensors, the increasing prevalence of fully furnished homes, and the rising demands for quality of life, this multifunctional testing instrument will have a wider range of applications. The innovation of this paper lies in integrating indoor environment and safety alarm functions. Considering the high cost of formaldehyde, the formaldehyde test is made into an independent module. The instrument has an external connector for external connection when needed, or it can be used in conjunction with a portable formaldehyde tester on the market. References: Zhang Zhengyong et al. New Principles and Methods for Testing Semiconductor Oxide Gas Sensors, Sensor Technology, 2005.02, 106-110; Ma Tian. On-site Detection Technology of Formaldehyde Analyzer, China Testing Technology, 2005.9, 131-132; Liu Liang. Advanced Sensors and Applications, Chemical Industry Press, Beijing, 2005.6, 48-52; Sun Dengfeng et al.. Research on the Testing Performance of Rapid Formaldehyde Analyzer, China Testing Technology, 2006.11, 26-28; Li Hong, Wen Xiumei, Gao Zhentian. Small Temperature Measurement System Based on MSP430 Microcontroller and DS18B20, Microcomputer Information, 2006.7-2, 137-138.