Formaldehyde is a colorless gas with a pungent odor. It is also a potential carcinogen that is harmful to human health. Many diseases are related to formaldehyde, such as asthma and leukemia. When the formaldehyde concentration reaches 0.06-0.07 mg/m3 per cubic meter of air, children will have mild asthma. When the formaldehyde content in indoor air is 0.1 mg/m3, there will be odor and discomfort. When it reaches 0.5 mg/m3, it can irritate the eyes and cause tears. Its harm to human health cannot be ignored. The single-chip microcomputer has outstanding advantages such as strong versatility, small size, low price, stability and reliability. It has been widely used in smart products, measurement and control systems and other fields. The tester designed in this paper can directly display the formaldehyde concentration value on site. When its concentration value is less than the standard value specified by the state (which can be modified by pressing the button), the green light is on and you can move in. When it exceeds the specified indoor living standard value, the red light starts to alarm and remind people not to move in temporarily.
1 Hardware Introduction
The indoor formaldehyde tester based on single-chip microcomputer consists of single-chip microcomputer system, display circuit, function keyboard, formaldehyde sensor, measurement circuit and 3.5-bit double integral A/D converter, alarm output circuit. The system structure is shown in Figure 1:
1.1 Measurement Circuit
The measurement circuit consists of a CH20/S-10 formaldehyde sensor, an I/U (current/voltage) converter RCV420 chip, a 5G14433A/D converter, etc., as shown in Figure 2.
The formaldehyde sensor consists of a formaldehyde probe and a CH20 sensor. When the air is absorbed by the internal sampling system, the generated current signal is connected to generate a current proportional to the formaldehyde concentration. The current is conditioned by the 4~20MA formaldehyde module and converted into a 0~5V voltage by the I/U converter RCV420 chip. The voltage is connected to the 8051 microcontroller through the 5G14433A/D converter, and the formaldehyde concentration value is displayed on the display. When it exceeds the national standard, an alarm is issued. The relevant parameters of CH20/S-10 are as follows: electrochemical working principle; range: 0-10PPM; maximum overload concentration: 50PPM; minimum resolution: ±0.05PPM; working life: 3 years; sensitivity: 1200±300nA/ppm, 4~20MA formaldehyde module; working temperature: -20~45, response time (T90): <50s.
The RCV420 precision I/U converter produced by Burr-Brown can convert 4~20mA loop current into 0~5V voltage output. As a monolithic integrated circuit, it has reliable performance and very low cost. In addition to the precision op amp and resistor network, it also integrates a 10V reference voltage source. Without the need for external adjustment, a common mode rejection ratio of 86dB and a common mode voltage input of 40V can be obtained. The input impedance has only a 1.5V voltage drop within the full range, and it has a good conversion capability for the loop current. The chip pin distribution and internal structure are shown in Figures 2 and 3.
During use, pins 10, 11 and 12 are connected, pins 2, 5 and 13 are connected to ground, and pins 14 and 15 are connected as the output end of the 0~5V voltage signal. When the gain needs to be adjusted, a potentiometer is connected between pins 14 and 15 to adjust the gain, but this will reduce the common-mode rejection ratio. The reduction is that the gain increases by 1%, and the common-mode rejection ratio will be reduced by 6dB. Therefore, when using it, we usually short-circuit pins 14 and 15 directly, leave pins 7 and 8 floating, connect a 1μF capacitor to ground on pins 4 and 16 respectively, and connect the input current signal to the IN+ or IN- terminal. Generally, only one end is used. The specific end to be used depends on the polarity of the input signal and the polarity of the required output voltage. During use, we use the IN+ terminal.
[page]
1.2 5G14433 A/D converter
The 5G14433A/D converter is the most popular and typical domestically produced dual-integral 3.5-bit A/D converter. It has good anti-interference performance, high conversion accuracy (equivalent to 11-bit binary numbers), automatic zero calibration, automatic polarity output, automatic range control signal output, dynamic word scanning BCD code output, single reference voltage, few external components, and low price. However, its conversion speed is slow, about 1 to 10 times/second in situations where high-speed conversion is not required. The pin parameters of the 5G14433 chip and its connection with the microcontroller are as follows:
VAG: The ground terminal (analog ground) of the measured voltage VX and the reference voltage VR.
VR: external input reference voltage (+2V or +200mv)
VX: Measured voltage input terminal.
R1, R1/C1, C1: External integration resistor and integration capacitor C1 component terminals, typical values of external components:
When the range is 2V, C1=0.1μF, R1=470KΩ;
When the range is 200mV, C1=0.1μF, R1=27KΩ
C01, C02: External offset compensation capacitor C0 terminal, the typical value of C0 is 0.1μF.
DU: The input terminal for updating the output A/D conversion data result. When DU is connected to EOC, each A/D conversion result is updated.
CLKI and CLKO: The external resistor Rc of the clock oscillator. The typical value of Rc is 470kΩ, and the frequency decreases as Rc increases.
VEE: Negative power supply terminal of the analog part, connected to -5V
VSS: Low level reference (digital ground) for all output terminals except CLKO. When VSS is connected to VAGR (analog ground and digital ground are connected), the output voltage is VAG~VDD (0~+5V). When VSS is connected to VEE (-5V), the output voltage amplitude is VEE~VDD (-5~+5V), with an amplitude of 10V. In application, VSS is generally connected to VAG, that is, the analog ground and the digital ground are connected.
EOC: Conversion cycle end mark output. Whenever an A/D conversion cycle ends, the EOC terminal outputs a positive pulse with a width of half the clock cycle, and is connected to the P3.2 pin of the microcontroller together with DU.
DS1~DS4: Multiplex pulse output terminals, connected to the P1.4~P1.7 pins of the chip computer respectively. DS1 corresponds to the thousands place, and DS4 corresponds to the ones place.
Q0~Q3: BCD code data output lines, connected to the P1.0~P1.3 pins of the microcontroller respectively. Q0 is the lowest bit and Q3 is the highest bit. When DS2, DS3 and DS4 are selected, three complete BCD codes are output.
1.3 Function Keyboard
The keyboard is set as a 3*3 array keyboard, with function selection keys, alarm confirmation keys, enter (value confirmation) keys, value keys, keys, etc.
1.4 CD display unit
The CD display unit uses an OCM 4×16 character dot matrix LCD display module assembly, which mainly consists of an LCD display, a controller, a driver and a bias generating circuit. It is used to display the current measured temperature value, current output value, temperature alarm setting value, P setting value, TI setting value, TD setting value, deviation, alarm status and other information.
2 Software Design
The software adopts modular design. The whole software consists of main program, keyboard processing subroutine, data acquisition subroutine and alarm program. The main program is the core of control and management. After the system is powered on, it performs initialization and interrupt processing operations. Initialization mainly completes the setting and initial inspection of the alarm value, and disconnects the power supply of each electrical appliance. After the initialization is completed, the system starts to operate normally. Perform operations such as formaldehyde concentration detection and alarm. The flow chart of the main program is shown in Figure 3.
In order to improve the measurement accuracy, this paper adopts the median filter method, which is to sample the parameters N times (usually N is an odd number), and then sort the N sampling values from large to small or from small to large in ascending or descending order, and then take the middle value as the current sampling value. Median filtering is more effective in removing fluctuations caused by accidental factors or errors caused by unstable sampling. As long as one of the N samplings is correct, the accuracy can be improved.
3 Conclusion
This paper makes a comprehensive description and analysis of the indoor formaldehyde concentration measurement using a single chip microcomputer. The formaldehyde concentration measurement system implemented in this paper has relatively comprehensive functions. The measurement system is easy to operate, cost-effective, reliable, and has high measurement accuracy. The system can also be appropriately modified according to specific needs.
Previous article:Using AT89C52 MCU as a multi-function peripheral device
Next article:Introduction to Keil C51 MCU Development Experience
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- TI Industrial Month Reading Check-in Plan Three lucky draw opportunities are waiting for you~
- There is a section of LCD code in the atomic stm32f1 tutorial that is not clear, please help me take a look
- Please recommend a 3.3V output chip
- Peking University Embedded Development Lecture Notes [Download]
- What is the function of SCR1 thyristor in this circuit?
- The Complete Manual of Global Positioning System (GPS)!!!
- COCOFLY Tutorial - Crazy Shell Drone Series Quick Start [4] Flight Control Firmware Burning
- What are the proximity magnetic induction switch sensors?
- MSP430F5529 ADC12_A initialization reference
- How to measure code execution time on ARM Cortex-M MCUs?