An IoT Fast and Low Cost Based Smart Irrigation Intelligent System Using a Fuzzy Energy-Aware Routing Approach

Agriculture plays a major role in the world economy and most people depend on it for their livelihood. This makes water an important resource that must be conserved using the latest available technologies. Today, the Internet of Things (IoT) has extended its capabilities to smart farming. In this paper, an automated and low-cost system for intelligent irrigation based on a Fuzzy-based energy-aware routing approach is presented. In addition, a neural network is trained to determine the best irrigation program, based on information received from sensors (such as temperature, soil moisture, etc.). The user in the system can monitor the data collection process with mobile phones, mobile computers, etc. and manage the irrigation of agricultural products. The proposed system proves its suitability with intelligence and low cost and portability, for greenhouses, farms, etc. The simulation results show that the proposed method offers better results compared to the LEACH protocol as well as the WSN-IoT algorithm in various criteria such as network lifetime and power consumption.


Introduction
Agriculture plays an important role in many countries and needs to become an intelligent industry [1]. The agricultural industry is currently evolving using modern intelligent technologies to find solutions for efficient use of resources. This has made water an important resource that must be maintained using the latest technologies. The Internet of Things (IoT) has developed its capabilities, in addition to industry, in smart agriculture [2]. Today, IoT is recognized as a new form of Internet use among users [2]. In IoT technology, all objects have a unique Internet address that can connect to the Internet. This new generation of the Internet has many applications in various fields, one of which is agriculture and water intelligence [3].
Modern and intelligent agriculture will be achieved by using interconnected communication equipment as well as new technologies such as IoT. Smart farming has advantages such as high and advanced efficiency, optimized arable land, high planning accuracy and so on. The use of existing technologies in intelligent agriculture has provided more profitability for farmers, increased the attractiveness of the agricultural industry and made such tools available to farmers to help them face future problems and challenges [4]. An intelligent irrigation device communicates with various sensors and manages irrigation based on the information it receives from the sensors. These sensors can inform the central device of information such as whether it is raining or not, and the ambient temperature, as well as the amount of soil moisture or the intensity of the wind. The advantage of this system over timer irrigation controls is its impact on water consumption because irrigation is done only when your trees and plants need water [5].
With the advent of the Internet of Things and digital transformation in rural areas, it is possible to intelligently control irrigation, soil moisture, crop growth monitoring, as well as preventive measures to detect damage by remote control. The use of this technology allows access to smart agriculture [5]. Remote management of agricultural activities with new technologies is a new field for research activities. This paper configures a fast and low cost management system for intelligent irrigation via wireless sensors and the Internet of Things. The data extraction unit includes a set of wireless sensors to measure agricultural activities and collect information related to irrigation parameters [6]. Based on information received from sensors (such as temperature, soil moisture, etc.), a neural network is trained to determine the best irrigation program. The user in the system can connect to an Internet network with mobile phones, mobile computers, etc. and manage the process of collecting information through the Internet of Things and monitoring agricultural products. In addition, a Fuzzy-based fast routing algorithm is designed to transmit information that helps distribute energy consumption in the network. The emphasis of the proposed method is on the analysis of routing protocol in the wireless sensor network (WSN) node for sending information from the hardware system to the interface software such as a mobile application [3].
The rest of this article is as follows: Section 2 deals with background and motivation. Some of the most recent work done in Section 3 is reviewed. Section 4 presents the proposed IoT-based method for creating an intelligent irrigation system. The results of the evaluation of the proposed method are given in Section 5 and finally the conclusions and suggestions are expressed in Section 6.

Motivation
Computers, and therefore the Internet, are almost entirely dependent on humans for information. This concept is the core of intelligent technology and can be used to properly manage irrigation in gardens, greenhouses, farms and farmland. Smart farming is a well-established domain, and combining technology with farmers' experience has numerous benefits: including improved crop health, better hygiene, faster tracking, water management, and more. Water is one of the most important resources in agriculture [7]. Large amounts of water are used almost 100 times more than personal consumption in agriculture and about 70% of river and groundwater is used for irrigation, which has made humans the largest consumer of water resources [8]. In addition, almost half of the water in traditional agriculture is lost due to evaporation. This has led to extensive work on the efficient use of this limited resource. Much work has been done and is being done by various research groups in the field of smart agriculture. As most IoT technology suggests wireless sensor networks to manage water consumption.

Literature review
Much research has been done on the Internet of Things and irrigation intelligence in agriculture to increase the quality of agricultural production as well as save water consumption. Krishnan et al. (2020) proposed Fuzzy logic based on intelligent irrigation system using IoT [9]. In this paper, the fuzzy logic controller is used to calculate the input parameters (e.g. soil moisture, temperature and humidity) and generate the output of the engine condition. Karar et al. (2020) proposed IoT and neural network-based water pumping control system for intelligent irrigation [10]. This paper aims to save water wasted in the IoT irrigation process based on a set of sensors and a multilayer perceptron neural network (MLP). Machine learning algorithm such as MLP neural network plays an important role effectively in supporting the decision of automatic control of IoT-based irrigation system, managing water consumption. Tiglao et al. (2020) proposed an intelligent irrigation system based on low-cost wireless network called Agrinex [11]. This provides an alternative to existing monitoring methods in agricultural land while providing an irrigation mechanism to assist resource conservation measures using a wireless sensor and excitation network. The Agrinex system has a network-like configuration of in-field nodes that acts both as a sensor for soil moisture, temperature and humidity, and as an actuator on a valve that regulates drip irrigation. Mousavi et al. (2020) proposed an approach to improve IoT security using encryption algorithms for intelligent irrigation systems [12]. This paper proposes a new hybrid encryption algorithm based on hedge encryption, elliptic-curve encryption, and secure Hash algorithm to protect sensitive information in IoT-based intelligent irrigation systems. The results confirm the effectiveness of this model and the solidification for confidentiality based on confidentiality analysis.
The WSN-IoT algorithm was proposed by Nawandar and Satpute (2019), which is a low-cost, intelligent IoT-based module for creating an intelligent irrigation system [13]. Including capabilities of this software are the manager mode for interacting with the user, making settings only once to estimate the irrigation program, neural network-based decision making for intelligent support and remote data monitoring. In addition, the system uses MQTT and HTTP to inform the user about the current status of crops and irrigation conditions even from a remote location. Alomar and Alazzam (2018) proposed an intelligent irrigation system using IoT controller and Fuzzy logic [14]. The purpose of this paper is to provide an IoT-based irrigation system that helps reduce irrigation frequency while increasing production through the use of Fuzzy logic. The system consists of a Mamdani fuzzy controller that obtains environmental characteristics, i.e., soil moisture and outside temperature through special sensors, then applies a series of fuzzy rules to control the flow of water through the water pump and the appropriate time and frequency for provides irrigation.

The proposed method
This paper presents an intelligent crop monitoring and irrigation system based on Fuzzy logic and neural network. Taking into account the needs of plants and soil, the proposed intelligent irrigation system achieves efficient utilization of water. To do this, the parameters of plant growth stage, ambient temperature, ambient humidity, soil moisture, evaporation rate, crop growth rate, crop water requirement, crop planting time, maximum and minimum temperature, geographical location, rainfall, irrigation method and type of mechanical stimulus are noticeable that is received from WSN. These parameters generally determine the water requirement of a product, which can be used to develop an intelligent and automatic irrigation system without any human intervention. In the proposed intelligent irrigation system, continuous monitoring of the environment, reading sensor data, connecting to a broker to disseminate information, deciding on irrigation mode, deciding on the amount of The amount of water output, transferring the decision to the Irrigation Unit (IU), decision feedback is done from the unit irrigation. Figure 1 shows a conceptual architecture of the proposed method consisting of four layers. The first layer is related to data collection through a WSN with fixed number of nodes. The nodes used in this section have the ability to collect the parameters defined for irrigation through a sense of environment. These nodes have the ability to convert analog signals to digital and use the radio frequency protocol to transmit information. In addition to WSN-related equipment, there is a water source available through the IU that can enforce submitted decisions. The second layer consists of a sensor information unit (SIU), which is responsible for processing data and communicating with devices connected to the Internet. Also, SIU can communicate and exchange data. The third layer consists of a GSM modem connected to the Internet through which the SIU can send information received from the WSN to the server (or application). Therefore, data analysis is performed by the server, which simplifies the system architecture. The fourth layer consists of a server or an application platform that the user (farmer) can view and manage its data. An application can be an app or website that runs on a mobile phone or personal computer In this research, a fast and low cost management system has been designed for intelligent irrigation through IoT. A number of wireless sensors are used to collect data. These sensors provide information such as temperature, soil moisture, temperature, amount of light, measurement of frost, etc. This data is used to measure agricultural activities and better management of the irrigation system. Based on the information collected, a neural network is trained to determine the best irrigation program. Here, a series of real inputs-outputs are used to train the neural network, which will be provided by an expert. The user in the system can connect to an Internet network with mobile phones, mobile computers, etc. and manage the process of collecting information through the Internet of Things and monitoring agricultural products. In  The basic routing protocol for implementing the proposed irrigation system is OSPF. In this protocol, SPF algorithm is used for routing and is based only on bandwidth [15]. In this paper the routing process in the OSPF protocol is improved by a Fuzzy system. Here, the network topology specification is considered as input based on a set of standard parameters.
The target network is a WSN network and includes a set of sensor nodes with the ability to send data. These nodes are actually IoT operators. Initially, the OSPF protocol is based on the WSN. This is done by sending a "hello" message and creating a neighborhood nodes. Neighborhood is defined here based on a threshold distance. In the next step, a routing table is created for each node. This is done by developing the SPF algorithm with a Fuzzy approach for each node. The OSPF protocol alternately modifies the neighborhood table based on LSA messages. However, the LSA is sent only in two cases: 1) Changes in the status of the links (for example, ending the energy of a node) and 2) A specified time range (for example, every second). Therefore, in case of changes, each node updates its neighborhood table and notifies the changes to its neighbors by sending an LSA.

Fuzzy approach to create routing table
The proposed routing system is such that the source node is first considered as the current path node ( ). The next is then identified based on all candidate nodes. That's mean, Where indicates 1 the number of candidate nodes for the current . Here, neighboring nodes are considered as candidate nodes. In the next step, based on a fuzzy system based on the law, for each node of the set of candidate nodes, the effect of its selection is calculated. Then one node is selected from the candidate nodes as the next node of the path. This selection is done based on the influence coefficient and the roulette wheel technique. Assuming the is selected, this node is considered as the current node, which means = . This process is repeated for the current node until the destination node is selected.
Fuzzy system designed based on the parameters "residual energy of the candidate node", "distance of the candidate node from the current node", "distance of the candidate node from the SIU" and "bandwidth of the link between the current node and the candidate node" determine the impact of each candidate node . Here the input parameters include 1) energy ( ), 2) distance ( ) and 3) bandwidth ( ). The parameters of the distance of the candidate node from the current node and the distance of the candidate node from the SIU are considered as the average sound. First, the values of these parameters are normalized based on the maximum value and then they become Fuzzy based on the trapezoidal Fuzzy set with three modes (Low, Middle and High). Figure 3 shows the considered trapezoidal Fuzzy set. The output of the Fuzzy system is also the influence coefficient which is modeled by the trapezoidal fuzzy set.

Fig. 3. Making system input parameters Fuzzy
The output is determined by a database of fuzzy rules designed by an expert, where the membership degree of each input pattern is calculated using the multiplier-field operator. The fuzzy rules considered are shown in Table 1.

Selecting the best irrigation program with neural network
Most research uses a threshold to decide on the type of irrigation. For example, if the temperature drops below -5, there is a possibility of freezing and irrigation is done. However, the parameters under consideration often include ambient temperature, humidity, soil-water content, which do not provide a simple relationship for decision making. Therefore, in this paper, an attempt has been made to use the neural network model instead of the threshold, where it can make the best decision for the current situation based on past conditions. Here, a neural network is trained to determine the best irrigation program based on information gathered by the Internet of Things. To do this, a series of real inputs-outputs are used to train the neural network, and this information is provided by an expert. The inputs considered in this system include ambient temperature, ambient humidity, soil moisture, evaporation rate, crop growth rate, crop water requirement, crop planting time and rainfall. In addition, the output of the system is a type of irrigation program that includes low pressure drip irrigation, high pressure drip irrigation, low pressure sprinkler irrigation, high pressure sprinkler irrigation, low pressure surface irrigation and high pressure surface irrigation.
In this paper, a multilayer perceptron neural network (MLP-NNs) is used, which has three input, hidden and output layers. The input characteristics are equal according to the parameters extracted by the sensors and the number of outputs is equal according to the defined types of irrigation. In addition, the number of hidden layers is 1 and the number of neurons in this layer is 4. The number of learning courses is equal to 1000 and the technique of learning weights is defined as descending gradient .The output of each node is generated by calculating the weight value of its input values and then performing the sigmoid activation function. Finally, the average square error (MSE) of the output is predicted and calculated based on its difference from the actual sample output. Figure  4 shows an example of the MLP-NN architecture based on the 3-4-1 configuration (i.e., 3 input nodes, 4 nodes in a hidden layer and 1 output node).

Results and discussion
The simulation is performed with MATLAB 2019a software and all tests are performed by an Asus laptop with Intel Core i7 processor and frequency and 3.0 GHz, 16GB memory. The simulation is performed on an IoT-based wireless sensor network topology. In the experiments performed, the values set for the parameters of the proposed method are as follows; Number of simulation cycles equal to 5000, LSA sending time range equal to 5 simulation cycles, agricultural land size equal to 100×100 meters, number of sensor nodes equal to 100, position of sensor nodes randomly with uniform distribution, initial energy of nodes equal to 0.2 joules, data packet size is equal to 4 KB, the size of Hello packets is equal to 25 bits, the position of the sensor information unit is equal to 50×50 meters and the number of fuzzy rules is equal to 12.
According to the energy consumption model [13] is used to send and receive data. In this model, if the distance between two nodes is greater than the threshold distance, the nodes send the packet with the maximum power level, otherwise, the package is sent based on the distance with an average power level. In this model, the amount of energy consumption for the sending nodes ( ) and receiving nodes ( ) is measured according to Eq. (1) and Eq. (2).
In these relationships, energy required to send / receive is one bit. And also the package size and the distance between the two nodes of the sender and receiver, respectively. And amplifier energy is to amplify the signal. In most studies, the threshold is considered as Eq. (3).

=
(3) Based on the information gathered by the Internet of Things, a neural network has been trained to determine the best irrigation program. The details of the neural network configuration are as shown in Table 2. In this section, extensive experiments have been performed to evaluate the performance of the proposed algorithm. First, the study of neural network convergence with 100 periods is presented. The neural network learning outcomes can be seen in Figure 5, where the error is measured in terms of square mean error (MSE). In the validation process, the best performance was achieved in period 85 with MSE equal to 0.0037699.

Fig. 5. Neural network convergence results
In another experiment, the residual energy of the network by separating nodes after the completion of routing cycles is reported in Figure 6. Given the initial energy of 0.2 J for nodes, the results show that the energy of most nodes is zero or close to zero after the end of routing cycles. In addition, the residual energy variance of the nodes is about 0.03, and only 6 nodes out of a total of 100 network nodes have energies greater than 0.1 J. These results indicate the appropriate distribution of energy consumption throughout the network. In the following, the residual energy of the network in the proposed method is compared to the routing cycles against the LEACH protocol [16] and the WSN-IoT algorithm [13]. At each routing cycle, the residual energy of the network is equal to the average residual energy for all network nodes. The results of this comparison are presented in Figure 7. In the first round of simulation, the network energy is 20 J. Here, a decreasing trend of network energy is observed during routing cycles for all methods. However, the proposed method shows less acceleration in energy reduction than other methods. The reason for the superiority of the proposed method is the use of energyaware technique in routing as well as proper distribution of energy consumption.

Fig. 7. Comparison of network residual energy in different methods
In another experiment, network lifetime and the number of live nodes were compared based on routing cycles in different methods. Figure 8 shows the results of this comparison. In the proposed method, death of the first node in the routing round is 2109. This criterion is 1057 for the LEACH protocol and 1625 for the WSN-IoT algorithm. Therefore, the proposed method offers better network life. In addition, after completing 5000 routing rounds, the proposed method with 22 live nodes reports better results than the LEACH protocol with 2 and the WSN-IoT algorithm with 4 live nodes.  Table 3 after the completion of 5000 routing rounds. In general, the proposed method based on IoT architecture as well as fuzzy based energy-aware routing algorithm has given better results than LEACH protocol as well as WSN-IoT algorithm.

Conclusions and future work
The world's population is growing and the current food supply is not enough to feed people. Today, traditional agriculture can be one of the reasons for the decline in food production, even if a lot of arable land is available. Therefore, it is necessary to integrate developing technologies with agriculture and perform intelligent agriculture. In addition, agriculture plays a major role in the world economy and most people depend on it for their livelihood. This makes water an important resource that must be conserved using the latest available technologies. Today, the Internet of Things has extended its capabilities to smart farming. In this paper, an automated and low-cost system for intelligent irrigation was designed. Here, IoT is used to build devices that automatically communicate with each other in the system and has features such as: manager mode for user interaction, setting irrigation schedule, neural network-based decision making for intelligent support and remote data monitoring. The proposed system has proven to be intelligent, low cost and portable, suitable for greenhouses, farms, etc.
For future work, it is recommended to use an IoT-enabled microcontroller which is equipped with internet to transfer information between the sensor nodes and the node processing unit, and to speed up the data transfer process. In addition, using and comparing the performance of OSPF protocol with other new protocols such as EIGRP [17] is another suggestion of this research.

Funding
No funding to declare.

Conflict of Interest
The authors declare that they have no conflict of interest.

Availability of data and material
All data and materials generated or analyzed during this study were included in this published article.

Code availability
There is no code for this study.