1. Introduction
Temperature and moisture sensors have extensive applications in many industries, including agriculture, food, pharmaceuticals, mining, construction, and so on. For instance, integrated temperature and moisture sensors have been widely deployed in the wheatland in Zhejiang academy of agricultural sciences, as shown in
Figure 1.
Many kinds of moisture sensors have been researched and developed. However, previous researchers have proven that temperature variation has a significant and nonlinear influence on moisture measurement results [
1,
2]. On the one hand, the materials which make up the moisture sensing elements behave in a nonlinear way with the temperature. On the other hand, all moisture sensors must contain active electronics, which are characterized by a nonlinear relationship with temperature [
3,
4]. To obtain a correct moisture reading, primitive moisture measurement data need to be adjusted according to temperature, often in a nonlinear manner [
3,
4,
5,
6].
In general, a commercial sensor would be made of a temperature sensing unit and a moisture sensing unit integrated together. Conventionally, moisture adjustment by temperature was achieved with look-up tables (LUTs), which are large datasets consisting of measured temperatures, measured moistures, and corresponding adjusted moisture values [
6]. Manufacturers perform huge numbers of tests under various temperatures and moisture levels in order to construct LUTs. However, the accuracy of this nonlinear mapping relationship depends on the precision of the measurements and the size of the LUT [
7,
8]. LUT-based adjustment can be highly accurate; however, a sensor unit can potentially be used in a huge range of temperatures, thus requiring a huge LUT to accurately provide moisture level readings. Despite this, the LUT method is effective and straightforward, although its huge size means it cannot be implemented in a microcontroller with limited memory.
A mathematical model of nonlinear adjustment can overcome the shortcomings of conventional sensors, and to a large extent, reflect and compensate the complex effect of temperature on moisture readings [
9,
10,
11]. However, the existing compensation methods often use nonlinear mathematical models with fixed orders, which may not reach optimal error under different usage environments, thus making it difficult to attain the best compensation effects. In addition, these models are hard to migrate from one type of sensor to another.
In order to achieve a better sensing performance and lower measurement error, we propose a nonlinear compensation method for adaptive order adjustment. A high-order mathematical formula is used to reflect the nonlinear relationship between the actual moisture and the sensor’s measured probe voltage [
12,
13]. A high-order mathematical compensation model with the smallest error is selected by an adaptive order selection module. The experimental results verify that the measurement accuracy of this adaptive order nonlinearity compensated temperature and moisture sensor is significantly improved.
2. System Construction
The structure of a conventional temperature and moisture sensor is shown in
Figure 2. A temperature sensor and a moisture sensor are integrated in the system. The analog measurement results are digitized by an analog-to-digital converter (ADC) and then calibrated by a LUT-based linearization module [
14]. The calibration memory should be large enough to store a large LUT for high-accuracy temperature and moisture sensing, thus this traditional method requires a large storage capacity.
As shown in
Figure 3, the temperature-moisture sensor uses a fixed-order temperature-dependent nonlinear compensation model rather than a look-up table. Temperature-dependent nonlinear modeling requires three sets of data, including internally detected moisture, internally detected temperature, and true moisture transmitted from the outside via the RS485 interface [
15]. When determining the fixed-order nonlinear model, the least square (LS) algorithm is used to estimate the model coefficients.
The adaptive order-adjusted temperature and moisture sensor proposed in this paper, as shown in
Figure 4, adds an adaptive order adjustment and feedback module based on the
Figure 3 fixed-order nonlinear compensation model. The same as the architecture shown in
Figure 3, temperature-dependent nonlinear modeling requires the same three sets of data, including internally detected temperature, internally detected moisture, and true moisture. The adaptive nonlinear order regulation algorithm module is added to search for the model with the optimal nonlinear order and the best nonlinearity compensation performance. During the searching process, the LS algorithm is used to estimate coefficients of the variable order models.
The advantages and disadvantages and degree of difficulty of the three temperature and moisture sensors are shown in
Table 1. All of the three integrated sensors can be implemented by a common sensor with temperature and moisture sensor cores and an STM32L4R5 microcontroller with 2048 KB flash, 640 KB ram, 12-bit DACs (digital-analog convertor), and 16-bit ADCs (analog-digital convertor) from STMicroelectronics in Geneva, Switzerland.
3. Adaptive Nonlinear Order Regulating Model-Based Nonlinearity Compensation Algorithm
We performed a total of 12 sets of tests among an adaptively-ordered nonlinearly-corrected sensor, a noncalibrated sensor, and a fixed third-order nonlinearly-corrected sensor just as in [
15]. The true moisture levels of each test were fixed, and moisture was measured in a changing environment from
C to
C, and subsequently compared with the true moisture values. The nonlinear effects of temperature on moisture measurements are clearly observed. The nonlinear modeling and the coefficients estimation are brought out by the experimental data of moisture sensing, as listed in
Table 2. To be clear, the true moisture values in the
Table 2 were measured using the weighting method after drying, which is a well-known standard method of moisture measurement [
16,
17].
The empirical Topp’s equation describes the nonlinear relationship between the volumetric water content
and the dielectric constant of water
[
18]:
Thus, during the measurement, we expected the measured moisture
to vary with temperature according to the following relationship:
where
, and
C, and where
.
During the test, the dielectric constant of water decreases with increasing temperature [
19,
20,
21], and so a temperature-dependent nonlinear model needs to be constructed to compensate for the effects of temperature [
15,
22,
23]. The relationship between the fixed actual moisture value
and the actual water dielectric constant can be seen in Equation (
3). The nonlinear relationship we constructed can be seen in Equations () and ().
where
is the real moisture of the
test;
is the real dielectric permittivity of water in general;
is temperature-related nonlinear factor; and
are the
n nonlinear coefficients to be estimated.
Estimated nonlinear coefficients are applied to validate the performance of the temperature-related nonlinearity compensation. By plugging
and
into Equations (
3)–(), one gets the estimation of the real moisture values
. For each test
i, the moisture error ratios with and without nonlinearity compensation [
15], expressed by
and
, are respectively defined as
where
m is the temperature index, and
M is the total number of the temperatures.
The specific calculation process can be seen in Algorithm 1:
Algorithm 1 Calculation process. |
- Require:
: real moisture of the test; : real dielectric permittivity of water; : temperature-related nonlinear factor; :the nonlinear coefficients to be estimated; n: Nonlinear correction equation order; - Ensure:
P:the optimal corrected nonlinear order; - 1:
initial ; - 2:
repeat - 3:
; - 4:
compute by solving Equation (2) with the measured moisture in each row of Table 2; - 5:
acquire by solving Equation (3) with the real moisture in each row of Table 2; - 6:
obtain by plugging and into Equation (4); - 7:
compute by solving Equation (5) by LS algorithm; - 8:
acquire ; - 9:
obtain ; - 10:
determine ; - 11:
if () then - 12:
set - 13:
set - 14:
else - 15:
set - 16:
end if - 17:
until () - 18:
is found, P is the optimal corrected nonlinear order.
|
In particular, the LS algorithm in Step 4 can be represented in matrix form as follows:
For the
ith moisture index, Equation (4) can be rewritten in the matrix form as
where the matrixes with
nth nonlinear order are
and (
) denotes matrix transpose.
With the knowledge of
and
, the nonlinear coefficients
can be estimated by the LS method. The objective function is
The least squares solution to Equation (
8) is
where
is the estimated nonlinear coefficients matrix.
4. Experimental Results and Discussion
Moisture error ratios under various nonlinear model-based compensation methods and the traditional methods are displayed in
Figure 5. Measurement environments were kept the same throughout. It is obvious that the measurement error is very large without correction, which shows that temperature has a significant and nonlinear influence on the measurement results. In addition, measurement errors were greatly reduced when using third-order nonlinear correction. To further enhance sensor performance, we proposed and studied the adaptive order adjustable model. For the sensors studied in this article, the moisture error ratio reached a minimum under the eighth-order nonlinear compensation model, which indicated the best correction effect. Furthermore, corrections at even higher orders (ninth and above) would not yield better results as they would be overcorrected.
For instance, in the condition of moisture index , the real moisture is , the sensing error ratio without nonlinearity compensation is as high as ; however, the error ratios with -order and -order nonlinearity compensations are reduced to and , respectively.
In the condition of moisture index , the real moisture is , the measurement error ratio without nonlinearity compensation is , but the error ratio with 3rd-order nonlinearity compensation is reduced to , while the error ratio with 8th-order nonlinearity compensation is . It is verified that the proposed adaptive nonlinear order regulating model-based nonlinearity compensation algorithm can obtain the optimal nonlinear order and achieve the best compensation performance.