An Agricultural Monitoring System Based on Wireless Sensor and Depth Learning Algorithm

The rise and development of the Internet of Things (IoT) have given birth to the frontier technology of the agricultural IoT, which marks the future trend in agriculture and the IoT. The agricultural IoT can be combined with Zigbee, a short-range wireless network technology for monitoring systems, to solve the excessively large planting area and other defects in agricultural production. Meanwhile, the modernization of planting and harvesting has set the stage for deep learning. Unlike the artificial neural network, the deep learning is an important intelligent algorithm, capable of solving many real-world problems. Therefore, this paper probes into the problems of modern automatic agriculture. First, the routing allocation technology and transmission mode were optimized to solve the energy consumption problem. Second, the classification model based on deep learning algorithm was put forward according to the application of the Wireless Sensor Network (WSN) in continuous monitoring of soil temperature and humidity. Despite the lack of upper soil humidity sensor in agriculture, the model can still classify the soil moisture of the nodes, and derive the main soil moisture content. Finally, a solution was presented based on agricultural ZigBee WSN technology. In addition to cheap cost and low power consumption, the solution has the functions of reminding and recognition due to the adoption of artificial intelligence algorithm. Suffice it to say that the solution is a successful attempt to integrate artificial intelligence and sensor technology into agricultural modernization.


Introduction
There are a series of problems facing the traditional agriculture. The production mainly relies on scale expansion by increasing the input of production factors, not to mention the high cost, extensive consumption, poor efficiency and low return [1]. To address these problems, developed countries integrated electronic and information (IT) technology into agricultural applications in the early 1990s.
One of the frequently used IT technology is wireless sensor network (WSN). The network realizes distributed monitoring through a large number of low-cost micro sensor nodes deployed in a certain environment. The nodes are self-organized into a multi-hop network. With the aid of wireless communication, these nodes coordinate with each other to perceive the environment, acquire information and process data, and then send feedback to the observer. As the new-generation monitoring technology, the WSN has attracted much attention from the academia, the industry and the media. The era of WSNs is highly anticipated in the near future. In September 1999, the WSN was identified by Business Week as one of the most important and impactive technologies for the 21st century. The continuous development of communication technology has pushed up the demand for diversified monitoring systems. Ever since the first practical application of WSN was made by US Armed Forces, the technology has been extensively applied in the civilian field [2].
Nowadays, the integration of the IoT, cloud computing, and big data provides a golden opportunity for the development of agricultural information [3]. The current application of agricultural IoT mainly focuses on the resource utilization, environmental protection, production monitoring and product traceability. Since the turn of the century, the intelligent expert system has been created based on greenhouse measurement, greenhouse control and crop model [4]. From the perspective of plant physiology and thermodynamics, J.C. Bakker examined the variation in temperature, humidity, and CO2 concentration in greenhouse [5]. Damas developed a distributed remote-control system for greenhouse auto-irrigation [6]. Evans and Bergman pioneered the study of precision irrigation systems containing a self-drive controller, a linear movement device, and a central pivot [7].
The agricultural IoT can be combined with Zigbee to solve the excessively large planting area and other defects in agricultural production. ZigBee [8] is an emerging short-range and low-power wireless network technology, and a marker between wireless technology and Bluetooth technology. Following a designated communication standard, ZigBee can realize long-distance data transmission through the mutual coordination of thousands of wireless sensor nodes. The technology is launched and made by ZigBee Alliance. For the development of the next-generation ZigBee technology, the alliance was founded in August 2001 [9] by four large corporations, including the British company Invensys, Mitsubishi Electric Corporation, Motorola and the Dutch giant Philips Semiconductor Corporation. In September 2015, Chipcon delivered on world's first true System-on-Chip (SoC) ZigBee solution CC2430. Since then, more and more companies have developed their own ZigBee chips, applying ZigBee technology to wireless communication. Featuring low consumption, cheap cost, and low transmission rate, ZigBee has been widely used in medical care, industrial monitoring, environmental protection and many other fields.
Meanwhile, the modernization of planting and harvesting has set the stage for deep learning. Deep learning, also known as deep structured learning or hierarchical learning, is part of a broader family of machine learning methods based on learning data representations, as opposed to task-specific algorithms. Many theoretical models have been developed for deep learning, namely generative model, discriminative model and hybrid model [11]. Depth belief nets (DBNS) and convolutional neural networks (CNNs) [12] are two important architectures in deep learning models. Through multilayer representation or abstraction, deep learning helps the observer to understand the essential information of data, such as image, text and audio [13], and perform unsupervised or supervised feature extraction and transformation by hierarchical nonlinear information processing, laying the basis for pattern analysis and classification.
In light of the features of the WSN, this paper designs a wireless sensor agriculture monitoring and control plan that consumes little power and supports intelligent data analysis. After solving the high energy consumption of wireless sensor, the author proposed a deep learning-based plan to estimate the moisture content in soil and autocontrol the operation of irrigation systems. In the end, a solution was presented based on agricultural ZigBee WSN technology. In addition to cheap cost and low power consumption, the solution has the functions of reminding and recognition due to the adoption of artificial intelligence algorithm. Suffice it to say that the solution is a successful attempt to integrate artificial intelligence and sensor technology into agricultural modernization. Figure 1 illustrates the ZigBee network system for wireless digital farms.

WSN and ZigBee
The WSN is a high-performance infrastructure-free network grounded on various technologies, including but not limited to sensor technology and network communication technology. The network consists of hundreds of wireless sensor nodes, each of which contains a wireless communication module, a processor module, and a sensor module and a power supply module. The sensor nodes are arranged randomly or orderly in the working environment. Through wireless communication, the nodes cooperatively sense and collect the data from the object covered by the network, make effective processing and management of the data, and eventually produce the accurate information of the object. The main features of the WSN are scale, range, selforganization and network dynamics.
ZigBee is an IEEE 802.15.4-based low-rate and short-distance wireless communication technology used to create Low Rate-Wireless Personal Area Networks (LR-WPANs). Zigbee builds on the physical layer and media access control defined in IEEE standard 802.15.4 for low-rate WPANs. The architecture is a standard branch based on the model of seven-layer Open Systems Interconnect (OSI) network. The protocol stack contains several layers, each of which provides certain services to the superior layer.
In the network layer, the data entity offers the service of data transmission, while the layer control offers the rest of services. Each entity of service provides a service port to its higher layer through a service access point (SAP). Every SAP gives the corresponding instruction to finish the related function. The network layer ensures the vital functions of ZigBee network, so that the MAC sublayer can operate normally. Besides, this layer provides a suitable interface for use by the next upper layer, namely the application layer.
The application layer comprises both the application support sublayer (APS) and the ZigBee Device Object (ZDO). This layer also offers manufacturer-defined application objects which allow for customization, making it convenient for ZigBee users to develop targeted capabilities according to specific hardware and application environment.
There are three kinds of devices in ZigBee network: full function device, reduced function device, network host or gateway. According to the three devices, the nodes are defined as the Coordinator, the Router and the End Device . Three topologies of ZigBee network can be formed by these three nodes, including the star topology, the tree topology and the mesh topology ( Figure 2).
The star network is made up of a central controller called the PAN coordinator and some sub devices. The PAN coordinator must be a full function device, while the sub devices must be either full function devices or reduced function devices. In the tree network, most of the devices are full function devices. The reduced function devices are only allowed as leaf nodes at the end of the branches, because such devices can only connect on full function device at a time. Any full function device can serve as a coordinator, and supply synchronous device services to the other devices or the main devices. The mesh network is a freely designed topology highly adaptive to the environment. To maximize the network reliability, each node in the network can be a router with rerouting ability. The communication path between any two nodes is not unique, and each node has multiple optional paths. http://www.i-joe.org

Deep Learning Algorithm
As a new direction in machine learning, deep learning is an uncontrolled learning aiming to establish a neural network that imitates the analytical mechanism of the human brain for figures, images, audios and texts. The learning structure contains a hidden multilayer perceptron. Inspired by the hierarchical operation of the human brain, the deep learning structure is also divided into several layers: the input layer, hidden layer and output layer. In each layer, high-level features are constructed by learning low-level features. The nodes of neighbouring layers are linked to each other, but those belonging to nonadjacent layers are not linked up. The structure of each layer can be regarded as a logical regression model. Figure 3 displays a deep learning model with multiple hidden layers. In the deep learning model, Restricted Boltzmann Machine (RBM) is generative stochastic artificial neural network that rose to prominence after Geoffrey Hinton and collaborators invented fast learning algorithms for them in the mid-2000s. The RMB is made up of two main parts: the visual layer(v) and the hidden layer (h). The units of one layer are not connected with or dependent on those of the other layer, that is, p(h!v)=p(h 1 !v 1 )"""p(h n !v n ). But the two layers are related through weight W.
The RMB can be viewed as a feature extractor. Assume that, in a RBM system, a and b are the biases of the visual layer and the hidden layer, respectively, and n and m are the number of visible units and hidden units, respectively. Let vector v={v 1 , v 2 ,…, v n } and h={h 1 , h 2 ,…, h n }denote the visible units and hidden units, respectively, where v i is the i-th state, and h j is the j-th state of the hidden layer. Then, the energy of the RBM system is: Where !={W ij , a i , b j } is the parameter of the RBM; W ij is the link weight between the i-th unit in the upper layer and the j-th unit in the current layer; a i is the bias of the i-th unit in the visible layer; b j is the bias of the j-th unit in the hidden layer. After determining these parameters, the joint distribution probability (v, h) can be defined below according to the energy model.
Where Z(#) is the normalization factor. Then, find the marginal distribution of joint distribution of v : The size of normalization factor Z(#) should be determined to calculate the marginal distribution. In the actual process, it takes 2 n+m calculations to obtain Z(#). Therefore, even if size is obtained by training, the distribution of P still cannot be determined.
For simplification, it is assumed that the visible layer and the hidden layer unit have a value of 0 or 1. When the visible layer is known, the units of the hidden layer are independent, that is, the activation probability of the j-th is shown in the following formula: where $(x) is the activation function. Similarly, when the hidden layer is known, the units in the visible layer are independent of each other, that is, the activation probability of the i-th unit is as follows.
The automatic encoder is the easiest way to implement deep learning. As an uncontrolled learning method, the automatic encoder adjusts the parameters of each layer based on the properties of manmade neural network, such that its output value equals the input value. In this way, each intermediate layer becomes the equivalent representation of input data. What is more, the automatic encoder can reduce dimensionality, compress data, and reproduce the neural network of input signals. It can be realized both by the RBM, and feedforward neural networks.

System Design
This paper puts forward measures to tackle problems in WSN of agricultural monitoring systems, such as high density and high-power consumption. First, the data fusion strategy was adopted to reduce the data volume and power consumption of data transmission. Then, an optimization algorithm was proposed to reduce the work power.
The study area had been divided into several zones before the research. Each zone formed a cluster. Moreover, multiple routing nodes had been deployed in the clusters as the candidate points for data fusion. After comparing the size of network address, the node with the smallest cluster address was selected as the fusion point. The specific process is as follows: 1. The routing nodes in the cluster broadcast the application messages circularly, and broadcast their address information to other nodes in the same zone. 2. Constantly update the candidate fusion points in the cluster. 3. When a routing node in the cluster has received the address of other routing nodes, it will select the node with the smallest cluster address as the fusion point to continue broadcasting. On this basis, the other nodes can detect whether the fusion point is normal. 4. Set the number of sensor nodes in the cluster and the statistical period. 5. Wait for the statistical period. 6. If the volume of collected data is equal to or greater than the threshold, consider the data as valid and go to Step (7). Otherwise, consider the data as invalid and return to Step (5). 7. The fusion point will perform the mean operation on the collected data in the period, seeking to obtain the actual situation of environmental variables in the zone. To reduce the data flow, the fusion point will then compress the amount of sent data in the statistical period to 1/n (n is the number of sensor nodes involved in data transmission in the statistical period).
In the data transmission section, an algorithm was proposed to optimize the routing power. Specifically, the terminal nodes of ZigBee network send different levels of data packets according to the level of moisture content in soil. The packets are sent from the lowest level to the highest level. The response of the coordinator is detected via voting. If there is no response to the packets sent in a number of voting cycles, the packets will be re-sent at the next higher level until the coordinator makes a response. To further improve the reliability of the network, the power level will be increased automatically for continuous packet transmission after receiving a response. If the RSSI value of the packet returned by the coordinator surpasses the threshold, it is considered that the value is the lowest reliable level of moisture content for data transmission.
After receiving the feedback signal of soil humidity sensor, the sparse auto-encoder of deep learning algorithm was adopted to reduce the dimension of the data. The classification efficiency was improved with the shortening of the running time of the algorithm. Using a stricter sparsity restriction than that of the auto-encoder, the sparse auto-encoder can maximize the sparsity of the compressed data. The moisture content in soil was determined quickly and efficiency through the combination of the dimension reduction of deep learning algorithm and the classification algorithm.
The obtained moisture content was fed back to the central processing unit (CPU). According to the instructions issued by the CPU, the valves of the irrigation system and the fans of the ventilation system were opened or closed, so as to adjust the moisture content of soil.

Experiment and Analysis
Due to the low power consumption, cheap cost, small size and simple structure of the system, CC2530 (Texas Instruments) was selected as the position chip, the centrepiece of ZigBee WSN. The environmental factors were measured by high temperature humidity sensors, soil temperature sensors, soil moisture sensors, and light intensity sensors. The software was developed on an integrated development platform and protocol stack. The former relied on the IAR Embedded Workbench, and the latter used the ZigBee2007 protocol stack (Texas Instruments).
The proposed system was contrasted with the traditional method in terms of power consumption. As shown in Figure 4, our system consumed 4 times less power than the traditional network.
With the aid of fans and other tools, a complex experiment was designed to analyse the moisture content in soil. The experiment simulated the arid, humid and other soil conditions. The soil used in this research was the loam with 25% moisture content. The system operation was monitored for one week to record the moisture content in soil. As can be seen from Figure 4, the system could identify the moisture content quickly when the soil was dry, and instructed the irrigation system to supplement water.

Conclusions
This paper designs an intelligent agricultural monitoring system based on the WSN and deep learning algorithm. After solving the high energy consumption of wireless sensor, the author proposed a deep learning-based plan to estimate the moisture content in soil and auto-control the operation of irrigation systems. In the end, a solution was presented based on agricultural ZigBee WSN technology. In addition to cheap cost and low power consumption, the solution has the functions of reminding and recognition due to the adoption of artificial intelligence algorithm. Suffice it to say that the solution is a successful attempt to integrate artificial intelligence and sensor technology into agricultural modernization.