Improved Soil Moisture and Electrical Conductivity Prediction of Citrus Orchards Based on IoT Using Deep Bidirectional LSTM

: In order to create an irrigation scheduling plan for use in large-area citrus orchards, an environmental information collection system of citrus orchards was established based on the Internet of Things (IoT). With the environmental information data, deep bidirectional long short-term memory (Bid-LSTM) networks are proposed to improve soil moisture (SM) and soil electrical conductivity (SEC) predictions, providing a meaningful reference for the irrigation and fertilization of citrus orchards. The IoT system contains SM, SEC, air temperature and humidity, wind speed, and precipitation sensors, while the mean absolute error (MAE), root mean square error (RMSE), and coefficient of determination ( R 2 ) were calculated to evaluate the performance of the models. The performance of the deep Bid-LSTM model was compared with a multi-layer neural network (MLNN). The results for the performance criteria reveal that the proposed deep Bid-LSTM networks perform better than the MLNN model, according to many of the evaluation indicators of this study.


Introduction
Citrus is a widely planted fruit crop throughout the world [1] that grows well in different kinds of environments in many countries [2] such as China, Brazil, and the United States. Among these countries, China's planting area and its production of citrus are the largest, distributed mainly in Guangdong, Guangxi, and Sichuan, making considerable profits every year [3]. Citrus cultivation in China has been intensified with the use of large-area orchards [4]; at the same time, drip irrigation is widely applied in citrus growing. Therefore, the decision-making and scheduling of the irrigation of citrus orchards have become important problems [5]. The traditional drip irrigation operation depends mainly on subjective experience to make decisions and schedules and lacks an objective reference [6]. It has been proved by practice and research that soil moisture (SM) plays an important role in reflecting the water shortage of citrus orchards [7]. SM is directly related to the growth of citrus fruit trees [8]. On the other hand, soil electrical conductivity (SEC) is relative to soil salt content and organic matter content [9]. Unreasonable SEC has a negative impact on the root absorption of inorganic salts and organic matter in the soil. For these reasons, it is important to obtain the environmental information of largearea orchards and establish prediction models of SM and SEC, which would be helpful in managing the irrigation and fertilization of citrus orchards.
In recent years, with the wide application of the Internet of Things (IoT) systems [10], the real-time monitoring of citrus orchard environments has become an essential basis for precision agriculture. Zhang et al. [11] have designed an IoT system to monitor SM and nutrients. This IoT system includes a wireless sensor network (WSN), an environment information database, an expert knowledge base regarding citrus irrigation, and other modules. This knowledge base is an important guideline for irrigation and fertilizer scheduling in the citrus orchards. This team has built an expert decision-making system based on the water requirements of citrus in different growing stages and the IoT environmental information. This system could help growers to manage the fertilization and irrigation scheduling precisely and scientifically with the environmental data of the IoT system. The research is mainly based on the use of real-time and remote systems to manage the citrus orchard. However, there are limitations to obtaining long-term environmental information of orchards, and it is challenging to realize the integrated irrigation scheduling and management of large-area citrus orchards.
Sawant et al. [12] proposed an interoperable agro-meteorological observation and analysis platform based on an IoT sensor system. This research aimed to solve cropweather-soil continuum issues. It is helpful to discover, access, and share the WSN data of precision agriculture. With this platform, the WSN sensors could be used in many applications, such as plug-and-play, remote monitoring, and crop water requirement estimation. This study facilitates the deployment of the IoT system, but it is difficult to adapt to citrus environments in mountainous and hilly terrain because the wireless signals easily experience interference in these complex areas.
J. Kolassa et al. [13] developed neural networks (NNs) to study the NASA Goddard Earth Observing System Model version 5 (GEOS-5) dataset containing surface SM data from April 2015 to March 2017 from the observations of the Soil Moisture Active Passive (SMAP) satellite. In the study, the SMAP Level-2 Passive (L2P) retrieval method was used for comparison with the NN for surface SM modeling. The analysis of SM using the Advanced Microwave Scanning Radiometer 2 (AMSR2) and Advanced Scatterometer (ASCAT) SM retrievals showed that the inversion errors of NN and L2P have the same spatial distribution. Furthermore, the inversion errors of NN were lower in the dense vegetation area and transitional vegetation area, which means it could integrate more features of surface SM. However, this study was based on an existing SM dataset, which means it could not collect real-time environmental data, as performed by the IoT system. Meanwhile, this study did not integrate the SM with the meteorological information characteristics of the specific orchard, so it could not be used for irrigation scheduling.
Adeyemi et al. [14] designed a dynamic SM prediction model which can be used as a reference for decisions about irrigation scheduling in crop fields. Classical long short-term memory (LSTM) networks are included as cores of the dynamic learning function. The main idea of this model was to obtain the future SM according to the SM of past period and the environmental information from three different areas. This project carried out a dynamic prediction of SM and made simulations of a potato-growing season using AQ-UACROP; however, it did not represent large-area citrus orchards, with only one observation site in every orchard, because large-area orchards have different terrain characteristics and occasionally altitudes, and there may be slight differences in terms of the internal SM migration mechanism. Considering the differences in crops and climate in the three study regions, the model may not be able to adapt to all regions completely.
Liang et al. [15] developed a nonlinear inversion method of SM based on the backpropagation neural network (BPNN). An important operation of this study was to separate the direct and indirect remote sensing data of Global Navigation Satellite System Interferometric Reflectometry (GNSS-IR). Then, the vegetation water content estimation model was established. After the correction of the phase of the signal-to-noise ratio (SNR), a Genetic Algorithm BPNN model was built for SM inversion. The proposed model had a good nonlinear fitting capability, reducing the effect of vegetation on the SM inversion and also illustrating the effectiveness of the study. The advantage of using remote sensing data acquisition is that it can carry out the comprehensive acquisition of soil environment information of large-area orchards. However, one of the disadvantages of using remote sensing data to carry out modeling and inversion is its poor real-time performance, making it difficult for the inversion model to grasp the changes in the orchard soil environment quickly.
Most citrus orchards in China are located in complex mountainous areas, making it difficult to obtain a steady supply of irrigation water, so citrus orchards often need to stock up on supplies such as water and fertilizer. Due to the high cost of soil sensors, it's expensive and impractical to deploy too many sensors in the orchards. In addition, although soil sensors measure real-time data, they may malfunction, causing data loss. At the same time, citrus orchards in China are mostly irrigated by drip irrigation; therefore, purposeful irrigation scheduling and decision-making can improve the utilization of water resources. Martínez-Gimeno et al. [16] proposed an irrigation schedule using the frequency domain reflectometry method and a LEACHM hydrological simulation model. This research suggested that critical soil moisture is helpful for irrigation scheduling. The goal of this research was to propose a deep bidirectional LSTM (Bid-LSTM) model based on the expert knowledge of citrus proposed by Zhang et al. [11] and the dynamic SM prediction model for irrigation scheduling in potatoes researched by Adeyemi et al. [14]. Furthermore, we aim to enhance the future SM and SEC prediction of citrus orchards based on the IoT to provide a reference for making irrigation, fertilizer scheduling, and supply ordering ahead of time. On the other hand, the Bid-LSTM model is also useful when the soil sensors malfunction with data loss, as it can provide a reliable reference to the managers of a citrus orchard. The specific objectives of this paper are as follows: (1) To collect the environmental information of citrus orchards based on the IoT system with general packet radio service (GPRS) protocol and transfer it to a remote MySQL database; (2) To propose a Bid-LSTM model based on LSTM and train with preprocessed IoT data to calibrate its performance; (3) To provide a meaningful reference for the irrigation scheduling and fertilization management of citrus orchards by fitting the predicted and measured data, SM and SEC, respectively, to evaluate the performance of the models after the training.

Study Area
The experimental area was located in a citrus orchard (114°29′6.666″ E, 23°29′53.2284″ N) in Boluo County, Guangdong Province, China, as shown in the red frame in Figure 1. The total area is about 66,000 m 2 , and the planting variety was "Shatangju" (Citrus reticulata Blanco). There were five sections in the orchard, and drip irrigation pipelines were uniformly arranged. Since the water pressure of the irrigation pipelines in the orchard was limited, in order to ensure a good effect on irrigation and fertilizer tasks, each section was carried out separately. It typically took about 3-7 days to irrigate all of the sections, which also required consideration of water storage. If the water supply was not guaranteed in time, the process might take longer. Therefore, it is necessary to provide predicted SM and SEC data to the managers as references in a period of time. The row spacing of the fruit trees is 4 m, the plant spacing is 3 m, and the average plant height is 2 m. The soil in this area is mainly sandy loam, with high temperatures and rain in the summer. The annual rainfall of this area is 1700 mm, while there is less rainfall in winter, meaning that it is prone to drought in this period. The citrus orchard is in hilly terrain [17] with complex environmental conditions, and interference with wireless data transmission occurs regularly, which may cause packet loss.

Structure of System
The IoT system of this paper was designed to monitor the real-time environmental information of citrus orchards. The system contained four layers [18]: one node layer, short-distance wireless communication layer, GPRS layer, and remote server layer. The overall structure of the system is shown in Figure 2. The first layer included two parts. The first part was the weather station node, which collected air temperature, air humidity, wind speed, and precipitation data and was set at the height of 2.5 m in the citrus orchard. The second part was the data acquisition node, which was mainly used to collect SM, SEC, and soil temperature (ST) data with sensors deployed in five different study areas. The sensors were set at a soil depth of 20 cm to reflect the surface soil condition. The short-distance wireless communication layer was designed to transfer collected data through an omnidirectional wireless antenna whose impedance was 50 Ω in 2.4 GHz using the ZigBee protocol based on the IEEE802.15.4 technical standard [19]. The purpose of the GPRS layer was to connect to a wireless wide area network (WAN). With the GPRS network, the collected data of the citrus orchard could be transferred to a remote server. The last layer was a remote server integrated with the MySQL database. The structured data table of the database was developed to store the environmental data [20]. The data were collected from 1 December 2019 to 30 November 2020.

Hardware of IoT System
The core processor was STM32F103R8T6, manufactured by STMicroelectronics. The GPRS DTU (WG-8010-232, TianTong Tech Inc., Beijing, China) had an RS232 serial communication port to transfer data between the IoT node and the remote server. The ZigBee module (CC2630, Texas Instruments, Dallas, TX, USA) was integrated with 32-bit dual cores to receive and handle data efficiently. Lithium batteries (AN-12010000, Yingneng Tech Inc., Dongguan, China) and solar panels (DJB-18V10WK, Qianyan Tech Inc., Changsha, China) were used as the power supply for the IoT system. The sensors, including an SM, SEC, and ST three-in-one sensor (YDBS-3001, Jingxun Tech Inc., Weihai, China), air temperature and air humidity two-in-one sensor (SM2110B, SONBEST Tech Inc., Shanghai, China), wind speed sensor (VMS-3000-FSJT, Weimengshi Tech Inc., Hangzhou, China), precipitation sensor (PR-YL-N01-3003, Puruisenshe Tech Inc., Jinan, China) and other components of the IoT system are shown in Figure 3. The ZigBee module and soil sensors were integrated on the motherboard powered by the lithium battery. The environmental data were transferred through the ZigBee and GPRS network and grouped in a remote server. The air sensors included an air temperature sensor and air humidity sensor. The weather data were transferred to a remote server directly through the GPRS network. The data uploading period of the weather station was 30 min. According to Zhuo et al. research [21], it's effective to deploy 828 sensors in grids of a 22,124 km 2 catchment, meaning that 3.74 10 sensor·m −2 was enough to monitor the environmental information. Considering the high cost of sensors, five nodes deployed in the five sections of the 66,000 m 2 study area were enough to measure the SM and SEC.

Software of IoT System
The software of the IoT system mainly included the ZigBee networking protocol and the node working protocol. Considering that all of the nodes were deployed in the citrus orchard with a solar supply, to reduce node energy consumption and packet loss, the tree networking mode was adopted to reduce the data forwarding and increase the communication distance of different nodes as shown in Figure 4. According to Dursun et al.'s research [22], the measured soil data in the center was closer to the mean value. Thus, five nodes were deployed in the center of each section to represent each SM and SEC, respectively. On the other hand, the nodes used a dual working mode, i.e., normal mode and sleep mode, with durations of 1 min and 10 min, respectively. In the normal mode, the system ran as planned to collect environmental information and transfer data through the ZigBee network. In sleep mode, the system was set to sleep until the timer woke up the core processor. With these strategies, the IoT system worked well for a long time under a solar power supply. The node working protocol is shown in Figure 5.

Data Preprocessing and Correlation Analysis
The IoT system in this paper contained five data acquisition nodes, one gateway, and one weather station node deployed in the orchard, fixed with brackets at the height of 2.5 m. This was effective for reducing the interference of wireless data transmission from the citrus tree canopy. The maximum distance between single nodes was 344 m, measured by a laser rangefinder (PRO XE, Bushnell, Beijing, China). Both SM and SEC are essential factors to the growth of citrus, which are directly related to the yield and quality of citrus [23]. Considering the collected environmental data had different magnitudes, it was necessary to first normalize the data. In this paper, the linear function normalization method [24] (min-max scaling) was applied to convert the data to the range [0, 1]. The equation is shown in Equation (1).
where norm is the normalized data and is the original data. and represent the maximum and minimum of the original data.
After the normalization preprocessing of the original data, the Spearman correlation coefficient [25] of the environmental parameter with the SM and SEC was calculated with Equation (2): where is the correlation coefficient, di is the difference between the two ranks of each observation, and n is the number of observations. The significance level (p-value) of the Spearman correlation coefficient was conducted using Pandas and the Scipy computing library. The correlation coefficient results and p-value between the environmental information and the SM and SEC obtained by the nodes are shown in Table 1. The SM and SEC had some correlation with air temperature and air humidity. The correlation between SM and precipitation was 0.3, i.e., a weak correlation, meaning that precipitation was just one of the secondary factors affecting SM. The correlation between SEC and air humidity was 0.27, while the correlation between SM and air humidity was 0.53, indicating that the influence of SEC may be more complex. The correlation coefficient between SEC, minimum temperature, and ST was 0.43 and 0.49, respectively, revealing that temperature may be a significant factor affecting SEC. The pvalue indicated that the significance level was strong between SM and SEC and environmental information factors, which was the basis for the realization of modeling and training in this paper. This paper took the 14-day environmental data as one step in terms of prediction steps and adopted the cyclic step method to form input features.

Deep Bidirectional LSTM Networks
A neural network is an efficient way to resolve complex, nonlinear problems [26]. However, a traditional neural network cannot predict future changes with historical data; in particular, the prediction of time series data, such as market sales, stock prices, and PM2.5 [27]. The sequence data, i.e., time-series data, are not only related to the current conditions but also have a high correlation with the previous data; they are difficult to model with a traditional neural network. In recent years, the recurrent neural network (RNN) [28] has been successfully applied in natural language processing, machine translation, and text prediction, showing a better result than a neural network. The RNN differs from general feedforward networks because it contains a hidden state extracting feature and then transforms to output data. On the other hand, RNN shares the weights, biases, etc., in all calculation steps, which makes it dependent on the connected nodes [29]. However, the standard RNN also has its disadvantages; for example, the input and output data are the same size. In addition, the hidden layer state of each layer of the RNN is obtained by the transformation and activation function of the hidden state of the previous layer, making it easy for a gradient vanishing and gradient exploding problem to occur when the RNNs take the derivative of backpropagation at certain steps [30]. Therefore, the standard RNN does not perform well enough to deal with long-term dependence problems [31].
As a special RNN, LSTM contains a gate to control what information should be thrown away, called the "forget gate" [32]. Secondly, to avoid the gradient vanishing problem, the gradient derivative is replaced by summing when the hidden layer state is calculated. Thus, the LSTM has the theoretical ability to solve long-term issues [33]. The LSTM unit is shown in Figure 6. The LSTM unit is composed of an input xt, cell state St, temporary cell state ct, input control it, hidden layer state ht, forget gate ft, and output gate ot. The equations used in this method are as follows: = σ ⋅ ℎ , + = ℎ ⋅ ℎ , + = * + * = σ ℎ , + Equation (3) is the formula of the forget gate and the value range of is (0,1), which determines how much information should be forgotten to prevent the network breakdown. The sigmoid function makes the equation nonlinear and helps bring the equation close to the actual value, improving the accuracy of the prediction. Wf and bf are the weight and bias parameters, respectively. ℎ and are the previous hidden states and input values, respectively. The total length of ℎ , is the sum of the length of ℎ , respectively. The second part is the input gate with the sigmoid and tanh functions to control how much information should be received in the current cell calculated by Equations (4) and (5). In the two equations, controls the input data with the sigmoid activation function. If the value is 0, the input data will be blocked. If the value is 1, the input data are allowed to pass through this gate. and are the weights of the input gate. The cell state is added by the vector , with a tanh activation layer. The next step is the combination of these two gates to update the cell state calculated by Equation (6). Equation (6) has two parts, * represents the information that is previously selected to be forgotten, while the other part, * , is how much information should be updated in the current cell state. The sum of the two parts determines the new cell state, which contains the previous and current information. The last layer is the output gate, consisting of two activation functions, as shown in Equations (7) and (8). The is the output information represented by the sigmoid function with two weights: and . The updated cell state is put through the tanh function to ensure its value range is [−1, 1] and then multiplied by o to output the information as ℎ .
After the operations above the filtered information, including and ℎ , takes the long-term storage data and calculated relevant data to the next cell. Therefore, the useful information will be extracted from several rounds of training processing.
Based on the LSTM model, a Bid-LSTM [34] network is established, as shown in Figure 7. In this Figure, both the forward layer and the backward layer are connected to the output layer. The Bid-LSTM network structure [35] contains six groups of shared weights: w1, w2, w3, w4, w5, and w6. In the forward layer, the network carries out a calculation from the initial time to time t. In the backward layer, the network calculates data from time t to the initial time to obtain the output of the backward hidden layer at each moment. The combined output of the forward and backward layers is the final output, whose equations are as follows [36]: where ℎ1 and ℎ1 are the output values of the bidirectional unit, and w1-w6 represent the weights of each layer. As shown in Figure 8, the Bid-LSTM network in this paper is mainly composed of the input layer, LSTM1 layer, LSTM2 layer, fully connected layer, and output layer. The LSTM1 layer is the first Bid-LSTM network which is designed to preprocess input features such as air temperature, air humidity, wind speed, and precipitation and transfer them to the next layer. The LSTM2 layer is the second Bid-LSTM and extracts abstract features of the previous layer to the next layer. The fully connected layer transforms the nonlinear multi-dimensional data and outputs the result. In this paper, the first LSTM layer had 128 neural nodes, and the second layer had 64 neural nodes. The fully connected layer had 16 neurons, and the output layer had one neuron. The ReLU activation function, MSE loss function, and Adam optimization algorithm were applied in the model. The number of epochs was 300, and the batch size was 72.

Multi-Layer Neural Network (MLNN)
Compared with the RNN, the traditional MLNN [37] is a commonly used neural network to perform nonlinear regression fitting in time series data. The MLNN structure [38] consists of an input layer, two hidden layers, and an output layer. The MLNN model contained four layers [39] in the work presented in this paper, in which the nodes of the input layer were N, representing the number of input features. There were two hidden layers, of which 15 neurons were in the first hidden layer, and ten neurons were in the second hidden layer. The last layer was the output layer with one neuron. The backpropagation and stochastic gradient descent (SGD) methods were applied to train and update the weights of the MLNN network.

Performance Criteria of the Models
The performance of the model in this paper is represented by the root mean square error (RMSE) [40], mean absolute error (MAE) [41], and the coefficient of determination (R 2 ) between the predicted value of the models and the measured value was calculated to describe the interpretability of the model. The equations are as follows: where pred is the predicted value, cal is the measured value, cal is the mean value of the measured value, and N represents the number of samples.

Model Training Settings
In this work, the environmental data of five nodes and one weather station in the citrus orchards were fused into five datasets. Each dataset represented the environmental information of each region of the study area. The node is shown in Figure 9. There were 365 preprocessed time series data points for each node. In total, 80% of the data was divided into the training dataset and 20% into the testing dataset.

Performance of Models
To build the Bid-LSTM and MLNN model quickly, the Keras framework and Scikitlearn scientific [42] computing framework were applied to train and test the model. As can be seen from the results shown in Figure 10, the MAE ranges of the MLNN model were 1.121-5.556 and 0.536-4.117 for the prediction of SM and SEC, respectively; while the MAE ranges of the Bid-LSTM model were 0.787-4.323 and 0.677-4.377, respectively. It was evidenced that the MAE value of Bid-LSTM was lower than that of the MLNN model for SM prediction. However, the MAE of Bid-LSTM for SEC was higher than that of the MLNN model, which could be due to the poor local fitting performance caused by the dataset. In terms of RMSE criteria, the RMSE ranges of the MLNN model fitting for SM and SEC were 1.367-7.599 and 1.161-5.939 in Figure 11, respectively, while the RMSE ranges of the Bid-LSTM model fitting for SM and SEC were 1.406-5.031 and 1.12-6.524, respectively. From the fitting performance of the two models for SM, the RMSEs of the node one to node four datasets for the Bid-LSTM model were 29.8%, 41.6%, 33.8%, and 59.7% lower than those of the MLNN model, respectively, indicating that the performance of the Bid-LSTM model was better than that of the MLNN model. Although the RMSE of the Bid-LSTM model was 2.9% higher than that of the MLNN model in node dataset five, the RMSEs of Bid-LSTM and MLNN were 1.121 and 0.787, respectively; however, it was revealed that this did not affect the above conclusion. As for the performance of the two models for SEC, the RMSEs of the Bid-LSTM model were 61.5%, 15.6%, 27.2%, and 3.5% lower for node 1, 2, 3, and 5 datasets, respectively, than those of the MLNN model; however, for the node four data, the RMSE of Bid-LSTM was 15.3% higher than the MLNN model. The fluctuations in the datasets caused by the environmental situation had a negative impact on the model prediction [43]. The MAE criteria reflect the deviation between the predicted value of a single sample and the mean value of all datasets, while RMSE represents the degree of dispersion of all the samples [44]. Therefore, in this paper, R 2 was used to describe the interpretability of models, i.e., fitting with linear regression between the predicted value and measured value. The closer R 2 was to 1, the better the performance of the model [45]. As we can see from Figure 12, in terms of fitting SM, the R 2 range of the MLNN model was 0.778-0.865, while the range of the Bid-LSTM model was 0.884-0.977. From each dataset, we can see that the R 2 performance of the Bid-LSTM model in node datasets 1, 2, 3, and 5 was much better than that of the MLNN model because the R 2 of the former was over 0.9, while the latter was less than 0.9. Additionally, the R 2 values of the two models in node four were close to each other, indicating that the reliability of the Bid-LSTM model was generally better than that of the MLNN model. As for SEC, the R 2 performances of the two models were similar; however, the fitting ability of the MLNN model for SEC was worse than that of Bid-LSTM compared to its prediction performance for SM because the R 2 of the MLNN model showed three of five results that were less than 0.8 ( Figure 12). Thus, one can conclude that the Bid-LSTM model performed better than the MLNN model in most situations.

Performance of Model Fitting
In this paper, the predicted values given by the Bid-LSTM and MLNN models were compared to the measured values of the SM and SEC of each node dataset to establish the regression analysis. The results are shown in Figures 13-16. Figures 13 and 15 showed the fitting result of the SM predicted by the Bid-LSTM and MLNN models. In Figure 13, during the periods of 15 days to 25 days, SM gradually fell due to the lack of rainfall and irrigation. Furthermore, the two models of SM prediction results seemed similar at this time. On the 26th day, the measured SM increased rapidly in a short time due to the manual irrigation activity. The Bid-LSTM model captured this change, although it gave results which were 6.7%, 5.5%, and 16.5% lower for nodes 1, 4, and 5, respectively, than the measured SM, and values that were 8.9% and 2.5% higher for nodes 2 and 3, respectively, than the measured SM. From the 27th day, the SM showed a downward trend with no rainfall or manual irrigation. The predicted SM of the Bid-LSTM and MLNN model did not deviate significantly from the measured value curve. After the 52nd day, we can see from a1-e1 of Figure 15 that the predicted value of the MLNN model began to show a visible deviation from the measured value, which was up to 94.5% higher than the measured SM, and the Bid-LSTM model was only 34% higher than the measured SM, indicating that the MLNN model could not make an accurate long-term prediction. As can be seen from the fitting diagram of a2-e2 in Figures 13 and 15, the data points of the Bid-LSTM model were more concentrated than the MLNN model, so the overall R 2 was higher than that of the MLNN model, meaning that the reliability of the Bid-LSTM model was higher. According to Figure 11, the RMSE of the Bid-LSTM model in the node five dataset was higher, while the R 2 was lower, showing that a single RMSE criterion was not completely equivalent to the performance of the model. Figures 14 and 16 show the prediction effect of the two models on SEC. It can be seen that the prediction performance of the two models on SEC was not as good as that of SM because of the lower SM and SEC. SEC is a complex factor [46] affected by soil nutrients, salinity, soil fertilization, organic matter content, and other parameters [47]. Figures 14  and 16 show that the five nodes of orchard SEC were mainly in the range of (6, 60) μS·cm −1 . The SEC prediction of the MLNN model on the node one dataset had obvious large fluctuations, with a maximum predicted SEC of 104.3 μS·cm −1 on day 64. Compared with the MLNN model, the Bid-LSTM model performed better on the node one dataset because it did not provide a predicted SEC that was far outside of the normal range. The fitting results of datasets 2, 3, and 4 showed that the predicted values of the SEC of the two models showed some fluctuations after fertilization and irrigation activity on the 26th day, meaning that human operation had a negative impact on model prediction. After the 52nd day, both models showed deviation, and the largest deviation was more than 100%. As can be seen from Figures 14 and 16, the MLNN model had a lower R 2 when predicting SEC. The outliers in the fitted scatter diagrams of a2-e2 in Figures 14 and 16 may be because of the complex environmental factors in the citrus orchard causing stochastic errors in the sensors when measuring SEC. Both models presented good results in predicting SM and SEC in dataset five, indicating that it was easier to obtain an ideal modeling result.    (a-e) represents node 1-5, respectively; in (a1-e1), the blue line represents the measured SEC, and the orange line represents the predicted SEC; (a2-e2) represents the regression fitting between the predicted SEC and measured SEC.

Method of Model Selection
The Akaike Information Criterion [48] (AIC) is widely used as a method for model selection. The MSE of the predicted value and the measured value was applied to calculate the selection basis of the models; the smaller the AIC value, the better the performance of the model on this dataset. The formula is as follows [49]: 15) where N is the number of samples, and k is the dimension of the sample. The AIC result is shown in Table 2. It was proven that the Bid-LSTM model performed better than the MLNN model in most situations with a lower AIC value. In some cases, even though the AIC value of the Bid-LSTM model was higher than the MLNN model, it still provided better reliability when predicting the SM and SEC over a period in the future, which is helpful for the irrigation scheduling of a citrus orchard.

Discussion
This paper has shown that the IoT and Bid-LSTM method can provide a reliable prediction of the SM and SEC of citrus orchards. Applying the IoT system to collect environmental information of citrus orchards, a times series model with long-short term data was built to predict SM and SEC. As shown in Figures 10-12 and Table 2, it can be seen that the Bid-LSTM model performed well and gave reliable fitting results when predicting both the SM and SEC. The IoT system was suitable to be used to acquire the environmental data of large citrus orchards.
Compared with the MLNN model, the Bid-LSTM model was more robust when manual irrigation occurred. According to Cheng et al. [50], the Bid-LSTM was effective in extracting and learning the abstract features of time series data. The reason was that the Bid-LSTM model in this research had two LSTM layers, which were helpful to store previous information. When the new preprocessed data came into the LSTM cells, the useful information was calculated to update a new cell state. There has been previous research about the prediction of the SM and SEC to instruct irrigation scheduling. Adeyemi et al. [14] developed a dynamic neural network to model the SM. The results showed that the R 2 values of the model were 0.92, 0.96, and 0.98 for the three sites, respectively, showing a performance similar to this paper. The difference was that our environmental data came from the real-time IoT system installed in the citrus orchard, which had better adaptability and flexibility for the citrus orchard. Fang et al. [51] applied SM Active Passive (SMAP) data to predict the SM of the US with an optimized LSTM model. Although they provided RMSE results with a minimum of 0 and a maximum of 1, the study focused on the macroscopic SM study, and their results were based on the prediction performance of the model between one and three days. Although the RMSE of that study showed higher performance than the model in our paper, we focused more on the SM prediction modeling at the micro-level of orchards. Hateffard et al. [52] used an artificial neural network to model topsoil SEC, which gave a minimum RMSE and maximum R 2 of 6.27 and 0.95, respectively. Their results are similar to our model, but we obtained a lower RMSE in most situations. According to the model selection criteria given in Table 2, the Bid-LSTM model showed good results for RMSE, R 2 , and other performance aspects, and the modeling and prediction of SM and SEC were sufficient to meet the practical requirements.
However, the Bid-LSTM model used in this research was not always desirable in certain situations. As mentioned above, the quality of the datasets played a critical role in modeling. As shown in Figures 13-16, the SM and SEC of the five nodes were different. The reason was that the study area was divided into five sections, with a clear dividing line in the orchard. Therefore, the different irrigation times, number of citrus trees, water runoff, leaf area, and growth status of citrus trees in each plot, leading to differences in the SM and SEC values in different regions. This paper just used one node in each section to make the Bid-LSTM model and predict SM and SEC; it's meaningful to carry out future work to get more data in other areas to optimize and estimate the transfer learning ability of the proposed model. This paper also found a unique phenomenon in that the two models performed slightly worse when predicting SEC than SM, which may be because the SEC was greatly affected by the moisture, salt, nutrients, and organic matter in the soil. Therefore, future research and the consideration of more factors and related sensors will be needed to acquire more precise soil parameters. Further research can also consider setting up a multi-point and multi-depth three-dimensional environmental data acquisition network based on the IoT to build a three-dimensional spatial and temporal distribution inversion model of the SM and SEC to provide more three-dimensional data support and more precise decision-making guidance for citrus orchard irrigation.

Conclusions
An IoT system was designed to monitor environmental information in real-time to deal with the long-term irrigation scheduling of large-area citrus orchards. The meteorological station node was used to collect local weather data, which were transferred to a remote server through the ZigBee network and GPRS. We used the linear function normalization method to convert the collected data to the special range of (0,1), and we also used the Spearman correlation coefficient to observe the relativity between different environmental parameters. The deep Bid-LSTM model was established to predict the SM and SEC to provide a valuable reference for irrigation and fertilization schedules. The research has led to the following conclusions: • The IoT system built in this paper aimed to collect environmental information, including the SM, SEC, ST, air temperature, air humidity, wind speed, and precipitation.

•
Compared to the predicted values and measured values using regression fitting, the Bid-LSTM model showed better performance than the MLNN model, even though the former model showed a higher deviation in a few cases due to the negative impact of environmental factors. The R 2 criteria showed that the Bid-LSTM model was more reliable than the MLNN model.

•
The AIC values showed that the Bid-LSTM model was reliable in most situations compared with the MLNN model.
There were some differences in the requirements for water and fertilization of citrus in different growth stages. In addition, it took a long time to conduct irrigation and fertilization schedules for a large-area citrus orchard. The Bid-LSTM prediction model of the SM and SEC established in this paper, combined with the current weather information and soil conditions, is valuable for providing a reference for irrigation and fertilization scheduling to improve water and fertilizer use efficiency. Further research can be carried out combining an expert knowledge base and predicted soil information to estimate the effect of long-term irrigation scheduling.