Design of Gas Monitoring Terminal Based on Quadrotor UAV

The problem of air pollution is an increasingly serious worldwide. Therefore, in order to better monitor the gas components in the atmosphere, the design of a gas monitoring terminal based on a quadrotor UAV, including software and hardware design, is hereby carried out. Besides, a pump-suction series cavity is designed to reduce the influence of airflow disturbance on the UAV, which is verified to possess a certain anti-interference ability through Computational Fluid Dynamics(CFD) simulation experiments. In addition, a linear regression algorithm is used for sensor calibration and a polynomial piecewise regression method is used for temperature compensation. The experimental results show that the R2 of the model reaches 0.9981, the fitting degree is rather high, and the output is closer to the real gas concentration value after calibration. At the same time, the temperature compensation parameters are determined, which considerably improves the accuracy of the entire hardware terminal. Finally, the vehicle exhaust monitoring experiment is conducted, and the experimental results show that this scheme can successfully detect the exhaust position of the vehicle exhaust under the interference of the downwash flow of the UAV, thereby proving the reliability and accuracy of the monitoring terminal.


Introduction
The atmospheric environment is one of the most important components of the natural environment, it is also the foundation for all living things in the world [1]. With the continuous development of modern urbanization, the problem of air pollution is increasingly worsened worldwide, and air quality directly affects the physical and mental health of contemporary people [2]. Long-term exposure to severely polluted air increases the incidence of cardiovascular and respiratory diseases, also lung cancer. According to statistics, a total of 4.9 million people died directly or indirectly from air pollution in 2017 [3]. In the case of comprehensive monitoring of air pollutants, air quality monitoring sites or portable air quality monitoring instruments are frequently adopted by many countries. However, the construction of the former requires a lot of supporting facilities and financial backup, which is also exposed to problems including a long construction period, low coverage density, and poor flexibility, while the latter can only monitor air quality in a small area. A large monitoring range requires a lot of labor costs. Besides, the effect is rather limited in some special scenarios, such as toxic and harmful gas leakage, where emergency personnel cannot intervene [4].
In recent years, the design of monitoring terminals for the atmospheric environment has attracted extensive attention. Atmospheric environment monitoring is the basis of atmospheric environment management and protection. Only by comprehensively, accurately and specifically understanding the atmospheric environment can effective prevention and control measures be implemented [5]. From the current domestic and foreign environment, the wired environment monitoring technology is relatively mature, but its application is still exposed to obvious limitations, including the application scope [6][7][8], making it necessary

Hardware Solution Design
In this chapter, the software and hardware scheme is designed first, followed by the series cavity design and CFD simulation. Finally, the linear calibration method and the segmented temperature compensation method are proposed for the errors generated by the electrochemical sensor.
The hardware structure of the monitoring terminal consisting of a sampling unit and a detection unit is shown in Figure 1, the sampling unit, includes a micro brushless air pump, a gas sensing array, a particle sensor, and a temperature and humidity sensor. The process is that the air pump continuously pumps the outside air to the gas sensing array to generate a response signal, and meanwhile, the particle sensor detects PM 10 concentration in the air, while the temperature and humidity sensor detects the temperature and humidity of the location of the UAV in real-time. Besides, the detection unit contains a power battery, a core processor, a data storage module, and a communication interface, among which, the power battery is used for driving the entire system; the communication interface is used for external communication, and data storage is used for data storage. Furthermore, the core processor is used for driving each sensor to work normally, collect sensor data, then preprocess and store the sensor data. Finally, it is transmitted through the communication interface. and experimental verification. The electrochemical gas sensor is calibrated using the linear regression algorithm, while polynomial regression is used for temperature compensation. Additionally, the software design is completed, and a vehicle exhaust gas detection experiment is carried out to verify the feasibility of the system. The hardware scheme design in Section 2.1, includes sensor selection and hardware circuit design. In Section 2.2, an introduction to the design of the tandem cavity is carried out. The need for sensor calibration and temperature compensation methods is described in Section 2.3. Moreover, the design of the software scheme is carried out in Section 2.4. Next, the CFD simulation experiment is carried out in Section 3.1. The sensor calibration experiment is carried out in Section 3.2. Moreover, the segmented temperature compensation method experiment is carried out in Section 3.3. Finally, the vehicle exhaust gas detection experiment is carried out and the conclusion is drawn.

Hardware Solution Design
In this chapter, the software and hardware scheme is designed first, followed by the series cavity design and CFD simulation. Finally, the linear calibration method and the segmented temperature compensation method are proposed for the errors generated by the electrochemical sensor.
The hardware structure of the monitoring terminal consisting of a sampling unit and a detection unit is shown in Figure 1, the sampling unit, includes a micro brushless air pump, a gas sensing array, a particle sensor, and a temperature and humidity sensor. The process is that the air pump continuously pumps the outside air to the gas sensing array to generate a response signal, and meanwhile, the particle sensor detects PM10 concentration in the air, while the temperature and humidity sensor detects the temperature and humidity of the location of the UAV in real-time. Besides, the detection unit contains a power battery, a core processor, a data storage module, and a communication interface, among which, the power battery is used for driving the entire system; the communication interface is used for external communication, and data storage is used for data storage. Furthermore, the core processor is used for driving each sensor to work normally, collect sensor data, then preprocess and store the sensor data. Finally, it is transmitted through the communication interface.  The monitoring targets of the hereby designed monitoring terminal are various air pollution chemical components, inhalable particulate matter, and temperature and humidity. For this purpose, a sensor array composed of temperature and humidity sensors, electrochemical gas sensors, particulate matter sensors and CO 2 sensors is selected.
(i). Electrochemical gas sensors Electrochemical gas sensors are provided with the advantages of high selectivity, strong linearity and low power consumption [29], and common electrochemical sensors include the two-electrode type, three-electrode type, and four-electrode type. The twoelectrode type has a relatively simple structure and only connects to the working electrode and the counter electrode through a load resistance. In the case of a slightly higher measured gas concentration, the potential of the sensitive electrode will exceed its allowable range, so that the output is no longer linear. Besides, its upper limit of detection is low, so it is not selected. The three-electrode type introduces a reference electrode, which greatly improves the detection range, and its structure is shown in Figure 2. The four-electrode type adds an auxiliary electrode on the basis of the three-electrode type to improve the selectivity and eliminate the influence of temperature and humidity, but the cost is much higher and the basic driving circuit is more complicated, so it is not selected either. The monitoring targets of the hereby designed monitoring terminal are various air pollution chemical components, inhalable particulate matter, and temperature and humidity. For this purpose, a sensor array composed of temperature and humidity sensors, electrochemical gas sensors, particulate matter sensors and CO2 sensors is selected.
(i). Electrochemical gas sensors Electrochemical gas sensors are provided with the advantages of high selectivity, strong linearity and low power consumption [29], and common electrochemical sensors include the two-electrode type, three-electrode type, and four-electrode type. The twoelectrode type has a relatively simple structure and only connects to the working electrode and the counter electrode through a load resistance. In the case of a slightly higher measured gas concentration, the potential of the sensitive electrode will exceed its allowable range, so that the output is no longer linear. Besides, its upper limit of detection is low, so it is not selected. The three-electrode type introduces a reference electrode, which greatly improves the detection range, and its structure is shown in Figure 2. The four-electrode type adds an auxiliary electrode on the basis of the three-electrode type to improve the selectivity and eliminate the influence of temperature and humidity, but the cost is much higher and the basic driving circuit is more complicated, so it is not selected either. There are many types of three-electrode electrochemical sensors produced by Honeywell in the United States of uniform size, which is convenient for replacement while monitoring the target gas changes in the future. However, Honeywell does not produce ozone sensors of the same size. In this case, the three-electrode ozone electrochemical sensor produced by Shengmi Technology Company is selected. Some parameters of each sensor are shown in Table 1. For the detection of inhalable particles, the laser sensor based on the principle of light scattering is currently the most widely used. The light scattering particle sensor is produced using the Mie scattering theory. Scattering occurs when light is irradiated on suspended particles, and the mass and concentration will be calculated according to the scattering characteristics to achieve the conversion of optical signals to electrical signals, which possess the characteristics of simple structure, fast response speed and high There are many types of three-electrode electrochemical sensors produced by Honeywell in the United States of uniform size, which is convenient for replacement while monitoring the target gas changes in the future. However, Honeywell does not produce ozone sensors of the same size. In this case, the three-electrode ozone electrochemical sensor produced by Shengmi Technology Company is selected. Some parameters of each sensor are shown in Table 1. For the detection of inhalable particles, the laser sensor based on the principle of light scattering is currently the most widely used. The light scattering particle sensor is produced using the Mie scattering theory. Scattering occurs when light is irradiated on suspended particles, and the mass and concentration will be calculated according to the scattering characteristics to achieve the conversion of optical signals to electrical signals, which possess the characteristics of simple structure, fast response speed and high precision. The performance of various commercial particulate matter sensors is compared and analyzed, as shown in Table 2. At present, there are many kinds of CO 2 sensing technologies, such as non-dispersed infrared (Non-Dispersed Infrared Red, NDIR) technology, gas chromatography, electrochemical method, etc., among which, gas chromatography detects carbon dioxide after being completely separated from other components of air in the chromatographic column. However, the chromatographic analysis conditions often vary under different experimental conditions. Besides, standard gas needs to be configured during the measurement process, and pure nitrogen is generally used for the standard gas, which not only undergoes a cumbersome process but also requires a long operation period; the electrochemical method has high sensitivity, good accuracy, simple instrument but poor selectivity; NDIR technology possesses good selectivity and a fast response speed for CO 2 detection [30,31], and is mostly used in indoor environmental monitoring, industrial production emission monitoring and other scenarios [32,33]. Based on the above comparison, this article chooses NDIR technology and compares a variety of CO 2 sensors using this technology as shown in Table 3. S8-0053, SCD30 and DS-CO 2 -20 are all provided with high monitoring accuracy and fast response speed. However, given that the monitoring terminal needs to be mounted on the UAV to operate smoothly, the airflow interference generated by the UAV will lead to lower monitoring accuracy. T6615-5KF is an inhalation detection method, which is more capable of resisting the impact of air pressure changes, though with a relatively poor monitoring accuracy. In addition, it is also suitable for the airborne application of UAVs. In this case, T6615-5KF is finally selected.
(iv). Temperature and humidity sensor The hereby selected temperature and humidity sensor is SHT21 which uses the I2C communication mode, the temperature monitoring range is −40~125 • C; the temperature monitoring accuracy, 0.3 • C; the relative humidity monitoring range, 0~100%; the relative humidity monitoring accuracy, 2% and the response time, 2 s.

Hardware Circuit Design
The STM32F429VGT6 microprocessor launched by ST Company is hereby selected as the core processor of the main control unit. This processor is based on the ARM Cortex M4 Sensors 2022, 22, 5350 6 of 23 core, with fast data processing speed and large storage space and is, therefore, widely used in embedded devices [34]. It has eight channels of serial ports, four channels of SPI and three channels of I2C, rich I/O resources, and peripheral circuits including a reset circuit, a crystal oscillator circuit, a status indicator, and an RTC power supply.
The output of the three-electrode electrochemical sensor is a weak current signal with a classic conditioning circuit, and its structure is shown in Figure 3. A potentiostat circuit is formed by operational amplifiers U1, U2, and external reference sources V ce and V mid to meet the fixed bias voltage between the working electrode (WE) and the reference electrode (RE) of the three-electrode electrochemical sensor mentioned above, that is, the amplifier U2 and feedback resistor R f form an I/V conversion circuit. The formula for calculating the magnification can be expressed as: where I in denotes the current output by the working electrode (WE) terminal, and V out represents the output of the operational amplifier U2. The STM32F429VGT6 microprocessor launched by ST Company is hereby selected as the core processor of the main control unit. This processor is based on the ARM Cortex M4 core, with fast data processing speed and large storage space and is, therefore, widely used in embedded devices [34]. It has eight channels of serial ports, four channels of SPI and three channels of I2C, rich I/O resources, and peripheral circuits including a reset circuit, a crystal oscillator circuit, a status indicator, and an RTC power supply.
The output of the three-electrode electrochemical sensor is a weak current signal with a classic conditioning circuit, and its structure is shown in Figure 3. A potentiostat circuit is formed by operational amplifiers U1, U2, and external reference sources and to meet the fixed bias voltage between the working electrode (WE) and the reference electrode (RE) of the three-electrode electrochemical sensor mentioned above, that is, the amplifier U2 and feedback resistor form an I/V conversion circuit. The formula for calculating the magnification can be expressed as: where denotes the current output by the working electrode (WE) terminal, and represents the output of the operational amplifier U2. The classic conditioning circuit is needed to modify the feedback resistance and the reference source voltage and can drive different sensors normally. However, its adaptability is poor, the structure is complex, and it is difficult to stably maintain the constant potential of the sensor with specific bias requirements. Therefore, the LMP91000 electrochemical sensing front-end chip is hereby adopted as the processing core of the output signal of the electrochemical sensor. The working principle of the LMP91000 is shown in Figure 4.
According to Figure 4, the Vref voltage divider controls the potential of the "+" terminal of the TIA amplifier and the "+" terminal of the A1 amplifier by programming. According to the virtual short principle of the operational amplifier, a fixed bias voltage can be realized between WE and RE. In addition, the resistance values of the load resistance and feedback resistance are also selected by programming. For the WE electrode current outflow type sensor of the electrochemical sensor, the weak output current signal can output an mV level voltage signal after passing through the TIA amplifier. The conversion relationship is shown in Formula (2): For the WE electrode current inflow type sensor of the electrochemical sensor, the conversion relationship is shown in Formula (3): where is the potential of the "-" terminal of the transimpedance amplifier TIA; , the output voltage, and , the current signal output by the working electrode. The classic conditioning circuit is needed to modify the feedback resistance and the reference source voltage and can drive different sensors normally. However, its adaptability is poor, the structure is complex, and it is difficult to stably maintain the constant potential of the sensor with specific bias requirements. Therefore, the LMP91000 electrochemical sensing front-end chip is hereby adopted as the processing core of the output signal of the electrochemical sensor. The working principle of the LMP91000 is shown in Figure 4.
According to Figure 4, the Vref voltage divider controls the potential of the "+" terminal of the TIA amplifier and the "+" terminal of the A1 amplifier by programming. According to the virtual short principle of the operational amplifier, a fixed bias voltage can be realized between WE and RE. In addition, the resistance values of the load resistance and feedback resistance are also selected by programming. For the WE electrode current outflow type sensor of the electrochemical sensor, the weak output current signal can output an mV level voltage signal after passing through the TIA amplifier. The conversion relationship is shown in Formula (2): For the WE electrode current inflow type sensor of the electrochemical sensor, the conversion relationship is shown in Formula (3): where V TI A− is the potential of the "−" terminal of the transimpedance amplifier TIA; V out , the output voltage, and I in , the current signal output by the working electrode. The load resistance matters considerably in reducing the noise of the sensor output, but a high load will extend the response time and polarization time. Therefore, the selection of R load needs to achieve a good balance between low noise and response speed, generally within the range of 15~50 Ω.
The load resistance matters considerably in reducing the noise of the sensor output, but a high load will extend the response time and polarization time. Therefore, the selection of needs to achieve a good balance between low noise and response speed, generally within the range of 15~50 Ω. The circuit connection between the electrochemical sensor and the LMP91000 is shown in Figure 5, where UA1 is an electrochemical sensor, and UA2 is an LMP91000. The electrochemical sensor requires a long polarization time to maintain its stable working state after being powered on. In addition, in order to keep the electrochemical sensor in the "preparatory work" state when the circuit is disconnected, it is necessary to shortcircuit the working electrode and the reference electrode pin during the disconnection. More importantly, it is of great significance to disconnect the short circuit between the two pins in time when powering on. For the above reasons, a P-channel JFET (Q1) is thus introduced between the two electrodes. During the power-off period, the D-poles are turned on to achieve the short-circuiting effect, and they are disconnected immediately after power-on. The LMP91000 communicates with the STM32 microprocessor through the I2C protocol. Both SCL and SDA pins are connected to the same pair of I2C interfaces of the microprocessor. LMP91000 has a chip select pin MENB. By controlling the level of this pin The circuit connection between the electrochemical sensor and the LMP91000 is shown in Figure 5, where UA1 is an electrochemical sensor, and UA2 is an LMP91000. The electrochemical sensor requires a long polarization time to maintain its stable working state after being powered on. In addition, in order to keep the electrochemical sensor in the "preparatory work" state when the circuit is disconnected, it is necessary to short-circuit the working electrode and the reference electrode pin during the disconnection. More importantly, it is of great significance to disconnect the short circuit between the two pins in time when powering on. For the above reasons, a P-channel JFET (Q1) is thus introduced between the two electrodes. During the power-off period, the D-poles are turned on to achieve the short-circuiting effect, and they are disconnected immediately after power-on. The circuit connection between the electrochemical sensor and the LMP91000 shown in Figure 5, where UA1 is an electrochemical sensor, and UA2 is an LMP91000. T electrochemical sensor requires a long polarization time to maintain its stable work state after being powered on. In addition, in order to keep the electrochemical sensor the "preparatory work" state when the circuit is disconnected, it is necessary to sho circuit the working electrode and the reference electrode pin during the disconnecti More importantly, it is of great significance to disconnect the short circuit between two pins in time when powering on. For the above reasons, a P-channel JFET (Q1) is th introduced between the two electrodes. During the power-off period, the D-poles turned on to achieve the short-circuiting effect, and they are disconnected immediat after power-on. The LMP91000 communicates with the STM32 microprocessor through the I2C p tocol. Both SCL and SDA pins are connected to the same pair of I2C interfaces of the m croprocessor. LMP91000 has a chip select pin MENB. By controlling the level of this p The LMP91000 communicates with the STM32 microprocessor through the I2C protocol. Both SCL and SDA pins are connected to the same pair of I2C interfaces of the microprocessor. LMP91000 has a chip select pin MENB. By controlling the level of this pin to determine whether it is in the selected state, multiple LMP91000s are enabled to communicate with the microprocessor. The structure is shown in Figure 6. The LMP91000 electrochemical sensing front-end chip greatly reduces the complexity of circuit design. Furthermore, corresponding parameters can be configured according to the characteristics of different electrochemical sensors, which thereby improves adaptability.
to determine whether it is in the selected state, multiple LMP91000s are enabled to communicate with the microprocessor. The structure is shown in Figure 6. The LMP91000 electrochemical sensing front-end chip greatly reduces the complexity of circuit design. Furthermore, corresponding parameters can be configured according to the characteristics of different electrochemical sensors, which thereby improves adaptability. The filtering and signal acquisition circuit consists of voltage follower UA3, RC filtering and 24−bit high-precision A/D acquisition module AD7793, as shown in Figure 7, among which, AD7793 is a 24−bit three−channel low−noise differential analog input ADC produced by ADI, with a sampling rate of 4.17 Hz~470 Hz. It also integrates an on-chip low−noise instrument op amp programmed and controlled by SPI. The microprocessor can communicate data with multiple AD7793 through a chip select pin, and the electrochemical sensor is input to the voltage follower after signal processing. The voltage follower has the characteristics of high input impedance, low output impedance, and a gain of 1, which hardly interferes with the signal itself, and can effectively suppress the influence of the electrical characteristics between the front and rear stages.
The ADR441 reference source chip is used to provide the Vref+ of 2.5 V for AD7793 and LMP91000, and has the characteristics of high precision, low noise and low drift, and an output error of only ±3 mV. In addition, given that the output signal of the electrochemical sensor is weak and susceptible to interference, the digital−analog isolation modules ADuM1401 and ADuM1400 are used for isolating the SPI signal and the chip−select signal, respectively. The CO sensor is taken as an example for signal analysis according to the electrochemical sensors selected in Table 1, which has a measurement of 0-500 ppm, a sensitivity coefficient of 70 ± 15 nA/ppm, and a bias voltage of 0 mV. Assuming that the sensitivity is 70 nA/ppm, the maximum current output becomes 35 uA according to the range. At the same time, the Vref divider of LMP91000 is controlled to maintain the bias between the The filtering and signal acquisition circuit consists of voltage follower UA3, RC filtering and 24−bit high-precision A/D acquisition module AD7793, as shown in Figure 7, among which, AD7793 is a 24−bit three−channel low−noise differential analog input ADC produced by ADI, with a sampling rate of 4.17 Hz~470 Hz. It also integrates an on-chip low−noise instrument op amp programmed and controlled by SPI. The microprocessor can communicate data with multiple AD7793 through a chip select pin, and the electrochemical sensor is input to the voltage follower after signal processing. The voltage follower has the characteristics of high input impedance, low output impedance, and a gain of 1, which hardly interferes with the signal itself, and can effectively suppress the influence of the electrical characteristics between the front and rear stages. The filtering and signal acquisition circuit consists of voltage follower UA3, RC filtering and 24−bit high-precision A/D acquisition module AD7793, as shown in Figure 7, among which, AD7793 is a 24−bit three−channel low−noise differential analog input ADC produced by ADI, with a sampling rate of 4.17 Hz~470 Hz. It also integrates an on-chip low−noise instrument op amp programmed and controlled by SPI. The microprocessor can communicate data with multiple AD7793 through a chip select pin, and the electrochemical sensor is input to the voltage follower after signal processing. The voltage follower has the characteristics of high input impedance, low output impedance, and a gain of 1, which hardly interferes with the signal itself, and can effectively suppress the influence of the electrical characteristics between the front and rear stages.
The ADR441 reference source chip is used to provide the Vref+ of 2.5 V for AD7793 and LMP91000, and has the characteristics of high precision, low noise and low drift, and an output error of only ±3 mV. In addition, given that the output signal of the electrochemical sensor is weak and susceptible to interference, the digital−analog isolation modules ADuM1401 and ADuM1400 are used for isolating the SPI signal and the chip−select signal, respectively. The CO sensor is taken as an example for signal analysis according to the electrochemical sensors selected in Table 1, which has a measurement of 0-500 ppm, a sensitivity coefficient of 70 ± 15 nA/ppm, and a bias voltage of 0 mV. Assuming that the sensitivity is 70 nA/ppm, the maximum current output becomes 35 uA according to the range. At the same time, the Vref divider of LMP91000 is controlled to maintain the bias between the The ADR441 reference source chip is used to provide the Vref+ of 2.5 V for AD7793 and LMP91000, and has the characteristics of high precision, low noise and low drift, and an output error of only ±3 mV. In addition, given that the output signal of the electrochemical sensor is weak and susceptible to interference, the digital−analog isolation modules ADuM1401 and ADuM1400 are used for isolating the SPI signal and the chip−select signal, respectively.
The CO sensor is taken as an example for signal analysis according to the electrochemical sensors selected in Table 1, which has a measurement of 0-500 ppm, a sensitivity coefficient of 70 ± 15 nA/ppm, and a bias voltage of 0 mV. Assuming that the sensitivity is 70 nA/ppm, the maximum current output becomes 35 uA according to the range. At the same time, the Vref divider of LMP91000 is controlled to maintain the bias between the RE and WE at 0 mV. According to Formula (1), the larger the V TI A− is, the better the amplification effect becomes. Select 67% of the maximum reference source, and the amplified signal is required to be lower than 1675 mV, so the value of the signal is within the range of A/D. Therefore, R tia is configured accordingly to 35 kΩ. According to Formula (2), the value of the amplified A/D sampling signal is calculated as 450 mV.
As the core driver of the whole system, the power supply module supplies power to each module, and its stability and load capacity have a huge impact on the performance of the entire system. In order to ensure the power supply performance, the power supply module is designed as shown in Figure 8, which is powered by two 3.7 V lithium batteries in series. Since the working voltage of the dust sensor and other modules is 5 V, and the working voltage of the main control chip is 3.3 V, the SPX29300-3V3 and SPX29300-5V high-power linear voltage regulator chips are selected to provide stable voltages of 5 V and 3.3 V. The input pins of the two voltage regulator chips are connected to 330 uF electrolytic capacitors for energy storage and effectively reduce the power input ripple. Considering the poor characteristics of large capacitors in filtering high-frequency signals, a 0.1 uF filter is connected in parallel at the back end. The capacitor also constitutes a secondary filter, and the capacitor introduced at the output end of the voltage stabilizer can effectively suppress the ripple generated by the voltage conversion of the voltage stabilizer. The magnetic beads are connected to the circuit in series to isolate the 3.3 V digital signal power supply from the analog signal power supply. In order to protect the circuit safety, a one-time fuse F2, Schottky diode D7, and TVS tube D8 are added to the input end of the power supply to prevent circuit overcurrent, reverse connection and absorb surges. At the same time, a micro-USB power supply interface is designed to meet the requirements of electrochemical sensor laboratory testing and preheating before use. The power input is filtered by a capacitor to provide a stable voltage of 5 V and input to the LM1117S-3.3 linear voltage regulator module, so a stable voltage of 3.3 V is provided by the LM1117S-3.3, and the front and rear capacitors.
value of the amplified A/D sampling signal is calculated as 450 mV.
As the core driver of the whole system, the power supply module supplies power to each module, and its stability and load capacity have a huge impact on the performance of the entire system. In order to ensure the power supply performance, the power supply module is designed as shown in Figure 8, which is powered by two 3.7 V lithium batteries in series. Since the working voltage of the dust sensor and other modules is 5 V, and the working voltage of the main control chip is 3.3 V, the SPX29300-3V3 and SPX29300-5V high-power linear voltage regulator chips are selected to provide stable voltages of 5 V and 3.3 V. The input pins of the two voltage regulator chips are connected to 330 uF electrolytic capacitors for energy storage and effectively reduce the power input ripple. Considering the poor characteristics of large capacitors in filtering high-frequency signals, a 0.1 uF filter is connected in parallel at the back end. The capacitor also constitutes a secondary filter, and the capacitor introduced at the output end of the voltage stabilizer can effectively suppress the ripple generated by the voltage conversion of the voltage stabilizer. The magnetic beads are connected to the circuit in series to isolate the 3.3 V digital signal power supply from the analog signal power supply. In order to protect the circuit safety, a one-time fuse F2, Schottky diode D7, and TVS tube D8 are added to the input end of the power supply to prevent circuit overcurrent, reverse connection and absorb surges. At the same time, a micro-USB power supply interface is designed to meet the requirements of electrochemical sensor laboratory testing and preheating before use. The power input is filtered by a capacitor to provide a stable voltage of 5 V and input to the LM1117S-3.3 linear voltage regulator module, so a stable voltage of 3.3 V is provided by the LM1117S-3.3, and the front and rear capacitors. The rationality of the PCB layout, line width, component spacing, power supply and bottom line routing, are all the keys to the overall performance of the realization of the hardware circuit. The physical diagram of the PCB is shown in Figure 9. The rationality of the PCB layout, line width, component spacing, power supply and bottom line routing, are all the keys to the overall performance of the realization of the hardware circuit. The physical diagram of the PCB is shown in Figure 9.

Design and Simulation Analysis of Pump Suction Series Cavity
During the flight and hovering of the UAV, the air velocity and gas concentration distribution around the fuselage is affected by the downwash flow of the propeller, which leads to certain errors in the gas sensor [35]. In order to minimize the error and improve the data accuracy, the air pump is used to send the external gas into the cavity, and the gas response cavity is thereby designed.
According to the size of the electrochemical sensor mentioned above, two cavity structures are designed as shown in Figure 10. CFD is an emerging discipline that simulates and analyzes fluid mechanics using computer and numerical methods. The powerful computing power of CFD provides technical support for fluid mechanics. In this case, a CFD simulation is hereby used for simulating the distribution of the gas flow field and pressure field when the gas flows through the cavity, which can effectively evaluate the influence of different cavity structure designs on the response of the electrochemical sensors. Besides, it is also required to mesh the part of the cavity through which the gas flows after completing the 3D modeling of the cavity in CAD. In addition, after importing the divided model, it is rather essential to select the simulation material, fluid model, boundary conditions, air inlet and outlet and set the initial conditions of the airflow field. Finally, the numerical solution is completed by a discrete solver. (i). Fluid model selection

Design and Simulation Analysis of Pump Suction Series Cavity
During the flight and hovering of the UAV, the air velocity and gas concentration distribution around the fuselage is affected by the downwash flow of the propeller, which leads to certain errors in the gas sensor [35]. In order to minimize the error and improve the data accuracy, the air pump is used to send the external gas into the cavity, and the gas response cavity is thereby designed.
According to the size of the electrochemical sensor mentioned above, two cavity structures are designed as shown in Figure 10. CFD is an emerging discipline that simulates and analyzes fluid mechanics using computer and numerical methods. The powerful computing power of CFD provides technical support for fluid mechanics. In this case, a CFD simulation is hereby used for simulating the distribution of the gas flow field and pressure field when the gas flows through the cavity, which can effectively evaluate the influence of different cavity structure designs on the response of the electrochemical sensors. Besides, it is also required to mesh the part of the cavity through which the gas flows after completing the 3D modeling of the cavity in CAD. In addition, after importing the divided model, it is rather essential to select the simulation material, fluid model, boundary conditions, air inlet and outlet and set the initial conditions of the airflow field. Finally, the numerical solution is completed by a discrete solver.

Design and Simulation Analysis of Pump Suction Series Cavity
During the flight and hovering of the UAV, the air velocity and gas concentration distribution around the fuselage is affected by the downwash flow of the propeller, which leads to certain errors in the gas sensor [35]. In order to minimize the error and improve the data accuracy, the air pump is used to send the external gas into the cavity, and the gas response cavity is thereby designed.
According to the size of the electrochemical sensor mentioned above, two cavity structures are designed as shown in Figure 10. CFD is an emerging discipline that simulates and analyzes fluid mechanics using computer and numerical methods. The powerful computing power of CFD provides technical support for fluid mechanics. In this case, a CFD simulation is hereby used for simulating the distribution of the gas flow field and pressure field when the gas flows through the cavity, which can effectively evaluate the influence of different cavity structure designs on the response of the electrochemical sensors. Besides, it is also required to mesh the part of the cavity through which the gas flows after completing the 3D modeling of the cavity in CAD. In addition, after importing the divided model, it is rather essential to select the simulation material, fluid model, boundary conditions, air inlet and outlet and set the initial conditions of the airflow field. Finally, the numerical solution is completed by a discrete solver.
where ρ is the fluid density and viscosity coefficient; d, the diameter of the tubular microelement; v, the fluid flow velocity, and η, the fluid viscosity. The Reynolds number is calculated as greater than 4000, so the k − ε turbulence model is selected for airflow simulation.
(ii). Cavity meshing It is necessary to simulate the flow field in the cavity by meshing the gas flow field. A comparison between the cover cavity and the cap cavity is shown in Table 4. Different divisions are made according to the characteristics of the two types of cavities. The cover cavity is shown in Figure 11a, and the cap cavity is displayed in Figure 11b. The calculation model of CFD depends on the properties and flow state of the fluid. The Reynolds Number (Re) defines the ratio between the inertia and the viscous force of the fluid, and the calculation formula is shown in Formula (4). The fluid model can be determined by calculating Re: it is laminar flow when Re < 2300; transitional flow when Re = 2300~4000, and turbulent flow when Re > 4000.
vd Re where ρ is the fluid density and viscosity coefficient; d, the diameter of the tubular micro-element; , the fluid flow velocity, and η, the fluid viscosity. The Reynolds number is calculated as greater than 4000, so the − k ε turbulence model is selected for airflow simulation.

(ii). Cavity meshing
It is necessary to simulate the flow field in the cavity by meshing the gas flow field. A comparison between the cover cavity and the cap cavity is shown in Table 4. Different divisions are made according to the characteristics of the two types of cavities. The cover cavity is shown in Figure 11a, and the cap cavity is displayed in Figure 11b.  In the case of performing numerical simulation calculations in the cavity, it is necessary to set the boundary conditions, mainly including the environmental conditions, velocity inlet, and pressure outlet. For the environmental conditions, the type of airflow entering the flow field is air, and the temperature is set to 293.15 K. One side is selected as the inlet boundary. At the same time, the flow velocity is calculated according to the flow rate of the air pump and the size of the air inlet, and the normal inflow velocity of the velocity field of the inlet boundary is set to 2 m/s. Meanwhile, the other side serves as the outlet boundary, and the pressure is 1 atm.
(iv). Solving method For the solution method, the finite element method is used to complete the solution

(iii). Setting of boundary conditions
In the case of performing numerical simulation calculations in the cavity, it is necessary to set the boundary conditions, mainly including the environmental conditions, velocity inlet, and pressure outlet. For the environmental conditions, the type of airflow entering the flow field is air, and the temperature is set to 293.15 K. One side is selected as the inlet boundary. At the same time, the flow velocity is calculated according to the flow rate of the air pump and the size of the air inlet, and the normal inflow velocity of the velocity field of the inlet boundary is set to 2 m/s. Meanwhile, the other side serves as the outlet boundary, and the pressure is 1 atm.

(iv). Solving method
For the solution method, the finite element method is used to complete the solution based on the three basic conservation equations of flow, including the mass conservation Equation (5), the momentum conservation Equation (6), and the energy conservation Equation (7), expressed as follows: where ρ is the fluid density; x, y, z, three orthogonal vectors; u, v, w, the components of the velocity field in the x, y, z directions; p, the pressure; τ, the viscous stress; → F , the volume force; C p , the specific heat capacity; T, the temperature, and q, the heat flux.
The solution results are shown in Figure 12, where (a) and (b) are the simulation results of the velocity field streamlines, and (c) and (d) are those of the pressure field. The following conclusions can be drawn from the simulation results: when the airflow flows into the two cavities, the airflow in the cavity will be seriously diffused and most of the airflow will flow straight to the outlet due to the large calculation area inside the cover cavity; there is very little flow at the top, which not only prolongs the response time of the sensor but also causes errors in the accuracy of the results. Therefore, the cover cavity will not achieve the expected results and the internal computing area of the cap cavity is small, and most of the airflow flows directly to the top of the sensor, which greatly shortens the response time of the sensor.
where is the fluid density; , , , three orthogonal vectors; u, v, w, the components of the velocity field in the , , directions; p, the pressure; , the viscous stress; ⃗ , the volume force; , the specific heat capacity; , the temperature, and , the heat flux. The solution results are shown in Figure 12, where (a) and (b) are the simulation results of the velocity field streamlines, and (c) and (d) are those of the pressure field. The following conclusions can be drawn from the simulation results: when the airflow flows into the two cavities, the airflow in the cavity will be seriously diffused and most of the airflow will flow straight to the outlet due to the large calculation area inside the cover cavity; there is very little flow at the top, which not only prolongs the response time of the sensor but also causes errors in the accuracy of the results. Therefore, the cover cavity will not achieve the expected results and the internal computing area of the cap cavity is small, and most of the airflow flows directly to the top of the sensor, which greatly shortens the response time of the sensor. By comparing and analyzing the flow direction of the airflow inside the cover cavity and the cap cavity, and their influence on the results through the above simulation results, it can be concluded that the cap cavity structure is more suitable for the actual needs of rapid sampling. Therefore, a series cavity with a buffer cavity is hereby designed on the basis of the cap cavity structure as shown in Figure 13, which is also simulated, and the simulation results are shown in Figure 14. By comparing and analyzing the flow direction of the airflow inside the cover cavity and the cap cavity, and their influence on the results through the above simulation results, it can be concluded that the cap cavity structure is more suitable for the actual needs of rapid sampling. Therefore, a series cavity with a buffer cavity is hereby designed on the basis of the cap cavity structure as shown in Figure 13, which is also simulated, and the simulation results are shown in Figure 14.  It can be seen from the above simulation results that the airflow conditions in the response cavity of each small cavity are basically the same in the designed series cavity, and the designed buffer cavity can affect the airflow when the speed of the air pump fluctuates. The buffering function keeps the airflow in the response cavity relatively stable.

Sensor Calibration and Compensation Method
Considering the process error of electrochemical sensor fabrication, there are certain differences in the sensitivity and baseline drift of each sensor. In order to make the monitoring results more accurate, the sensor should be necessarily calibrated for a more accurate sensitivity and zero voltage [36]. The reaction basis of the electrochemical sensors is a chemical reaction, the response of which is easily affected by temperature changes, thereby resulting in output drift in the case of climate changes throughout the year. Therefore, temperature compensation for the electrochemical sensors is also required. To this end, a linear regression algorithm is adopted for sensor calibration and a polynomial piecewise regression method is chosen for temperature compensation.

Software Solution Design
In order to drive the electrochemical sensor to work properly and read the current value, the LMP91000 and AD7793 are configured as shown in Figure 15. The LMP91000 is initialized and its power-on status is read after power-on. A value of 1 means that it is ready to receive I2C commands, unlock the write function to the chip and configure the  It can be seen from the above simulation results that the airflow conditions in the response cavity of each small cavity are basically the same in the designed series cavity, and the designed buffer cavity can affect the airflow when the speed of the air pump fluctuates. The buffering function keeps the airflow in the response cavity relatively stable.

Sensor Calibration and Compensation Method
Considering the process error of electrochemical sensor fabrication, there are certain differences in the sensitivity and baseline drift of each sensor. In order to make the monitoring results more accurate, the sensor should be necessarily calibrated for a more accurate sensitivity and zero voltage [36]. The reaction basis of the electrochemical sensors is a chemical reaction, the response of which is easily affected by temperature changes, thereby resulting in output drift in the case of climate changes throughout the year. Therefore, temperature compensation for the electrochemical sensors is also required. To this end, a linear regression algorithm is adopted for sensor calibration and a polynomial piecewise regression method is chosen for temperature compensation.

Software Solution Design
In order to drive the electrochemical sensor to work properly and read the current value, the LMP91000 and AD7793 are configured as shown in Figure 15. The LMP91000 is initialized and its power-on status is read after power-on. A value of 1 means that it is ready to receive I2C commands, unlock the write function to the chip and configure the It can be seen from the above simulation results that the airflow conditions in the response cavity of each small cavity are basically the same in the designed series cavity, and the designed buffer cavity can affect the airflow when the speed of the air pump fluctuates. The buffering function keeps the airflow in the response cavity relatively stable.

Sensor Calibration and Compensation Method
Considering the process error of electrochemical sensor fabrication, there are certain differences in the sensitivity and baseline drift of each sensor. In order to make the monitoring results more accurate, the sensor should be necessarily calibrated for a more accurate sensitivity and zero voltage [36]. The reaction basis of the electrochemical sensors is a chemical reaction, the response of which is easily affected by temperature changes, thereby resulting in output drift in the case of climate changes throughout the year. Therefore, temperature compensation for the electrochemical sensors is also required. To this end, a linear regression algorithm is adopted for sensor calibration and a polynomial piecewise regression method is chosen for temperature compensation.

Software Solution Design
In order to drive the electrochemical sensor to work properly and read the current value, the LMP91000 and AD7793 are configured as shown in Figure 15. The LMP91000 is initialized and its power-on status is read after power-on. A value of 1 means that it is ready to receive I2C commands, unlock the write function to the chip and configure the TIACN and REFCN registers for setting variables including the load impedance, transimpedance gain, internal zero point potential, bias voltage, reference source and working mode. Finally, it needs to be locked to prohibit writing to the register. Then the AD7793 is initialized, and at the same time, the microprocessor sends an instruction to read the correctness of the register ID. For a correct ID, the first step is to set the configuration register, i.e., to select the gain, reference source and differential mode input channel, while the second step is to set the mode register, i.e., to set the working mode, clock source and sampling frequency. Finally, the ADC conversion result can be read from the data register.
ors 2022, 22, x FOR PEER REVIEW 14 of TIACN and REFCN registers for setting variables including the load impedance, transi pedance gain, internal zero point potential, bias voltage, reference source and worki mode. Finally, it needs to be locked to prohibit writing to the register. Then the AD7793 initialized, and at the same time, the microprocessor sends an instruction to read the c rectness of the register ID. For a correct ID, the first step is to set the configuration regist i.e., to select the gain, reference source and differential mode input channel, while second step is to set the mode register, i.e., to set the working mode, clock source a sampling frequency. Finally, the ADC conversion result can be read from the data regist AD7793 selects the external reference source as the sampling reference, the sampli range of which is 0~2.5 V, and the gain is 1. Additionally, the differential input channe and the internal clock source are selected, and the sampling frequency is set to 16.7 H According to the range and sensitivity parameters of the four electrochemical sens selected in Table 1, the LMP91000 sets the potential of the TIA "-" terminal to 67% of reference source, that is, = 1.675 V and the bias voltage is 0 mV. In order to ma the output range of the electrochemical sensor after the amplifier within the A/D sampli range as far as possible, the values of in the LMP91000 are selected as follows: C sensor-350 kΩ; SO2 sensor-120 kΩ; NO2 sensor-120 kΩ, and O3 sensor-120 k Besides, the load resistance is selected as 50Ω. The STM32F429VGT6 processor reads the readings of each electrochemical gas s sor using the SPI chip selection polling method, and these values are calibrated throug calibration model and a temperature compensation model. Then, readings of the CO2 se sor, particulate matter sensor, and temperature and humidity sensor are read in turn. data are stored in an SD card for backup, and the data are sent in UART mode. At same time, warning lights are set up to remind the programmer of errors.

Results
In this chapter, firstly, the CO electrochemical sensor is taken as an example to co duct a CFD experiment on the series cavity designed in the previous chapter. Then, parameter calibration experiment based on the linear regression model and the piecew AD7793 selects the external reference source as the sampling reference, the sampling range of which is 0~2.5 V, and the gain is 1. Additionally, the differential input channel 2 and the internal clock source are selected, and the sampling frequency is set to 16.7 Hz. According to the range and sensitivity parameters of the four electrochemical sensors selected in Table 1, the LMP91000 sets the potential of the TIA "−" terminal to 67% of the reference source, that is, V TI A− = 1.675 V and the bias voltage is 0 mV. In order to make the output range of the electrochemical sensor after the amplifier within the A/D sampling range as far as possible, the values of R tia in the LMP91000 are selected as follows: CO sensor-350 kΩ; SO 2 sensor-120 kΩ; NO 2 sensor-120 kΩ, and O 3 sensor-120 kΩ. Besides, the load resistance R load is selected as 50 Ω.
The STM32F429VGT6 processor reads the readings of each electrochemical gas sensor using the SPI chip selection polling method, and these values are calibrated through a calibration model and a temperature compensation model. Then, readings of the CO 2 sensor, particulate matter sensor, and temperature and humidity sensor are read in turn. All data are stored in an SD card for backup, and the data are sent in UART mode. At the same time, warning lights are set up to remind the programmer of errors.

Results
In this chapter, firstly, the CO electrochemical sensor is taken as an example to conduct a CFD experiment on the series cavity designed in the previous chapter. Then, the parameter calibration experiment based on the linear regression model and the piecewise temperature compensation method experiment are, respectively, carried out to reduce the errors caused by the sensor.

Experimental Verification and Analysis of CFD Simulation
In order to verify the consistency of the simulation results with the actual effect, the CO sensor is taken as an example to carry out the verification experiment. The 3D printing technology is used to realize the serial cavity, and nylon material is chosen for the printing. Firstly, the cavity is installed on the CO sensor. When the sensor polarization is completed and the output is stable after 2 min of power-on, clean air is introduced into the cavity for 2.5 min. At the same time, the gas mixture is controlled by a Mass Flow Controller (MFC). Then, the air is mixed with 1000 ppm CO according to the ratio of 98:2, and passes the cavity for 2.5 min. Finally, clean air passes through the cavity for 2.5 min. Since the electrochemical sensor will generate a weak current itself when not in contact with the target gas, the output is considered the baseline current. Therefore, the sensor baseline is corrected following Formula (8) in the data processing process, where I is the current of the sensor after baseline processing; I t , the original current value of the sensor at time t, and N, the sampling times, generally within the range of 60-120. Excluding the polarization process data, the experimental results after baseline processing are shown in Figure 16. In order to verify the consistency of the simulation results with the actual effect, the CO sensor is taken as an example to carry out the verification experiment. The 3D printing technology is used to realize the serial cavity, and nylon material is chosen for the printing. Firstly, the cavity is installed on the CO sensor. When the sensor polarization is completed and the output is stable after 2 min of power-on, clean air is introduced into the cavity for 2.5 min. At the same time, the gas mixture is controlled by a Mass Flow Controller (MFC). Then, the air is mixed with 1000 ppm CO according to the ratio of 98:2, and passes the cavity for 2.5 min. Finally, clean air passes through the cavity for 2.5 min. Since the electrochemical sensor will generate a weak current itself when not in contact with the target gas, the output is considered the baseline current. Therefore, the sensor baseline is corrected following Formula (8) in the data processing process, where is the current of the sensor after baseline processing; , the original current value of the sensor at time t, and N, the sampling times, generally within the range of 60-120. Excluding the polarization process data, the experimental results after baseline processing are shown in Figure 16. The experimental results show that the response generated by the CO sensor is smooth and stable under the series cavity, and the time (t90) for reaching 90% of the stable response is about 30 s.
The monitoring terminal is mainly used for monitoring atmospheric environmental pollution. The concentration of various polluting gases is low in the atmospheric environment. Therefore, the measured gas is mixed to a low concentration in the follow-up experiment. In order to verify the series cavity's capability of achieving the same effect, four CO electrochemical sensors of the same batch are installed on the series cavity for experiments, with the CO gas test as an example.
For a low measured gas concentration value, the sensor tends to exhibit relatively large noise, which requires the obtained data to be denoised. Exponentially Weighted Moving-Average (EWMA) is an algorithm that estimates the current value by combining it with historical observations, as shown in Equation (9) [37]. When the current value is predicted, the weight of the historical observation value decreases exponentially with time. The closer the data are to the current moment, the higher the correlation is and the greater the weight becomes, which can effectively reflect the recent change trend. The experimental results show that the response generated by the CO sensor is smooth and stable under the series cavity, and the time (t 90 ) for reaching 90% of the stable response is about 30 s.
The monitoring terminal is mainly used for monitoring atmospheric environmental pollution. The concentration of various polluting gases is low in the atmospheric environment. Therefore, the measured gas is mixed to a low concentration in the follow-up experiment. In order to verify the series cavity's capability of achieving the same effect, four CO electrochemical sensors of the same batch are installed on the series cavity for experiments, with the CO gas test as an example.
For a low measured gas concentration value, the sensor tends to exhibit relatively large noise, which requires the obtained data to be denoised. Exponentially Weighted Moving-Average (EWMA) is an algorithm that estimates the current value by combining it with historical observations, as shown in Equation (9) [37]. When the current value is predicted, the weight of the historical observation value decreases exponentially with time. The closer the data are to the current moment, the higher the correlation is and the greater the weight becomes, which can effectively reflect the recent change trend.
where ρ 0 is the initial time value; ρ 0 = Y 0 ,X i , the observed value at the time; Y i , the predicted value at the time and k, the weighted descending speed. The larger the value is, the faster the weighting decreases.
The coefficient can be expressed as the half-life τ hal f function [38]: where f s is the sampling frequency. The experimental results before and after EWMA filtering and the experimental results of four CO sensors at the same time are shown in Figures 17 and 18, respectively. where is the initial time value; = , i X , the observed value at the time; Yi, the predicted value at the time and k, the weighted descending speed. The larger the value is, the faster the weighting decreases.
The coefficient can be expressed as the half-life function [38]: where is the sampling frequency. The experimental results before and after EWMA filtering and the experimental results of four CO sensors at the same time are shown in Figures 17 and 18, respectively.  In the figure, CO_1_EWMA, CO_2_EWMA, CO_3_EWMA, and CO_4_EWMA represent the response curves of the four CO sensors installed in the series cavity from left to right after EWMA filtering, respectively. The horizontal axis represents time, and the vertical axis is the output current value of the working electrode. The experimental results show that the response duration and response start time of the four CO sensors in the series cavity are basically the same, and there is almost no delay problem, which is consistent with the simulation results. where is the initial time value; = , i X , the observed value at the time; Yi, the predicted value at the time and k, the weighted descending speed. The larger the value is, the faster the weighting decreases.
The coefficient can be expressed as the half-life function [38]: where is the sampling frequency. The experimental results before and after EWMA filtering and the experimental results of four CO sensors at the same time are shown in Figures 17 and 18, respectively.  In the figure, CO_1_EWMA, CO_2_EWMA, CO_3_EWMA, and CO_4_EWMA represent the response curves of the four CO sensors installed in the series cavity from left to right after EWMA filtering, respectively. The horizontal axis represents time, and the vertical axis is the output current value of the working electrode. The experimental results show that the response duration and response start time of the four CO sensors in the series cavity are basically the same, and there is almost no delay problem, which is consistent with the simulation results. In the figure, CO_1_EWMA, CO_2_EWMA, CO_3_EWMA, and CO_4_EWMA represent the response curves of the four CO sensors installed in the series cavity from left to right after EWMA filtering, respectively. The horizontal axis represents time, and the vertical axis is the output current value of the working electrode. The experimental results show that the response duration and response start time of the four CO sensors in the series cavity are basically the same, and there is almost no delay problem, which is consistent with the simulation results.

Sensor Calibration Experiment
The monitoring terminal and standard equipment are connected to the gas circuit in series. Similar to the above experimental process, clean air is introduced for 2.5 min when the polarization of each sensor is completed, and the MFC is controlled to introduce a certain concentration of a single type of target gas for 2.5 min. Then, the target gas concentration is increased through MFC and passed into the gas path. A gas concentration step is formed after several increases in the concentration. The current output value I of the monitoring terminal and the gas concentration value C are recorded during the whole process, and the experiment is repeated five times.
The response generated by the electrochemical sensor in its range has a linear relationship with the target gas concentration. Taking the CO sensor as an example, its sensitivity is 70 ± 15 nA/ppm according to Table 1. A linear model is built accordingly as shown in Formula (11), whereĈ is the gas concentration predicted by the model; I, the current value output by the sensor; w, the sensitivity correction factor and b, the offset.
The preprocessing and model training process is shown in Figure 19. The ratio of the training set to the test set is 7:3.
R PEER REVIEW 17 of 23

Sensor Calibration Experiment
The monitoring terminal and standard equipment are connected to the gas circuit in series. Similar to the above experimental process, clean air is introduced for 2.5 min when the polarization of each sensor is completed, and the MFC is controlled to introduce a certain concentration of a single type of target gas for 2.5 min. Then, the target gas concentration is increased through MFC and passed into the gas path. A gas concentration step is formed after several increases in the concentration. The current output value I of the monitoring terminal and the gas concentration value C are recorded during the whole process, and the experiment is repeated five times.
The response generated by the electrochemical sensor in its range has a linear relationship with the target gas concentration. Taking the CO sensor as an example, its sensitivity is 70 ± 15 nA/ppm according to Table 1. A linear model is built accordingly as shown in Formula (11), where Ĉ is the gas concentration predicted by the model; I , the current value output by the sensor; w, the sensitivity correction factor and b, the offset.
( ) The preprocessing and model training process is shown in Figure 19. The ratio of the training set to the test set is 7:3.  The data recorded by the monitoring terminal are processed by the baseline and filtered by EWMA. At the same time, the average values I 0 , I 1 , I 2 , . . . , I n (n > 0, n∈R) of the 1 min data are taken after each step is stabilized, and these average values are input into the linear model for prediction. The loss function is L1Loss as shown In Equation (12), which takes the absolute value of the difference between the true value of gas concentration measured by standard equipment and the model predicted value. Adam optimizer is used for parameter optimization, and the learning rate is 0.5.
During backpropagation, the parameters θ (including the sensitivity factor w and bias b) are updated by minimizing the loss product of the gradient θ and the learning rate a as shown in Equation (13). Backpropagation is automatically handled by the Adam optimizer under the pytorch framework. The linear regression model can better fit the training set data after each iteration of feedforward and backpropagation.
After 150 iterations, the loss tends to be stable, and the training results of parameters w and b are w = 2.754541, and b = 0.4882. The performance in the test set is shown in Figure 20a, where it can be observed that R 2 = 0.998106, and the fitting degree is rather high. The comparison of the linear regression model before and after calibration is shown in Figure 20b. After calibration, the output is closer to the real gas concentration value.

Design of Segmented Temperature Compensation Method
The temperature compensation design is hereby carried out according to the facto test temperature compensation curve in the data sheet of each sensor. Considering th strong nonlinearity of the temperature compensation curve, the order of the model mu be much higher to achieve a better fitting effect. Additionally, the adoption of the line regression method results in a segmentation phenomenon in the results. Therefore, order to reduce the complexity of the model, piecewise polynomial regression is used f designing the temperature compensation as shown in Equation (14), where C denotes th gas concentration value after calibration; CT, the concentration value detected by th electrochemical sensor at the temperature T; T, the temperature, and the unit is ℃;

Design of Segmented Temperature Compensation Method
The temperature compensation design is hereby carried out according to the factory test temperature compensation curve in the data sheet of each sensor. Considering the strong nonlinearity of the temperature compensation curve, the order of the model must be much higher to achieve a better fitting effect. Additionally, the adoption of the linear regression method results in a segmentation phenomenon in the results. Therefore, in order to reduce the complexity of the model, piecewise polynomial regression is used for designing the temperature compensation as shown in Equation (14), where C denotes the gas concentration value after calibration; C T , the concentration value detected by the electrochemical sensor at the temperature T; T, the temperature, and the unit is • C; a, b and c the weight of temperature at order 1, 2 and 3, respectively, and d, the bias. The training results of each parameter are shown in Table 5. Figure 21 depicts the temperature compensation curves of various sensors corresponding to the model.

Discussion
So far, the design of the entire gas monitoring terminal has been completed. An automobile exhaust pollution point detection experiment is hereby designed to verify the scheme feasibility, and the F330 rotorcraft is used and the airborne monitoring terminal is also installed directly below the UAV to ensure the safety of the experiment. A fuel vehicle is started and parked in the open parking lot on the west side of the Electronic Information Engineering College of the Hebei University of Technology. After waiting for about 20 min, the exhaust gas emitted by the vehicle reaches a relatively stable distribution around it. A remote control is used to control the F330 rotorcraft to take off about 5 m from the horizontal direction of the vehicle and 1.8 m from the ground. Then, the UAV flies to the vehicle and carries out hovering sampling around the vehicle. At the same time, the ground station system records the flight track and various gas concentration data of the UAV, as shown in Figure 22.

Discussion
So far, the design of the entire gas monitoring terminal has been completed. An automobile exhaust pollution point detection experiment is hereby designed to verify the scheme feasibility, and the F330 rotorcraft is used and the airborne monitoring terminal is also installed directly below the UAV to ensure the safety of the experiment. A fuel vehicle is started and parked in the open parking lot on the west side of the Electronic Information Engineering College of the Hebei University of Technology. After waiting for about 20 min, the exhaust gas emitted by the vehicle reaches a relatively stable distribution around it. A remote control is used to control the F330 rotorcraft to take off about 5 m from the horizontal direction of the vehicle and 1.8 m from the ground. Then, the UAV flies to the vehicle and carries out hovering sampling around the vehicle. At the same time, the ground station system records the flight track and various gas concentration data of the UAV, as shown in Figure 22. The whole process of the UAV taking off and returning to the starting point is intercepted, and the result of the rotorcraft flight trajectory is shown in Figure 23a. The blue line denotes the flight trajectory of the UAV; the green diamond, the rotorcraft take-off point of the UAV; the orange diamond, the landing point of the UAV, and the red triangle, the location of the vehicle. The gas monitoring data are preprocessed and the data during the warm-up period are removed and normalized. Changes in various gas concentrations during the entire flight are shown in Figure 23b. The whole process of the UAV taking off and returning to the starting point is intercepted, and the result of the rotorcraft flight trajectory is shown in Figure 23a. The blue line denotes the flight trajectory of the UAV; the green diamond, the rotorcraft take-off point of the UAV; the orange diamond, the landing point of the UAV, and the red triangle, the location of the vehicle. The gas monitoring data are preprocessed and the data during the warm-up period are removed and normalized. Changes in various gas concentrations during the entire flight are shown in Figure 23b. The experimental results show that the concentrations of CO, SO2, NO2, and CO significantly increased near the vehicle position, and the system can still carry out effec gas environment monitoring under the disturbance of UAV airflow. The experimental results show that the concentrations of CO, SO 2 , NO 2 , and CO 2 are significantly increased near the vehicle position, and the system can still carry out effective gas environment monitoring under the disturbance of UAV airflow.

Conclusions
The overall hardware design of the monitoring terminal is hereby expounded. In the first part, the selection of sensors is carried out, and the NIDR carbon dioxide sensor, particulate matter sensor and temperature and humidity sensor are finally selected after comparing and analyzing the performance of various sensors. At the same time, the design of each part of the hardware circuit is introduced in detail, and the signal analysis of the driving circuit of the electrochemical sensor is carried out to obtain the original signal output value of each sensor; Then, the cavity design and CFD simulation are conducted to reduce the influence of the airflow disturbance of the UAV and improve the response speed. The simulation results show that the airflow conditions in the response cavity of each small cavity are basically the same in the designed series cavity. The designed buffer cavity can buffer the airflow when the speed of the air pump fluctuates so that the airflow into the response cavity remains relatively stable; finally, the software design is performed. In the second part, taking the CO sensor as an example, the CFD simulation experiment is compared and analyzed. The experimental results show that the designed series type can effectively shorten the response time of the sensor by 7.6 s. Considering the sensitivity of the electrochemical sensor and the difference in baseline drift that leads to the problem of bias in the results, the sensor calibration and temperature compensation are carried out. Based on the linear regression algorithm, the calibration model experiment of the electrochemical sensor is designed and accomplished. The experimental results show that the R 2 of the model reaches 0.9981, and the fitting effect is rather high. After calibration, the output is much closer to the real gas concentration value. Finally, the design experiment of the segmented temperature compensation method is carried out. The temperature compensation parameters are determined, thereby improving the accuracy of the entire hardware terminal. In the third part, a vehicle exhaust monitoring experiment is designed to verify the feasibility of the gas monitoring terminal, which is proven capable of detecting the emission position of the vehicle exhaust under the interference of the downwash flow of the rotorcraft.