A Novel Low-Cost Instrumentation System for Measuring the Water Content and Apparent Electrical Conductivity of Soils

The scarcity of drinking water affects various regions of the planet. Although climate change is responsible for the water availability, humanity plays an important role in preserving this precious natural resource. In case of negligence, the likely trend is to increase the demand and the depletion of water resources due to the increasing world population. This paper addresses the development, design and construction of a low cost system for measuring soil volumetric water content (θ), electrical conductivity (σ) and temperature (T), in order to optimize the use of water, energy and fertilizer in food production. Different from the existing measurement instruments commonly deployed in these applications, the proposed system uses an auto-balancing bridge circuit as measurement method. The proposed models to estimate θ and σ and correct them in function of T are compared to the ones reported in literature. The final prototype corresponds to a simple circuit connected to a pair of electrode probes, and presents high accuracy, high signal to noise ratio, fast response, and immunity to stray capacitance. The instrument calibration is based on salt solutions with known dielectric constant and electrical conductivity as reference. Experiments measuring clay and sandy soils demonstrate the satisfactory performance of the instrument.


Probes for Measuring θ, σ and T
Patents US2013073097 and US3882383 describe a probe capable of detecting water content in the soil [22,23]. However, the system is based only on conductivity measurements, and does not consider the dielectric constant of the soil. Probes designed to estimate the soil water content based on conductivity usually do not have good precision, because the results also depend on the soil salinity. Patent US5445178 proposes a sensor for this purpose based only on the dielectric conductivity [24], but it does not measure the soil electrical conductivity.
In this work, low-cost probes to measure θ and σ were developed based on measurement of the electrical impedance of the soil material located between two parallel stainless steel rods. In order to construct the probes, stainless steel rods (length = 130 mm, diameter = 3 mm), liquid polyester resin, a semiconductor temperature sensor (LM35), five-way cable and covers for electrical outlets plugs were used, according to the scheme shown in Figure 1a. The cover for electrical outlets plugs served as a housing and to fix the rods and the temperature sensor using polyester resin. Figure 1b illustrates the probes implementation.

Theory and Signal Conditioning Unit
According to Ohm's law in complex notation, the impedance (Z) corresponds to the ratio between the voltage (V) and the current (I) phasors. This concept assumes that the electrical properties of materials/circuits are time-invariant. The impedance establishes the relationship between module and phase of current and voltage signals in a dipole.
In some cases, it can be more convenient to use the admittance (Y)-inverse of impedance, for the analysis of electrical circuits. Equations (1) and (2) represent the impedance and admittance, respectively: G jB  Y (2) where j 2 = −1, R is the resistance and X the reactance in Ohms; G is the conductance and B the susceptance in Siemens. The real part of Equations (1) and (2) is related to the losses by Joule effect. The imaginary part is the ability to exchange energy. The complex relative permittivity (ε) is often used to characterize the electrical properties of materials. This parameter is related to the absolute complex permittivity (ε a ) according to Equation (3): where ε0 is the permittivity of free space (=8.85 pF· m −1 ). The fluid parameter ε presents dielectric relaxation, where the real part decreases with increasing frequency. This phenomenon occurs in the GHz-range. In this work, the frequency range of the measurements is limited to 5 MHz. Therefore, relaxation mechanisms can be neglected, and the complex relative permittivity can be represented by Equation (4): where ε is the relative dielectric constant (dimensionless), σ the electric conductivity (S· m −1 ) and ω the angular velocity (rad· s −1 ). The imaginary part is the dielectric losses factor. The impedance measurements of solid, liquid or gaseous substances are carried by means of a probe. Equation (5) lists the electrical properties of the substance around the electrodes, and the probe admittance: where kg is the geometric constant of the probe, σ g Gk  and 0 ωε ε g Bk  . As the impedance is a complex variable, it is necessary to determine two parameters to define it: module and phase, or real and imaginary part of voltage or current. The standard method of impedance measurement consists on applying a pure sinusoidal voltage at a single frequency to the sensor electrodes and measure the phase shift and amplitude, or the real and imaginary parts, of the resulting current using either analog circuit or analog-to-digital conversion and signal processing algorithm to analyze the response [25]. In this context, different measurement techniques have being proposed based on the frequency range, required accuracy, measurement range and complexity of the system [26][27][28].
Measuring voltage and current above 100 MHz are usually difficult, and generally are not directly applicable to high-frequency devices , as in the case of the patent US5479104 [29] and US5418466 [30], which work at frequencies up to 100 MHz and 150 MHz, respectively. In this case, the determination of impedance is usually derived from the measurement of wave reflection and transmission together with distributed circuit concepts, such as Theta Probe [31], HidroSense [32], TRIME tube access probe [33]. For this purpose, it is common to employ network analyzers and time domain reflectometers (TDRs), which have higher costs when compared to low frequency measurement systems [27,34].
At lower frequencies (up to MHz range) impedance is determined by current-voltage (or I-V), bridge or resonant methods. The I-V method is quite simple, but has low accuracy. The bridge method has high accuracy, but due to the need to balance the bridge (need of balancing), it is not suitable for fast, repeated and continuous measurements. The resonance method exhibits good accuracy, but also requires adjustment of resonance, which results in the same problem of the bridge method. Moreover, all the above methods are sensitive to stray capacitances to ground, which are normally present in probes due to connecting cables or other grounded metallic parts of a probe, for example. These stray capacitances can impair the measurement impedance, which makes it necessary to use more complex circuitry to eliminate their effect [25].
Sensor 5TE (Decagon Devices Inc., Pullman, WA, USA), for example, provides a 70 MHz wave to the prongs and the bult in microprocessor measures the stored charge, which is proportional to soil ε [13]. This technique requires a third rod to measure ε and σ. Furthermore, this technique does not eliminate the effect of stray capacitances, and requires hardware capable to operate in high frequencies.
Attempting to solve some of these drawbacks, we adopt a variation of the fourth method for measuring impedance, called auto-balancing bridge or self-balancing bridge. This method has a high accuracy, fast response and simple circuit. The measurement is improved with the inclusion of an operational amplifier with high input and low output impedances ( Figure 2). This setting is also known as trans-impedance amplifier or current-voltage converter. It has high signal to noise ratio and stray capacitance immunity, capable of measuring small impedances between the electrodes even in the presence of large stray capacitances to ground [25,35].
A measurement system for θ and σ using this measurement method, and neither a low cost embedded system that performs the conditioning and signal processing could not be found in the literature. This circuit allows estimating σ at low frequency (kHz) and ε at high frequency (MHz), requiring only one pair of electrodes in the probe. The basic auto-balancing bridge circuit diagram is represented in Figure 2a, where Vi is the input voltage, Zx is the unknown impedance, Z f is the impedance feedback circuit and Vo is the output voltage. The potential of the operational amplifier non-inverting port is connected to ground potential, which is also known as a virtual ground. Thus, the currents passing through Zf and Zx are balanced through the operational amplifier action, and the current through the unknown impedance is proportional to the operational amplifier output voltage.
In fact, there are stray capacitances Cs1 and Cs2, caused by cables used to connect the sensor to the measuring circuit according to Figure 2b. These capacitances do not affect the measurements since Cs1 is drained directly by the voltage source and Cs2 is virtually grounded by the operational amplifier. This is a major advantage of auto-balancing bridge circuit [25]. The gain of the circuit shown in Figure 2b is given by Equation (6): where Gx and Gf are the conductance, Cx and Cf are the capacitances of the impedances Z x and Z f , respectively. In Equation (6), Cx and Gx are directly connected with the determination of the sensor σ and ε. This involves the measurement of two parameters, which may be: (i) magnitude and phase in a single frequency; (ii) real and imaginary parts of V 0 at a single frequency; or (iii) two amplitudes at different frequencies. These three possibilities are mathematically equal, but differ with respect to the complexity of the circuit [25,36]. This work proposes an electronic circuit for instrumentation that uses the third option to estimate σ and ε of the material located between the probe electrodes.
According to Equation (6), two thresholds can be identified by the ratio of GxGf −1 and CxCf −1 when frequency f → 0 and f → ∞, according to Figure 2b. In practice, one should choose two frequencies located on each level. The voltage gain at lower frequency (A0) can be correlated with σ, and the voltage gain in the higher frequency (A1) with ε of the material located between the probe electrodes.
Silva [25] presented an approach to measure ε and σ of saline solutions using auto-balancing bridge circuit. However, these experiments were performed using signal generators for circuit excitation, and data was monitored and stored in the computer through an oscilloscope and a signal-processing algorithm. Solutions ε and σ were estimated by measuring the gain of the auto-balancing bridge circuit at two different frequencies.
The present work describes the development of an embedded system in order to perform all tasks proposed in Silva [25], and to measure the soil parameters ε and σ for agriculture purposes. Furthermore, the system measures temperature to evaluate its effect on the measurements of ε and σ. Figure 3 shows the circuit diagram and the signal-conditioning unit.
In the circuit diagram shown in Figure 3a, the microcontroller provides Pulse Width Modulation (PWM) signals at different frequencies (100 kHz and 5 MHz) with 50% working cycle. These signals pass through bandpass filters to make them closer to sine functions. Therefore, they can be used as the excitation source for self-balanced bridge circuit. The input and output of self-balanced bridge circuit are measured by the analog-to-digital converter (ADC) of the microcontroller. However, these signals are rectified before performing the reading. The multiplexers are meant to direct the power signals to the auto-balancing bridge circuit and to select which signal is read by the ADC: input signals or output. In addition, the microcontroller performs measurements of the temperature sensor located within the probe circuit and battery power level. This data is sent wirelessly to the master program installed on a computer. The measurement of load cell signal is used only in the system calibration process, which will be described later.
It is possible to use a variety of microcontrollers and amplifiers to implement the proposed circuit. For this implementation, the auto-balancing bridge uses a 680 Ω resistor, a 270 pF capacitor and an AD8065 FastFET operational amplifier. The microcontroller is a PIC16F873A. The multiplexers employ a CMOS quad bilateral switch CD4066. Both band-pass filter and rectifier are implemented with a TLE2072 operational amplifier.

Calibration Using Salts Solutions
To perform the calibration procedure seven different substances were used as references, all of which having both σ e ε known, as follows: μ The constant σ of each material was measured using an apparatus with automatic temperature compensation. On the other hand, ε was obtained from the literature. These values were adopted as conventional real values, both for σ and ε of the solutions.
The tests were conducted in a climate chamber with temperature controlled at 25 ± 1 °C. Forty measurements were performed for each situation. So, there were seven treatments and 40 replicates for each of the three designed probes.
For the calibration models, circuit voltage signals from the gains A0 and A1 of the auto-balancing bridge at each frequency were respectively correlated with σ and ε using linear regression.
After obtaining these models, the effect of temperature was evaluated. For this purpose, measurements were taken under seven different temperature conditions described above. Subsequently, the cooling chamber was configured to vary the temperature from 5 °C to 45 °C with 5 °C steps, with each step lasting for 2.5 h. During this process, the supervisory software carried out data acquisition.
According to the solutions measurements of σ and ε accomplished at different temperatures, two correction models were obtained empirically. After, they were applied in the soil conductivity and water content measurements. Both of them have also being compared to the correction models proposed by Rhoades et al. [37] Equation (7) and Chanzy et al. [38] Equation (8). Root mean square error (RMSE) and coefficient of determination (R 2 ) were employed to compare the corrections difference: where σ25 is the electrical conductivity adjusted to 25 °C , and σm is the conductivity measured according to the temperature T. For the complex relative permittivity, we have: where α is obtained empirically, based on the soil θ and σ; here we adopt α = 0.114 [38]. This model will be employed and compared to the one proposed in this work.

Tests Conducted with Soil
Two tests using clay and sandy soil were performed. These tests consisted of saturating a soil sample with water and submitting it to a drying procedure. Meanwhile, the sample mass and the signals corresponding to σ and ε were measured by the signal-conditioning unit and stored in the supervisory program database. A load cell suspending the sample measures its mass, as illustrated in Figure 4. The signal-conditioning unit is also responsible for performing these measurements.
The soil drying procedure consists on placing the structure shown in Figure 4 in the climate chamber, which was scheduled to reach 50 ± 1 °C for three hours and go back to 25 ± 1 °C for five hours, until the soil gets quite dry, and its weight practically stops changing. After this test, the soil moisture content by weight using a standard oven method for each measuring point is obtained. Finally, a correlation model between dielectric constant of the soil and the soil water content is fitted using linear regression.
Attempting to minimize the biasing influences on the sensor readings about the vertical gradient of water content from soil saturation to field capacity, the weighting container has restricted dimensions-75 mm diameter and 200 mm height.
The structure presented in Figure 4 was developed to find the calibration models for a specific soil according to a standard procedure. This procedure is necessary since the measuring circuit to obtain σ, ε and the soil temperature also detects the mass inside the weighing recipient. The acquired information is sent to the supervisory software that adjusts the calibration model. The novel calibration device greatly enhances the estimation precision of θ.
For experimental validation, we took 2608 measurements of sandy soil and 1780 measurements of clay soil, during a period of 12 and 16 days, respectively. The volumetric water content ranges for sandy and clay soil were 0.02-0.40 and 0.02-0.43. The volumetric soil water content was calculated multiplying the soil water content on weight basis by the soil bulk density ρ, which in this case is 1.27 g· cm −3 for sandy and 0.92 g· cm −3 for clay soils. In order to validate the correlation models between the dielectric constant and the water content, we employed the K-fold cross validation method. This analysis consists on randomly dividing the original sample data in K subsamples. After that, a single subsample is retained to be used as the validation, and the remaining K − 1 subsamples are used as training data. The cross-validation process is then repeated K times (the folds), until each K subsample is employed once as the validation data.
The K results from the folds then can be averaged to produce a single estimation. The advantage of this method over repeated random sub-sampling is that all observations are used for both training and validation, and each observation is used for validation exactly once [39]. Here we applied K = 10 and 100 rounds.
The models proposed to predict θ based on ε were compared with models developed by Topp et al. [40], Ledieu et al. [41] and Malicki et al. [42]. These models are represented by Equations (9)-(11), respectively. To quantify the models accuracy, we analyzed the RMSE and R 2 between observed and predicted values:  Figure 5a shows the correlation between σ measured by a conductivimeter and A0 for a temperature of 25 ± 1 °C. Figure 5b shows the correlation between ε of the substances and A1 for a temperature of 25 ± 1 °C. This experiment is based on work by Silva [25], which employs air (ε = 1, σ = 0), oil (ε = 2, σ = 0), isopropanol (ε = 19, σ = 0.06 μS·cm −1 ), glycol (ε = 37, σ = 3 μS·cm −1 ), deionized water (ε = 79, σ = 2 μS·cm −1 ) and water + salt (ε = 79, σ = 26 μS·cm −1 ) to demonstrated the first order relationship between the auto-balancing bridge circuit gain at high frequency and the dielectric constant of these substances. Assuming the same first order relationship and measuring principles, we use only three reference points of ε (Figure 5b). To evaluate the effect of temperature on the measured results of ε the same procedure described above was adopted. The slopes of correlation patterns between the measured value of ε and the conventional true value of ε (ε0) were used for each temperature, as shown in Figure 7. Two models were fit between the average temperature of each solution and slopes and Y-intercepts, as shown in Figure 8. Thus, it is possible to correct the measured ε and present the measurement result at a reference temperature of 25 °C, according to Equation (13).

Salt Solutions
Equation ( where ε25 corresponds to ε adjusted to 25 °C, and εm is ε measured according to the temperature T.

Soils
The measurement of σ is greatly influenced by temperature, as has already been observed in the tests with solutions. Figure 9 shows graphs of correlation between σ at 25 °C (σ25) and σ at all temperatures (20, 25, 30, 35 and 40 °C), measured before and after correction with temperature employing the correction model presented in this work (Equation (12)) and also the model proposed by Rhoades et al. [37] (Equation (7)). Table 1 shows R 2 and RMSE, after and before the σ correction according to the temperature.  Before correction, the adjusted models showed RMSE of approximately 6.8 μS· cm −1 for sandy soil and 2.0 μS· cm −1 for clay soil. Using the correction model presented by Rhoades et al. [37] Equation (7), it is possible to note that R 2 increases while RMSE decreases, for both soils. Employing the model developed here, R 2 increases while RMSE decreases even more, which indicates that the correction model proposed in this work is more accurated.
In this work we propose three prediction models: the first two Equations (14) and (15) are specific for sandy and clay soils; the third model was developed for both types of soil Equation (16). Even so, similar to Malicki et al. [42], it also takes into account ρ: Equations (14) and (15) could be considered a recalibration of Topp's equation, estimating water content based on ε through a third-degree polynomial, whose coefficient values change from soil to soil. Table 2 presents the results from the linear regression and cross-validation related to the models proposed in this work. Figure 10 illustrates the relation between θ predicted by each model and observed using the calibration system. Table 3 presents R 2 and RMSE for each relation.   According to Table 3, one can note that the prediction models for water content developed for each specific soil Equations (14) and (15) are more accurate due to the smaller RMSE and larger R 2 . Even so, the model represented by Equation (16), employed for both soils, also presented better precision than the regular models presented in the literature (Equations (9)-(11)). Figure 11 shows graphs of correlation between ε at 25 °C (ε25) and ε at all temperatures, measured before and after correction with temperature employng the models proposed in this work Equation (13) (8)). Table 4 ilustrates R 2 and RMSE, after and before the correction of ε based on the temperature of the two soils.
According to Table 4, it is possible to observe that the results accuracy do not present significant changes due to the correction. The correction improves the results related to the sandy soil, but worsens the results related to the clay soil. Seyfried and Grant [43] mention a small and non linear effect for the temperature response, ranging from 5 °C to 45 °C, during the measurement of ε. According to the authors, this effect is small enough to be ignored for many applications. Muñoz-Carpena [44] pointed out that the equipment that adopt the Time Domain Reflectometry (TDR), Amplitude Domain Reflectometry (ADR) and Frequency Domain Reflectometry (FDR) methods have a RMSE of 0.01 m 3 · m −3 . The measurement system that uses the neutral probe is the most accurate, since it has a RMSE of 0.005 m 3 · m −3 . Other inexpensive soil water content measurement systems presented RMSE of 0.02 to 0.03 m 3 · m −3 [12]. During the laboratory experiments, the measurement system developed in this work showed RMSE of 0.002 m 3 · m −3 for both clay and sandy soils, indicating good accuracy and cost-effectiveness with respect to traditional methods. Nevertheless, further experiments should validate the system accuracy under field conditions.

Conclusions
This paper presents the development, design and construction of a low-cost instrumentation system for measuring water content, apparent electrical conductivity and temperature of the soil. The measurement method is based on an auto-balancing bridge circuit. Experimental results obtained in the laboratory demonstrate the system accuracy, considered satisfactory for irrigation control. A comparison with other results in the literature also indicates the proposed system as a promising instrumentation device.
The proposed device corresponds to an efficient alternative to automatize irrigation systems, especially due to the satisfactory accuracy and low cost associated. The instrument was designed considering the final cost of the system to the farmer, which is a crucial concern while developing automation solutions for agriculture. Future work includes testing the prototype with slightly different and/or in undisturbed soils, and also manufacturing new devices for testing and field validation.