**1. Introduction**

Soil is an important natural resource and the most critical material basis for agricultural production. The acquisition and analysis of data related to soil moisture, salt, pH, and other physicochemical properties is an important basis for land resource utilization and agricultural production activities. Conventional soil sampling and laboratory analyses have long sampling and analysis cycles and high labor costs; therefore, various proximal soil sensor devices and data acquisition systems have been widely used in fields [1,2]. Proximal soil sensing mainly refers to the use of field sensors to acquire information proximal to the ground or in the soil. This concept was first proposed by Viscarra Rossel and McBratney in 1998 [3] and further developed in 2010 [4]. At present, various proximal ground sensor devices based on different working principles have been developed. For example, the EM38 conductivity meter developed by Geonics Inc. (Mississauga, ON, Canada) is an instrument used to obtain soil comprehensive apparent electrical conductivity (ECa) based on the principle of electromagnetic induction. Myers et al. used this instrument to combine conductivity data from the soil surface and soil profiles for high-resolution ECa soil digital mapping [5]. Besson et al. used MUCEP (multi-continuous electrical profiling) to measure soil resistance coefficient and monitor the temporal and spatial changes in soil moisture at the field scale [6]. Electrochemical sensors based on ion selective electrodes (ISEs) and ion sensitive field effect transistors (ISFETs) are mainly used for the determination

**Citation:** Tu, Y.; Tang, H.; Hu, W. An Application of a LPWAN for Upgrading Proximal Soil Sensing Systems. *Sensors* **2022**, *22*, 4333. https://doi.org/10.3390/s22124333

Academic Editors: Zihuai Lin and Wei Xiang

Received: 19 April 2022 Accepted: 3 June 2022 Published: 8 June 2022

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

of soil pH and nitrate and potassium ion concentrations. Adsett and Thottan designed a real-time automatic nitrate content measurement system using ISFETs and a nitrate detector [7]. Similar instruments include the pH meters produced by Veris Technologies, Inc. (Salina, KS, USA) and Spectrum Technologies, Inc. (Aurora, IL, USA). These proximal soil sensor devices or systems are usually deployed in field environments and connected to data acquisition devices with RS-485, RS-232, or SDI-12 cables, and manually obtain data on-site. In practical applications, such systems face the problems of limited bearing capacity, cumbersome wiring, high operation costs, and inconvenient installation and maintenance. With the rapid development of information technology, the IoT has been widely used in various industries, promoting their rapid development and extension. Low-power wide-area networks (LPWANs) form one of the main hotspots of IoT access technology [8]. Compared with conventional wired communication technologies (such as RS-485 and SDI-12), mobile cellular technologies (such as 2G, 3G, 4G, etc.), and short-range wireless communication technologies (such as Bluetooth, ZigBee, etc.), an LPWAN has the advantages of low cost, low power consumption, wide coverage, and strong connection [9], and can effectively achieve the application of a proximal soil sensing system. An LPWAN is an important technical support tool for promoting the transformation from conventional laboratory-based physicochemical soil analyses to field-based measurements. Vu et al. designed an automatic irrigation system for greenhouses based on LoRa technology [10]. Rachmani et al. designed an IoT monitoring system based on LoRa technology for a starfruit plantation [11]. Co et al. designed and developed the hardware and software components of a wireless sensor network (WSN) for soil monitoring [12]. In these applications, the LoRa communication module is usually independent of the sensor device, but the sensor device is still based on the conventional application design, and its power requirements cannot be met by a long-term battery power supply. Thus, the deployment of the system is troublesome, and a lot of maintenance work is required in the later stages of use.

To meet the needs of long-term field work, and considering the limitations of sensor battery power supply, LPWAN technology needs to be integrated and applied in proximal soil sensor devices. However, such devices generally need to be redesigned at a high cost, and this leads to the elimination of the previous generation of inventoried devices, due to their outdated technology. At the same time, the redesigned sensor not only needs to have its communication function tested, but also requires more practice to verify its sensing technology [13]. Therefore, this paper selected an inventoried soil moisture sensor based on an RS-485 interface as the research object; designed and adapted the attachment hardware system (AHS), according to its electrical specifications and communication protocol, integrated LPWAN technology; and realized the technological upgrade of the sensor, so that it not only retained the function and performance of the original sensor, but also had the attributes of ultralow power consumption and long-distance transmission, while supporting long-term battery power supply, easy deployment, and simple management. At the same time, the elimination of an inventoried device due to the application of new technology was avoided, and resources and costs were saved, because the design was based on the inventoried device.

The main contributions of this paper are as follows:


The rest of this paper is organized as follows: Section 2 presents the overall architecture design of the system. Section 3 describes the hardware design of the AHS. Section 4 introduces the software design of the system. Section 5 tests and analyzes the sensor device, after loading the AHS, and also discusses the relevant factors affecting the communication quality. The last section summarizes this paper and discusses its significance.

#### **2. Design of the System Architecture**

The AHS, which was designed to adapt inventoried sensor devices, mainly included an ultralow-power MCU system, a communication module, and a power module. The overall architecture is shown in Figure 1. The AHS took the ultralow-power MCU system as its core, and enabled and controlled the boost chip to turn the working power supply of the sensor device on or off. It obtained the data acquired by the sensor device or configured its relevant parameters by adapting the 485 interface communication protocol; connected and controlled its communication module through UART; and exchanged data with the server through ultralow power wireless transmission, which included uploading the data acquired by the sensor device and receiving the control command parameters sent by the server to control the workflow of the system.

**Figure 1.** Overall structure of the system.

#### **3. Hardware Design of the AHS**

*3.1. Proximal Soil Sensor Device and Power Supply*

Soil moisture is not only an important part of soil fertility and an important factor affecting plant growth and development, but it is also an important parameter for studying agricultural drought and crop drought. Therefore, data acquisition devices and systems based on various soil moisture sensors have been widely used [14]. In this paper, a commercial soil moisture sensor was used as the research object and was taken as the sensing module of the AHS. Its accuracy and reliability have been tested in practice and in the market for a long time. The volumetric moisture content of the soil was measured with an RS-485 standard communication interface, with a working voltage of 12 V and a response time of less than 1 s. Under the condition of no external load, the maximum working current was less than 25 mA, and the average was no more than 10 mA. More parameters are shown in Figure 2.


**Figure 2.** Soil moisture sensor.

The system power supply adopted a lithium thionyl chloride battery with an output voltage of 3.6 V and a battery capacity of 3500 mAh. It has the characteristics of high energy density, long service life, and excellent low-temperature performance. It is especially suitable for all-weather battery-based power supply devices in the field [15]. To simplify the hardware structure and facilitate application deployment, the system adopted a singlebattery global power supply and an efficient power managemen<sup>t</sup> scheme. The sensor device adopted a 12 V DC power supply, and the MCU, flash chip, RS-485 transceiver, and other chips adopted 3.3 V power supplies. Therefore, the battery voltage was boosted to 12 V in the circuit hardware, to supply power to the sensor. A stable 3.3 V was output by the multichannel linear voltage regulator to supply power to the chips, in which the main controller (3.3 V) and the peripheral circuit (3.3 V) were independently supplied to eliminate the interaction between loads.

#### *3.2. Ultralow-Power MCU System*

MCUs typically use CMOS technology, and their power consumption mainly includes static power consumption and dynamic power consumption. Static power consumption mainly consists of the energy consumed by transistors, which is almost constant, most of the time. Dynamic power consumption includes switching power consumption, shortcircuit power consumption, and burr power consumption. In general, especially when working at a high frequency, dynamic power consumption plays a major role, which can be approximately expressed as the following Equation (1) [16]:

$$P = \mathbb{C}\_L \times V\_{DD}^2 \times f \tag{1}$$

where *CL* is the load capacitance, *VDD* is the supply voltage, and *f* is the clock frequency. The total power consumption is the sum of the static power consumption and dynamic power consumption. Therefore, to reduce the total power consumption, we can reduce the size of the MCU chip or the number of transistors; reducing the MCU supply voltage can reduce power consumption at the square level and reduce the clock frequency to just meet the application needs. In addition, a reasonable choice of working mode, such as entering sleep mode after working at full speed for a very short time, can also greatly save energy [17–19].

In this paper, the ultralow-power MCU adopted the MSP430 series, which was specially designed for battery-powered devices in field environments [20]. It adopted a lowpower supply voltage of 1.8–3.6 V. When operating under the clock condition of 1 MHz, the power consumption in active mode was only approximately 280 μA, in standby mode it was approximately 1.6 μA, and the minimum power consumption in RAM hold mode was only 0.1 μA. In addition, the MSP430 integrated rich on-chip resources and had multiple interrupt sources, which could be arbitrarily nested and used in a flexible and convenient manner. When the system was in a low-power state, the wake-up interrupt took only 5 μs. The minimum ultralow-power MCU system of the AHS is shown in Figure 3.

#### *3.3. Communication Module Based on LoRa*

LPWANs have attracted extensive attention, mainly because they can provide affordable connections for low-power devices distributed in very large geographical areas. When realizing the vision of the IoT, LPWAN technologies complement and sometimes even replace conventional wired communication and cellular and short-range wireless technologies, in terms of their performance for various emerging smart city and machine-to-machine applications [21]. Sigfox, LoRa, and NB-IoT are the three leading LPWAN technologies that compete for large-scale IoT deployment, and they have different characteristics that affect the performance of IoT solutions; device connectivity, information delay, and even device battery life [22]. Some of their key characteristics are shown in Table 1.

**Figure 3.** Minimum ultralow-power MCU system.

**Table 1.** The key characteristics of LPWAN technologies: Sigfox, LoRa, and NB-IoT.


LoRa has the characteristics of long-distance and low power consumption, which can prolong the battery life. It uses the unlicensed Sub-1GHz ISM bands and does not need to pay additional licensing fees. In addition, LoRa can adapt the data rate and allow private networks, while Sigfox and NB-IoT cannot [23]. LoRa, as a representative LPWAN technology, has emerged as an attractive communication platform for the IoT [24,25]. Therefore, in this paper, the mature commercial LoRa module, which was designed based on SemTech sx1278 (Camarillo, CA, USA), was used as the communication module of the AHS, with an adjustable transmission power and a maximum transmission power of 20 dBm; it supported remote wake-up in sleep mode and adopted advanced channel coding technology. Its receiving sensitivity could reach −142 dBm, enabling it to realize long-distance communication under ultralow power consumption. The LoRa gateway was designed based on a sx1301 transceiver controller. The gateway has a higher receiving sensitivity than other technologies, its sight distance coverage radius can reach 5 km, it includes eight receiver channels and one transmission channel (among which 8 receiver channels can receive data simultaneously), and it supports up to 10,000 LoRa terminals, which are convenient for building a massive connection network. It can also support LTE (4G/3G/2G), connect to servers without wiring, and adapt to the multiple access modes of PAAS platforms, such as MQTT, TCP, and Modbus [26].
