Development of the peanut precision fertilization control system based on threshold velocity algorithm

: In view of the fact that the current ground wheel velocimetry of the peanut precision fertilizer control system cannot solve the phenomenon of ground wheel slippage, and signal interference and delay loss cannot be excluded by BeiDou positioning velocimetry, a set of peanut precision fertilizer control system was designed based on the threshold speed algorithm. The system used STM32F103ZET6 microcontroller as the main controller, and touch screen for setting the operating parameters such as operating width, fertilizer type, and fertilizer application amount. The threshold speed algorithm combined with BeiDou and ground wheel velocimetry was adopted to obtain the forward speed of the tractor and adjust the speed of the DC drive motor of the fertilizer applicator in real time to achieve precise fertilizer application. First, through the threshold speed algorithm test, the optimal value of the length N of the ground wheel speed measurement queue was determined as 3, and the threshold of the speed variation coefficient was set to 4.6%. Then, the response performance of the threshold speed algorithm was verified by comparative test with different fertilization amounts (40 kg/hm 2 , 50 kg/hm 2 , 60 kg/hm 2 , 70 kg/hm 2 ) under two speed acquisition methods of ground wheel speed measurement and threshold speed algorithm (combination of Beidou single-point speed and ground wheel speed measurement) in different operation speeds (3 km/h, 4 km/h, 5 km/h). The response performance test results showed that the average value of the velocimetry delay distance of the BeiDou single-point positioning velocimetry method was 0.58 m, while the average value of that with the threshold velocity algorithm was 0.27 m, which decreased by 0.31 m and indicated more accurate with the threshold velocity algorithm. The field comparison test for fertilizer application performance turned out an over 96.08% accuracy rate of fertilizer discharge by applied with the threshold speed algorithm, which effectively avoided the inaccurate fertilizer application caused by wheel slippage and raised the accuracy of fertilizer discharge by at least 1.2% compared with that of using the ground wheel velocimetry alone. The results showed that the threshold speed algorithm can meet the requirements of precise fertilizer application.


Introduction 
Peanut seeder fertilizer's working quality will place a great impact on the growth of peanuts, ultimately affecting their yield. Peanut precision fertilizer control technology can change the traditional manual adjustment of fertilizer apparatus via the control terminal for fertilizer apparatus amount setting, and also can ensure uniform fertilizer apparatus, reduce fertilizer waste, and actively respond to the national policy of weight loss and reduction. Therefore, the technology for peanut precision fertilizer control has become the main research direction of peanut seeders in recent years. At present, domestic and foreign researches on precision fertilization technology have had quite an effect in other fields. But taking peanuts as research object is still a blank space in respect of precision fertilization control technology [1,2] . Researchers at home and abroad have been focusing on precision fertilizer application control technology, such as fertilizer distributing wheel improvement [3,4] , PID (Proportion Integration Differentiation) control technology [5,6] , working monitoring technology [7][8][9] , bivariate fertilizer application control technology [10,11] , and electrical driving technology [12][13][14][15][16] , etc. While the commonality of current researches on precision fertilizer application control systems focuses on obtaining information on the speed of the operating machinery, controlling the corresponding drive systems (hydraulic motors, electric motors, etc.), and achieving real-time precise control of fertilizer application volume. In view of that measuring more accurate operating speed information is the key to precision fertilizer application. Peng et al. [17] improved the intelligent maize precision seeding and fertilizing machine by changing the original ground wheel mechanical transmission fertilization method, and using the ground wheel speed measurement and motor-driven fertilizer discharger to carry out precise fertilization. However the ground wheel often slipped when running on complex surfaces, which will affect the accuracy of measuring the speed through the ground wheel, and the accuracy of precision fertilization cannot be guaranteed. Yu et al. [18] developed the precision fertilization and seeding device for rice stubble and wheat compound working machines. Aiming at the problem of uneven fertilization and seeding caused by the slippage of the ground wheel on wet and slippery land, a single-motor transmission is mainly used, and the mechanical transmission of the ground wheel is supplemented. However, the mechanical design of this driving method is complicated and less applied. Ding et al. [19] developed the control system of electric-driven maize precision planters based on GPS speed measurement to adjust the motor's real-time speed. In the case of 12 km/h high-speed sowing, the effect of GPS speed measurement was better than that measured by the encoder. Zhao et al. [20] developed the control system of maize dressing machine based on dual speed measurement mode combined with Beidou single-point speed measurement to the situation of ground wheel slippage. However, because the Beidou single-point speed measurement is below 6 km/h and the signal delay in the process of vehicle acceleration and deceleration is serious, the pure Beidou speed measurement is less effective than the ground wheel speed measurement.
In response to the above problems, a set of precision fertilizer application control systems was designed in this study based on the combination of land wheel velocimetry and BeiDou single-point velocimetry, and proposes that the threshold speed algorithm is applicable to low-speed peanut sowing operations below 5 km/h. The system adopts the touch-display terminal apparatus to set and monitor the parameters of fertilizer application. BeiDou receiver and photoelectric proximity switch are combined to measure the forward speed of the seeder. The main controller adjusts the speed of the fertilizer apparatus drive motor in real-time according to the speed information with an expectation to achieve precise fertilizer application.

Overall system design and working principle
The peanut precision fertilizer application control system, based on threshold speed algorithm, mainly consists of STM32 main controller, touch display screen terminal, BeiDou signal receiver, photoelectric proximity switch, DC motor driver, DC motor, encoder, reducer, fertilizer discharger, diffuse reflection infrared photoelectric switch [21][22][23] . As shown in Figure 1, when the system works, the BeiDou signal receiver installed on the roof of the tractor will receive the single point positioning data and transmit the information to the main controller through the serial port, meanwhile, the inductive proximity switch installed on the side of the land wheel will measure its speed. The main controller solves the tractor's forward speed by fusing the two speeds through the threshold speed algorithm, while the touch display screen terminal sets the fertilizer application operating parameters to 1. Human-computer interaction display 2. BeiDou signal receiver 3. Electric-driven fertilizer spreader 4. Ground wheel speed measurement module 5. Fertilizer quantity detection module 6. Main controller Figure 1 System structure diagram configure the timer to output the PWM control signal with the corresponding duty cycle. The motor driver, based on the PWM signal received, controls the motor speed, and at the same time, the encoder collects the real-time motor speed and performs fuzzy PID control on the motor according to the difference between the actual and the theoretical speeds to accomplish precise fertilization [24][25][26] .
3 Design of the system hardware 3.1 Signal acquisition unit 3.1.1 BeiDou signal acquisition The system uses an X25 BeiDou signal receiver produced by Harbin Starway Navigation Science Technology Co., Ltd., China. Its technical parameters are as follows: the speed accuracy of 0.1 m/s, maximum signal update frequency of 10 Hz, and operating temperature range of -40°C to 70°C. Its cold start time is less than 20 s and the hot start time is only 1 s. All the above key parameters can satisfy the design requirements of the system. With the RS232 serial communication protocol based receiver and TTL level single-chip microcomputer, the level conversion circuit has been designed to realize the communication between the BeiDou signal receiver and the main controller. The main controller can acquire the current tractor forward speed by receiving the BeiDou NMEA0183 format navigation telegram and analyzing the data in the GPRMC frame [27] .

Land wheel speed signal acquisition
This system uses an inductive proximity switch, mounting on the side of the land wheel, to measure the speed signal of the land wheel. When the planter works, the iron pillar evenly distributed on the ground wheel leaves the proximity switch detection after entering its range with the rotation of the land wheel, and the iron pillar passing through the sensor detection range will periodically trigger the proximity sensor to be open and closed. The proximity sensor converts the on/off signal into a falling edge/rising edge signal and inputs it to the controller which calculates the time interval between each on/off moment and takes five adjacent time intervals.
Then the controller removes the maximum and minimum values to calculate the median average value by which it calculates and obtains the real-time speed of the ground wheel [28,29] . The land wheel speed detection is shown in Figure 2.

Fertilizer drive unit
This system selects an external slotted wheel fertilizer apparatus which is connected to a DC motor through a deceleration gear. In terms of the maximum operating speed and fertilizer application volume, the deceleration gear transmission ratio was selected as 1/55, and the maximum load of fertilizer applicator during operation was measured as 25 N•m. The circumferential transmission ratio μ 1 was 1, and the deceleration gear ratio μ 2 was 55, with the safety factor K being 2. The motor driving torque was calculated to be 0.9090 N•m. The motor was powered by the 12 V battery of the tractor and the XD60D94-12Y-50S DC motor of Xinta brand with a rated torque of 1 N•m, which will satisfy the operational requirements [30][31][32] . The structure of the DC motor fertilizer apparatus is shown in Figure 3 4 Design of the system software 4.1 Fuzzy PID control system design for fertilizer application DC motor Fuzzy PID control system for fertilizer application DC motor consists of PID controller, motor driver, DC motor, fuzzy controller, and encoder (speed detection). The control system's work principle is as follows: During the fertilizer application operation of the seeder, the main controller calculates the data based on the speed signal obtained, the type of fertilizers, the preset fertilizer application amount, etc. Therefore the fertilizer motor speed data can be acquired and transmitted to the PID controller. The PID controller controls the motor rotary speed by converting the speed data into a PWM duty cycle signal through the motor driver. Meanwhile, the encoder detects the motor rotary speed in real-time and transmits the feedback signal to the PID controller to precisely control the motor rotary speed according to the fuzzy PID control rules [33][34][35] .
1) Determination of controller structure The speed error and the speed error rate of the DC motor as input variables are e and ec. And the three output variables are ΔK p , ΔK i , and ΔK d , which represent the parameter corrections of the PID controller. The input variables e and ec fuzzy theoretical domain is [-6, 6]. The output variables ΔK p , ΔK i and ΔK d fuzzy theoretical domain is [-3, 3]. The fuzzy language variables are NB, NM, NS, ZO, PS, PM, and PB, respectively. It means negative large, negative medium, negative small, zero, positive small, positive medium, and positive large [36,37] . The fuzzy PID control block diagram is shown in Figure 4. 2) Determination of the affiliation function The triangular affiliation function and the Gaussian type affiliation function were chosen for input and output variables respectively. Mamdani type was adopted as the fuzzy controller type [38,39] . The affiliation functions are shown in Figures 5 and 6.  [40,41] . In general, according to relevant experts' experience, the control parameters self-tuning rules table can be obtained as listed in Table 1.  (4) Defuzzification process Since the control system needs a deterministic value, the output quantity results obtained through fuzzy inference should be processed with defuzzification, which takes the uncertain quantity of the fuzzy controller output multiplied by the proportional factor and turned into a deterministic value. The quantization factors K e and K ec corresponding to the input variables e and ec, as well as the proportional factors K p1 , K i1 , and K d1 needed by the fuzzy controller to obtain fuzzy control quantities can be acquired through several simulated motor trials [42] .

Threshold speed algorithm
The process of peanut seeder operation starts from the front of the field, which is accelerated from standstill to uniform speed, and then decelerated to a standstill again at the front of the field in a repetitious process. According to the research results of Zhao Xueguan, the Beidou single-point speed measurement is added to the system to compensate for the influence of ground wheel slip on the measurement accuracy of the forward speed of the peanut planter, so as to accurately determine the speed process of acceleration, deceleration, and uniform speed. To judge this process, a sequence H() is defined in the control system, and the elements of the sequence are noted as H(i), which saves the land wheel velocimetry data, and the length of the sequence is N. Each sequence element corresponds to a current speed value.
That where, SD{H(n)} is variance function; Mean{H(n)} is mean value function.
As the length of the land wheel velocimetry sequence N affects the accuracy and stability of judgments on acceleration and deceleration processes. In order to ensure the correct distinction between the uniform speed phase and the acceleration/deceleration phase, the optimal N value should be determined under acceleration/deceleration and uniform speed tests at different speed targets. These tests were conducted in the peanut planting field, in which the tractor mounted with peanut seeder accelerated from standstill, speeding up to 3.0 km/h and 5.0 km/h successively and then decelerating to a stop. Each target speed trial would be repeated five times, during which the current speed value, time, and other information were recorded. The data were analyzed and calculated to get variation coefficients. The statistical results are shown in Figures 7 and 8.
According to the acceleration and deceleration process of different target speeds, it can be learned that the speed variation coefficients of the land wheel velocimetry gradually decrease in the acceleration process to the target speed and gradually increases in the deceleration process. The sequence length N set in the previous section has less influence on the speed variation coefficients. During the acceleration process, the requisite time increases gradually as the increasing of target speed. During the deceleration process, the requisite time is not significantly related to the target vehicle speed due to its own vehicle weight. According to the analysis of acceleration and deceleration processes of various target speeds, the response time of the land wheel velocimetry is not related to the target speed, but only to the sequence length N set in the previous section. Namely, the less the value of N is set, the faster the response speed presents. Therefore, the comprehensive analysis determines that N is 3.
The tractor was driven at a uniform speed in the peanut planting field with the speed measured by BeiDou, and variation coefficients were recorded at 3 km/h, 4 km/h, and 5 km/h. Each target speed was repeated five times, and the statistical results are shown in Figure 9. From the system data records, it was found that when the land wheel slips in the process of uniform driving, the speed variation coefficient has a large fluctuation. On the contrary, the land wheel does not slip, and the speed variation coefficient of uniform driving is basically stable at less than 3.4%. Since the maximum variation coefficient of 4.6% occurs during the deceleration process with 5 km/h as the target speed, the threshold C max is set as 4.6% on the basis of comprehensive analysis. When the velocity variation coefficient measured by the land wheel is less than C max , it will be deployed as the input control system velocity. In another situation, if the variation coefficient is greater than C max , the slippage is considered to occur and the speed measured by BeiDou is used as the input control system speed. The above speed algorithm is able to reduce the impact of the land wheel slippage on fertilizer application accuracy to a certain extent.

Control program design
The main controller program is programmed by the C language in Keil5 software, and the program flow is shown in Figure 10. After the main controller program starts, the system configuration and display screen parameters are first initialized. The program obtains BeiDou single point positioning information, monitoring whether the signal lights are up on the display screen, which indicates that BeiDou signal has been acquired, and its current velocimetry value has been analyzed. The speed value is obtained by the land wheel velocimetry and saved to the set series. Then the solved speed variation coefficient is compared with the preset threshold value to gain the accurate speed value which will be transmitted to the lower computer according to the threshold speed algorithm. The lower computer calculates the fertilizer motor speed from the current speed and fertilizer application volume and adjusts the motor speed through the fuzzy PID algorithm so as to achieve precise fertilizer application.

Threshold speed algorithm response performance test
In order to test the response performance of the threshold speed algorithm, a comparison test on the response performance between BeiDou single-point positioning velocity measurement method and the velocity measurement method with the new threshold velocity algorithm can be conducted. Setting a fertilizer application amount at 40 kg/hm 2 , the peanut seeder, mounted on a tractor, accelerates to the target speed from standstill, travels at a uniform speed for 50 m, and then decelerates till it stops. The system automatically records the speed and time of the whole process. While digging soil method, the delayed distance of the two fertilizing velocities measurement methods was also measured. Three kinds of target speeds were measured, and the data from 5 trials for each target speed were counted ( Table 2).
From the statistical results, it can be seen that the average relative response time of adding the threshold speed algorithm speed measurement method and the Beidou single-point positioning speed measurement method in the acceleration stage is 1.9 s, and the average relative response time in the deceleration stage is 2.23 s. During the two phases, it can be found that the two velocity measurement modes have the largest relative response time at 3.0 km/h. This indicates that BeiDou single-point positioning velocity measurement model has a relatively large drift and long response time at low speeds. And its average delay distance was 0.58 m, while that of the velocimetry method with the new threshold velocity algorithm was 0.27 m, which achieved a delay reduction effect of 0.31 m less than the former.

Field fertilization performance comparison test
In order to test whether the new threshold speed algorithm velocimetry method has a certain improvement effect on the slipping phenomenon of the land wheel velocimetry method, a comparison test of fertilization between the land wheel velocimetry method and the new threshold speed algorithm velocimetry method was carried out at the test site of Qingdao Wannongda Peanut Machinery Ltd. on Dec. 8, 2021, as shown in Figure 11. The results of the fertilizer application tests at four application rates (40 kg/hm 2 , 50 kg/hm 2 , 60 kg/hm 2 , and 70 kg/hm 2 ) and three operating speeds (3 km/h, 4 km/h, and 5 km/h) for the two velocity measurement methods are listed in Table 3. Figure 11 Field fertilization performance comparison test Based on the fertilizer application test results, showed that the fertilizer discharge accuracy obtained by the land wheel velocimetry method is up to 95.88%, while that acquired by the new threshold speed algorithm velocimetry method is up to 97.38%. The difference value of fertilizer discharge accuracy between the two velocity measurement methods is more than 1.2%. In conclusion, the new threshold speed algorithm velocimetry method has reduced the inaccuracy of fertilizer application caused by land wheel slippage, and its accuracy rate has witnessed a more than 1.2% increase. Together with a fertilizer discharge accuracy of 96.08%, the requirement of precise fertilizer application can be met.

Conclusions
1) A threshold speed algorithm combining the land wheel speed measurement with BeiDou single-point speed measurement was proposed. A peanut precision fertilizer application control system based on the threshold speed algorithm was built, and the control system program design was completed.
2) The threshold value C max of 4.6% was determined through the experiment and the land wheel speed measurement method was adopted when the speed variation coefficient was less than the set threshold value. On the contrary, under the circumstance of the speed variation coefficient being greater than the threshold value, the land wheel was considered to be slipping and the BeiDou speed measurement method was adopted at the moment.
3) In the response performance test of the threshold speed algorithm, the average delay distance of the BeiDou single-point positioning velocity measurement method was 0.58 m, while the average delay distance of the added threshold speed algorithm velocity measurement method was 0.27 m, which decreased by 0.31 m compared to BeiDou single-point positioning velocity measurement method. 4) In the comparison test of fertilizer application performance in the field, the accuracy of fertilizer discharge was improved by more than 1.2% with the threshold speed algorithm velocity measurement method, and the inaccurate fertilizer application caused by the land wheel slipping declined to a certain extent. In addition, the accuracy of fertilizer distribution was above 96.08%, which can meet the requirement of precise fertilizer application.