Indoor Environment Quality Monitoring and Evaluation System Based on LoRa Communication

Abstract

Indoor environmental quality has always been the focus of people’s long-term attention. How to monitor the indoor environmental level conveniently and accurately is a problem that people pay attention to now. After research, an indoor environment level monitoring system based on LoRa communication is designed. The system is mainly divided into two parts, the detection node, and the monitoring terminal. Temperature, humidity, light intensity, noise, formal-dehyde, and carbon dioxide are detected through the node with STM32F103ZET6 microcontroller as the controller; the data is sent to the monitoring terminal for display through LoRa communication. At the same time, the T-S fuzzy neural network (TSFNN) is improved by the particle swarm optimization (PSO) algorithm to classify the indoor environment quality level. Experimental test: the total error of the improved TSFNN model test set is reduced by 8.6007. The system can monitor the indoor environment level objectively and reliably, and has high practical value.

Share and Cite:

Jiang, J. , Zhu, W. , Xie, X. and Wei, Q. (2022) Indoor Environment Quality Monitoring and Evaluation System Based on LoRa Communication. Journal of Computer and Communications, 10, 72-86. doi: 10.4236/jcc.2022.104007.

1. Introduction

In recent years, with the continuous improvement of material conditions, people are more and more concerned about the living and working environment. Especially after the spread of COVID-19 around the world, people’s concept of life and work has undergone tremendous changes, and more attention has been paid to the quality of the indoor environment [1]. People usually judge whether the indoor environment is suitable for life and work according to their subjective feelings, but it is difficult to make accurate evaluations through human subjective judgment for some environmental factors that are difficult to be identified by feeling.

At present, scholars have carried out research on indoor environmental quality evaluation. Li Minghai [2] obtains the weights of each index through the AHP and then obtains the comprehensive results of the fuzzy evaluation through the fuzzy comprehensive evaluation method. Chen Huaiyu [3] determined the weight of each evaluation index through the entropy weight method, and then made a comprehensive evaluation through the attribute recognition theoretical model. However, the calculation process of this method is cumbersome, and the attribute measure and fuzzy membership degree in the model are not easy to determine. Yong Wang [4] used the improved BP neural network model to evaluate indoor air quality. However, the BP neural network itself has low learning efficiency, and it is easy to fall into the local minimum value and cannot find the global optimal solution, which limits its application in indoor environment evaluation.

In terms of indoor environment monitoring, Yan Dongwen [5] designed a monitoring system based on ZigBee wireless network, aiming at the disadvantages of traditional monitoring systems such as difficult wiring and poor flexibility. However, the ZigBee network has problems such as short transmission distance and poor penetration ability, and it is poor in large-scale networking communication. Ismaila B. Tijani [6] proposed a sensor node with a wireless sensor network function for monitoring air quality conditions. However, this node only monitors the air environment, and factors that affect the quality of the indoor environment include thermal environment, light environment, and sound environment. Zhou Chengzhuang [7] uses LoRa technology for networking communication and monitoring the home environment. However, this system only monitors the changes in environmental indexes in bedrooms, bathrooms, study rooms, and kitchens, and does not comprehensively analyze and evaluate environmental quality.

Based on the above problems, this paper designs an indoor environment monitoring system based on LoRa communication, mainly for temperature, humidity, light intensity, noise, formaldehyde, and carbon dioxide. The detection data is sent to the monitoring terminal through LoRa communication, combined with the improved TSFNN evaluation model to achieve real-time monitoring of the indoor environmental quality level.

2. System Overall Structure Design

The system is mainly composed of detection nodes and monitoring terminals, as shown in Figure 1. The indoor environment monitoring and evaluation system based on LoRa communication [8] can collect indoor environmental quality data in real-time, evaluate the collected data through the indoor environment classification model, and display it on the OLED screen of the monitoring terminal.

Figure 1. The overall structure of the system.

The system test selects three laboratories in the School of Computer Science and Engineering the school to place nodes respectively and sends the collected data to the monitoring terminal. If the environmental quality in a laboratory deteriorates, the monitoring terminal records the current laboratory environment information and time to facilitate user analysis.

3. System Detection Node and Monitoring Terminal Design

3.1. Hardware Design

The detection node uses STM32F103ZET6 as the processor and LoRa as the wireless communication module [9] [10]. Indoor environmental quality testing indexes include temperature, humidity, light intensity, noise, formaldehyde, and carbon dioxide. The temperature sensor model is DS18B20, single bus communication, the temperature measurement range is −55˚C - +125˚C, and the accuracy is ±0.5˚C; the humidity sensor model is DHT22, single bus communication, the humidity measurement range is 0% - 99.9% RH, and the accuracy is ±2% RH; light intensity sensor model is BH1750, IIC communication, corresponding to a wide range of input light (equivalent to 0 - 65,535 lx), the minimum error variation is ±20%; noise sensor model is PR-ZS-BZ, serial communication, TTL Output or RS485 output, the measurement range is 30 dB - 130 dB, the error is less than 2%; the formaldehyde sensor type is ZE08-CH2O, serial communication or DAC data acquisition, with digital output and analog voltage output function, the measurement range of formaldehyde concentration is 0 - 5 ppm, the resolution is less than or equal to 0.01 ppm; the carbon dioxide sensor model is SGP30, IIC communication, the carbon dioxide concentration measurement range is 400 - 60,000 ppm; the resolution is less than or equal to 31 ppm.

3.2. Software Design

1) Detection Node

The node is composed of a low-power STM32 microcontroller, LoRa wireless transmission module, environmental parameter acquisition sensors, etc. To save power consumption, after the node is successfully connected to the monitoring terminal, the environmental parameters are periodically collected. Outside the acquisition period, the node enters the sleep state and wakes up after the acquisition period. The workflow of the detection node is shown in Figure 2.

2) Monitoring Terminal

The monitoring terminal uses STM32F103C8T6 as the processor, and mainly receives the sensor data sent by the detection node through the LoRa wireless communication module. After the main program starts, initialize the STM32 microcontroller system clock, LoRa module, and LCD module, check whether each node is successfully connected, and then evaluate the received data. If the data environment quality evaluation of a node is poor, record the current laboratory environment information and time. The workflow of the monitoring terminal is shown in Figure 3.

4. The Basic Principle of PSO Optimization TSFNN Algorithm

4.1. T-S Fuzzy Neural Network

The fuzzy neural network is composed of a fuzzy system and neural network structure. In 1985, Takagi and Sugeno first proposed a typical fuzzy system (T-S model) [11], which is a function of the input language variables by the fuzzy rule consequent, and linearly combines the input variables. Sun Zengqi [12] also proposed a structure to realize a fuzzy neural network based on the T-S model for the general situation of multiple inputs and multiple outputs. T-S fuzzy neural network [13] [14] has a strong self-adaptive ability, can achieve the purpose of automatic update through its adjustment, and can also realize the correction of the membership function corresponding to the fuzzy subset many times in a row. The model is mainly divided into two parts, the Forward network, and the Consequent network. Assuming that the network has m inputs and n rules, its topology is shown in Figure 4.

1) Forward Network

The first layer is the input layer, which transmits the input information x = [ x 1 , x 2 , , x m ] T into the next layer.

The second layer is the fuzzification layer, which calculates the membership degree of each component belonging to the fuzzy set of their respective linguistic variable values. The membership degree function generally adopts a Gaussian function:

μ j i = exp [ ( x j c j i ) 2 / b j i ] , i = 1 , 2 , , n ; j = 1 , 2 , , m (1)

where c is the center of the membership function and b is the width of the membership function.

The third layer is the fuzzy rule layer, which performs fuzzy calculations on each membership degree to calculate the fitness of each fuzzy rule. The fitness calculation uses the continuous multiplication operator:

ω i = μ 1 i ( x 1 ) μ 2 i ( x 2 ) μ m i ( x m ) , i = 1 , 2 , , n (2)

The fourth layer is the defuzzification layer, which uses the weighted average discrimination method to obtain the output of each node:

Figure 2. Detection node workflow.

Figure 3. Monitoring terminal workflow.

Figure 4. T-S Fuzzy neural network topology.

ω i ¯ = ω i i = 1 n ω i (3)

2) Consequent Network

The second layer obtains the output of the nodes in the middle layers according to the fuzzy rules:

y i = ( p i + p 1 i x 1 + + p m i x m ) , i = 1 , 2 , , n (4)

The third layer calculates the final output value of the fuzzy neural network model:

y = i = 1 n ω i ¯ y i (5)

4.2. Particle Swarm Optimization Algorithm

The particle swarm optimization algorithm was first proposed by Kennedy and Eberhart in 1995 [15] [16], mainly for solving multi-objective optimization problems. Particle swarm optimization [17] [18] is an intelligent optimization method for communities, which is mainly an algorithm generated by simulating the cooperation and information sharing among bird flocks. The individual search optimal solution of each particle in the search space is recorded as the current individual extremum, and its speed and position are adjusted through the current individual extremum and the current global optimal solution shared by the overall particle swarm. The updated rules of speed and position are shown in formula (6).

{ v i k + 1 = ω × v i k + c 1 × r × ( p b e s t i k x i k ) + c 2 × r × ( g b e s t i k x i k ) x i k + 1 = x i k + v i k + 1 (6)

Among them, ω is the inertia weight; k is the current number of iterations; r is a random number; c 1 and c 2 are learning factors; g b e s t i k is the individual extreme value; g b e s t i k is the global optimal solution.

4.3. Optimization of T-S Fuzzy Neural Network by Particle Swarm Optimization Algorithm

The center and width of the membership function randomly generated by the T-S fuzzy neural network and the weight of the middle layer of the consequent network will affect the accuracy and convergence speed of the model. This paper will give full play to the advantages of PSO to obtain the best weights of the T-S fuzzy neural network, and construct a new evaluation model (PSO-TSFNN) for indoor environmental quality classification.

The specific steps of the optimization algorithm are as follows:

1) Determine the structure and related parameters of the TSFNN.

2) Set the colony size, particle initial velocity, and position. The initial value of the selected particle is the current individual extreme value, and the extreme value of the community is the global optimal solution.

3) Calculate the fitness value of each particle. The fitness function is generally the TSFNN training error:

F i = 1 2 i = 1 m ( y d i y c i ) 2 (7)

Among them, m is the number of train samples; y d i is the evaluation output; y c i is the actual output.

4) Update the individual extrema and the global optimal solution. The current fitness value of each particle is compared with the previous results, if it is better than the past, it will replace the previous individual extreme value, otherwise, it will remain unchanged. If the previous global optimal solution is not as good as the current one, replace it with the current optimal solution, otherwise, it will remain unchanged.

5) Update the position and velocity of each particle according to Equation (6).

6) Check whether the speed and position of each particle are out of bounds, if it is out of bounds, perform corresponding threshold processing.

7) Check whether the algorithm reaches the termination condition (reaches the maximum number of evolutions or the set error accuracy). If the termination condition is met, the global optimal solution is output, otherwise, it returns to step 3). The algorithm flow is shown in Figure 5.

5. Experimental Test

5.1. Indoor Environmental Quality Evaluation Standard

The evaluation of indoor environmental quality is based on the environmental

Figure 5. PSO-TSFNN algorithm flow.

data samples collected through a certain mathematical model to determine the environmental level, the purpose of the environmental quality evaluation is to be able to judge the indoor environmental quality level, and based on this to help people improve the indoor environment. Considering the thermal environment, light environment, acoustic environment, and air environment, this paper mainly selects six indexes for evaluation: temperature, humidity, light intensity, noise intensity, formaldehyde concentration, and carbon dioxide concentration. Refer to Indoor Air Quality Standard (GB/T 18883-2002), Standard for lighting design building (GB 50034-2013), Environmental Quality Standard for noise (GB 3096-2008), and Standard for Indoor Environmental Pollution Control of civil building engineering (GB 50325-2020) as the evaluation standard. Among them, the evaluation standard values of the evaluation indexes are shown in Table 1.

5.2. Model Training and Testing

1) Train Samples, Test Samples, and Expected Output

Train samples are generated according to random and uniform distribution among evaluation standards at all levels. Since the indexes of temperature, humidity, and light intensity have two properties, there are 8 cases according to the

Table 1. The standard value of the indoor environmental quality evaluation index.

arrangement and combination. 100 train samples are generated between the evaluation standards at all levels, and a total of 4000 samples are generated to solve the problem of too few train samples caused by only using the evaluation standards at all levels as train samples. The test sample is a random sample of 500 samples from the training sample in a ratio of 7:1. The expected output of samples less than class I environmental standards is the corresponding value between 0 and 1.5 according to the interpolation proportion when generating samples. the expected output of samples between class I environmental standards and class II environmental standards is the corresponding value between 1.5 and 2.5 according to the interpolation proportion when generating samples. And so on, the corresponding values between class II, III, IV, and V environmental standards are 2.5 - 3.5, 3.5 - 4.5, and 4.5 - 5 respectively, As shown in Table 2.

2) Model Training

The evaluation indexes temperature, humidity, light intensity, noise intensity, formaldehyde concentration, and carbon dioxide concentration are used as input vectors, and standard expected output values are used as output vectors. The model is trained with learning samples, and the data is normalized to improve the model training effect. Part of the sample data is shown in Table 3.

At the same time, to prove the superiority of the improved PSO-TSFNN model, the TSFNN model is used for comparison under the same conditions. The model structure of both is 6-12-1, and both use the gradient descent algorithm to iterate 300 times, and the learning rate is 0.0005. Figure 6 shows the variation of the sum of squared errors of the two models during the training process.

It can be seen from the above figure that the error of the PSO-TSFNN model decreases more rapidly, the final value is smaller, and the training effect is better. After the training, the error of the model is 0.2088, while the error of the TSFNN model is 0.4054, indicating that the TSFNN model optimized by the PSO algorithm has a stronger learning ability.

3) Model Testing

The generated model is tested with test samples, and the detection and evaluation outputs are shown in Figure 7, which can be seen. The output error of the TSFNN model is larger, with a total error of 17.6425, while the output of the PSO-TSFNN model is closer to the target output of the test, with a total error of 9.0418, which is 8.6007 lower than the total error of the TSFNN model test set.

Table 2. The expected output value of indoor environmental quality.

Table 3. Partially normalized sample training data.

Figure 6. Variation of network model training error.

Figure 7. Network model test effect.

5.3. Actual Environment Experiment

To verify the practicability of the system, the experiment of this system is carried out in the laboratory of the School of Computer Science and Engineering. Three laboratories in the college were selected as experimental objects, and the detection nodes were placed in the laboratories for evaluation index detection. The detection nodes are shown in Figure 8.

In this experiment, the evaluation indicators of 3 laboratories were tested at the same time during the laboratory work. The detection frequency is collected once every 10 seconds, and the hourly average detection results of node 1, node 2, and node 3 are recorded until the laboratory is closed. Due to the length of the article, this article only lists the test data of one of the laboratories throughout the day, and the test data of node 1 is shown in Table 4.

Figure 8. Detection node.

Table 4. Node 1 actual detection data.

The actual detection data of node 1 is evaluated by the PSO-TSFNN model, TSFNN model, AHP, and Nemerow exponential method [19] respectively. Among them, the weights of the analytic hierarchy process indexes are determined, mainly using the 1 - 9 scale method [20], combined with the scores of the three laboratory students. First, calculate the relative weight of each index, then perform a consistency check, and finally obtain the index weight. The evaluation results are shown in Table 5.

It can be seen from Table 5 that the output of the TSFNN model in the period from 14:00 to 15:00 is level two. It can be seen from Table 4 that the carbon dioxide concentration, temperature, and formaldehyde concentration are significantly higher in the period, and the humidity is low. Therefore, the evaluation output is biased; the output of AHP in the period from 12:00 to 13:00 is level two. The main reason is that the weights of formaldehyde and light intensity indexes are relatively high, and these two indexes are in Class I during this period. Therefore, the evaluation output is more subjective; the output of the Nemerow index method in the period from 10:00 to 11:00 is level one. The more important reason is that this method highlights the impact and effect of the most variable index on environmental quality, and all the indexes did not change too much during this period, but there were certain fluctuations in temperature, formaldehyde concentration, and carbon dioxide concentration. Therefore, the evaluation output is not comprehensive. The evaluation output of the PSO-TSFNN model conforms to the objective reality and can provide a reliable evaluation output for the indoor environment monitoring system.

The monitoring terminal uses the trained PSO-TSFNN model to evaluate and display the detection data of node 1, node 2, and node 3 received in the three laboratories. The evaluation results are shown in Figure 9, and the monitoring terminal is shown in Figure 10.

Figure 9. Environmental quality Evaluation results.

Figure 10. Monitoring terminal.

Table 5. Comparison of algorithm evaluation results.

The weight of AHP index is 0.0379, 0.0047, 0.1251, 0.1830, 0.5411, 0.1082.

By analyzing Figure 9, it can be found that the change laws of the three laboratories are similar on the whole. At 9:00 and 21:00, the environmental level of the laboratory is level one, which is mainly due to the small number of people in the laboratory in the morning and at night and the low temperature. During the period from 13:00 to 17:00, the environmental quality level of the laboratory fluctuated greatly, and the environmental level of No. 1, No. 2, and No. 3 laboratory reached level three. The important reason is that the weather on the day of the experiment is sunny, and the afternoon temperature and carbon dioxide concentration are relatively high.

6. Conclusions

The LoRa-based multi-sensor indoor environment monitoring and evaluation system can detect and classify the thermal environment indexes, light environment indexes, acoustic environment indexes, and air environment indexes that affect the quality of the indoor environment, and users can view them in real-time according to the monitoring terminal. By using LoRa communication technology, this system has a longer transmission distance than ZigBee, Bluetooth, and other communication methods, and can be extended to large-scale occasions such as teaching buildings and shopping malls for environmental quality monitoring.

The parameter model of the T-S fuzzy neural network is optimized by a particle swarm algorithm. The model combines particle swarm algorithm, fuzzy mathematics, and neural network, and has strong fuzzy reasoning ability. Based on the traditional T-S fuzzy neural network, the convergence speed and accuracy are improved. The system can objectively and accurately evaluate the indoor environment and provide a reliable basis for users to improve the indoor environment quality.

However, the learning factor and inertia weight of the network model are relatively fixed, and it remains to be tested how to change the learning factor or design a random function for the inertia weight to improve the training accuracy. Moreover, different membership functions and the number of fuzzy rules may also affect the training accuracy of the model. These are all questions to be addressed later in this article.

Fund

Supported by Technology R&D project of Sichuan smart tourism research base (ZHZJ19-01), and Graduate Innovation Fund of Sichuan University of Science and Engineering (y2021090, y2021092).

Conflicts of Interest

The authors declare no conflicts of interest regarding the publication of this paper.

References

[1] Loosová, J. and Hernych, M. (2021) Indoor Environment Monitoring as a Measure to Reduce Epidemic Spreading. 2021 IEEE International Workshop of Electronics, Control, Measurement, Signals and Their Application to Mechatronics (ECMSM), Liberec, 21-22 June 2021, 1-7.
https://doi.org/10.1109/ECMSM51310.2021.9468838
[2] Li, M.H., Xue, D.Z. and Wang, T.H. (2017) Indoor Environment Quality Evaluation Based on Data Fusion. Journal of Xi’an University of Architecture and Technology (Natural Science Edition), 49, 611-616.
[3] Chen, H.Y., Lin, Q., Liu, W.W. and Wang, F.F. (2019) Application of Attribute Recognition Model Based on Entropy Antoriyt in Evaluation of Indoor Air Quality. Environmental Engineering, 37, 205-209.
[4] Wang, Y. and Cui, Y.H. (2020) Research on Indoor Air Quality Evaluation Based on Improved BP Neural Network. Journal of Simulation, 8, 31-35.
[5] Yan, D.W. (2021) Indoor Environment Online Monitoring-Based on ZigBee Network. E3S Web Conferences, 284, 6.
https://doi.org/10.1051/e3sconf/202128404007
[6] Tijani, I.B., Almannaee, A.D., Alharthi, A.A. and Alremeithi, A.M. (2018) Wireless Sensor Node for Indoor Air Quality Monitoring System. 2018 Advances in Science and Engineering Technology International Conferences (ASET), Dubai, Sharjah, United Arab Emirates, 6 February-5 April 2018, 1-6.
https://doi.org/10.1109/ICASET.2018.8376839
[7] Zhou, Z.Z. and Wang, Q. (2021) Design of Indoor Environment Monitoring and Intelligent Adjustment System Based on LoRa Technology. Transducer and Microsystem Technologies, 40, 96-98+102.
[8] Zourmand, A., Hing, A.L.K., Hung, C.W. and AbdulRehman, M. (2019) Internet of Things (IoT) Using LoRa Technology. 2019 IEEE International Conference on Automatic Control and Intelligent Systems (I2CACIS), Selangor, 29-29 June 2019, 324-330.
https://doi.org/10.1109/I2CACIS.2019.8825008
[9] Ren, L.Y. and Yu, X.Y. (2021) Hardware Implementation of STM32 Microcontroller-Based Indoor Environment Monitoring System. Open Journal of Applied Sciences, 11, 997-1008.
https://doi.org/10.4236/ojapps.2021.119072
[10] Lv, W.L. and Wu, Y. (2021) Design of Indoor Environment Monitoring System Based on STM32 MCU. Scientific Journal of Intelligent Systems Research, 3, 19-22.
[11] Takagi, T. and Sugeno, M. (1985) Fuzzy Identification of Systems and Its Applications to Modeling and Control. IEEE Transactions on Systems, Man, and Cybernetics, SMC-15, 116-132.
https://doi.org/10.1109/TSMC.1985.6313399
[12] Sun, Z.Q. and Xu, H.B. (1997) Fuzzy-Neural Network Based on T-S Model. Journal of Tsinghua University (Science and Technology), 3, 77-81.
[13] Chen, H. (2016) Land Conservation and Outdoor Environment Evaluation Method of Green Railway Station. Journal of Railway Science and Engineering, 13, 1433-1438.
[14] Jiang, X.Q., Chen, W.F., Guo, L.J. and Huang, Z.W. (2020) Application of T-S Fuzzy-Neural Network Model in Water Quality Comprehensive Evaluation. Procedia Computer Science, 166, 501-506.
https://doi.org/10.1016/j.procs.2020.02.057
[15] Kennedy, J. and Eberhart, R. (1995) Particle Swarm Optimization. Proceedings of ICNN’95—International Conference on Neural Networks, Perth, 27 November-1 December 1995, 1942-1948.
https://doi.org/10.1109/ICNN.1995.488968
[16] Eberhart, R. and Kennedy, J. (1995) A New Optimizer Using Particle Swarm Theory. MHS’95 Proceedings of the Sixth International Symposium on Micro Machine and Human Science, Nagoya, 4-6 October 1995, 39-43.
https://doi.org/10.1109/MHS.1995.494215
[17] Yu, Z.Y. and Han, L.T. (2013) Environmental Air Quality Assessment Method Based on Immune Optimization Algorithms with Particle Swarm. Chinese Journal of Environmental Engineering, 7, 4486-4490.
[18] Zhang, Y.D., Wang, S.H. and Ji, G.L. (2015) A Comprehensive Survey on Particle Swarm Optimization Algorithm and Its Applications. Mathematical Problems in Engineering, 2015, 38.
https://doi.org/10.1155/2015/931256
[19] Pan, B.F., Wang, S., Li, M.S., Gong, Z.Y. and Zhang, J.H. (2015) Study on Comparing Ranking Methods of Ambient Air Quality in Urban Area. Environmental Engineering, 33, 135-138.
[20] Wang, Z.H. and Zhou, J. (2013) Research on Green Building Evaluation System Based on AHP. Construction Economy, 2013, 79-82.

Copyright © 2024 by authors and Scientific Research Publishing Inc.

Creative Commons License

This work and the related PDF file are licensed under a Creative Commons Attribution 4.0 International License.