Measurement of soil electrical conductivity based on direct digital synthesizer (DDS) and digital oscilloscope

A soil electrical conductivity (EC) measurement system based on direct digital synthesizer (DDS) and digital oscilloscope was developed. The system took the “current-voltage four-electrode method” as the design principal and adopted a six-pin structure of the probe, two center pins to measure the soil EC in shallow layer, two outside pins to measure the soil EC in deep layer, and two middle pins for inputting the driving current. A signal generating circuit using DDS technology was adopted to generate sine signals, which was connected with the two middle pins. A digital oscilloscope was used to record and store the two soil output signals with noises in microseconds, which were from the two center pins and two outside pins, respectively. Then a digital bandpass filter was used to filter the soil output signals recorded by the digital oscilloscope. Compared with the traditional analog filter circuit, the digital filter could filter out the noises of all frequency except for the frequency of the excitation source. It could improve the effect of filtering and the accuracy of the soil EC measurement system. The DDS circuit could provide more stable sine signals with larger amplitudes. The use of digital oscilloscope enables us to analyze the soil output signals in microseconds and measure the soil EC more accurately. The new soil EC measurement system based on DDS and digital oscilloscope can provide a new effective tool for soil sensing in precision agriculture.


Introduction 
Traditional agriculture management adopts a unified management strategy for the farmland.In that farming system, massive fertilizers and pesticides are applied to ensure the yield.On the other hand, the utilization of massive fertilizers and pesticides in the farmland has led to many problems such as soil compaction, environmental pollution, and food safety problems [1,2] .Contrary to the traditional agriculture, Precision Agriculture [3,4] differentiates agriculture management based on the soil nutrient status and crop growth conditions of different locations in the farmland and can increase yield with less input [5,6] .Rapid and accurate access to soil parameters is one of the bases of Precision Agriculture [7,8] .Soil electrical conductivity (EC) is an important soil parameter and has a relationship with several soil properties such as soil moisture, soil salinity, soil texture, cation exchange capacity (CEC), and organic carbon content.The measurements of the soil EC can reflect the soil status and provide a basis for implementing Precision Agriculture [9,10] .
The measurement methods of the soil EC could be broadly classified into two categories, electromagnetic induction (EMI) method and current-voltage four-electrode method.
In the electromagnetic induction method, soil EC is obtained by measuring the corresponding electromagnetic field intensity of soil.It could measure soil EC of different depth and has the advantage of no contact with soil.Several soil EC detectors based on the EMI method have become commercial products, such as EM38 (Geonics Limited, Ontario, Canada), TSM (Geoprospectors GmbH, Traiskirchen, Austria).
On the other hand, although those products have higher accuracy, the high price makes them unavailable to farmers.
The current-voltage four-electrode method is a contact measurement method.Two electrodes are used to conduct the driving current to soil and the other two electrodes are used to detect the output signals (voltage) to calculate soil EC [11] .It has a simple structure and less affected by electromagnetic noises [12] .Research has shown that the two measurements of the soil EC have similar results [13] .The direct contact method is widely used for its robust construction, no interference from metal materials, and avoid daily calibration [14] .We have developed a vehicular soil electrical conductivity monitoring system based on the current-voltage four-electrode method, which can work together with ploughing [15] .
The soil EC measurement based on the "current-voltage four-electrode method" usually adopts an analog circuit to generate an AC current and an analog filter circuit to filter output signals.
A voltage effective value conversion circuit is used to convert soil output signals into DC signals, which are converted into digital values by the AD conversion circuit [15][16][17][18] .The results of AD conversion are used for calculating soil EC.Although the traditional system could measure soil EC conveniently, there are still several disadvantages.For example, the limitation of the voltage effective value conversion circuit and AD conversion circuit's conversion frequency lead to the loss of detail information of the soil output signals, which could be used for analyzing soil EC further.It is difficult to evaluate the signal-to-noise ratio (SNR) of the output signals and the measurement accuracy of the traditional soil EC measurement system.It is also difficult to evaluate the effect of the filter circuit.If the noises are not filtered by the filter circuit, they would affect the accuracy of the traditional soil EC measurement system.Furthermore, the current value of the driving current signal generated by the analog circuit is considered as a constant value, which is easily affected by the temperature, humidity and electromagnetic noises in fact.It is difficult to evaluate the filtering effect of the analogy filter circuit and the SNR of soil output signals under farmland conditions.In response to these problems, a soil EC measurement system based on DDS and digital oscilloscope was developed, which could solve those problems effectively and improve measurement accuracy.
Direct Digital Synthesizer (DDS) is a type of frequency synthesizer used for creating arbitrary waveforms from a single, fixed-frequency reference clock.It can be used as signal generators, local oscillators in communication systems, function generators, mixers, modulators, sound synthesizers and the part of a digital phase-locked loop [19] .
A basic DDS consists of a frequency reference, a numerically controlled oscillator, and a digital-to-analog converter (DAC).Digital oscilloscope could record the soil output signals at the frequency of 200 MHz, which could provide detailed information for in-depth analysis.
This study aims to develop a high accuracy measurement system of soil EC.Hence, we decided to develop a new kind of soil EC measurement system using a DDS module and a digital oscilloscope.It could solve the problems of the traditional soil EC measurement system.In the developed system, the traditional analog signal generation circuit will be replaced by a DDS circuit, which can greatly improve the accuracy and the stability of the driving current.The current value of the input signal is recorded for calculating soil EC, which can eliminate the influence of current fluctuation on soil EC.The voltage effective value conversion circuit will be replaced by the digital oscilloscope since it can collect much more information.The collected data can be used for calculating soil EC, analyzing noises and the SNR in-depth.A digital bandpass filter is used to replace the analog filter circuit so that the filtering effect can be evaluated according to the waveform of the filtered signals.

Materials and methods−Development of the soil EC system based on DDS and digital oscilloscope 2.1 Soil EC measurement system based on DDS and digital oscilloscope
The probe is an important part of the soil EC measurement system.Since the purpose of this study is to improve the measurement accuracy of soil EC by using DDS and digital oscilloscope, we didn't consider any improvement on the probe structure and decided to adopt a six-pin structure of the probe based on current-voltage four-electrode method [15] .As shown in Figure 1, pin J and pin K are the electrodes for input signal, pin M and pin N are used to measure soil EC in shallow layer (σ s ), and the pin P and pin Q are used to measure soil EC in deep layer (σ d ).

Figure 1 Illustration of the soil EC system
The distance between pin P and pin Q is 1 m.The distance between two adjacent pins is 0.2 m.The length of the copper pin tip is 0.15 m.The dimension of the digital oscilloscope, DDS module and laptop were also labeled.
The calculation formula of σ s is shown as the following [9] : And the calculation formula of σ d is shown as the following [9] : where, σ is soil electrical conductivity, S/m; d is the distance between the two probes, m; V MN is the voltage between probe M and the probe N, V; I is the current of the input signal, A; In the traditional soil EC measurement system, I is considered as a constant value.However, in the developed system I is considered as a variety to eliminate the influence of the input signal's fluctuation.
The overall design's comparison of the traditional soil EC measurement system and the system based on DDS and digital oscilloscope is shown in Figure 2. In the traditional system (Figure 2a), the input signal is generated by an analog circuit.It contains obvious noises and the amplitude is relatively small.The output signals are also processed by analog circuit and the frequency of the voltage effective value conversion and AD conversion is slow.In addition, there is no way to evaluate the SNR of the output signals and the effect of the analog filter circuit.
In response to the above questions, a new soil EC measurement system was developed (Figure 2b) which based on DDS and digital oscilloscope.The developed system consists of a DDS signal generation circuit, a multimeter, two input electrodes, four output electrodes, a digital oscilloscope, a digital filter, a PC and other components.The DDS signal generation circuit generates a sine signal with stable waveform and a larger amplitude conducts it into the soil through the input electrodes.The multimeter is used to measure the current value of the sine signal, which is used to eliminate the impact of the input signal fluctuations on measurement results.The soil output signals are collected and recorded by the digital oscilloscope along with the environmental noises.
The maximum sampling frequency of the digital oscilloscope is 200 MHz, which can record the very detailed information.The mixed soil output signals and environment noises can be visually observed and the influence of the noises can be evaluated by analyzing the stored data.The digital bandpass filter consists of Chebyshev type I digital filters.The waveform of the output signals after filtering can be used for evaluating the effect of the digital filter.The average effective value of the output signal is used as the measurement result for calculating soil EC, which can reduce the influence of the noises.The developed system improves the measurement accuracy from the input signal, output signals sampling frequency, filtering effect, reducing noise by averaging and evaluating SNR of the signals.The detailed stored data also provide the feasibility of analyzing soil EC and noises further.

DDS signal generation circuit and multimeter
Compared with the excitation source generation circuit of the traditional soil EC measurement system, the DDS signal generation circuit has the advantages of larger amplitude, better stability and flexible operation.DDS works on the basis of the sampling theorem.Firstly, the target signal waveform is sampled and the sampled value is stored in the memory as a lookup table.In use, the value in the table is read and converted into an analog signal by a DA converter.Therefore, the saved waveform is re-synthesized.
As shown in Figure 3, the DDS signal generation circuit in the system is based on AVR microcontroller.It can generate a sine wave, square wave, sawtooth wave, triangle wave, and other waves from 1 Hz to 65 kHz.The circuit is capable of generating an amplitude of 0.5-14 Vpp and the output impedance is 20-200 ohms.The waveform and frequency of the signal could be adjusted through the buttons and the LCD screen.The amplitude can be adjusted by the amplitude knob.In the system, a sine signal with a frequency of 1 kHz and an amplitude of 14 Vpp is used as the input signal. 1 kHz is chosen according to the existed research [20] , which can improve the measurements marginally.14 Vpp is the maximum of the DDS circuit's output signal, which can improve the SNR.In the traditional soil EC measurement system, the current of the input signal is assumed to be a constant value, which doesn't change while load varies.In the actual measurement procedure, the current intensity of the input signal will change when the load varies, which will greatly reduce the accuracy of the soil EC measurement system.In order to improve the measurement accuracy of soil EC, the current intensity of the input signal is recorded synchronously with soil output signals, which could eliminate the influence of the input signal's instability on the measurement results.

Digital oscilloscope
The As shown in Figure 5, the digital oscilloscope is small (103 mm×74 mm ×13 mm), easy to carry and integrate.The input voltage is -100-100 V and the aluminum alloy case can shield the influences of the environmental noises.
The oscilloscope processes signal based on FPGA.The bandwidth is 50 MHz and the maximum sampling frequency is 200 MHz.With the software of the oscilloscope, two channels of soil output signals could be collected.The oscilloscope could display real-time waveforms, storage waveforms and display spectrograms.

Digital filter
The soil output signals and the environmental noises are recorded by the oscilloscope and saved in PC as CSV files.In order to reduce the influence of environmental noises and improve the measurement accuracy of soil EC, a digital bandpass filter based on Chebyshev type I digital filter was applied.The bandpasses of the filter range are from 990 Hz to 1100 Hz.And the frequency of the input signal was 1 kHz.Except for 990-1100 Hz, the noises of all frequencies are filtered out, which could reduce the influence of the environmental noises in the farmland.
The output signals were converted into frequency domain when filtering.As shown in Figure 6a, the main noises were harmonics.The noises of other frequencies were relatively small.The filtered signal spectrum is shown in Figure 6b.The voltage at 1 kHz before filtering and after filtering is 886.92 mV and 864.42 mV respectively.The signal intensity at 1 kHz is less affected by the filter and the noises are eliminated obviously.

Soil samples
In order to verify the stability and repeatability of the system, a series of tests were carried out.
108 measurements were conducted by the developed soil EC system at the Shangzhuang Experimental Station of China Agricultural University, Beijing, and 108 soil samples were collected from each experimental position.Those soil samples were sealed in light-shielded sealed bags to minimize the impacts of the environment.And then the soil EC value of the 108 soil samples was also measured with the laboratory solution measurement method respectively.Corn was cropped in the experimental field for at least seven years.The field was under proper management after corn was planted and left idle after corn was harvest.For the 108 soil samples, the moisture varied from 6.3% to 15.6%.For soil texture, the clay fraction is 34.5%, the silt fraction is 56.4% and the sand content is 9.1%.The nitrogen content is 0.1328 mg/kg.
In order to verify the application prospects of the system, 10 soil samples with different nitrogen contents were also made and the measurements of soil EC were measured using the developed system and the laboratory method.For these 10 prepared soil samples, the soil moisture is 10.6%, the clay fraction is 34.3%, the silt fraction is 56.8%, and the sand content is 8.9%.average value of σ s and σ d was taken as the final measurement result of soil EC, which could reduce the impact of soil EC unevenness.

System performance experiment
The corresponding current values of the input signal, two-channel soil output signals were recorded and soil EC values were calculated and analyzed of the 108 field measurements.The average, maximum, minimum and Coefficient of Variation (CV) of the input signal current values are shown in Table 1.It could be seen from the table that the current value varies a lot while the load changes.It's very necessary to measure the current value with the soil output signals synchronously.Otherwise, the instability of the input signal would affect the measurement accuracy seriously.Repeatability is very important to the application of the system.In order to evaluate the repeatability of the system, 450 measurements were repeated for the same position in the field experiment.The average, maximum, minimum and CV of the measurement result are shown in Table 2.It could be seen that the system worked very stably and the fluctuation of the measurement results was small.When soil texture is even, σ s and σ d should be highly related.
In the 450 sets of σ s and σ d results of the repeatability experiment, the correlation coefficient of them is 0.91.For the 108 field measurements, the correlation coefficient of σ s and σ d is 0.93.It shows that σ s and σ d are highly related.
The 108 soil samples were also measured for soil EC values in the laboratory using the solution method.The soil samples were dried in a 60°C oven for 24 h firstly.The soil solution was made with a soil to water ratio of 1:5.The solution was fully shaken and then left aside still for 24 hours.The soil EC was measured using a DDB-303A portable conductivity meter (Shanghai Yidian Scientific Instrument Co. Ltd.).
The average, maximum, minimum and CV of the results measured by the developed system in the field experiment and DDB-3-3A meter in the laboratory are shown in Table 3.For the measurement results of these 108 soil EC measurements, the correlation coefficient between the developed system and the solution method is 0.7.The correlation coefficient is not very high.It's mainly because the laboratory solution measurement method eliminates the influence of soil moisture, soil texture and other factors.The developed system measurement needs to further eliminate the effect of those factors.

Prediction of soil nitrogen content using the developed system
Nitrogen is an essential element for crop growth.Rapid measurement of soil nitrogen content is very important for Precision Agriculture [21] .In this study, 10 soil samples with KNO 3 content of 0.33%, 0.67%, 1.00%, 1.33%, 1.67%, 2.00%, 2.33%, 2.67%, 3.00% and 3.33% were prepared.The soil sample was pulverized, sieved and thoroughly stirred and divided into 10 portions.After calculating the weight of KNO 3 needed for each portion of the soil sample, each KNO 3 sample was dissolved in an equal amount of distilled water, and mixed with each soil sample and stirred thoroughly.Finally, the soil samples mixed with KNO 3 samples were air dried to a suitable level and measured with the developed system after fully stirring again.
The soil EC of these 10 soil samples were measured with the developed system.The relationship between soil EC and soil KNO 3 content was analyzed and shown in Figure 9.The accuracy of the prediction is 0.93, which has achieved a good prediction accuracy.Under the conditions of consistent soil parameters such as soil moisture, soil particle size and temperature, there was a strong correlation between soil EC and soil nitrogen content.Soil nitrogen content could be predicted with soil EC when other soil parameters are consistent.

Discussion
Soil EC is related to a variety of soil parameters.Soil EC measurement could be used to reflect the soil conditions, which is of great significance to Precision Agriculture [22,23] .For the traditional soil EC measurement system based on the "current-voltage four-electrode method", the input signal was unstable.The electrical signals were easily affected by the environment.It was hard to evaluate the SNR of the soil output signals and the effect of the digital filter.Only a small amount of information could be recorded.
In response to the above disadvantages, a soil EC measurement system based on the DDS and digital oscilloscope was developed.In the developed system, DDS signal generation circuit was used to provide a more standard input signal.The current value of the input signal was recorded with soil output signals to eliminate the instability of the input signal, which varied with the change of load.Two-channel soil output signals were recorded along with the environment noises by the digital oscilloscope.And it was able to record the detailed signals in microseconds.After filtering by the digital filter, the noises of all frequencies except for 990-1100 Hz were filtered out, which greatly suppressed the influences of the noises and improve the SNR of the signals.The filtered waveform is approximately a standard sine waveform.The voltage effective value of the soil output signal is calculated by averaging, which could reduce the influence of noises further.σ s and σ d could be calculated with Equations ( 1) and (2).By calculating the average of σ s and σ d , the influence of soil texture inhomogeneity on soil EC was further reduced.
The stability of the input signal and the overall measurement stability of the system were analyzed through experiments.And the measurement results of the developed system were compared with the measurement results of the laboratory solution method.Besides, soil samples with different nitrogen contents were prepared and the soil EC of them was measured by the developed system.It achieves a good accuracy when predicting soil nitrogen content with soil EC measurements.In the case of consistent soil moisture, soil texture, soil temperature and other parameters, soil EC could be used to predict soil nitrogen content accurately.
The results above mentioned were basically achieved under the conditions of the laboratory.
Although it has proved the performance of the developed system, it is necessary to conduct field tests in the next study to improve practicability.Furthermore, it is necessary to study the new algorithms of processing the oscilloscope's waveforms in the future.
With proper data processes algorithms, the impacts of complex farmland environment could be reduced and the accuracy and application range of the system could be improved.

Conclusions
1) A DDS signal generation circuit was used to generate an input signal, which significantly improves the stability of the input signal.It could reduce the influence of environment noises on the input signal and provide a standardized sinusoidal signal.The current value of the input signal and the soil output signals were recorded simultaneously.It could eliminate the influence of instability of the input signal on the measurement accuracy completely.
2) Two-channel soil output signals mixed with the environment noises were recorded by the digital oscilloscope in microseconds, which could record the detailed information of the signals.The waveform of these signals could be seen directly on the PC to evaluate the SNR of the output signals.When the SNR significantly reduced, system adjustment was needed to improve the SNR.The detailed waveform data could be used to analysis the reason for waveform jitter and noise enhancement, which could improve measurement accuracy further.
3) The use of the bandpass digital filter significantly improved the filtering effect.It could filter the noises of all frequencies except for the input signal's frequency, which could improve the SNR.The filtered signal was approximately a standard sine wave.The filtering effect of the digital filter could be intuitively evaluated by comparing the signal waveforms before and after filtering.When the filtering effect reduced, the parameters of the digital filter could be adjusted to improve the filtering effect.
4) A large number of waveforms were recorded by the digital oscilloscope.And the effective values of the soil output signals were calculated by averaging, which could reduce the influence of the environment noises.The corresponding σ s and σ d were calculated.By calculating the average of the σ s and σ d , the influence of soil texture unevenness could be further reduced to improve the system measurement accuracy.

Figure 2
Figure 2 Comparison of the overall design of the traditional soil EC system and the developed soil EC system

Figure 3
Figure 3 Diagram of DDS signal generation circuit Compared with the electrical signal generated by the traditional AC analog circuit, the DDS signal generation circuit could generate a variety of waveforms with larger amplitudes and more standard waveforms.The electrical signals generated by the traditional AC signal generation circuit and DDS signal generation circuit are shown in Figure 4a and Figure 4b, respectively.It could be seen that the signal in Figure 4a contains a lot of noises and the SNR is low.While the signal in Figure 4b has a larger amplitude and SNR than the traditional signal shown in Figure 4a.

Figure 4
Figure 4 Comparison of the signal generated by traditional signal generation circuit and DDS signal generation circuit portable digital oscilloscope (DreamSourceLab open-source hardware lab) was used to collect, display and record two channel soil output electrical signals.The soil output signals were saved by the oscilloscope along with the environmental noises.By analyzing the data, SNR could be evaluated.The closer the output signals are to the input signal (sine waveform), the less the output signals are affected by noises.

Figure 5
Figure 5 Digital oscilloscope 2.4 Digital filterThe soil output signals and the environmental noises are recorded by the oscilloscope and saved in PC as CSV files.In order to reduce the influence of environmental noises and improve the measurement accuracy of soil EC, a digital bandpass filter based on Chebyshev type I digital filter was applied.The bandpasses of the filter range are from 990 Hz to 1100 Hz.And the frequency of the input signal was 1 kHz.Except for 990-1100 Hz, the noises of all frequencies are filtered out, which could reduce the influence of the environmental noises in the farmland.The output signals were converted into frequency domain when filtering.As shown in Figure6a, the main noises were harmonics.The noises of other frequencies were relatively small.The filtered signal spectrum is shown in Figure6b.The voltage at 1 kHz before filtering and after filtering is 886.92 mV and 864.42 mV respectively.The signal intensity at 1 kHz is less affected by the filter and the noises are eliminated obviously.2.5 Soil samplesIn order to verify the stability and repeatability of the system, a series of tests were carried out.108measurements were conducted by the developed soil EC system at the Shangzhuang Experimental Station of China Agricultural University, Beijing, and 108 soil samples were collected from each experimental position.Those soil samples were sealed in light-shielded sealed bags to minimize the impacts of the environment.And then the soil EC value of the 108 soil samples was also measured with the laboratory solution measurement method respectively.Corn was cropped in the experimental field for at least seven years.The field was under proper management after corn was planted and left idle after corn was harvest.For the 108 soil samples, the moisture varied from 6.3% to 15.6%.For soil texture, the clay fraction is 34.5%, the silt fraction is 56.4% and the sand content is 9.1%.The nitrogen content is 0.1328 mg/kg.In order to verify the application prospects of the system, 10 soil samples with different nitrogen contents were also made and the measurements of soil EC were measured using the developed system and the laboratory method.For these 10 prepared soil samples, the soil moisture is 10.6%, the clay fraction is 34.3%, the silt fraction is 56.8%, and the sand content is 8.9%.

Figure 6 3 Results and discussion 3 . 1 Figure 7 Figure 8
Figure 6 Comparison of frequency domain diagram before and after filtering3 Results and discussion3.1 Waveform of output signals before and after filteringThe waveform comparison of the soil output signals before and after filtering is shown in Figures7a and 7brespectively.Due to noises interference, the waveform fluctuated significantly at the peaks and troughs before filtering, and it became approximately standard sine wave after filtering.As seen in Figure7, the digital filter achieved a very good filtering effect.

Figure 9
Figure 9 Relationship of soil EC and soil Nitrogen content