Design of Farmland Information Acquisition System Based on LoRa Wireless Sensor Network

. A farmland information acquisition system based on LoRa wireless sensor network is designed aiming at solving the problem of small transmission range of traditional farmland information acquisition system. This system consists of three parts: the sensor node, wireless transmission network and host computer. The sensor node is composed of sensors, A/D converter, microprocessor and power module; and wireless transmission network includes LoRa network and the gateway. Low power LoRa technology is used for data transmission. The gateway consists of LoRa receiving node, GPRS module and the controller. The data collected by sensor nodes will be transmitted to LoRa terminal node, and then to the host computer through the LoRa network and GPRS network. The host computer performs functions of data processing, storage, analysis, real-time display. The test results show that the system can realize the real-time collection of farmland information, with low cost and simple installment.


Introduction
The crops are affected by many natural factors in the process of growth, such as temperature, humidity, wind speed and so on.In traditional agriculture, farmers can only go to the farm irregularly and get the value of these factors on the basis of experience.Therefore this cannot guarantee the healthy growth of crops and the increase of yield [1].In the meantime, the traditional farmland acquisition system has some problems such as small data transmission range, high hardware price, complicated wiring and so on, which make those systems not suitable in wide range.Therefore, the wireless sensor network has become an inevitable choice for the establishment of remote monitoring system for farmland information [2].Wireless sensor network [3][4][5][6][7][8] is a new platform for information acquisition and wireless communication, can monitor and collect various object detection information in the region where the network is distributed in real time.It has a wide application prospect in the field of monitoring agricultural environmental information.The common wireless communication technology is ZigBee technology [9][10][11] in wireless sensor networks.But the ultra-remote wireless transmission scheme--LoRa technology [12][13][14][15][16] based on spread spectrum technology has greatly improved in the signal receiving sensitivity, transmission distance and admissible noise compared to ZigBee technology.The two kinds of technique are compared in Table 1.Based on the above reasons, the farmland information acquisition system based on LoRa wireless sensor network was designed.A wide area sensor network using low-power LoRa wireless communication technology was built to collect and transmit the data.The system can collect dynamic field information such as soil temperature and humidity, air temperature and humidity, wind's speed and direction by arranging sensor nodes in a large-scale area.The system has the advantages of low power consumption, low cost, simple operation, wide monitoring range and flexible monitoring options.

Overall Design of System Structure
As shown in Fig. 1, the field's information collection system consists of three parts: the sensor node, wireless transmission network and host computer.Micro controller STM32F103C8, as the core of the sensor node, realizes data acquisition, processing  and forwarding by controlling a plurality of sensors (soil temperature and moisture, air temperature and moisture, wind speed and wind direction sensor, etc.).The wireless transmission network includes the LoRa wireless network and the gateway.LoRa wireless network can be divided into three kinds of nodes: the terminal node connected with sensor nodes, the router node for data transmission and the receiving nodes in the gateway.The gateway realizes the information interaction between the LoRa network and the GPRS network, and transmits the data to the remote monitoring center [17][18][19][20].The host computer in remote control center receives the information sent by the gateway, and performs the functions of data processing, analysis, storage to the database and real-time monitoring of the current monitoring data.

Design of Sensor Nodes
The function of sensor nodes is collecting the farmland information and converting it into digital signals.The hardware structure of the sensor node is shown in Fig. 2. It consists of sensors, A/D converters, microprocessors and power modules.The corresponding sensors (including air temperature and humidity, soil temperature and humidity, wind speed, wind direction and other sensors) will be selected for the monitoring objects to collect the information.Energy consumption, measurement range, accuracy and cost are considered in the selection of sensors.Sensor nodes collect the farm environmental information by cooperating with each other and converge the data to the microprocessor STM32F12C8.After integrating the data, the microprocessor transmits the data through the serial port to the terminal nodes in the LoRa network.

Design of Gateway
The hardware structure of the gateway is shown in Fig. 4. It mainly consists of 3 parts: LoRa receiving node, GPRS module and ARM controller.The LoRa node receives the data sent by the sensor network and sends the data to the gateway controller through the serial port.Double serial port ARM chip STM32F103C8 is applied as the communication between LoRa receiving node and the gateway controller, as well as between the gateway controller and GPRS module.SIM900A module is used to communicate with GPRS network.It has built-in TCP/IP protocol and supports the AT instruction set.The gateway controller is responsible for the information interaction between the LoRa network and the GPRS/GSM network, and also controls the memory, serial ports, Ethernet access and other functional modules.

Design of System Software
The software part of farmland information collection system includes the hardware driver procedure and the host computer.Hardware driver are programmed for the micro controller of sensor nodes to gather and process data, as well as realizing LoRa networking and wireless data transmission.The host computer monitors and stores the received data in real time and realizes remote control of the system.

Hardware Driver Programs
Sensor Node Program.The work flow diagram of the sensor node is shown in Fig. 5.At first, given electricity, the hardware of the system is initialized.And then the system goes into standby mode.The sensor node starts to collect the data monitored by the sensor (soil humidity, air temperature and humidity, wind speed, wind direction, etc.) periodically when the microprocessor receives the start signal from monitoring center.The microprocessor collates the sensor data, discards the abnormal data, adds the receiving node's address before the data, and then sends it to the LoRa terminal node through the serial port.When a stop signal is received from the monitoring center, the sensor node enters the standby mode.2, wherein Preamble, PHDR, PHDR_CRC and CRC are all hardware generated without software participation.And user data packet is shown in Table 3. Header represents the number of sensor nodes.Function (identifiers defined in Table 4) marks which kind of environmental factor is measured.Flag is used to distinguish different data types as the environmental factor guide code.The packet length can be changed according to actual measurement.Gateway Driver.The gateway controller implements the information interaction between the LoRa network and the GPRS network.Its work is to send the data received from the LoRa receiving node to GPRS network by controlling the SIM900A module.The gateway workflows are shown in Fig. 6.Firstly, the gateway checks whether the data format is correct and complete when receiving the data sent by the LoRa network.Then it uses SIM900A module to send data to the monitoring center via the GPRS network.Before that, GPRS network strength will be checked since it may cause transmission failure if the strength is too weak, and then the gateway will set up the TCP/IP connection with the monitoring center.The TCP connection will be disconnected after sending the data.The host computer of farmland information acquisition system is programmed on Visual Studio 2013 based on TCP/IP protocol (the interface is shown in Fig. 7).

Fig. 7. Farmland information collection system
The host computer has two main functions: one is the data communication with slave computer, receiving, analyzing and storing of data sent from the gateway, and sending the command to salve computer; the other is the database management, creating and increasing, deleting and modifying records and provides database view function.The function sketch of host computer is shown in Fig. 8.

Test of Farmland Information Collection System
The farmland information collection experiment was carried out in order to verify the correctness of the system.The environment factors collected in the experiment include air temperature and moisture, soil temperature and moisture, wind speed and direction.Data were collected in every 10 minutes during experimenting and were stored in the SQL database.The data collected on June 12, 2015 is shown in Fig. 9, and the average daily data in May 2015 is shown in Fig. 10.The results of experiment show that the system can realize real-time acquisition, long-distance transmission, display data, storage of data and other functions.

Conclusion
The farmland information acquisition system based on LoRa wireless sensor network is designed in two aspects: hardware and software.The sensor nodes in wireless sensor network, LoRa network, the design of gateway hardware and the software flow chart are given.The microprocessor chip STM32 in sensor nodes sends the data collected by sensors to the LoRa terminal node.And then, the farmland environmental information is transmitted to the remote monitoring center through the LoRa wireless communication network and GPRS network constantly.This system is reasonable and economical in the application of remote transmission of farmland information and has great market prospects.Verifying and testing the validity of the data, the stability of LoRa network and the coverage area of the system to improve the applicable range and practical value of the whole system will do in future work.

Fig. 1 .
Fig. 1.Frame diagram of farmland information collection system

Fig. 8
Fig. 8 Functional sketch of host computer host computer

Table 1 .
The comparison between LoRa and ZigBee.

Table 2 .
MAC packet structure of LoRa network.

Table 3 .
Format of user packet.

Table 4 .
Definition of function bits.