Design of Distributed Agricultural Service Node with Smartphone In-field Access Supporting for Smart Farming in Beijing–Tianjin–Hebei Region

1Department of Computer Science and Technology, North China Institute of Science and Technology, Langfang, Hebei 065201, China 2Hebei IoT Monitoring Engineering Technology Research Center, North China Institute of Science and Technology, Langfang, Hebei 065201, China 3College of Information Science and Technology, Donghua University, Songjiang, Shanghai 201620, China 4School of Economics and Management, Yanshan University, Qinhuangdao, Hebei 066004, China


Introduction
Beijing-Tianjin-Hebei (BTH) region in north China is called China's "Capital Circle", which includes Beijing, Tianjin, and Hebei provinces (Langfang, Qinhuangdao, Baoding, Tangshan, Zhangjiakou, Chengde, Shijiazhuang, Cangzhou, Handan, Xingtai, Hengshui, and 11 other cities).In the BTH region, the land area is 218000 km 2 and the resident population is about 110 million.In recent years, the urbanization of the BTH region has rapidly accelerated.Because of the influence of the urbanization of the BTH region, the agricultural land area is decreasing year by year. (1,2)Additionally, in the BTH region, the per capita arable land is limited, and the agricultural investment is insufficient. (3,4)Therefore, it is important to increase the production value of each agricultural unit area.According to the "Beijing-Tianjin-Hebei Modern Agricultural Coordinated Development Plan (2016-2020)" of the Ministry of Agriculture of the People's Republic of China, 27 cities and counties in Beijing, Tianjin, and Hebei provinces will be promoted to urban modern agricultural and high-yielding/efficient ecological agricultural areas, and the establishment of a modern agriculture circle in the BTH region will be accelerated.
Smart farming is an effective means of improving the production value of agricultural units.By smart farming, the agricultural production process is expected to be effectively managed through informatization and to provide profitable service by means of the information system within it. (5,6)For the construction of a smart farming system in the BTH urbanization region, the old agricultural cultivation method should be changed and higher-margin services should be introduced.Agricultural tourism is considered to be the most lucrative service in the BTH region and is bringing new business opportunities to farmers in the BTH region.
For the future construction of a smart farming system in the BTH region, we should meet the needs of further efficient agriculture, which are based on accurate planting information monitoring and efficient remote equipment control.The need for an agricultural tourism service must also be satisfied.
9) The data sink and central management is carried out by the central station (host).However, if we want to add an agricultural tourism service in the conventional smart agricultural service process with data monitoring and equipment control, we must change the technologies used.Although this traditional structure (central management, i.e., terminal/host configuration) can meet the needs of scale agriculture management for smart farming, it is difficult to carry out the distributed in-field service directly.
In recent years, smartphones have been widely used in various fields of society.12) The application of smartphones in agricultural WSNs is expected to change the traditional structure.System users can not only use a WSN to realize the traditional monitoring/control function, but can also use smartphones in field access via a nearby node to obtain local agricultural data or directly control nearby agriculture equipment.This method increases the flexibility and effectiveness of WSNs and brings true distributed access service to users.In addition, the business functions of agricultural WSNs can be enriched by the introduction of smartphones.In this paper, we present a distributed agricultural service node design.The node can realize the monitoring of planting information and remote control, and can be used for agricultural tourism service operations.A real distributed agricultural tourism service in the BTH region is expected to be realized through the use of these new nodes.

Hybrid Node Function Configuration
WSN-based smart farming information management architectures are already widely used in some smart farms in the BTH region.A fundamental change in these structures would bring about some difficulties regarding, for example, cost and construction time.Therefore, in our research, we focus on the use of the existing WSN-based smart farming information management architecture to provide the mobile device in-field access to mobile devices without the need for large changes.Agricultural managers should easily and remotely manage agricultural operations through each hybrid node in a traditional terminal/host way.Tourists and farmers use smartphones for distributed in-field access to the hybrid node.Through smartphone access to the hybrid node, tourists can learn the types of agricultural products in the vicinity of the nodes, and the real-time agricultural process (agriculture sensing data around a node) and a certain degree of a tourism business function can also be realized.An educational function for children can also be provided using agriculture sensing data.In-field farmers use smartphones to view the surrounding agricultural processes via the hybrid nodes and to control the agricultural electromechanical equipment connected to hybrid node control ports.The function configuration of a hybrid node is shown in Fig. 1.
The communication configuration between a hybrid node and the host computer in the central station is similar to that in the traditional WSN-based smart farming management architecture, which can be based on a commercial WSN transport protocol (such as ZigBee). (13,14)However, the communication between the smartphone and the hybrid node needs to be carefully designed.As tourism farms are usually located in suburban areas, the signal quality of mobile data service (3G, 4G) may be not good.Mobile data service will also produce the continuous access cost and increase the operating cost of a tourism farm.In addition, because of the service restriction of the mobile company, the data transmission structure based on the mobile data network can bring security weakness, data bottleneck, system development complexity, and so on.In recent years, Bluetooth has become a standard configuration of smartphones.Near-field communication (NFC) technology has also been aggressively promoted by China's smartphone makers, such as Xiaomi and Huawei (they have integrated NFC support in their mainstream smartphones, which have been launched 2017 years later).With the combination of Bluetooth communication and NFC tags, smartphones can communicate with the nodes directly and quickly at a low cost, and avoid the introduction of additional data communication cost or billing mobile data service.
Sensors on the hybrid nodes should also be carefully designed.In the BTH region, which has cold winter, most tourism farms rely on greenhouses to provide tourists with continuous harvest service.Therefore, in the selection of sensors, we should adapt to the needs of greenhouse planting and set up soil sensors, T/H sensors, solar radiation sensors, contact sensors for monitoring soil parameters, temperature, humidity, and amount of sunlight in greenhouses, and water supply temperature.In addition, the wind speed sensors should be set up to provide early warning for gales in the BTH area.In general, the nodes for greenhouses can also be used outdoors.The hybrid node also controls the external devices through the output logic I/O.The irrigation water supply control is the most important.It should be noted that, in order to improve the utilization rate of water resources, drip irrigation technology is commonly used in the new generation greenhouse of the BTH region.Thus, the quantity of water supply is not large at unit time.In addition, it is necessary to note that, because the sensing parameters and control information on the nodes do not need to be responded to in a short time, the information interaction between the host computer and the node can be based on polling operation with a larger cycle.Besides, a large polling cycle is good for energy saving and avoiding smartphone access service conf licts.

Node Hardware Design
In our design, nodes must serve as central management and in-field smartphone access points simultaneously.Each node operates in the normal mode when there is no smartphone access.In this mode, the node receives instructions from the host computer by ZigBee in each polling cycle.Then, it performs sensor reading and device control in accordance with the instructions.After completing these operations, the node will send the sensor data, smartphone access information, and external device status parameters to the host computer.The NFC tags of nodes contain, for example, node identification information, planting information around nodes, and Bluetooth device information for smartphones to read.Smartphone users first approach the NFC label, then the mobile phone reads the node NFC tag information by means of the corresponding App, and finally the encrypted information in the NFC tags can be converted to readable specific planting data and device parameters through the App's builtin database.The smartphone is also automatically certified to connect to the Bluetooth module of the node quickly in accordance with the device parameter (NFC-based quick connection).After connection, the real-time environmental parameters around the node can be obtained and the field control of the external electromechanical device is realized.The benefit of using this scheme is not only the realization of convenient and fast communication between the smartphone and the hybrid node, but also the avoidance of Bluetooth multi-access collision with the NFC (coverage < 10 cm). (15,16)he hardware design of the node must not only satisfy the function requirement of the distributed agriculture service system, but also meet the requirements of simple structure and high reliability.The node is designed to be at the centered of the PIC16F1947 nanoWatt XLP microcontroller, RN4020 Bluetooth module, and DRF2619C ZigBee module.Sensors on the node are used to gather agricultural data.In order to make the node function and cost optimal, the sensors on the node can be added and removed in accordance with actual needs.The user can simply adjust the dial-up switch on the node to set the node sensor configuration.The node can also provide pulse width modulation (PWM) and logic General-purpose input/output (GPIO) control signals for external devices.Both control signals are connected to a controlled device with a plug-in module card with a motor drive or relay.When each data acquisition and control command is complete, the node also stores the sensor data and device status parameters in its internal memory.The node sets the low and high interrupt response operations for instruction from the host computer and smartphone access.PIC16F1947 also monitors the node state and the alarm information is sent to the host computer when a system exception occurs.For the rest of the time, it goes to sleep to minimize energy utilization.The hybrid node hardware configuration is shown in Fig. 2. The interactive format between the host and the nodes, and the hybrid node hardware program framework are shown in Figs. 3 and 4, respectively.

Android App for Hybrid Node
The App for hybrid node access must not only meet the need of the agricultural application, but also make full use of the smartphone's ability.By fusion NFC and Bluetooth, it can realize rapid, convenient, and reliable access via the node.In addition, tourists are often reluctant to spend a long time learning how to use an App, so the interface should be as simple as possible.The core function of the App comprises NFC label operation, Bluetooth connection, planting information/price display, planting environment parameter real-time display, electromechanical equipment control, and location positioning (as shown in Fig. 5).In App development, the farmer's App and tourism App use the same background architecture and similar interface layout style.The difference is that the interface in the App for tourists does not have the electromechanical device control or the NFC label maintenance options.When the NFC tag has been read, the App converts the encrypted information within the NFC tag (as shown in Fig. 6) into planting data and device parameters, and shows it to the user via the user interface (UI).In addition, the unique ID information of the node in the park and the application programming interface (API) of the Baidu map are used for positioning.By matching IDs and location information, the user can find their corresponding specific locations in the park, and through the layer-marking operation, show them on the tour map.In a Bluetooth connection, the  smartphone scans the NFC tag, reads the MAC address, and pins match codes for the Bluetooth device of the node.
After the smartphone successfully reads this information, it can initiate a quick connection to the specified Bluetooth module.After accessing the node, the smartphone can read the information of each environmental parameter and draw the curves of the environmental parameters.In the interaction between the smartphone and the node, the node receives the planting environment parameter query instruction and sends the real-time sensor reading together with the last 15 monitored data values stored before the smartphone access.To enable users to easily monitor the trend of environmental parameters, the App design includes a number of buttons that can be clicked to monitor the changes in various environmental parameters in the graph.When the smartphone is connected to the node, the control instruction and information interaction formats between the smartphone and the node are similar to the interaction format between the host computer and the node.Because the Bluetooth connection is P2P, the node-smartphone interactive format does not include the node or host computer address.Users can also develop Apps for other specific applications based on the hybrid node's capabilities.The App framework is shown in Fig. 7.

Test Results and Discussion
Hybrid nodes were tested in a tourism farm, Qinhuangdao, Hebei Province.A total of 11 nodes were installed for testing.The distance between the node and the host computer is between 200 and 500 m.The NFC tag for each node is positioned approximately 3-5 m away from the nodes.The polling period is 220 s.The collection of agricultural parameters is an important function of hybrid nodes.Figure 8 shows the data collected in one day by the hybrid node installed in a tomato greenhouse.As can be seen from the figure, the ambient temperature data collected by the node show the change in the air temperature of the greenhouse following the changes in solar radiation and ambient temperature.Because the use of the polyolefin (PO) film (agricultural polyolefin special film by Sumitomo) has a better solar radiation transmittance (about 70%), the greenhouse heating effect is stronger.The humidity in the greenhouse also changes with soil moisture evaporation and environmental control measures.The relationship between the humidity in the greenhouse and the ambient temperature and solar radiation can be observed through the ambient humidity sensor on the hybrid node.In addition, the abnormal humidity caused by the work of the atomization equipment used in the greenhouse landscaping can also be seen (usually a low humidity at a high amount of sunlight).The contact temperature sensor used to perceive the water supply temperature can also clearly detect the temperature change of the water supply in the greenhouse, which is supplied by the reservoir.The soil sensors laid at the head of drip irrigation can effectively monitor the effect of drip irrigation, and the effects of soil temperature on soil moisture during daytime can be clearly seen from the monitoring results.The soil moisture content (70-75%) can be effectively clamped in the optimal irrigation in the tomato fruit period by combining the control measures of drip irrigation diversion.In order to monitor the photosynthesis effect, the solar radiation sensor of the node is placed near the plant.The movement of the clouds and plant blades will affect the solar radiation data, which can be seen from the graph.The monitoring results of the solar radiation obtained by the nodes could better reflect the influence of the cloud on the solar irradiation.In addition, wind-wind sensors can also be used to obtain the wind monitoring results.
The main factors that affect the reliability of agricultural wireless sensor nodes are energy consumption, data transmission, and hardware reliability.Because the node uses the solar energy power supply (sunshine time is sufficient in the BTH region), the node polling period is long, the Bluetooth module is the low-power bluetooth low energy (BLE) module, and therefore the power supply fully satisfies the node daily work demand.In the hardware design, microcontroller usits (MCUs) and sensors have been chosen with industrial certification, outdoor work standard, simple and reliable configuration.The test results show that the hardware design is highly stable and errorless.The hybrid node, due to its smartphone access, also has new challenges to its reliability design.Because access by smartphones used by tourists or farmers in the area is highly random, the interaction between the host computer and the node of information collection may be interrupted by smartphone access.It is found that most of the conflict occurs in the time period of sensor data collection of the node.The statistical data show that most smartphone access time lengths are less than the polling interval [as an example, the access time from July 6 to July 12, 2016 is shown in Fig. 9(a)].Thus, we actually solved the problem of stability caused by smartphone access by introducing three polling cycles pro-cache (for about 11 min and 660 s, it is almost impossible for anyone to access the node for a long time).The access reliability of the smartphone to the hybrid node is also very important.Smartphones and hybrid nodes will be separated by a certain distance when users scan the NFC tag for access and use BLE communication with nodes.As shown by the experimental results in Fig. 9(b), the access and communication between the smartphone and the node are highly reliable in the cases of various mobile phone grip modes and surrounding obstacles.When the smartphone is communicating with the hybrid node by BLE, it can be several meters away from the hybrid node.
Therefore, only the 2.4 GHz ZigBee transmission may mainly affect the stability of the node.(19) In communication, we adopt a very large link budget.The DRF-2619C ZigBee communication module of the node can reach above 1.6 km.The 18 dBi high-gain Yagi-Uda antenna on the node and the 15 dBi fiber-reinforced plastic (FRP) omnidirection antenna at the central station further enhances the transmission stability greatly.Although there are some obstructions in the Fresnel zone between most nodes and the host computer, the communication between nodes and the host computer is highly stable.In days without rain, the sensing data transmitted by ZigBee between the nodes and the host computer show no sensing data loss related to channel reason.The smartphone access operation that is very close to the polling instruction arrival time (shorter than the sensor read time) may trigger delay in the cache mechanism for sensing data collection in time in one polling interval.Thus, sensing data loss in one polling period may occur.However, this case (sensing data loss due to access) is extremely rare and only occurs when the visitor is extremely dense.However, different from the sensing data loss due to smartphone access, as observed in the test, the rain fade of ZigBee is the main cause of sensing data loss.However, as shown in Fig. 10, even if there are medium to heavy rains, the average sensing data loss of nodes can be below 9%.It should be noted that the above test results were obtained in the case of continuous rainfall.In the BTH region, which is located in low-precipitation north China, a continuous medium or heavy rainfall is rare.Thus, in most rainy days, sensing data loss is better than that shown in Fig. 10.
The study also involved questionnaires on the node and the App developed by Yanshan University.The questionnaires focused on the tourists' tour time, interest level (5-point evaluation), and consumption (the main consumption of tourists in the park is the purchase of agricultural products).A total of 754 effective questionnaires were recovered (about one-third to one-fourth of the tourists took part in the survey), 291 of which were from tourists with node access and the rest from tourists without node access.The tour time (3 h 21 min), interest level (4.71 points), and consumption (154.64Yuan) of the node access tourist group are better than those of the ordinary tourist group (3 h 37 min, 4.53 points, 114.32 Yuan).The results showed that this method can effectively improve the experience index of tourists.Considering that the main part of node cost is less than 500 Yuan and that sensing/control function modules can be increased or decreased according to needs, the farm recovered its investment cost and gained profit in one tourism season.In particular, through the hybrid node, tourists learn more about the planting process and real-time agriculture, which promotes the consumption of agricultural products, and thus improves the income of tourism farms.

Conclusions
WSNs are very important for smart farming.The combination of WSNs and smartphones can provide distributed information services to tourists and farmers in the field.Through this method, the new distributed information service means that such in-field tourism service can be provided with the traditional central agriculture management.Aiming at the demand for smart farming in the BTH region, we presented a design of an agricultural hybrid node.The hybrid node not only supports a traditional host/terminal configuration for agricultural data collection and device control, but also provides users with distributed in-field access to hybrid nodes via a smartphone for distributed agriculture service.By introducing the hybrid node, we can provide a truly ubiquitous and f lexible service without changing the traditional WSN structure.In the test, the node showed high reliability, convenience, and good support of commercial applications.This hybrid node is expected to bring about new smart agriculture service methods and business models for smart farming in the BTH region.