# Improvement of the Capacitive Grain Moisture Sensor

Liu Yang, Yongjun Zheng, Zhijie Jiang, Zhijun Ren

► To cite this version:

Liu Yang, Yongjun Zheng, Zhijie Jiang, Zhijun Ren. Improvement of the Capacitive Grain Moisture Sensor. 5th Computer and Computing Technologies in Agriculture (CCTA), Oct 2011, Beijing, China. pp.300-307, 10.1007/978-3-642-27275-2_34. hal-01361152

HAL Id: hal-01361152

https://inria.hal.science/hal-01361152

Submitted on 6 Sep 2016

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Improvement of the Capacitive Grain Moisture Sensor

Liu Yang¹, Yongjun Zheng¹, Zhijie Jiang², Zhijun Ren¹,

¹ Engineering College, China Agricultural University, 100083, Beijing China;

² The Department of Automobile, Beijing Jiaotong Vocational Technical University, 102200, Beijing China

yangliu@cau.edu.cn, zyj@cau.edu.cn,

jiangzhijie@163.com, zhijunr@gmail.com

**Abstract.** Moisture is one of the most important factors affecting grain quality in storage. The grain must be dried as soon as possible after harvesting to lower moisture to a standard level. It is difficult to obtain satisfactory measurement effect on precision in capacitive grain's moisture measurement due to many influencing factors, such as temperature, species and weight. The data confusion method of Radial Basis Function nerve network is adopted with improved hardware of the measurement system. Tests show that the precision in moisture measurement of wheat has been improved.

**Keywords:** Moisture Measurement, Precision, Factors, Radial Basis Function, Never Network

## 1 Introduction

Safe storage of food is one of the most important strategic issues for a nation's economy and the people's livelihood. Moisture is a key factor to food storage. High grain moisture levels at harvest can result in heat, fermentation, deterioration and low burgeoning rate. To ensure safe storage, the grain must be dried as soon as possible after harvesting and is maintained at lower moisture levels. It is, therefore, important to use an advanced sensor system to accurately monitor grain moisture levels. This paper examines the ways to improve accuracy and reliability of moisture sensors and to develop an advanced moisture monitoring system.

China urgently needs matching equipment with simple construction, low cost, high accuracy, reliable and good repetition of results. The capacitance sensor has advantages such as low cost, high sensitivity and good dynamic performance and it is suitable for online measurement. So the capacitance sensor is selected to measure the moisture.
## 1.1 The current situation of online moisture sensors

The principle of the capacitance sensor is that it measures the capacitance value to obtain moisture levels of the grain which changes with the relative dielectric constant. There are two types of capacitance sensors: double electrodes and cylindrical[1].

1. Change the hidden area

The capacitance value is proportional to the angle movement. The hidden area can be changed by using the line movement[2]. At the beginning the hidden area is the biggest and it changes when the relative electrodes changes. It is hard to measure moisture levels of the grain.

2. Change the distance of the electrodes

This kind of sensor consists of two electrodes. One is grounded and the other is active with the measured object. The capacitance varies when the distance of the two electrodes changes. Accuracy of measurement is low when moisture levels of the grain are high.

3. Change the dielectric constant[3]

One kind is cylindrical sensor probe. It has stable performance and high accuracy. But it is difficult to install this type of sensor on the dry machine and to achieve online measurement.

# 2 Research on affecting factors of the capacitive grain sensor

The capacitance value can be expressed by the following equations.

$$C_x = K_0 e \varepsilon_3 + K_0(1-e)\varepsilon_1 + \frac{K_0 \gamma_d (1-e)(\varepsilon_2 - \varepsilon_1)}{1 + M(\gamma_d - 1)} M \quad (1)$$

$K_0 = \frac{\varepsilon_0 L H}{D}$, LH is the front area and D is the distance between the two electrodes;

$\varepsilon_0$ is the vacuum dielectric constant; M is the grain moisture; $\varepsilon_1$ is the object dielectric constant; $\varepsilon_2$ is the dielectric constant of water in grain; $\varepsilon_3$ is the dielectric constant of the air between grain holes; $\gamma_d$ is the object volume of grain; e is the rate of hole gaps.

From the equation we can derive the following affecting factors:

1. The temperature is an important factor and should be eliminated.

2. Different grains have different dielectric constants which will affect the capacitance.

3. The rate of grain gaps is the main factor that affects precision and should be eliminated.
# 3 Hardware Circuit

## 3.1 Moisture measurement

Fig.1 is the basic circuit of capacitance moisture senor. The driving electrode is connected with the oscillation circuit and sensor electrode and protecting electrode are connected to the ground. The frequency $f$ is decided by induction L and measured capacitance $C_x$

$$f \propto \frac{1}{\sqrt{LC_x}} \quad (2)$$

Different grain moisture leads to changes in $C_x$, and the frequency changes. Thus we can obtain the moisture from the frequency.

<figure><img src="image_2.png" /><figcaption>Fig. 1. Moisture Measurement Circuit</figcaption></figure>

## 3.2 Temperature Measurement

Fig. 2 is the temperature to frequency transfer circuit. LM35 is the accurate temperature sensor. The output voltage is proportional to the Celsius temperature. The accuracy is ±0.5°C. Output voltage is -1.0~+6V. The output signals transfer into frequency signals.
<figure><img src="image_3.png" /><figcaption>Fig. 2. Temperature Measurement Circuit</figcaption></figure>

3.3 Weight Measurement

Fig.3 shows the weight measurement circuit. The resistance strain sensors are used in the measurement circuit. The difference amplifier is applied in the preamplifier to improve the input resistance and block the common noise. Two channels of low-pass filter the signals of the two arms. The signals send to slave computer.

<figure><img src="image_4.png" /><figcaption>Fig. 3. Weight Measurement Circuit</figcaption></figure>
# 4 Hardware Circuit

There are a few major factors affecting the measuring accuracy of grain moisture: the ambient temperature, the testing frequency and the wieght of the grain[4][5]. This model composes by input layer, hidden layer and output layer. The input layer has 3 neurons, the hidden layer has I neurons, the output layer has one neuron. The neural network topology is show in Figure 4.

<figure><img src="image_5.png" /><figcaption>Fig. 4. RBF network structure of moisture measurement system.</figcaption></figure>

## 4.1 Mathematics Model

The input vector is $X = [x_1, x_2, x_3]$; $x_1, x_2, x_3$ are temperature, frequency and compactness. The output vector is $Y = y$, y is grain moisture. RBF network hidden layer output (the ith node)[6].

$$u_i = \varphi(\|X - t_i\|) \quad (3)$$

In the sentence, RBF function ($\varphi$) is Gauss function, $t_i$ is the centre of ith hidden node, $\|\cdot\|$ is Euclidean Norm.

From the mathematical model, it is known that.

$$y = \sum_{i} w_{i}u_{i} - \theta \quad (4)$$

In the sentence, $w_i$ is the ith connection weight between the ith output $u_i$ and the system output y, $\theta$ is respectively the neurons threshold of output.

W, as a Vector with I dimensions, is given by weights matrix composed of output connection weights.

$$W = [w_1, w_2, \dots, w_i, \dots, w_{I-1}, w_{I}] \quad (5)$$
To obtain RBF network[7] for a measuring system, which has N groups of inputs and outputs, can be described in mathematical model as: to get the optimum weights matrix W so as to achieve minimum error between output of RBF network and the expected output of the samples. The target function is.

$$ \min \quad B = \frac{1}{2} \sum \| \mathbf{d}_k - \mathbf{Y}_k \|^2 = \frac{1}{2} \sum_{k=1}^{N} (d_k - y_k)^2 \quad (6) $$

$\mathbf{Y}_k$ is kth output vector of RBF network, $\mathbf{d}_k$ is kth expected output vector of training samples.

# 5 Training Algorithm of RBF Neural Network

There are 2 stages for this algorithm. Stage 1 is to determine the radial primary function for the hidden layer; stage 2 is the get the optimum weights matrix from nonlinear programming model.

## 5.1 Improved RBF network OLS algorithm

Three parameters are needed to be computed and learned: center vector in basis function, variance vector and weight value matrix. Structural optimization in network is a difficult. The general structure has large numbers of hidden nodes and leads to over-learn. The general orthogonal method is the traditional Gram-Schmidt which has rounding error[8][9]. The hidden network structure is optimized with the improved method in the article.

The I eigenvectors are obtained by K-mean clustering [10]. Suppose the output testing samples column vector is.

$$ \mathbf{d} = [d_1, d_2, \dots, d_I] \quad (7) $$

The hidden layer output vector is.

$$ U = [u_1, u_2, \dots, u_I]^T \quad (8) $$

The expected output vector can be expressed by hidden layer function output vector.

$$ \mathbf{d} = UW + E \quad (9) $$

In the sentence, E is error vector.

Make U as orthogonal triangular factorization with Gram-Schmidt orthogonal algorithm [11].

$$ U = QR \quad (10) $$
The elements in upper triangular matrix R are computed in row but not in line in improved Gram-Schmidt method which lead to lower rounding error. For details, viewing $q_1$ as the result of $u_1$, at the same time $u_2, L, u_1$ minus the parallel component of $u_1$ in advanced.

$$ \left\{ \begin{array}{l} R_{11} = u_{11}, q_1 = u_1 / \|R_{11}\| \\ R_{1j} = q_1^T u_j, u_j^{(1)} = u_j - q_1 R_{1j} \quad 2 \le j \le I \end{array} \right. \qquad (11) $$

After the computation, $u_2^{(1)}, u_3^{(1)}, L, u_1^{(1)}$ are orthogonal with $q_1$.

Then, Ortho-normalized $u_2^{(1)}: u_3^{(1)}, L, u_1^{(1)}$ minus the parallel component of $u_2^{(1)}$.

$$ \left\{ \begin{array}{l} R_{22} = u_{22}^{(1)}, q_2 = u_2^{(1)} / \|R_{22}\| \\ R_{2j} = q_2^T u_j^{(1)}, u_j^{(2)} = u_j^{(1)} - q_2 R_{2j} \quad 3 \le j \le I \end{array} \right. \qquad (12) $$

Thus, $u_3^{(2)}, L, u_1^{(2)}$ are orthogonal with $q_1, q_2$. Repeating the steps, the orthogonal matrix Q and upper triangular matrix R are obtained. The structure network is optimized with improved Gram-Schmidt method and detail solving process is designed in the article. The improved optimized network structure is obtained by sentence (7).

$$ d^T d \approx \sum_{i=1}^{I} g_i^2 + E^T E \qquad (13) $$

In the sentence, $\sum_{i=1}^{I} g_i^2 = G^T G$

$$ G = (g_1, g_2, \dots, g_i, \dots, g_I) = RW \approx Q^T d $$

Suppose the compression ratio is.

$$ [err]_i = g_i^2 / d^T d \quad 1 \le i \le I \qquad (14) $$

The above results show that as the rounding error is lower in the improved Gram-Schmidt, the numbers of the hidden layer nodes can be computed precisely. The computation amount is decreased and over learned problem is avoided.

## 5.2 Data Analysis and Processing

Comparing experiments have been done to verify the function of the improved RBF algorithm in this article, which is supposed to achieve higher moisture detecting accuracy.
BP network, traditional RBF network and improved RBF methods are used to
compare for data fusion process.

300 groups of wheat samples are prepared for the experiments. Among which, 250 samples are used for learning algorithm, and 50 groups are used for measuring.
Testing values and standard values of the two methods are listed in Fig.5.

<figure><img src="image_6.png" /><figcaption>Fig. 5. Comparing Error of Three Kind of Grain With Four Methods</figcaption></figure>

1 No RBF Algorithm

2 BP Algorithm

3 Regular Algorithm

4 Improved Algorithm

5 Conclusion

Factors such as temperature, species and weight affect measurement precision in capacitive grain moisture sensors are analyzed in this paper. The data confusion method of Radial Basis Function nerve network is adopted with improved hardware of the measurement system. Laboratory tests have been conducted on grains of wheat, rice and corns. The results demonstrate that the precision in wheat's moisture measurement has been improved, which shows that the proposed method is better than conventional methods.

Reference

1. Zhang Cijun, Zhang Jinnan. Introduction on the Capacitor Sensors Method for a Moisture Measuring Instrument on Line in Grains.Journal of ChangChun University of Science and Techenology, 2004, 27 (1) : 19-21
2. Meng Wenshun, Yang Yunjing, Liu Yunpeng. Principle and Application of Capacity Sensor. Modern Electronic Technique 2003, 7 (150): 78-79

3. Larry K. Baxter. Capacitive Sensors. IEEE Press, 1997

4. Zhai Baofeng and Chen Qiuyan, "Data Processing of Moisture Content Measurement Based on Data Fusion," Journal of Liaoning Institute of Technology, vol. 26, no. 3, pp. 158-160, 2006.

5. Hardy. R, "Multiquadric Equations of Topography and Other Irregular Surfaces," Journal of Geophysics Research, pp. 1905-1915, 1987.

6. Harder. R and Desmarais. R, "Interpolation using surface splines. J. Aircraft," no. 9, pp. 189-191, 1972.

7. Moody. J and Darken. C, "Fast learning in networks of locally-turned processing units," Neural computation, vol. 1, no. 2, pp. 281-294, 1989.

8. Yan Pingfan and Zhang Changshui, Artificial Neural Networks and Evolutionary Computing, Beijing: Tsinghua University Press, 2002.

9. Billings. S and Zheng. G.L, "Radial basis function network configuration using genetic algorithms," Neural Networks, vol. 8, no. 6, pp. 877-890, 1995.

10. Liu Jinjun, Study on RBF Neural Network Improvement and its Application, Lanzhou: Lanzhou University, 2008.

11. Huan Youdu, Di Cheng'en and Zhu shixin, Matrix Theory and its Application, HeFei: University of Science and Technology of China Press, 2005.