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

HAL
open science

# Nozzle Fuzzy Controller of Agricultural Spraying Robot Aiming Toward Crop Rows

Jianqiang Ren

► To cite this version:

Jianqiang Ren. Nozzle Fuzzy Controller of Agricultural Spraying Robot Aiming Toward Crop Rows. Third IFIP TC 12 International Conference on Computer and Computing Technologies in Agriculture III (CCTA), Oct 2009, Beijing, China. pp.198-206, 10.1007/978-3-642-12220-0_30. http-01061732

HAL Id: hal-01061732

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

Submitted on 8 Sep 2014

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_2.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
NOZZLE FUZZY CONTROLLER OF
AGRICULTURAL SPRAYING ROBOT AIMING
TOWARD CROP ROWS

Jianqiang Ren

Department of Computer, Langfang Teachers College, Langfang, Hebei Province, P.R. China
065000

Corresponding author, Address: Department of Computer, Langfang Teachers College,
Langfang 065000, Hebei Province, P.R. China, Tel:+86-316-6817802, Email:
renjianqiang@163.com

**Abstract:** A novel nozzle controller of spraying robot aiming toward crop-rows based on fuzzy control theory was studied in this paper to solve the shortcomings of existing nozzle control system, such as the long regulation time, the higher overshoot and so on. The new fuzzy controller mainly consists of fuzzification interface, defuzzification interface, rule-base and inference mechanism. Considering the actual application, the fuzzy controller was designed as a 2-inputs&1-output closed-loop system. The inputs are the distance from nozzle to crop row and its change rate, the output is the control signal to the execution unit. Based on the design project, we selected the FMC chip NLX230, the EMCU chip AT89S52 and the EEPROM chip AT93C57 to make the fuzzy controller. Experimental results show that the project is workable and efficient, it can solve the shortcomings of existing controller perfectly and the control efficiency can be improved greatly.

**Key words:** nozzle, fuzzy controller, spraying robot, crop-rows

# 1. INTRODUCTION

The automation and intellectualization of the farmland working
assignment is the development trend of today agriculture, the application of
agricultural robot will reduce the agricultural labor intensity and raise the
work efficiency greatly. The spraying robot is a type of intelligent
agricultural implement. The conventional spraying robot adopts the overlapped spraying technology(Cui Jun et al., 2006), which can effectively solve the problem of leak spray but can lead to the serious consequences easily, such as the waste of pesticide resources, the unattainment of pesticide residues in agricultural products, the environmental pollution and so on. The precision pesticide-application technology has become one of the research directions of precision agriculture (Ma Hui, 2002, Fu Zetian et al., 2007). A pesticide system spraying with changeable quantity based on fuzzy control was studied by Anhui Agricultural University (Shao Lushou et al., 2005). The automatic target detecting electrostatic air assisted orchard sprayer was designed by China Agricultural University and Chinese Academy of Agricultural Mechnization Sciences (He Xiongkui et al., 2003). The precision sprayer for site-specific weed management was studied by the Davis Branch, California University of United States (Tian L. et al., 1999). Precision band spraying system with machine-vision guidance and adjust able yaw nozzles was studied by Giles D.K. and Slaughter D.C. (Giles D.K. et al., 1997). The spray control system to aim toward crops rows based on machine vision was studied by Nanjing Agricultural University (Rao Honghui et al., 2007). In these works, the spray control to aim toward crops rows is an important technology in the farmland working and the nozzle was moved to aim toward crop rows accurately by a step motor. But to the existing nozzle control system has shortcomings, such as the long regulation time, the higher overshoot and so on. To solve these problems, a new nozzle controller based on fuzzy control theory was proposed in this paper and the control efficiency was greatly raised.

## 2. STRUCTURE OF SPRAYING ROBOT

The Structure of the spraying robot is shown in Fig. 1. It mainly consists of the right camera, the left camera, the spray lance, the ultrasonic ranging device, the nozzles, the lifting gear, the robot body and the pedrails.

<figure><img src="image_3.png" /><figcaption>Fig.1: Structure of the spraying robot</figcaption></figure>

The left camera and the right camera are used to make images of the crops. Based on these images, the crop rows can be detected and the distance
between the crop rows and the central axis of robot can be calculated using stereoscopic vision algorithm (Rao Honghui et al., 2007). The ultrasonic ranging device is used to measure the distance between the nozzle poles and it is consisted of one ultrasonic transmitting device and two receiving devices, the transmitting device sits on the central axis and the receiving devices sit on the top of the nozzle poles. The spray lance (1meter long) is used to sustain the nozzles and nozzle control systems. Each nozzle is equipped with a fuzzy control system which is in the spray lance and the nozzle control system is consisted of difference calculator, fuzzy controller (based on FMC (Fuzzy Micro Controller) chip), execution unit, drive circuit, stepper motor and transmission gear. The structure of the nozzle control system is shown in Fig.2. The difference calculator can receive the distance ($d_0$) from a crops row to the central axis of robot and the distance ($d_1$) from the corresponding nozzle to the central axis, then calculate their difference value (ed). The fuzzy controller can receive ed as input and produce the control signal c to the execution unit based on fuzzy control theory. The execution unit and the drive circuit are used to produce the specific control signal to stepper motor according to the value of c, the absolute value of c represents the rotation speed of stepper motor and the sign of c represents the rotation direction. The stepper motor and the transmission gear are used to adjust the position of the nozzle in order to aim toward the crop row.

<figure><img src="image_4.png" /><figcaption>Fig.2: Structure of the nozzle control system</figcaption></figure>

In the course of the control, the stepper motor is the final controlled object, so the mathematical model of the stepper motor is very important. Duan and Yang studied the mathematical model of the stepper motors in their paper (Duan Yinghong et al., 2006). To be on the distinct side, the mathematical model is introduced simply as follows. The differential equation of the stepper-motors mathematical model is as follow

$$ \begin{bmatrix} u_a \\ u_b \\ u_c \end{bmatrix} = \begin{bmatrix} R_a & 0 & 0 \\ 0 & R_b & 0 \\ 0 & 0 & R_c \end{bmatrix} \begin{bmatrix} i_a \\ i_b \\ i_c \end{bmatrix} = \begin{bmatrix} L_{aa} & L_{ab} & L_{ac} \\ L_{ba} & L_{bb} & L_{bc} \\ L_{ca} & L_{cb} & L_{cc} \end{bmatrix} \begin{bmatrix} \frac{di_a}{dt} \\ \frac{di_b}{dt} \\ \frac{di_c}{dt} \end{bmatrix} + \frac{\partial}{\partial \theta} \begin{bmatrix} L_{aa} & L_{ab} & L_{ac} \\ L_{ba} & L_{bb} & L_{bc} \\ L_{ca} & L_{cb} & L_{cc} \end{bmatrix} \begin{bmatrix} i_a \\ i_b \\ i_c \end{bmatrix} \cdot \frac{d\theta}{dt} \quad (1) $$

The transfer function of the stepper motor deduced as follows
$$G(s) = \frac{\theta_2(s)}{\theta_1(s)} \qquad (2)$$

To simplify, we can ignore the self-inductances and the mutual-inductances. Under the assumption of $T_1 = 0$ and a-b-c-a phase sequence, the motion equation of stepper motor is as follows

$$J \frac{d^2 \theta}{d^2 t} + D \frac{d \theta}{d t} - \frac{Z_r L_j i_a^2}{2} \sin Z_r \theta = 0 \qquad (3)$$

If the rotor arrives at the equilibrium position when $t=0$, the transfer function of the stepper motor can be further deduced based on the conditions stated above and it is as follows

$$G(s) = \frac{\theta_2(s)}{\theta_1(s)} = \frac{Z_r^2 L_1 i_a^2 / 2J}{S^2 + \frac{D}{J} S + Z_r^2 L_1 i_a^2 / 2J} \qquad (4)$$

Where: $Z_r$ is the teeth number of stepper motor. $L_1$ is the inductance. $i_a$ is the phase electric current. $J$ is the rotational inertia. $D$ is the coefficient of viscosity.

# 3. DESIGN OF FUZZY CONTROLLER

## 3.1 Overall Design of the fuzzy controller

Considering the actual application, the fuzzy controller is designed as a 2-inputs&1-output closed-loop system. The first input is ed (in centimeters), the second one is the change rate of ed (recorded as ed') (in centimeters/second) and the output is c. As mentioned above, the absolute value of c represents the rotation speed of stepper motor and the sign of c represents the rotation direction. The structure of the nozzle controller is shown in Fig.3. In the controller, the original inputs (ed and ed') are tuned to ed and ed' firstly,and $K_{ed}$, $K_{ed'}$ are the proportional gains for tuning via scaling universes of discourse of inputs. Then ed and ed' are quantified to the fuzzy linguistic variables (eD and eD') by the fuzzification interface. The inference mechanism can receive ed and ed', determine the extent to which each rule is relevant to the current situation as characterized by ed and ed', and draw conclusion (C) using the previous inputs and the information in the rule-base (Kevin M. P., 2001, P60-66). The defuzzification interface and the output scaling gain $K_c$ are used to convert the fuzzy linguistic variable C into the actual output c.
<figure><img src="image_5.png" /><figcaption>Fig.3: Structure of the fuzzy controller</figcaption></figure>

## 3.2 Tuning via Scaling Universes of Discourse

In order to enhance the efficiency of the fuzzy controller, we can tune the
universe of discourse for inputs and output in the course of design. In this
papae, the spraying robot has three nozzles and the first input is ed, so the
effective universe of discourse for ed is set to [-33.3,+33.3] centimeters.
The tuned universe of discourse for ed is selected as Ed̃ = [-3, +3] and
the input scaling gain K<sub>ed</sub> = 0.09.

The second input is ed' and its value depends on the actual rotation speed
of the stepper motor, the parameters of the transmission gear and some other
specific factors. In this paper, taking universality into account, its effective
universe of discourse is set to [α, β] centimeters/second, its tuned universe
of discourse for ed' is selected as Ed' = [-3, +3] and the input scaling gain

$$
K_{ed'} = \frac{6}{\beta - \alpha}.
$$

The output c is the control signal to the execution unit and its value
depends on the actual factors too, its effective universe of discourse is set to
[μ,ν]in this paper. The tuned universe of discourse for c̃ is also selected as

$$
[-3, +3] \text{ and the input scaling gain } K_c = \frac{6}{\nu - \mu}.
$$

3.3 Fuzzy quantification of inputs and output

In the fuzzy controller, the fuzzification interface is used to convert the
inputs e&#x0303;d and e&#x0303;d' into their linguistic variables so that they can be
interpreted and compared to the rules in the rule-base and the defuzzification
interface is used to convert the conclusions reached by the inference
mechanism into the output c&#x0303;. eD, eD' and C are the linguistic variables
corresponding to the inputs and output and their linguistic values set are all
the set of {NB, NM, NS, NZ, PS, PM, PB}. Their membership functions are
shown in Fig.4.
<figure><img src="image_6.png" /><figcaption>Fig.4: Membership functions of the inputs and output</figcaption></figure>

## 3.4 Design of Rule-base and Inference Mechanism

The rule-base is the foundation of fuzzy inference and it contains a set of rules, which are the knowledge of how best to control the nozzle system and how to control the system without outside help. In this paper, taking into account the information from a human decision maker who performs the control task, the rule-base array that we use for the nozzle controller is designed as Table 1.

<table><caption>Table 1. Rule-Based for fuzzy nozzle controller</caption><thead><tr><th colspan="2">eD</th><th colspan="7">eD'</th></tr></thead><tbody><tr><td colspan="2"></td><td>NB</td><td>NM</td><td>NS</td><td>NZ</td><td>PS</td><td>PM</td><td>PB</td></tr><tr><td colspan="2"></td><td colspan="7">□ C</td></tr><tr><td>NB</td><td>PB</td><td>PB</td><td>PB</td><td>PB</td><td>PM</td><td>PS</td><td>PS</td></tr><tr><td>NM</td><td>PB</td><td>PB</td><td>PS</td><td>PS</td><td>PS</td><td>PS</td><td>NZ</td></tr><tr><td>NS</td><td>PB</td><td>PM</td><td>PS</td><td>PS</td><td>NS</td><td>NM</td><td>NB</td></tr><tr><td>NZ</td><td>PB</td><td>PM</td><td>PS</td><td>NZ</td><td>NS</td><td>NM</td><td>NB</td></tr><tr><td>PS</td><td>PM</td><td>PS</td><td>PS</td><td>NS</td><td>NS</td><td>NM</td><td>NB</td></tr><tr><td>PM</td><td>PS</td><td>PS</td><td>PM</td><td>PB</td><td>PM</td><td>PS</td><td>NZ</td></tr><tr><td>PB</td><td>PM</td><td>PB</td><td>PB</td><td>PB</td><td>NM</td><td>NB</td><td>NB</td></tr></tbody></table>

The inference mechanism is used to emulate the expert's decision making in interpreting and applying knowledge about how best to control the nozzle system. In this paper, the “Mamdani” inference method is used to realize the fuzzy inference and the fuzzy implicative relation as follows

$$ 
\begin{aligned}
\mu_{C}^{*}(z) &= \bigwedge_{x \in X} [\mu_{ED}^{*}(x)] \wedge \mu_{ED}^{*}(y)] \wedge [\mu_{ED}(x)] \wedge \mu_{ED}^{*}(y)] \wedge \mu_{C}(z)] \\
&= \bigwedge_{x \in X} ([\mu_{ED}^{*}(x)] \wedge \mu_{ED}^{*}(y)] \wedge [\mu_{ED}(x)] \wedge \mu_{ED}^{*}(y)]) \wedge \mu_{C}(z) \\
&= \{ \bigwedge_{x \in X} [\mu_{ED}^{*}(x)] \wedge \mu_{ED}(x)] \wedge \bigwedge_{y \in Y} [\mu_{ED}^{*}(y)] \wedge \mu_{ED}^{*}(y)] \} \wedge \mu_{C}(z) \\
&\triangleq (\omega_{ED} \wedge \omega_{ED}') \wedge \mu_{C}(z)
\end{aligned} 
\quad (5) $$

Where: $\omega_{ED}$ is the adaptive degrees of $ED^*$ to $ED$. $\omega_{ED'}$ is the adaptive degrees of $ED^*$ to $ED'$.
## 3.5 Selection of defuzzification method

The defuzzification interface is used to convert the conclusions of the inference mechanism into the actual output through a defuzzification method. In this paper, we use the center-average method and the process of defuzzification is shown in Fig.5.

<figure><img src="image_7.png" /><figcaption>Fig.5: The process of defuzzification</figcaption></figure>

Where: $c^*$ is the actual output and it is given by

$$c^* = \frac{c_1^* \mu_{\max}^1(c) + c_2^* \mu_{\max}^2(c)}{\mu_{\max}^1(c) + \mu_{\max}^2(c)} \quad (6)$$

## 4. IMPLEMENTATION OF FUZZY CONTROLLER

The fuzzy controller can be implemented based on FMC (Fuzzy Micro Controller), and NLX230 chip is selected as FMC in this paper. NLX230 is a typical FMC chip produced by NeuraLogix, it has 40pins in DIP package, and its input and output are all 8-bits of digital data. The built-in 24-bit rule register can store 64 rules at most and the maximum inference speed is 30M rules/second (Huang Xiaolin et al., 2006). The internal structure of NLX230 is shown in Fig.6.

<figure><img src="image_8.png" /></figure>
<caption>Fig.6: Internal structure of NLX230</caption>

In this paper, the connection of fuzzy controller circuit is shown in Fig.7. The MCU AT89S52 is used to control all the NLX230 chips. In the initialization of system, the pins of P1.0-P1.2 of AT89S52 provide signals to control and synchronize all the NLX230 chips. When the RST signal become effective, NLX230 will generate the signal of SK and CS to AT93C57 and receive the rules data from AT93C57. AT93C57 is a 2Kb EEPROM (Wang xingzhi, 2004, P360-373) used to store the rules data. In work process, NLX230 receive the input *ed* through DI0-DI7 and produce the output *c* through DO0-DO7.

<figure><img src="image_9.png" /><figcaption>Fig.7: Connection diagram of fuzzy controller circuit</figcaption></figure>

## 5. EXPERIMENT AND ANALYSIS

In order to testify the performance of the proposed scheme, the experiment was carried out and the 57BYG4503 stepper motor was selected in it. The driving voltage of the 57BYG4503 is 36V, the phase current is 1.5A, the phase inductance is 2.4mH, the rotational Inertia is 0.3 Kg.cm², the teeth number is 50 and the stepping angle is 1.8°. In the experiment, the proposed control project was compared with the traditional control methods. The experimental results show that the proposed project has excellent control effect and ability of anti-jamming.

## 6. CONCLUSION

A novel nozzle controller of spraying robot aiming toward crop-rows based on fuzzy control theory was studied in this paper and the aim of this work was to solve the shortcomings of existing nozzle control system, such as the long regulation time, the higher overshoot and so on. In our design project, the fuzzy controller mainly consists of the fuzzification interface, the
defuzzification interface, the rule-base and the inference mechanism. The
proportional gains were used to tune the universe of discourse for inputs and
output. The fuzzification interface is used to convert the inputs into their
linguistic variables so that they can be interpreted and compared to the rules
in the rule-base and the defuzzification interface is used to convert the
conclusions reached by the inference mechanism into the output. The
inference mechanism is used to emulate the expert's decision making in
interpreting and applying knowledge about how best to control the nozzle
system. In our Implementation project, we selected the FMC chip NLX230,
the EMCU chip AT89S52 and the EEPROM chip AT93C57. The
experimental results show that the project is workable and efficient, and the
control efficiency can be raised greatly.

ACKNOWLEDGEMENTS

Funding for this research was provided by Hebei Provincial Department
of Education (P. R. China) and the project number is 2009332.

REFERENCES

Cui Jun, Qiu Baijing, Zhao Jun. Research on Overlap and Leak Spray of Spraying Robot. *Journal of Agricultural Mechanization Research*. 2006, (12):63-65

Ma Hui. China should vigorously develop the precision of pesticide application technology. 2002, 41(6): 47

Fu Zetian, Qi Lijun, Wang Junhong. Developmental Tendency and Strategies of Precision Pesticide Application Techniques. *Transactions of the Chinese Society for Agricultural Machinery*. 2007, 38(1):189-192

ShaoLushou, DaiZhixiang, CuiHuailei, et al. 2005. Study on a Pesticide System Spraying with Changeable Quantity Based on Fuzzy Control. *Transactions of the Chinese Society for Agricultural Machinery*. 2005, 36(11):110-112

He Xiongkui, Yan Kerong, Chu Jingyu, et al. Design and testing of the automatic target detecting, electrostatic, air assisted, orchard sprayer, Transactions of the CSAE. 2003, 19(6):78-80

Tian L., Reid J.F., Hummel J. W.. Development of precision sprayer for site-specific weed management. Transactions of the ASAE. 1999, 42(4):893-900

Giles D.K., Slaughter D.C. Precision band spraying with machine-vision guidance and adjust
able yaw nozzles)y transaction of the ASAE, 1997, 40(1):29-36

Rao Honghui, Ji Changying. Study on spray control to aim toward machine vision. Journal of Nanjing Agricultural University. 2007, 30(1):120-123
Duan Yinghong, Yang Shuo. Fuzzy-PID control of stepping motor. Computer Emulation. 2006, 23(2):290-293

Kevin M. Passino, Stephen Yurkovich. Fuzzy control [Photoprint edition]. Beijing: Tsinghua University Press. 2001.

Huang Xiaolin. Research on NLX230 fuzzy controller and its embedded application. Foreign electronic components. 2006, (3):16-21

Wang xingzhi, Zhong Aiqin, Wang Lei, et al. Principle and Interface Technology of AT89 series Single Chip Processor. Beijing: Press of Beijing University of Aeronautics and Astronautics. 2004.