**Calibration and Validation of a Low-Cost Capacitive Moisture Sensor to Integrate the Automated Soil Moisture Monitoring System**

#### **Ekanayaka Achchillage Ayesha Dilrukshi Nagahage \*, Isura Sumeda Priyadarshana Nagahage and Takeshi Fujino**

Graduate School of Science and Engineering, Saitama University, 255 Shimo-Okubo, Sakura-ku, Saitama 338-8570, Japan

**\*** Correspondence: ayesha@mail.saitama-u.ac.jp; Tel.: +81-48-858-3005

Received: 18 May 2019; Accepted: 3 July 2019; Published: 4 July 2019

**Abstract:** Readily available moisture in the root zone is very important for optimum plant growth. The available techniques to determine soil moisture content have practical limitations owing to their high cost, dependence on labor, and time consumption. We have developed a prototype for automated soil moisture monitoring using a low-cost capacitive soil moisture sensor (SKU:SEN0193) for data acquisition, connected to the internet. A soil-specific calibration was performed to integrate the sensor with the automated soil moisture monitoring system. The accuracy of the soil moisture measurements was compared with those of a gravimetric method and a well-established soil moisture sensor (SM-200, Delta-T Devices Ltd, Cambridge, UK). The root-mean-square error (RMSE) of the soil water contents obtained with the SKU:SEN0193 sensor function, the SM-200 manufacturer's function, and the SM-200 soil-specific calibration function were 0.09, 0.07, and 0.06 cm3 cm<sup>−</sup>3, for samples in the dry to saturated range, and 0.05, 0.08, and 0.03 cm3 cm<sup>−</sup>3, for samples in the field capacity range. The repeatability of the measurements recorded with the developed calibration function support the potential use of the SKU:SEN0193 sensor to minimize the risk of soil moisture stress or excess water application.

**Keywords:** calibration function; capacitive soil moisture sensor; internet-based data acquisition; soil moisture content

#### **1. Introduction**

Readily available soil moisture is a key requirement for the growth and development of plants and depends on the physical properties of the soil and the meteorological conditions of the surrounding environment. The upper and lower limits of the readily available soil moisture are known as the field capacity and the permanent wilting percentage, respectively. At the field capacity, sufficient water and air are retained in the soil, resulting in optimum plant growth. The effect of the meteorological conditions on soil moisture is minimal in indoor systems. However, the readily available soil moisture content varies throughout the soil, owing to the differences in transpiration and moisture loss from the soil, even in controlled environments [1]. Thus, continuous monitoring of the soil moisture content at different locations is required in indoor systems. These practices are costly, time-consuming, and labor-dependent.

There are several techniques to determine the soil moisture content, including the destructive gravimetric method as well as nuclear, electromagnetic, tensiometric, hygrometric, and remote sensing processes [2]. Among them, sensors employing an electromagnetic technique are widely utilized to measure soil moisture levels. Time-domain reflectometry (TDR), time-domain transmission (TDT), and capacitance sensors are the most commonly used sensors based on an electromagnetic technique [3,4]. TDR and TDT sensors are accurate but have limited large-scale applicability owing to the cost

of investment. In contrast, capacitance sensors are less expensive but require precise calibration. The capacitance of a sensor is determined by the dielectric constant [5,6] and the volume fraction of each phase (bulk water, water vapor, air, solid minerals, etc.) [7,8]. It provides real-time soil moisture data according to the changes in the moisture content of the soil.

Many researchers have focused on the calibration of low-cost sensors which are used in different sensing techniques, such as capacitance-based sensors [9,10], resistivity-based granular matrix sensors [9,11], and sensors based on a tensiometer technique [9], to measure the soil water content in fields [2,12–14] and to develop low-cost automated irrigation systems [15]. Some studies have considered the effects of the physical and chemical properties of soil on the performances of soil moisture sensors [4,13,14,16–18]. These studies provide valuable insight into the necessity of soil-specific calibration.

A variety of capacitance sensors have become increasingly popular because they are less expensive than TDR and TDT high-frequency (GHz range) sensors and sufficiently reliable. Considering the cost of investment, a low-cost sensor even with a relatively weak accuracy is preferred in agriculture [19].

The SKU:SEN0193 sensor is a commercially available, low-cost capacitive soil moisture sensor which operates in low-power consumption. However, this soil moisture sensor has not been properly investigated for its accuracy and repeatability under laboratory conditions. Hence, the present study was performed (i) to investigate the accuracy and reliability of the SKU:SEN0193 low-cost capacitive soil moisture sensor under laboratory conditions, (ii) to develop a calibration function, and (iii) to integrate this sensor with a data acquisition system.

#### **2. Materials and Methods**

The SKU:SEN0193 capacitive soil moisture sensor, (DFRobot, Shanghai, China) with dimensions of 9.8 × 2.3 cm (L × W) was used for this study. The SKU:SEN0193 sensor can be powered from a voltage source in the range of 3.3 to 5.5 V. Thus, it can be interfaced with low-power microcontrollers. In addition, the sensor is made of corrosion-resistant material which increases durability. In parallel, SM-200 (Delta-T Devices Ltd., Cambridge, UK) a well-established commercially available soil moisture sensor was used for comparison to evaluate the accuracy of the SKU:SEN0193 sensor. The SM-200 sensor operates at 100 MHz, which measures a material (soil, water, air) response to polarization in an electromagnetic field (i.e., permittivity). The permittivity of the soil can be detected as a voltage output corresponding to the soil moisture content. The measuring accuracy is ±0.3% for volumetric water content, θ from 0 to 0.50 m3 m<sup>−</sup>3. The SM-200 sensor has been used in studies as a reliable soil moisture sensor to determine the soil moisture content in the plant root zone [20] and as a reference sensor to compare the accuracy of other capacitive-type soil moisture sensors [21]. In addition, the SHT30 temperature and humidity sensor was used to obtain the temperature and humidity of the air.

Commercially available organic-rich gardening soil was obtained from a local producer (Gardening. Pro, Maruki, Japan), hereafter referred to as organic-rich soil. This soil was originally obtained from the surface of the kanto loam layer (Black soil, Kanuma city, Tochigi Prefrecture, Japan). The measured organic matter content and mineral content were 24.8 and 75.2%, respectively [22]. The air-dried soil was sieved through a 2 mm mesh to remove aggregated soil clumps, and the <2 mm fraction of the soil was used in this study. In addition, a laboratory soil mixture was prepared by mixing the organic-rich soil with vermiculite in a 1:1 ratio [23,24]. This soil mixture was used as a growing medium for laboratory plants.

#### *2.1. Data Acquisition and Analysis via an Internet-Based Platform*

The data acquisition system used in this study consisted of two main components called the microcontroller unit and the Wi-Fi module. The main microcontroller STC89C52RC was operated at a speed of 11.0592 MHz. A software-implemented I2C bus [25] was used to interface a 16 <sup>×</sup> 2 LCD (1602 character-type liquid crystal display) module, an ADS1115 16-bit analog-to-digital converter (ADC), and temperature and humidity sensor with the microcontroller. An ESP8266-12E low-cost serial-to-WiFi module was interfaced through STC89C52RC inbuilt UART. The analog data output pin of the SKU:SEN0193 sensor was connected to the ADS1115 with a full-scale range of ±4.096 V. The ADS1115 converted the voltage of SKU:SEN0193 sensor to raw counts (raw). ThingSpeak API, an open IoT (Internet of Things) platform, was used to collect and analyze data with MATLAB@ analytics. The assembly program for the microcontroller (Supplementary Material: Microcontroller program code) was written by using Keil μVision 5 IDE, and AT commands were used to control the WiFi module (Figures 1 and 2). The total cost of the developed prototype was around \$45.7 (Table 1).



**Figure 1.** Acquisition and visualization of real-time data during the soil sample calibration process.

**Figure 2.** Circuit diagram of the data acquisition system.

#### *2.2. Soil Sample Preparation*

Soil samples with different soil moisture contents were prepared by adjusting the soil moisture content gravimetrically. The moisture-adjusted samples were packed into polycarbonate containers (average volume 110 cm<sup>3</sup> (Area: 18.08 cm<sup>2</sup> <sup>×</sup> Height: 6.1 cm)) with an average dry bulk density, <sup>ρ</sup>d, of 0.6 g cm−<sup>3</sup> for organic-rich gardening soil and 0.3 g cm−<sup>3</sup> for the laboratory soil mixture. Then the containers were covered with plastic wrappings to avoid moisture loss during the calibration, and the samples were stored after sealing with a lid. The sensor was inserted to the center of the soil core at a depth of 5–6 cm from the upper soil surface. Then, the samples were let achieve equilibrium for 15 to 20 min, before performing the measurements. The noise of the data, i.e., data fluctuation, was very limited during the measurements. All experiments were performed at room temperature (25 ◦C). The raw counts of the samples for each gravimetric water content were stored using the Thingspeak platform.

#### *2.3. Sensor-to-Sensor Variability Study*

Prior to the calibration, the sensor-to-sensor reading variability (raw counts) of the SKU:SEN0193 sensors for predetermined soil moisture contents was evaluated (Table 2). The sensor-to-sensor variability study was performed only for the organic-rich soil. Samples with two different soil moisture contents (40 and 80%, g g−<sup>1</sup> of organic-rich soil), in duplicate, and water were used to test sensor-to-sensor variability. Repeated measurements (twenty replications of sensor measurements) were obtained for every duplicated soil sample with four SKU:SEN0193 sensors (S1, S2, S3, and S4). The sensor-to-sensor variability was analyzed using a one-way Analysis of Variance (ANOVA) statistical test [26]. Further, to estimate the measurement noise of the SKU:SEN0193 sensors, the coefficient of variance (CV) of raw counts was determined. The CV values thus obtained were CVS1 = 0.05%, CVS2 = 0.10%, CVS3 = 0.06%, CVS4 = 0.09% for 80%, g g−<sup>1</sup> sample, i.e., an organic-rich soil sample in a field capacity range.

#### *2.4. Calibration of the Sensor*

Considering the sensor-to-sensor variability, the samples were measured repeatedly using two selected SKU:SEN0193 sensors to obtain a calibration function. The soil-specific calibration was performed using the organic-rich gardening soil and the laboratory soil mixture. The moisture contents of the tested soil and soil mixture were adjusted gravimetrically using distilled water. Moisture-adjusted samples were prepared with gravimetric water content of 0 (oven dried), 10, 20, 30, 40, 50, 60, 70, 80, 90, and 100 g g<sup>−</sup>1. The moisture-adjusted samples were kept in closed plastic bags for 24 h for equilibration, and the gravimetric water content was verified by evaluating the moisture content of each sample by oven-drying at 105 ◦C [27]. The raw counts for the samples of the two different materials with each gravimetric water content were stored using the Thingspeak platform.

#### *2.5. Validation of the Developed Calibration Function*

The developed calibration function was validated by measuring organic-rich soil samples with different moisture contents: oven-dried samples, air-dried samples, samples with a moisture content of up to 100%, and saturated samples (>100%, g g−1). The samples with different moisture contents were packed into polycarbonate containers. The soil water content of the samples was measured by the SKU:SEN0193 and SM-200 sensors. These values were confirmed gravimetrically by oven-drying. Similarly, data validation was performed in the selected values of the field capacity using samples with soil water contents of 60, 65, 70, 75, and 80% g g−1. A soil-specific calibration was performed for the SM-200 sensor in accordance with its user manual [28]. The calculated coefficients a0 and a1, which conveniently parameterize the dielectric properties of soils, were 1.3 and 6.1, respectively, for the organic-rich soil (Equations (1)–(3)).

$$
\sqrt{\varepsilon} = a\_0 + a\_1 \theta \tag{1}
$$

$$a\_0 = \sqrt{\varepsilon\_{dry\\_soil}}\tag{2}$$

$$
\sqrt{\varepsilon} = 1.0 + 16.103V - 38.725V^2 + 60.881V^3 - 46.032V^4 + 13.536V^5 \tag{3}
$$

where ε is the dielectric permittivity of the soil, θ (cm<sup>3</sup> cm<sup>−</sup>3) is the volumetric water content, and *V* is the SM-200 reading in Volts of the corresponding soil moisture content.

A polynomial conversion (Equation (4)) was performed to calculate the volumetric water content θ (cm3 cm<sup>−</sup>3) after soil-specific calibration for the organic-rich soil:

$$\theta = \frac{\left[1.0 + 16.103V - 38.725V^2 + 60.881V^3 - 46.032V^4 + 13.536V^5\right] - a\_0}{a\_1} \tag{4}$$

#### **3. Results and Discussion**

The data measured by the low-cost SKU:SEN0193 sensor and the temperature and humidity sensor were stored and visualized via an internet-based platform. The soil water contents predicted using the linear equation (which we developed by considering the raw counts of the sensor for bulk water and air with average values of 10,653 and 20,240, respectively) were inaccurate for both the organic-rich soil and the laboratory soil mixture. Hence, new calibration functions were developed by plotting the volumetric water content θ of the tested materials as a function of the raw count.

The volumetric water content θ (cm3 cm−3) of the samples can be obtained by the measured gravimetric water content *w* (g/g, %) of the samples, the dry bulk density of the material ρ*<sup>b</sup>* (g cm<sup>−</sup>3), and the density of water ρ*<sup>w</sup>* (g cm<sup>−</sup>3) as follows (Equation (5)) [29]:

$$\theta = w \frac{\rho\_b}{\rho\_w} \tag{5}$$

#### *3.1. Results of the Sensor-to-Sensor Variability Study*

The results of the ANOVA test at a 5% significance level for 20 replications of sensor response measurements (for each duplicated soil sample) of 4 SKU:SEN0193 sensors indicated that the mean sensor response was significantly different for the 4 SKU:SEN0193 sensors (see Table 2), demonstrating significant sensor-to-sensor variability.


**Table 2.** Results of the ANOVA test for 20 replications of sensor response measurements of 4 SKU:SEN0193 sensors for 3 different conditions.

\* df: degrees of freedom.

#### *3.2. Calibration of the SKU:SEN0193 Sensor for Organic-Rich Soil and Laboratory Soil Mixture*

The sensor-to-sensor variability study suggested that the responses of the tested four sensors were different, and therefore, their accuracy should be improved by using a sensor-specific calibration model for each sensor [29]. Considering the sensor-to-sensor variability, the samples were measured repeatedly using two selected SKU:SEN0193 sensors to obtain a calibration function.

The average raw count of the two SKU:SEN0193 sensors was obtained for each moisture-adjusted sample. Soil moisture, temperature, and humidity data were recorded at intervals of 1 min. After the equilibrium, the data were recorded over 15–20 min for each sample (*n* = 15–20). The averaged raw count as a function of volumetric water content, θ, was plotted in Figure 3. Here, we show the results for three moisture categories for organic-rich soil: dry to moderately wet samples with volumetric water content around 0.0–0.26 cm3 cm<sup>−</sup>3, field capacity samples with volumetric water content around 0.34–0.50 cm<sup>3</sup> cm<sup>−</sup>3, and saturated samples with volumetric water content around 0.62–0.74 cm3 cm<sup>−</sup>3. In addition, these data indicate that the sensor could distinguish the three different soil moisture levels of dry to moderately wet, field capacity, and saturated. Hence, the minimum and maximum values of the readily available soil moisture (permanent wilting percentage and field capacity) can be maintained using the SKU:SEN0193 sensor in organic-rich soil. Interestingly, the calibration curve obtained for the laboratory soil mixture did not show a clear difference among the three moisture categories. The laboratory soil mixture was prepared by mixing organic-rich soil and vermiculite. It has been reported that also high-cost sensors such as TDR do not accurately predict the soil moisture content of soil substitutes based on mineral media (vermiculite, tuff, perlite) [30]. Furthermore, it is known that less expensive capacitance moisture sensors operate in low frequencies and are thereby more sensitive to effects of soil textural variances and salinity [4,31]. Thus, the low sensitivity of the SKU:SEN0193 sensor for the soil moisture content of the laboratory soil mixture could be due to the high mineral content of the laboratory soil mixture.

**Figure 3.** Average raw count as a function of the volumetric water content θ of the tested porous materials (*n* = 20). The raw count varies with the dielectric constants of the bulk water and air and ranges between 10,000 and 20,000 according to the sensor output.

#### *3.3. Soil-Specific Calibration Function*

The derived soil-specific calibration function for the organic-rich soil accurately predicted the soil moisture values of known samples, while that for the laboratory soil mixture did not. Therefore, further studies were carried out using organic-rich soils.

The derived calibration function (polynomial function) of the SKU:SEN0193 sensor for the organic-rich soil is (*R*<sup>2</sup> = 0.98):

$$\theta = 13.248 - 2.576 \times 10^{-3} \text{ raw} + 1.726 \times 10^{-7} \text{ raw}^2 - 3.839 \times 10^{-12} \text{ raw}^3 \tag{6}$$

#### *3.4. Data Validation with the Commercially Available SM-200 Sensor and the Low-Cost SKU:SEN0193 Capacitive Sensor*

Soil samples were analyzed for their soil water content using the commercial available SM-200 sensor and the low-cost SKU:SEN0193 capacitive sensor. The volumetric water contents derived from the polynomial function of the SKU:SEN0193 sensor, the polynomial function of the SM-200 sensor for organic soil (manufacturer's function), and the soil-specific calibration (the function obtained from the measured coefficients) are plotted in Figure 4 as a function of the measured volumetric water content. The root-mean-square error (RMSE) was calculated for the soil water contents derived by the different calibration (polynomial) functions. The RMSE values of the SKU:SEN0193 sensor function, the SM-200 manufacturer's function, and the SM-200 soil-specific calibration function were 0.09, 0.07, and 0.06 cm<sup>3</sup> cm<sup>−</sup>3, respectively, for the samples with dry to saturated levels of soil water content. The soil water content at 0.45 cm<sup>3</sup> cm−<sup>3</sup> (74% gravimetric water content) was predicted precisely by the derived polynomial functions of both sensors (Figure 4a). Hence, data prediction at the field capacity (a gravimetric water content of 60–80%) was performed by measuring the moisture-adjusted samples (Figure 4b). The RMSE was calculated as before. The RMSE values of the SKU:SEN0193 sensor function, the SM-200 manufacturer's function, and the SM-200 soil-specific calibration function were 0.05, 0.08, and 0.03 cm<sup>3</sup> cm<sup>−</sup>3, respectively, in the field capacity range. The data prediction ability of the sensor appeared similar to that of the SM-200 sensor (with soil-specific calibration) at a lower investment cost. This study highlights the potential use of the low-cost SKU:SEN0193 capacitive moisture sensor for predicting the water content of soil.

**Figure 4.** The samples' soil water contents θ derived from the polynomial function of the SKU:SEN0193 sensor, the polynomial function of the SM-200 sensor for organic soil (manufacturer's function), and the soil-specific calibration function as a function of volumetric water content: (**a**) in the range of soil water contents from dry to saturated, (**b**) in the range of the field capacity.

Prior to deploying the system in the field, it is necessary to evaluate the performance of the derived function for continuous operation. Thus, soil moisture loss from a sample in the field capacity range was evaluated using the derived polynomial function (gravimetric basis) (Figure 5). The experiment was performed for 12 h, from day to nighttime, under laboratory conditions. The room temperature and the relative humidity of the room ranged from 25 to 26 ◦C and 72 to 75%, respectively, during the measurements. The 3D scatter-plot in Figure 5 illustrates the soil moisture loss with time. It shows a gradual decrease in soil moisture during 12 h of measurements.

**Figure 5.** Soil moisture loss with time. The developed calibration function (gravimetric basis) was used to derive the soil moisture loss every minute (Equation (6)).

#### **4. Conclusions**

We evaluated the accuracy and reliability of the SKU:SEN0193 low-cost capacitive soil moisture sensor under laboratory conditions. The developed soil-specific calibration function for gardening soil performed satisfactorily during the sensor validation procedure for the prediction of soil water content. Furthermore, our data suggest that the soil-specific calibration function of the SKU:SEN0193 sensor can be used to predict the soil water contents in three different ranges of soil moisture. Hence, it can be used to maintain the minimum and maximum values of readily available soil moisture in indoor systems. In contrast, the SKU:SEN0193 capacitive soil moisture sensor did not perform acceptably for the laboratory soil mixture in predicting the soil moisture content. This result suggests that the accuracy of the sensor depends on the soil mixture constituents.

However, it is necessary to investigate the effects of soil temperature, bulk density of the soil profile, and salinity levels on the accuracy of the sensor measurements. Further studies should be undertaken to assess its behavior in a real working scenario under field conditions.

**Supplementary Materials:** The following are available online at http://www.mdpi.com/2077-0472/9/7/141/s1, Supplementary Material: Microcontroller program code.

**Author Contributions:** Conceptualization, validation, and production of the final manuscript, E.A.A.D.N. and I.S.P.N.; Microcontroller program and prototype development, I.S.P.N.; Experiments for sensor calibration, E.A.A.D.N.; Supervision, revision and editing, T.F.

**Funding:** This study was supported by Saitama University president's discretion program.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**


© 2019 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 (http://creativecommons.org/licenses/by/4.0/).

*Article*
