*Article* **Mechanical Control with a Deep Learning Method for Precise Weeding on a Farm**

**Chung-Liang Chang \*, Bo-Xuan Xie and Sheng-Cheng Chung**

Department of Biomechatronics Engineering, National Pingtung University of Science and Technology, Neipu 91201, Taiwan; m10944002@mail.npust.edu.tw (B.-X.X.); m10844005@mail.npust.edu.tw (S.-C.C.) **\*** Correspondence: chungliang@mail.npust.edu.tw; Tel.: +886-8-7703202 (ext. 7586)

**Abstract:** This paper presents a mechanical control method for precise weeding based on deep learning. Deep convolutional neural network was used to identify and locate weeds. A special modular weeder was designed, which can be installed on the rear of a mobile platform. An inverted pyramid-shaped weeding tool equipped in the modular weeder can shovel out weeds without being contaminated by soil. The weed detection and control method was implemented on an embedded system with a high-speed graphics processing unit and integrated with the weeder. The experimental results showed that even if the speed of the mobile platform reaches 20 cm/s, the weeds can still be accurately detected and the position of the weeds can be located by the system. Moreover, the weeding mechanism can successfully shovel out the roots of the weeds. The proposed weeder has been tested in the field, and its performance and weed coverage have been verified to be precise for weeding.

**Keywords:** deep learning; machine vision; weeder; smart agriculture; mechanical control

**Citation:** Chang, C.-L.; Xie, B.-X.; Chung, S.-C. Mechanical Control with a Deep Learning Method for Precise Weeding on a Farm. *Agriculture* **2021**, *11*, 1049. https://doi.org/10.3390/ agriculture11111049

Academic Editor: Yanbo Huang

Received: 25 September 2021 Accepted: 23 October 2021 Published: 26 October 2021

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

#### **1. Introduction**

The type of crop production and management has been toward knowledge- and automation-intensive practices, which use automated machine, information communication technology, and biotechnology for large-scale production, which can be combined with precision agriculture technique to increase productivity, reduce resource waste and production costs, and improve environmental quality [1–3]. Among them, weed management is regarded as one of the most challenging tasks in crop production. Effective weed control can increase the productivity per unit area to meet the growing demand for crop production [4]. Improper weed management can lead to a potential loss of approximately 32%, which is increasing every year [5]. If weeds are not effectively controlled, most of the fertilizer nutrients applied to the crop are absorbed by the weeds, resulting in 60% reduction in crop yield in organic farming [6].

Since weeds exhibit uneven spatial distribution [7], however, the traditional weed management method is that herbicides are usually applied uniformly across the field. Most herbicides are released into the environment through runoff and drift, which have an impact on the ecological environment and human health [8]. Hand-weeding is a common weed management practice, but it is time-consuming, high cost, labor-intensive, and more difficult due to labor shortage in the agriculture. This practice may also expose farmers to the risk of infected weeds. Some countries have even abandoned this practice [9,10]. Fortunately, some smart agricultural machines have been investigated recently, which use physical or chemical methods to solve the issue of weed management [11–17]. It can be expected that machines will replace humans or assist operators to achieve the purpose of smart production management [18].

The type of weeding machine can be divided into passive and active based on whether there is a power source [19]. Among them, active weeding can realize the behavior of

5

avoiding seedlings and simultaneously weeding. Its weeding behavior can be divided into swing, rotation, hybrid, etc. [18,20–23]. Among them, swing behaviors are mainly powered by ground-driven system to drive the hoe to reciprocate. The rotary type is divided into vertical axis rotation and horizontal axis rotation according to the position of the rotation axis. There are notched hoe knives, claw tooth cycloidal hoe knives, etc., which rotate around the vertical axis of the transmission mechanism of the machine. Hybrid is a combination of swing and rotating, and its motion behavior has a high degree of spatial freedom. However, the design challenge is how to optimize the transmission mechanism and reduce the number of components. The weeding machines are usually mounted behind the tractor. As the tractor moves, the weeding machine will continue to shovel the soil to remove weeds. In fact, the implementation of full-cover mechanized shoveling operations will affect the organic matter content in the soil, which in turn affects the nutrient absorption effect of the crop roots.

Generally, a detector is installed on an automated weeding machine, which is expected to be used to detect whether there is crop in the interrow. At the same time, the actuator can control the knives or hoe knives under the soil. Based on the detection results, the actuator can move the knives into or out of the rows to fork over the soil, so as to remove weeds [9,24]. Since the performance of the end effector (actuator) of weeding machinery directly affects the efficiency of weeding. This kind of variable rate technology is rarely used in actual operation and the cost is also a key factor that needs to be considered [25]. In order to achieve the purpose of precise weeding, some weeding machine combine computer vision technology with a mobile robot capable of autonomous navigation [26]. The mobile manipulator must be able to accurately locate the weeds in real time. At the same time, the weeding tools must cooperate with the actuator to operate the weeding tools at the right time to remove the weed.

In previous study, a machine vision-based smart weeder is peoposed that uses image processing methods to identify crops and weeds, and uses an inference-based control method to drive three direct current (DC) motors, which are driven by gears and chains [27]. The three-claw harrows weeding tool on the connecting rod is inserted into the soil, and then the soil is moved backward to remove the weeds. However, due to the type of claw harrow and the torque limitation of the actuator, this machine is only suitable for soft soil and small weed removal. McCool et al. [28] described mechanical methods as an alternative to weed management. They proposed different types of weeding tools, including arrow- and tine-shaped, which can be mounted on a guided vehicle to perform weeding operations. Statistical analysis proves the effectiveness of these tools and emphasizes the importance of early intervention. Other types of weeding tools, such as intrarow plowshares, comb harrows, spring harrows, and specific plowshares for in-row weeding, are also used for weeding operations [29]. Fennimore and Cutulle [30] developed and implemented machine vision technology in an autonomous weeder. Two robotic arms cooperate with weed actuators to spray herbicides directly on each weed. Raja et al. [31] proposed a weeding system based on a 3D geometry detection algorithm of robot vision. A corresponding mechanical weeding device was also designed, used for automated weeding in tomato and lettuce fields, which can efficiently perform weed removal in a high-density environment. Kumar et al. [32] proposed an mechatronics prototype for interrow weeding and crop damage control, which initiates weeding operations through plant sensing, soil, and plantation parameters. The developed method combines the different conditions of soil, forward speed, and plant spacing to calculate the dynamic lateral movement speed. However, it is still easy to be affected by vibration or other uncontrolled movements during image processing in practical applications, resulting in blurry images, which impact the recognition and positioning performance. Meanwhile, this mechanism is complicated and lacks modular design.

The implementation of machine vision technology for weeding tasks first needs to use image processing methods to extract features such as the color, texture, and shape of the image, and then combine them with machine learning algorithms such as clustering or classification to detect and classify weeds [33–36]. Among them, the shape or feature extraction based on the support vector machine is the most commonly used to distinguish crops and weeds [37–39]. After this, it is necessary to determine the feature of the target object and use some morphology or color space conversion methods to extract the feature and position of the weeds [40,41]. Due to the use of a machine vision system to detect and locate weeds, its system performance is limited by the uncertainty of the environment, including light conditions and color variance of leaves or soil, which also results in a decrease in the performance of weed control. There are currently some weed detection technologies that integrate images taken from multiple perspective sources and multiple feature marks to improve the accuracy of weed recognition and location [42,43]. Because of its complex system design, time-consuming and maintenance costs need to be considered. Other methods include the use of controlled light emitting diode (LED) lighting equipment in the dark box and the use of camera-lighting module to record the reflection spectrum of the object. The system combines the size information of the desired object to distinguish crops, weeds and soil in horticultural crops, which can locate weeds [44]. Currently, this method has not integrated weeding equipment to implement precise weeding operations.

With the improvement of computer computing performance and the increase in the number of available images, deep learning has been able to provide enhanced data expression capabilities for target objects in images. These methods can be used to extract multiscale and multidimensional spatial semantic feature information of objects [5,45–47].

In many cases, the detection and classification results obtained using convolutional neural network method are better than the classification results produced by using machine learning commonly in the early stages [48–55]. However, deep learning needs to rely on a large number of data sets for training, it is not easy to collect crop and weed images [56]. Redmon et al. [57] proposed a fast target detection algorithm called YOLO, which can quickly implement real-time applications. This method is based on the Darknet-53 network architecture and has been modified many times to greatly improve the accuracy of target identification with only a small amount of data samples.

This study proposes a weed identification technology and weeding tool control method based on the YOLOv3 model [58], and implements it in an innovative weeding mechanism. In the early study, an artificial intelligent-enabled shovel weeder is designed and implemented [59]. Nevertheless, the weeder was only tested in a simulated field and its weeding performance is limited by the torque of actuator and unstable transmission mechanism, which requires further design and testing. The earlier designed mechanism was modified and re-made and assembled. The modular weeding tool is attached to an unpowered machine. The motion behavior of the weeding tool is a combination of swing and rotating. The design concept of the transmission mechanism of the weeding machine is derived from the power transmission of a bicycle. An inverted triangle weeding knife is designed. The weeding machine is equipped with a camera module, which can be used to obtain top-in-view images in real time. This weeding tool is used to test and evaluate the effectiveness of deep learning methods. After that, the weeding machine was used in the field to actually test the weeding performance of the method in the presence and absence of crops. The results of different types of knives for weed removal will also be analyzed and compared.When the trailer is moving, the proposed weeding machine can automatically remove weeds in the farmland.

The purpose of this study is as follows: First, a weeder is implemented and can be used to replace manual weeding. Second, the use of deep learning methods to achieve precise removal of individual weeds to improve the existing mechanized weeding. Third, modularize the weeder. Multiple modules can be attached to the back of the vehicle to solve the problem of difficult disassembly and spacing adjustment of large weeders. Fourth, the proposed weeder simultaneously weeds and shovels soil, which can reduce the probability of weed growth. The proposed weeder is particularly suitable for homeworkers and farmers who want to carry out organic cultivation for weeding operations in small fields.

The chapters of this paper are organized as follows: The design method for the weeding machine and the mobile platform, including the design of the weeding mechanism and transmission mode, the software and hardware construction of the weeding system, and the performance evaluation matrices are described in Section 2. The flow of the weed detection program is also explained in this chapter. Section 3 explains how to test the performance of weeding machine, including evaluating the performance of weed detection and testing the weeding efficiency. The last chapter summarizes the characteristics and applications of the weeding methods proposed in this paper and explains future work.

#### **2. Materials and Methods**

The weeding machine developed in this research will can be attached to a simple four-wheeled trailer with no power source to perform weeding operations. The battery supplies power to the machine. The appearance of the entire mechanism is shown in Figure 1. At most, two sets of weeding machines are attached to the vehicle, which are respectively mounted on the left and right sides of the vehicle. On the right is the advanced intelligent weeding machine (Weeder #1) equipped with an inverted triangle weeding tool. On the left is the first-generation weeding machine (Weeder #2), which is equipped with a claw rake-type weeding tool [59].

**Figure 1.** Smart weeding machine and its four-wheel trailer.

Based on the YOLOv3 network, the deep learning model is used as weed detection, the network model is trained by multiple feature objects, and the trained network model and the weeding tool control algorithm are integrated and implemented in the embedded system. Through the execution of the program, the weeding tool can swing up and down and back and forth for weeding operations. The following describes the design of the drive mechanism of the weeding machine and the weed detection and control system, including the weed recognition algorithm and the hardware construction, and the software program flow is also described in detail in this chapter.

#### *2.1. Mechanism Design*

The design and development of weeding equipment must take into account the various agronomical requirements of crops, soil conditions, and weed characteristics for field management operations. For example, the appearance of the field includes different field heights, widths, and densities of cultivated crops. In addition, the height of crops, root length, leaf branch and soil type, water content, bulk density, and strength of the soil also need to be considered. The mechanical design of weeding tools needs to be simplified, so that farmers or craftsmen can repair them quickly and have low maintenance costs. Therefore, based on the above ideas, a DC-driven weeding machine was developed. Its

components include a DC motor (model: SWG-24-1800, Xajong), a transmission mechanism, a height-adjustable weeding handle, and a protective case (see Figure 2).

**Figure 2.** A drawing prototype of the weeding mechanism.

The transmission mechanism consists of an upper sprocket (Model: RS35-B-16, New Sheylee CO., Ltd., Taichung City, Taiwan), a lower sprocket (Model: RS35-B-32, New Sheylee CO., Ltd., Taichung City, Taiwan), a drive chain (Model: RS35, Prelead Industrial CO., Ltd., Taiwan), left and right discs, a coupler, a ball bearing seat, and a cylindrical rod (16 mm × 200 mm (diameter [D] × length [L])). The size of the case is 216 mm × 180 mm × 278 mm (L × width (W) × height (H)), and the weight of the whole machine is 6 kg. In terms of tool design, the appearance of traditional weeding tools is mostly designed to imitate the blade geometry. Different types of soil require the use of different shaped cutters to shovel the soil [60]. This type of tool set is installed on a rotating mechanism, which can make the vertical cutting surface of the blade move downward through the rotating torsion force to achieve the purpose of shoveling the soil. However, this tool is suitable for use in fields with a low cultivation density. In contrast, weeding tools, such as the disc, round head, and sawtooth types, are more suitable for use in fields with higher planting density and can effectively treat weeds on the surface of the soil. In addition, the rake-type cutter can be used to dig out weeds with shallow roots [27,59], but the material of this cutter is more likely to stick to the soil.

Therefore, a new type of tool was designed, the material of which was aluminum alloy. The shape of the weeding tool is an inverted triangle (90 mm × 47 mm × 80 mm (L × W × H)) with a sharp end, which is suitable for hard soil. In addition, the bottom of the cutter is wider, which can cover the size of a single weed and shovel out the roots of the weeds. A combination of multiple iron plates is used as the mechanism case. The upper part of the front and rear sides is locked with a pull handle, and a proximity switch is installed inside the upper part of the iron plate (Model: TG1-X3010E1, Prosensor Phototech Co., Ltd., Taoyuan city, Taiwan), which is used to stop the motor. The digital lens (Model: Logitech BRIO, Logitech International S.A., Lausanne, Switzerland) is installed under the case.

The control box is installed on the back side of the case, and it contains an embedded control board (Model: Jeston Nano, NVIDIA Company, Santa Clara, CA, USA) and peripheral circuit boards. A DC 24V lead-acid battery (Model: GP1272 F2, CSB Energy Technology Co., Ltd., Taipei city, Taiwan) is the power source for the entire system. The specifications of the weeding system are shown in Table 1.


**Table 1.** The specifications of the weeding machine.

Considering the lowest transmission loss, the double-gear chain transmission mechanism was designed. This design concept was derived from the mechanical transmission principle of the bicycle. The transmission component adopts a sprocket, which is made of medium carbon steel.

First, the DC motor rotates to drive the upper gear, and the chain of the upper gear drives the lower gear. The lower gear is fixed in the case on the left side, and is connected to the left and right disks by a coaxial connector. Close to the center point of the two discs, a square seat is locked, and a cylindrical rod is installed in it, which is inserted into the square coupler and is connected to a ball bearing seat inside the casing. There are holes in different positions on the end of the cylindrical rod, and the user can select a suitable hole position and lock the weeding tool on the cylindrical rod to adjust the distance between the weeding tool and the ground. When the motor rotates, the weeding handle has a reciprocating swinging behavior (Figure 3). This operation mode is like a farmer holding a hoe for weeding. The sequence of this motion involves extending the weeding tools, digging down, turning up the roots of the weeds, throwing away the weeds, and retracting the weeding tools.

**Figure 3.** Transmission of the weeding mechanism.

Assume that the torque, speed, and radius of the upper sprocket are *Ta*, *na*, and *ra*, respectively. The chain connects the upper and lower gears. Without considering the transmission and mechanical friction, the torque *Tb* and speed *nb* of the lower gear are:

$$T\_b = \frac{G\_b}{G\_a} \times T\_a \tag{1}$$

$$m\_b = \frac{G\_a}{G\_b} \times n\_d \tag{2}$$

Among them, *Ga* and *Gb* represent the ratio of the number of teeth of the upper gear to the lower gear, respectively. Since the lower gear and the two discs are on the same axis, the disc rotation speed *nc = nb*, the tangential torque of the fixed point of the cylindrical rod on the disc *Tc* is:

$$T\_c = \frac{r\_b}{r\_c} \times T\_b \tag{3}$$

where *rb* represents the radius of the lower gear and *rc* is the distance between the center of the disc and the center of the square seat. Assuming that point o is a fixed point, the distance from point *o* to the ground is defined as h and the depth of weeding as D. When the center point of the square seat is at the positions ❶, ❷, ❸, and ❹ in Figure 3, the length *l* from point *p* to the end of the cylindrical rod can be defined as:

$$l = \hbar \cos^{-1} \theta$$

where *θ* depicts the angle of weeding. When *θ* = 0 ◦ (position ❷), the length reaches the maximum value *lmax*:

$$l\_{\text{max}} = \mathbf{h} + \mathbf{d} \tag{5}$$

When the center point of the square seat is at position 4 (origin position), *l* has a minimum length *lmin*.

During the weeding process, a digital camera takes an image of the planted area, and a YOLOv3-based deep learning method is used to detect and locate weeds (see Figure 4a). Suppose v depicts the moving speed of the vehicle and s represents the operation range of weeder between the center point p (xp, yp) of the weed detection frame and the point q (xq, yq) below the weed cutter, as shown in Figure 4b. The orange frame represents the detection results. The green arrow indicates the heading of the trailer and the dashed box indicates ground truth. The light gray area represents the weeding range, w is the width of the weeding, and the white color line represents the upper and lower boundary of the weeding range. Once two weeds are detected and appear in the gray area, the object with the largest frame area is selected. In addition, the size of weeds that are too small are ignored because they have little effect on the growth of the crop. When the trailer moves for t = s/v seconds, once the weeding system detects weeds, the system must activate the weeding tool within t seconds to remove the weeds.

#### *2.2. System Description*

#### 2.2.1. Hardware

The sensing and control circuit components in the weeding system include a main control board, relays (JQC-3FF-S-Z, Tongling), DC motors, digital cameras, DC/DC conversion modules (model: XL4005, XLSEMI company, Shanghai, China), proximity switches, and automatic voltage regulators (AVRs). The circuit system architecture is depicted in Figure 5a. The function of the main control unit is to execute weed detection algorithms and motor drive and control decisions. The main control board can receive the images taken by the digital camera via the Universal serial bus (USB) port and store them in the memory. Two sets of relays are connected to the general-purpose input/output (GPIO) port of the main control board, which can receive the driving signal output from the main control board to start and stop the motor.

**Figure 5.** Sensing and circuit architecture: (**a**) Block diagram of electronic circuit and (**b**) peripheral electronic component board (upper layer) and main control board (lower layer) in the control box.

The proximity switch (type: normal open (NO)) is used to detect whether the square seat in the weeding mechanism has returned to the original position, and the detection signal is then input into the main control unit through the GPIO interface. The 24 V battery provides power for circuit components, including motors and proximity switches. The negative output terminal "−" of the battery is connected to the ground (GND) terminal of the circuit board. The DC/DC module is used to convert 24 V to 5 V for the embedded control board; these components and the control board are integrated in a waterproof control box, as shown in Figure 5b. The upper layer is a circuit board, which mainly integrates DC/DC conversion modules, relays, and other electronic components, and the lower layer is for placing an embedded control board.

#### 2.2.2. Software

The YOLOv3 tool [57] is a common deep learning model used to quickly detect objects. It is executed in the Darknet environment. Residual neural network (RestNet) [61] and feature pyramid networks (FPN) are its main architectures, which can improve the prediction ability of small objects. This network tool is used to detect weed objects. A desktop computer with a high-speed computing processor (Model: Intel i5-8400, Intel Co., Santa Clara, CA, USA) is paired with a high-speed graphics processing unit (GPU) (Model: GTX 1070, Nvidia Co., Santa Clara, CA, USA) to train the YOLOv3 network model. The training model of YOLOv3 is configured as follows: Batch size set to 64, image size resized to 416 × 426 pixels, subdivision of 32, momentum of 0.9, decay of 0.0005, learning rate of 0.001, batch size of 64, etc. After that, image preprocessing is performed, including image cropping, white balance, and noise filtering processing, which is then marked by trained technicians and used for model training and evaluation. Among them, 80% of the images are used for training and 20% are used for testing. The bounding box of the region of interest is drawn and exported to YOLO format for model development.

During training, the training loss of each epoch is recorded to evaluate the performance of the visualization model in real time. Once the loss is stable and there is no significant change, the training process stops, and the corresponding weights of the model are saved for further evaluation of the weed detection performance. The trained YOLOv3 model integrates the weeding control program and is embedded in the weeding system. Figure 6 shows the program execution flow, which is written in python language. First, the function library is imported, including the external function (ctype.cdll), multi-threading module, and open source computer vision library (cv2). Then the GPIO pins, data type, class, structure, and subfunctions are defined. The next step is to set, import, and load the environmental variables of Darknet; it also includes defining the frame selection parameters and their storage file paths.

The program is executed to perform a while loop, the image is read and converted from the blue (B)–green (G)–red (R) color layer to the RGB color layer, and then weed detection operation is performed. Once the weed object is detected, the value "1" is written to the text file. Otherwise, the value "0" is written to the text file. The detection results, including bounding box and labels, are displayed in the image (see Figure 6a). In the process of program execution, the multi-threaded module is activated and the motor control program is executed synchronously (Figure 6b). In the while loop, the text file value is open and read. When the value is 1, the system outputs a signal to start the motor, otherwise it stops the motor. A function Delay() with a delay time is inserted into the program for starting and stopping the motor.

#### *2.3. Performance Evaluation Metrics*

The performance indicators for detecting weeds will be defined in this section, including the precision, recall, and F1-score, as well as descriptions of the efficiency of weeding and the rate of plant damage.

2.3.1. Weed Detection

The detection performance metrics used to evaluate YOLOv3 include the precision, recall, and F1 score [61]. The accuracy index is as per Equation (6):

$$
\delta\_P = \frac{TP}{TP + FP} \tag{6}
$$

*TP* (true positive solution) represents a true positive test result is one that detects the condition when the condition is presented; in contrast, *FP* (false positive solution) is the opposite result.

Ideally, the *FP* should be as small as possible in order to ensure the accuracy of the network in identifying each object. The intersection-over-union (IoU) is a method to define whether the detected object is a positive solution, as shown in Equation (7):

$$\mu = \frac{\mathcal{U}\_d \cap \mathcal{U}\_y}{\mathcal{U}\_d \cup \mathcal{U}\_y} \tag{7}$$

where *Ud* and *Uy* indicate the ground truth and predict boxes of the deep neural network, respectively, and the symbols "∩" and "∪" depict the intersection and union operator, respectively. If *u* is larger than the threshold *uT*, the prediction result is regarded as a *TP*; otherwise, it is regarded as an *FP*.

**Figure 6.** *Cont*.

**Figure 6.** Software program flow for weeding system. (**a**) program flow for weed detection; (**b**) program flow for weeding operation.

The recall rate is a metric that quantifies the number of correct positive predictions made from all possible positive predictions, and its definition is shown in Equation (8).

$$
\delta\_R = \frac{TP}{TP + FN} \tag{8}
$$

where *FN* depicts the false negative test result. The sum of *TP* and *FN* in Equation (8) is just the number of ground-truths, so there is no need to compute the number of *FN*. The F1-score (*δf*) is a weighted average of the precision and recall which is performed as a trade-off between *δ<sup>R</sup>* and *δ<sup>P</sup>* to demonstrate the comprehensive performance of the trained models.

$$\delta\_f = \frac{2\delta\_P \delta\_R}{\delta\_P + \delta\_R} \tag{9}$$

The values of *δ<sup>f</sup>* range from 0 to 1, where 1 means the highest accuracy. Through the *uT* setting for the confidence score at various recall levels, different pairs of precision and recall are generated with recall on the *x*-axis and precision on the *y*-axis, which can be drawn as a precision–recall (PR) curve, indicating their association and can be employed to measure the performance of the weed detection.

#### 2.3.2. Weeding Efficiency

We conducted field tests in the field to evaluate the performance of the weeding machine for weeding operations. The evaluation metrics include weeding efficiency and plant damage, which are shown in Equqtions (10) and (11):

$$
\eta = (\mathcal{W} - \overline{\mathcal{W}}) / \mathcal{W} \tag{10}
$$

$$D = \overline{d}/d\tag{11}$$

Among them, *W* and *W* represent the number of weeds before and after weeding, respectively, and *d* and *d* represent the damaged crop and the total amount of crops, respectively.

#### **3. Experimental Results**

This section explains the data collection and model training methods. In addition, two test scenarios were used to evaluate weed detection performance and weeding efficiency

#### *3.1. Data Collection and Model Training*

Images were collected in the field under different climates and time periods. A digital camera was used to take a total of 140 images of weeds in the experimental field. Image processing technology, including geometric transformation (resize, crop, rotate, horizontal flip, etc.) and intensity transformation (such as contrast and brightness enhancement, color and noise adjustment), was used to modify the original image, thereby increasing the number of image samples, which totaled 60.

Then, the image size was adjusted from 1920 × 1080 to 416 × 416 pixels to fit the YOLOv3 model network, and then, each weed in each image was marked with an object box for model training. There were 160 images in the training set, 30 images in the validation set, and 10 images in the test set. When the number of iterations reached 20,000 times and the loss function approached 0.135, the training was stopped and the weight value of the network was obtained. Finally, the trained model was used to evaluate the performance of weed detection.

#### *3.2. Experimental Test*

The experiment site is located in front of the Department of Biomechanical Engineering of National Pingtung University of Science and Technology (longitude: 120.6059◦; latitude: 22.6467◦). The experiment period was from 5 August to 15 September 2021. Vegetable crops were grown for 20 days on the cropland ridges. The length of each cropland ridge in the field was approximately 20 m and the width was 25 cm. The spacing between each plant was 50 cm. The number and location of the weeds within the cropland were recorded in advance. These data were used for a comparison with the experimental results. In addition, we set up a hoist machine at the end of the field, and hooked the trailer with a steel shackle. The user was able to adjust the speed of the hoist machine to maintain the forward speed of the trailer.

Two experiments were used to verify the performance of the weeding system. Experiment 1 was mainly to test the weed removal performance of the weeding machine on both sides of the crop. Two weeding machines were used. Among them, the weeder machine (Weeder #1) was mounted on the right side of the vehicle, and the first-generation weeder machine (Weeder #2) was mounted on the other side. An inverted triangle-shaped weeding tool was installed on the right machine, and a claw-shaped weeding tool was installed on the left machine. Experiment 2 was mainly to test the weeding performance of the weeder (Weeder #1) proposed in this study in the intrarow of crops. Weeder #2 was mounted at the center of the rear of the trailer.

The test scenarios of Experiments 1 and 2 are shown in Figure 7. The dashed border represents the area of weed detection. The mechanical design parameters and specifications of the modified weeder (Weeder #1) based on previous research results [60] are demon-

strated in Table 2. When the weeding tool was at the origin of the mechanism, the distance between the coupler in the mechanism and the surface of the ground was h = 16.9 cm. When the weeding tool was activated, the excavation depth for the weeding tool was d = 3 cm. The maximum and minimum lengths of the cylindrical rod were *lmax* = 26 cm and *lmin* = 15 cm, respectively.

**Figure 7.** Illustration of two scenarios for testing the performance of weeding: (**a**) Using two weeders (Weeder #1 and Weeder #2) to weed the areas on both sides of the cropland ridges (gray areas); (**b**) using a weeding machine (Weeder #1) for intrarow weeding (the area within the dashed frame).


**Table 2.** The parameters and specifications of the modified weeder (Weeder #1).

When the weeding operation was completed, manually the number of weeds that had not been removed and the number of damaged crops on the cropland ridges were recorded. Weeds that are too small are ignored. When the roots of the weeds were exposed to the soil surface, it was considered that the weeds had been successfully removed.

#### *3.3. Results and Discussion*

#### 3.3.1. Performance of Weed Detection Using the YOLOv3 Model

The trained YOLOv3 model was verified to detect weeds in different climatic conditions. During the experiment, the climatic conditions were cloudy in the morning and at noon, cloudy in the afternoon, and cloudy in the afternoon. When the vehicle was moving, the weeding tool was not activated. Only the digital camera under the weeding tool was used to shoot the image on the cropland, and the image samples were taken by a digital camera every 2 h. The image samples were stored in the memory card. The number of weed objects is counted in each image that were framed (or unframed), and Equations (6), (8) and (9) were finally used to evaluate detection performance of the model.

Table 3 shows the results of weed detection using the YOLOv3 model in different time periods. The results show that the F1 score was between 74.3% and 92.8%, especially during the period from 10:00 to 13:00, where the accuracy was up to 95.6% and the F1-score value was also the highest. It is worth noting that due to the low light intensity during 18:00–19:00, the accuracy rate and recall rate are reduced.


**Table 3.** Using deep learning models to detect weeds during the daytime.

Figure 8 shows the weed detection results of each time interval, where the green frame represents the area where weeds are detected. It can be seen from these figures that most of the weed objects were framed, and only a few weeds were not framed between 18:00 and 19:00.

Then, weed detection experiments were carried out on different days, and the climatic conditions during the detection process were variable, including cloudy, sunny, and rainy. Figure 9 shows average detection performance results obtained at different time intervals in the same field using the YOLOv3 network model. The evaluation metrics at different time intervals include precision, recall, and F1-score, each representing a ten day average value.

#### 3.3.2. Performance of Weeder

The experimental weeder tests was conducted from 10:00 to 12:00, and the weather conditions were sunny. Due to the limited area of the site, two experiments were carried out in a single day and repeated on three different days. Finally, the data obtained from the three times were averaged. Figure 10 shows the actuation behavior of the weeding tool. In Figure 10a, "❶" and "❷" in the white frame indicate the visible range of the camera on the left and right weeding tools. The orange line indicates the position of the weeding tool, which is the origin of the mechanism. When the vehicle was moving, once the weeds had been detected, the weeder was activated (the weeding tool on the right side of Figure 10b). In contrast, Weeder #1 was maintained at the origin of the mechanism when the weeds could not be detected (as shown in Figure 10b, the left weeder—Weeder #2).

**Figure 8.** Weed identification results in different time intervals.

**Figure 9.** Ten day average detection results at different time intervals.

The effective cutting width of the two weeding machines is 20 cm. The data given in Table 4 show that in scenario 1, when the vehicle speed was 10 and 15 cm/s, the weeding efficiency was between 84% and 90.9%, which is equivalent to an hourly working area of up to 72 and 108 m2. The average F1-score values of the deep learning networks in the left and right weeders were between 0.841 and 0.901. When the trailer speed increased to 20 cm/s, its weeding efficiency was significantly reduced, and the F1-score value was able to still reach approximately 0.867.

In scenario 2, when the vehicle moving speed was 10 and 15 cm/s, the weeding efficiency when using Weeder #1 was 92.3% and 82.6%, respectively, the crop damage rate was 5.5% and 11.1%, and the F1-score was at least 0.890. The weeding efficiency of using Weeder #2 was 87.0% (10 cm/s) and 78.6% (15 cm/s), respectively, the crop damage rate was 8.33% and 13.8%, and the F1 score value was above 0.878. Once the vehicle speed increased to 20 cm/s, the weeding efficiency of using Weeder #1 and Weeder #2 dropped to 64% and 56%, respectively, and the crop damage rate increased to 44.4% and 52.7%. However, the F1-score values were still 0.833 and 0.848, respectively.

(**b**)

**Figure 10.** The operation of the weeder. The orange lines indicate the claw rake (left) and the inverted triangle (right) weeding tools. The white dotted line indicates the area of view taken by the two cameras on the left and right weeders. (**a**) The weed object is framed (the detection result of area ❶ (upper right corner)) and no weed is detected (the detection result of area ❷ (upper left corner)); (**b**) the weeding tool on the right is activated, and the left weeding cutter is maintained at the origin of the mechanism.



\*, \*\*: Number of weeds on the left\* and right\*\* sides of the cropland.

Figure 11 shows an image of the weeds being removed by two weeding tools and the damage of the crops. Most of the roots of the weeds were turned up to the soil surface (Figure 11a,d), and some of the weeds on the edge of the weeding tool's coverage area were also turned up (Figure 11b,e). Some crops were slightly shifted or damaged from their original position due to the activation of the weeding tools (Figure 11c,f).

**Figure 11.** Snapshot of the soil on the field after weeding by the weeding machine. (**a**) weeds are completely removed by weeder #2, partially removed (**b**) and damaged crops (**c**); (**d**) weeds are completely removed by weeding tool #1, partially removed (**e**) and damaged crop (**f**). The red circle and orange arrow indicates the position of the crop roots and the root of the weed, respectively.

#### 3.3.3. Discussion

There were three types of weeds in the experimental field, namely gramineous weeds, cyperaceae and broadleaf grasses, of which sedges and broadleaf grasses accounted for a higher proportion. At the end of each weeding experiment, we recorded the number of weeds remaining in the field, and most of these weed objects were detected. Part of the weeds did not actually turn up and the roots of some weeds were not removed due to the position of the weeds on both sides of the cutting width of the weeding tools. In addition, different shapes of weeding tools have different effects on different types of weeds. The claw rake-type weeding tool is suitable for shallow-rooted weeds. In contrast, the weeding tools used in this study are more suitable for removing weeds with deep roots, such as the tuber roots of Cyperaceae.

Second, the speed of the vehicle needs to match the weeding time. When the speed is greater than 20 cm/s, the weeding tool cannot accurately turn up the weeds. Especially under high weed density, some weeds cannot be removed immediately. The experimental results showed that the vehicle has a 92.6% success rate of weeding when the moving speed is lower than 15 cm/s. The cutter can shovel 3 cm below the ground. The, the height of the camera and the ground, and the distance between the camera and the weeding tool are 10 cm and 20 cm respectively. However, when the vehicle moves at a speed of 20 cm/sec, the highest success rate is only 64%, and there is a 44.4% crop damage rate. The loop speed of the weeding machine is set to one circle per second. If the moving speed of the trailer

exceeds 20 cm/s, it increases the probability of crop damage and reduce the efficiency of weeding. A relatively slow speed is required to achieve a higher weeding success rate without damaging the crop. It is worth noting that when multiple weeds appear in the image simultanously, select the weed object with the largest area to maximize the weeding efficiency. In addition, before using this weeding tools, make sure that there are no large stones or bricks in the soil to avoid damage to the weeder. Because the steel cable is used by the hoist to pull the vehicle, when the vehicle is moving, the ground is relatively uneven, and there are several short speed changes during the movement of the vehicle, resulting in a time deviation. However, the deviation of weeding is still within the acceptable range.

The frame rate of YOLOv3 is set to 5 frame per second (fps), which can meet the requirements of real-time detection. A small number of weed samples were provided to the YOLOv3 model for training. Its network model was able to effectively detect weed objects with an accuracy rate of up to 95.6%. As far as we know, there are no relevant studies that use the YOLOv3 model to detect individual weeds in the field and use weeding tools to weed them. Since the number of image samples has an impact on the model detection performance, too few samples will reduce the model recognition performance [62].

In this study, the images were taken by mobile phones and some of the images were obtained using data augmentation technology. With a limited number of images, the weed detection model will still have different detection performance due to the difference in the brightness of the image background. In Scenario 1, the brightness of the images captured by the cameras on both sides is different due to the mask of the body frame and the asymmetry of the position of the weeding equipment, resulting in different model detection results (F1-score) of the two modules. The F1-score of the deep learning model designed in this research can reach above 0.83. Although the use of image processing technology can achieve a recognition rate of more than 90% in the identification of individual weeds and crops [27]. However, due to the influence of unstable light, the recognition rate fluctuates greatly. Using YOLOv3 model to detect weeds in low light conditions, the accuracy rate dropped slightly, but it remained at 83.2%. On the other hand, when the deep learning model detects eggs, its detection results are not affected by light [63], which is slightly different from the results of this study. The reason may be that the characterization of the detected object is more complicated. In weak light intensity environments, the performance of the model is still affected. This result still needs to be further studied.

The advantage of using the YOLOv3 model based on the Darknet-53 architecture is that it can quickly obtain the main characteristics of a weed or crop, and even features outside of human visual perception [55]. It can be observed from Fig. 11 that tiny weeds still remain on the soil surface. This result is acceptable. The dynamic balance of farmland agroecosystems will be improved when the composition of the weed community is changed, and the biodiversity of farmland will be improved [64].

The weeder is equipped with only one camera, and its weeding system can detect all weeds in the image. The proposed system does not involve the construction of multiple cameras and complex detection systems that require lighting control [42]. Meanwhile, the YOLOv3 model can also solve the identification limit of the same size of crops and weeds [44]. This study proposes an alternative strategy for single weed removal, replacing the traditional all-in-one weeding (chemical or physical) method. Small weeds on the field are neglected, which can improve the dynamic balance of the farmland ecosystem and increase the biodiversity of the farmland [64].

Finally, the use of a new-generation YOLOv4 network can shorten the time for object recognition [65]. If there are multiple different types of objects in the image or there are complex backgrounds, this method should be explored and studied.

#### **4. Conclusions**

The proposed weeder uses deep learning technology to detect weeds in the field and can use a special weeding tool to remove the weeds. The experimental results herein confirmed the effectiveness of the machine for weeding. At travel speeds of vehicle below 15 cm/s, the weeding system can detect the weed signal with a detection speed 5 fps of YOLOv3 and the average weeding efficiency is 88.6%. With an F1-score of 89.5% and a recall rate of 90.1%, the average detection accuracy rate is 90.7%. These results were from field trials of vegetable under different climate condition, which also included various densities of weeds. Since most of the deep learning model is only used to detect objects in the image; and the operating conditions of the weeder depend on the detection results of the contact or non-contact sensors on the machine. In this study, a smart farming method combining deep learning and weeding control was proposed. Its advantage lies in reducing the number of sensors used and the cost of maintenance. In addition, the powerful deep learning method can also identify different types of crops and weeds, with high flexibility.

The proposed weeder can be installed on the pylon behind the tractor, and multiple units can be made to be used on farmland of different scales and areas. The weeder is suitable for low-density weeds, early germination of weeds, or farming environments with deep roots of weeds, such as rice in wetlands or weeding in fields that have been prepared. The use of the proposed weeder can indeed destroy the growth conditions of weeds while reducing environmental medication. In addition, the weeder adopts DC power supply, which has a low production cost (approximately 1000 US dollars) and power consumption (approximately 500 W/h), which is of great significance for energy saving and environmental protection.

Future work will focus on the improvement of the performance of the weeder, including reducing the weight of the weeder and adjusting the rotation speed of the weeding tool in real time to adapt to different speed of vehicle. This deep learning method will also be tested to distinguish crops or weeds of the same size but different colors. Finally, install this weeder on a large tractor for tillage farming verification.

**Author Contributions:** Conceptualization, C.-L.C. and B.-X.X.; Methodology, C.-L.C.; Software, B.-X.X. and S.-C.C.; Verification, C.-L.C., B.-X.X. and S.-C.C.; Data management, B.-X.X.; Writingmanuscript preparation, C.-L.C. and B.-X.X.; writing—Review and edit, C.-L.C.; visualization, C.-L.C. and B.-X.X.; supervision, C.-L.C.; project management, C.-L.C.; fund acquisition, C.-L.C. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was funded by Ministry of Science and Technology (MOST), Taiwan, grant number MOST 109-2321-B-020-004; MOST 110-2221-E-020-019.

**Data Availability Statement:** The datasets presented in this study are available from the corresponding author on reasonable request.

**Acknowledgments:** Many thanks to all anonymous reviewers for their constructive comments on this manuscript. Meanwhile, we sincerely thank Wen-Chung Li, Director of the Department of Biomechanical Engineering, National Pingtung University of Science and Technology, for providing administrative support and Wei-Cheng Chen for assisting in the maintenance of the experimental site.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**


## *Article* **A Design of an Unmanned Electric Tractor Platform**

**Yung-Chuan Chen, Li-Wen Chen and Ming-Yen Chang \***

Department of Vehicle Engineering, National Pingtung University of Science and Technology, Pingtung 912, Taiwan; chuan@mail.npust.edu.tw (Y.-C.C.); Liwen@mail.npust.edu.tw (L.-W.C.) **\*** Correspondence: chang.mingyen@mail.npust.edu.tw

**Abstract:** The tractor is a vehicle often used in agriculture. It is mainly used to tow other unpowered agricultural machinery for farming, harvesting, and seeding. They consume a lot of fuel with emissions that often contain a large amount of toxic gases, which seriously jeopardize human health and the ecological environment. Therefore, the electrical tractor is bound to become a future trend. The objective of this study is to design and implement a lightweight, energy-saving, and less polluting electric tractor, which meets the requirements of existing smallholder farmers, equipped with unmanned technology and multi-functions to assist labor and to provide the potential for unmanned operation. We reduced the weight of the tractor body structure to 101 kg, and the bending rigidity and torsional rigidity reached 11,579 N/mm and 4923 Nm/deg, respectively. Two 7.5 kW induction motors driven by lithium batteries were applied, which allows at least 3.5 h of working time.

**Keywords:** agricultural; unmanned; electrical tractor

#### **1. Introduction**

In recent years, with the rapid development of industrialization, agricultural machinery has gradually replaced traditional labor-intensive farming methods, improved work efficiency, and reduced manpower requirements. This is a major change in agricultural history. Today, agricultural machinery has developed into different forms, for example, agricultural machinery for arable land, for planting and fertilizing, for field management, etc. However, the wide usage of agricultural machinery increases the use of internal combustion engine vehicles, causing air pollution, environmental damage, and rapid consumption of land resources. According to statistics, global natural gas, oil, and coal resources can be supplied for another 30 years, 55 years, and 152 years, respectively [1]. Global environmental awareness is gradually rising. In order to reduce the harm to the environment, many countries have begun to promote electric vehicle-related industries vigorously, and have achieved good results in batteries, hybrid vehicles, and electric vehicles.

The tractor is a vehicle often used in agriculture. It is mainly used to tow other unpowered agricultural machinery for farming, harvesting, and seeding. For sedans, the key performance criteria are speed, loading force, and traction, but for tractors, highspeed performance and strength for traction are not important. The tractor needs to pull agricultural machinery and implement farmland farming. The tractor can have different operation modes depending on the agricultural tools with which it is equipped. If a Western plow, harrow, or raking machine, etc., is mounted behind the tractor, a plowing operation can be carried out. If the tractor is equipped with a rotary plow, the power transmission device of the tractor can be used for rotary tillage. Adding a flat soil board or a rice transplanter to the tractor can achieve soil leveling or planting operations, so the tractor is essential in agriculture. The agricultural tractors used in Taiwan are less driven by motors. However, as a trend for small-scale farmers, greenhouse planting emphasizes the development of technological agriculture and is environmentally controlled. The development of agricultural machinery needs to fulfill users' requirements and provide a

**Citation:** Chen, Y.-C.; Chen, L.-W.; Chang, M.-Y. A Design of an Unmanned Electric Tractor Platform. *Agriculture* **2022**, *12*, 112. https:// doi.org/10.3390/agriculture12010112

Academic Editor: Mustafa Ucgul

Received: 24 November 2021 Accepted: 10 January 2022 Published: 14 January 2022

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

27

safe and environmental-friendly configuration to reduce labor demand and improve work comfort for better agricultural production.

Electric tractors have been studied since the 19th century. The first electric tractor appeared in the USA [2,3], and subsequent developments were mainly powered by batteries. A 36.8 kW electric tractor manufactured by German Siemens in 1912 was the first electric tractor [4], which was mainly used for rotary tillage operations. The German company, Bungartz, developed an electric tractor called Töpfer in 1945. It was equipped with a gearbox and had a speed control function. Its key characteristic was to move both forward and backward without turning [5]. Later, General Electric (USA) introduced the Elec-Trak series of electric tractors. This electric tractor used lead-acid batteries to drive a permanent magnet brushless motor. The motor power was between 5.9 kW and 11 kW. In addition, the tractor was equipped with a rotary converter, which could tow other agricultural implements [6]. Since the 1990s, the control and battery technology have developed rapidly, and the performance of electric tractors has gradually improved, and there is more research devoted to the development of electric tractors and their electromechanical related design [7–9].

Furthermore, many articles are devoted to studying the performance and stability of tractors [10–13]. Improving the effectiveness of tillage is closely related to the characteristics of soil, and it is one of the areas that cannot be ignored [14–16]. There is a lot of research on autonomous driving [17–21], but there is very little on intelligent electric vehicles for unmanned driving in agriculture. We will enable these devices for autonomous driving on the field either to reach fixed points or to follow planned routes in farming.

#### **2. Materials and Methods**

The vehicle design was divided into four parts: the vehicle body design, which is lightweight and contains safety considerations; the power and vehicle control, which provides vehicle power and covers a series of system integration and unmanned controls; the mechanism design, which improves the mechanical functions and analyzes the state of the vehicle driving; and the field tests and the implementation of the whole vehicle. The divisions are shown in Figure 1.

**Figure 1.** Planning of the division for vehicle design.

The tractor type and the related load affect the power consumption and the design of the vehicle. For a small electric tractor, the size, mass, and motor power are smaller than those of a high-load tractor. The designed tractor will be mainly used for rotary tillage and plowing operations, so the resistances are calculated based on the rotary tillage operation. Since the designed electric tractor is mainly operated in greenhouses, which have rather flat terrain, the slope resistance and air resistance of the tractor are not taken into consideration. The configuration and parameters are shown in Figure 2 and Table 1.

**Figure 2.** System configuration of the electric tractor.

**Table 1.** Vehicle parameters of the electric tractor.


In addition, the tractors require a wide range of force changes, especially when working under heavy loads, which requires larger torque output. Therefore, the reducer must be used to decelerate and increase the torque to respond to different conditions. The drive motor can be adjusted and is equipped forward and reverse rotation to achieve reverse gear requirements. When transporting in the field, it can be switched to a high gear to increase the speed. In addition, when working in the field, the wheels may have insufficient grip due to the road or terrain, so a four-wheel drive system is required. Based on the above analysis, the power system configuration of the electric tractor in this study is shown in Figure 3, which is equipped with a motor, a reducer, a differential, and a controller.

**Figure 3.** Power system configuration of the small electric tractor.

#### **3. Body Design**

The body of the small tractor is equipped with an on-board motor and a battery system. The tractor must meet the requirements of rigidity, safety, strength, and fatigue durability. The analysis process first established the prototype of the car body, then used TOSCA topology optimization analysis for lightweight analysis and ABAQUS finite element analysis for strength check, and finally used fe-safe fatigue life analysis to calculate the fatigue life of the vehicle body on different road grades.

#### *3.1. Lightweight Design and Analysis of Car Body*

During the space planning, the load position of each system on the vehicle was considered, such as the vehicle power system, steering system, suspension system, transmission system, electronic control system, battery, counterweight, rotary plow power system and slewing plow, etc., as shown in Figure 4. The required bearing weight of the vehicle included the vehicle power system, steering system, transmission system, electronic control system, battery, counterweight, rotary plow power system, rotary plow, and other weights. The target weight of the vehicle body was 120 kg. The total weight was estimated to be 650 kg. In order to reduce manufacturing costs, a commercially available transmission system and suspension system with a wheelbase of 1297 mm were selected. The power system was placed on the left side of the vehicle body for the power transmission. To balance the center of gravity, two lithium batteries were placed on the right side of the vehicle body to reduce the possibility of overturns. The power system was planned to be 350 mm in length, 338 mm in width, and 285 mm in height, and the battery is 338 mm in width, and 660 mm in height, and 480 mm in length. During transportation, the rotary plow at the rear of the vehicle body will be raised and the center of gravity will be moved backwards. Therefore, a counterweight of about 100 kg was installed in the front of the vehicle body to maintain balance. Based on the above-mentioned configuration, the preliminary frame size was 1720 mm in length, 1100 mm in width, and 660 mm in height.

In order to complete the required setting under the existing conditions, the vehicle types similar to this study were evaluated, space planning of the whole vehicle was carried out, including transmission, suspension type, wheelbase, type and quantity of battery, etc. The prototype of an electric tractor was established, and a topology optimization analysis of this structure was conducted. According to the topological optimization analysis, an overall structural material distribution was obtained for reference, and a preliminary conceptual design of an electric tractor was proposed.

**Figure 4.** Space planning of car body, (**a**) Side view; (**b**) Top view.

It was necessary to confirm whether the preliminary conceptual design met the design goals. Once the design goals were met, manufacturing feasibility was considered for welding deformation and component interferences. The body of the preliminary conceptual design was modified to obtain the final conceptual design. The completed vehicle body was imported into ABAQUS to create a finite element model and to conduct rigidity and strength analysis to confirm whether the rigidity and strength of the vehicle body met the design goals. If the design goals were not met, the structure was modified. Once the final vehicle body was obtained, the body was imported into the fe-safe for fatigue analysis. The fatigue life theory and rain flow cycle counting method were used to calculate the fatigue life. Figure 5 shows the analysis process of the lightweight design of the small electric tractor for this study.

First, the prototype of the vehicle body that was planned during the space layout was imported into ABAQUS to build a finite element model, as shown in Figure 6. Then the area to be made lightweight in the TOSCA topology optimization analysis software was defined as the design zone, shown as the green area in Figure 7. Considering the compatibility of the suspension system and the transmission system, the space and hardpoints were reserved for the shock absorbers, upper and lower control arms, power system, steering system, and transmission system, etc. The outer frame of the vehicle was defined as the non-design zone, the red area shown in Figure 7. Next, the material parameters of the vehicle body in the design area and the non-design area were defined. This study mainly used high-strength steel SPFH 590 and STKM 11A for materials. The properties of the materials are shown in Table 2. The topology optimization analysis, which were load condition analyses, including bending, torsion, and full load braking, was mainly static. The load conditions of these three types were all the same, and the weight of all the load-bearing objects was applied to the vehicle body as shown in Figure 8. Then the boundary conditions were set separately according to the bending strength analysis, torsion strength analysis, and load braking strength analysis.

**Figure 5.** Analysis process of the lightweight design of the small electric tractor.

**Figure 6.** The finite element model of the vehicle body prototype.

**Figure 7.** The design area of the vehicle body prototype.

**Table 2.** Material properties.


**Figure 8.** Load conditions on the prototype of the vehicle body.

#### *3.2. Fatigue Life Analysis*

In order to confirm the fatigue life of the frame, the geometric model of the final conceptual design of the vehicle body was imported into the ABAQUS to establish the finite element model. In the fatigue life analysis of the vehicle body, the suspension system did not undergo fatigue life analysis; the suspension model was described as simplified beam elements. In Figure 9, Kf is the stiffness value of the front shock absorber spring, Kr is the stiffness value of the rear shock absorber spring, Cf is the damping value of the front shock absorber, and Cr is the damping value of the rear shock absorber. The simplified suspension model was simulated by a three-dimensional two-node beam element and defined as a rigid body. In the fatigue life analysis, a three-dimensional dynamic elastoplastic finite element model was used, and the element type was eight-node hexahedral.

**Figure 9.** Finite element model of the suspension system. (**a**) Front suspension; (**b**) Rear suspension.

#### A. Material parameters

When the vehicle is running, the structure of each part bears different stresses from different load. Since the tractor often works in the field, and the working environment is relatively harsh compared with ordinary vehicles, SPFH 590 high-strength steel was used as the main material of the vehicle structure. Due to the small load between the upper and lower layers of the vehicle, steel STKM 11A was used between the 2 layers. The suspension hardpoints and the reinforced plate were used to meet the assembly requirements with SPFH 590, which were cut by laser and formed by bending. Other parts of the vehicle body used different materials, as shown in Figure 10.

#### B. Loading conditions

In the fatigue life analysis, different load conditions were applied on the vehicle body based on the working conditions and operations. For example, the rotary plow was placed on the ground and counted as unsprung mass. There was no load from the rotary plow in the analysis. In addition, traction resistance will be generated during rotary tillage operations, so resistance was applied to the rear of the vehicle body.

#### C. Boundary conditions

The boundary conditions of the fatigue life analysis are shown in Figure 11. In the figure, Kf and Kr are the stiffness of the front and rear suspension springs, respectively, which both equaled 27.5 N/mm. Cf and Cr are the damping values of the front and rear suspension shock absorbers whose values were set as 0.96 N.s/mm and 2.16 N.s/mm, respectively. During analysis, road signals of different levels in y direction were applied to the wheel center. Table 3 lists the parameters of the spring stiffness and shock absorber damping coefficient of the front and rear suspension systems during the fatigue life analysis.

**Figure 10.** Material distribution of car body.

**Figure 11.** Boundary conditions for fatigue life analysis.

**Table 3.** Spring stiffness and damping coefficient value of suspension system.


Fe-safe was used to predict fatigue life. It uses the rain flow method to count the number of stress amplitude occurrences and the average stress. Here, the rotary tillage with a larger load was selected for illustration. When the vehicle body is used for rotary tillage, Figures 12a and 13a show the von-Mises stress distribution diagrams obtained from the simulation of the vehicle body driving on the C- and D-level road surfaces at a speed of 2 km/h. It is observed that both σe,max occurred at the hardpoint of the upper control arm of the left front suspension. The stress histories of this location, as shown in Figures 12b and 13b, were respectively imported into the fe-safe software for calculation. The rain flow counting method was used to calculate the stress history of the C-and D-level

road surface. The stress amplitude σ<sup>a</sup> and the number of occurrences of average stress σ<sup>m</sup> are shown in Figures 12c and 13c. The fatigue life of the vehicle body obtained from the fe-safe simulation was N = 2.4 × <sup>10</sup><sup>6</sup> and N = 6.7 × <sup>10</sup>5, which also means the vehicle can travel 40,724 and 11,190 km, respectively, as shown in Figures 12d and 13d.

**Figure 12.** Analysis of driving on a C-level road at = 2 km/h during rotary tillage operation. (**a**) Von-Mises stress distribution; (**b**) the von-Mises stress of the car body where σe,max occurs; (**c**) stress amplitude and number of average stress; and (**d**) fe-safe life simulation.

**Figure 13.** Analysis of driving on D-class road surface at = 2 km/h during rotary tillage operation. (**a**) Von-Mises stress distribution; (**b**) the von-Mises stress of the car body where σe,max occurs; (**c**) stress amplitude and number of average stress; and (**d**) fe-safe life simulation.

#### **4. Power and System Integration**

Due to different operating conditions and load distributions of the tractor, there are also different requirements for the performance of the tractor. The power system of the electric tractor must be designed according to the load distribution in different operating conditions. It was calculated according to the requirements of the vehicle under various operating conditions, with a suitable drive motor and reducer.

#### *4.1. Force Estimate and Power System Planning*

The resistance of the tractor is related to the selection of the specifications of the power system, so the total resistance of the tractor during transportation operations and rotary tillage operations can be calculated. In addition, the electric tractor uses two drive motors (induction motors) for rotary tillage operations, one for driving the tractor, and one for driving the rotary plow operation, etc. When the tractor is transporting, the motor driving the rotary plow will not work. At this time, the driving force of the whole vehicle is relatively small.

#### 4.1.1. Force Estimate

In the transportation operation, the required driving force can be obtained [22]:

$$\mathbf{F\_{q1} = f \cdot G = 0.12 \times 6474.6 = 776.95 \text{ N}} \tag{1}$$

where f = 0.12 is the rolling resistance coefficient, and G = 6474.6 N is the vehicle weight.

Before the driving force Fq2 required for the rotary tillage operation can be calculated, it is necessary to know the rotary tillage speed ratio λ and the soil cutting pitch S. After calculating these two values, the rotary tillage specific resistance Kλ and the soil resistance FL can be obtained, and then the rotary tillage can be calculated. The driving force Fq2 is required for the operation. The rotary tillage speed ratio λ can be obtained by formula (2):

$$\lambda = \frac{2\pi \text{r} \mathbf{r}\_{\text{f}}}{60,000 \text{v}\_{\text{m}}} = \frac{2\pi \times 205 \times 236}{60,000 \times 0.55} = 9.2 \tag{2}$$

where r = 205 mm is the turning radius of the scimitar, nr = 236 r/min is the rotary knife shaft speed, and vm = 0.55 m/s is the tractor speed. After calculating the rotary tillage speed ratio λ, we obtain:

$$\mathbf{S} = \frac{\pi \mathbf{r}}{5 \mathbf{Z} \lambda} = \frac{\pi \times 205}{5 \times 2 \times 9.2} = 7 \text{ cm} \tag{3}$$

where Z = 2 is the number of scimitars in the same vertical plane.

Before calculating the soil resistance, it is necessary to find the standard rotary tillage specific resistance Kg corresponding to the soil cutting pitch S and then find the correction coefficient that meets the working conditions to obtain the rotary tillage specific resistance Kλ. The specific resistance K<sup>λ</sup> of the rotary tillage is:

$$\mathbf{K}\_{\lambda} = \mathbf{K}\_{\mathsf{B}} \mathbf{K}\_{1} \mathbf{K}\_{2} \mathbf{K}\_{3} \mathbf{K}\_{4} = 15 \times 0.8 \times 0.95 \times 0.8 \times 0.66 = 6.019 \text{ N/cm}^{2} \tag{4}$$

where Kg = 15 N/cm<sup>2</sup> is the standard rotary tillage specific resistance, K1 = 0.8 is the tillage depth correction coefficient, K2 = 0.95 is the soil moisture content correction coefficient, K4 = 0.66 is the stubble vegetation correction coefficient, and K3 = 0.8 is the operation mode correction coefficient. Knowing the specific resistance of rotary tillage, we can obtain the soil resistance FL:

$$F\_L = 100\text{ K}\_\lambda\text{ BH} = 100 \times 6.019 \times 1 \times 12 = 7222.8\text{ N}\tag{5}$$

where B = 1 m is the width of the rotary tillage, and H = 12 cm is the depth of the rotary tillage. After calculating Formulas (2)–(5), we know the rotary tillage speed ratio λ, soil cutting pitch S, rotary tillage specific resistance K<sup>λ</sup> and soil resistance FL, and then the rotary tillage operation time can be calculated by Formula (6) The required driving force Fq2 is:

$$\begin{aligned} \mathbf{F\_{q2}} &= \mathbf{k\_1 F\_L} + \mathbf{f} \times (\mathbf{G} + \mathbf{k\_2 F\_L})\\ &= 0.68 \times 7222.8 + 0.12 \times (6474.6 + 0.74 \times 7222.8) \\ &= 6329.8 \text{ N} \end{aligned} \tag{6}$$

where k1 = 0.68 is the horizontal component coefficient, and k2 = 0.74 is the vertical component coefficient.

#### 4.1.2. Power System Planning

The specifications of the electric vehicle power system are critical to the performance of the vehicle. The motor and the reduction ratio of the reducer of the vehicle power system are calculated by the rotary tillage operation that requires more power.

(1) Transportation operations

$$P\_1 = \left(\frac{1}{3600 \times \eta}\right) \times \text{fG} \times \text{V1}\_{\text{max}} = \left(\frac{1}{3600 \times 0.81}\right) \times 0.12 \times 6474.6 \times 18 = 4.8 \text{ kW} \tag{7}$$

where η = 0.81 is the efficiency of the power transmission of the whole vehicle, and V1max = 18 km/h is the highest vehicle speed during transportation.

(2) Rotary tillage operations

$$\begin{array}{rcl} \text{P}\_2 &=& \left(\frac{1}{3600 \times \eta}\right) \times \left[\text{k}\_1 \text{F}\_\text{L} + \text{f} \times (\text{G} + \text{k}\_2 \text{F}\_\text{L})\right] \times \text{V} 2\_{\text{max}} \\ &=& \left(\frac{1}{3600 \times 0.81}\right) \times \left[0.68 \times 7222.8 + 0.12 \times (6474.6 + 0.74 \times 7222.8)\right] \times 2 \\ &=& 4.3 \text{ kW} \end{array} \tag{8}$$

where the highest vehicle speed during rotary tillage operation is V2max = 2 km/h. Generally, the tractor used in the greenhouse requires 20 PS (15 kW) of horsepower, so two motors with a rated power of 7.5 kW were finally selected as the driving motors in this study, one for driving the tractor and the other for driving the rotary plow. Table 4 presents the specifications of the selected motor.

**Table 4.** Selected motor specifications.


#### 4.1.3. Reducer Selection

In order to confirm whether there is sufficient torque, the upper and lower limits of the reduction ratio of the reducer can be calculated.

(1) Transportation operations

 $\frac{\text{fGR}}{\text{T}\_{\text{m}}\text{H}\_{\text{H}}} \le \text{i} \le \frac{0.37 \text{T}\_{\text{m}}\text{R}}{\text{V}\_{1\text{max}}\text{H}}$ 
 $\frac{0.12 \times 6474.6 \times 0.3125}{0.81 \times 23.2 \times 12.5} \le \text{i} \le \frac{0.377 \times 5800 \times 0.3125}{18 \times 12.5} \tag{9}$ 
 $1.03 \le \text{i} \le 3.04$ 

where R = 0.3125 m is the wheel radius, Tm = 23.2 N·m is the motor output maximum torque, iH = 12.5 is the high gear reduction ratio, nm = 5800 rpm is the motor maximum speed, and V1max = 18 km/h is the maximum vehicle speed.

(2) Rotary tillage operations

 $\frac{\mathbf{f} \times (\mathbf{G} + \mathbf{k}\_2 \times \mathbf{F}\_\mathrm{L})\mathbf{R}}{\eta \mathbf{T}\_\mathrm{m} \mathrm{u}\_\mathrm{L}} \le \mathbf{i} \le \frac{0.377 \mathbf{n}\_\mathrm{m} \mathrm{R}}{\mathbf{V}\_{2\mathrm{max}} \mathrm{u}\_\mathrm{L}}$ 
$$\frac{0.12 \times (6474.6 + 0.74 \times 7222.8) \times 0.3125}{0.81 \times 23.2 \times 23.3} \le \mathbf{i} \le \frac{0.377 \times 5800 \times 0.3125}{2 \times 23.3} \tag{10}$$

where iL = 23.3 is the low gear reduction ratio, and V2max = 2 km/h is the maximum vehicle speed.

1.01 ≤ i ≤ 14.7

#### *4.2. Unmanned/Intelligent Control System Integration*

There is a lot of research on autonomous driving [12,13], but there are very few developments on intelligent electric vehicles for unmanned driving in agriculture. The unmanned driving system uses cameras, optical radars, ultrasonic sensors, and other equipment on the vehicle to enable autonomous driving on the field to reach fixed points or to follow planned routes for farming and other tasks.

The unmanned driving system can be divided into three parts, information collection, electronic control unit (ECU), and execution unit. The information collection part refers to the sensing components. Different sensors collect information for different systems. The information collected by the sensors will be transmitted to the ECU for analysis and processing, and commands are given based on the results calculated by the ECU for the Execution unit. Figure 14 is a diagram of the unmanned driving system.

**Figure 14.** Unmanned driving system.

The positioning system used two GPS-RTK. The two were aligned in parallel, one was set at the center of gravity of the vehicle and the other was set at the back of the car. The two GPS-RTK collect the difference between the current heading angle and the heading angle toward the target point. A PID controller receives the angle error from the GPS-RTK, determines whether the vehicle should drive, spin, or stop, and tracks the target point with a GPS-RTK located at the center of gravity to achieve autonomous driving. The tractor uses LiDAR for obstacle avoidance and navigation assistance. The rotary plow carried by the tractor is dangerous. The LiDAR scans 360 degrees around the tractor to stop the tractor when an object enters the hazard zone, which was redefined, and to prevent something from getting caught in the rotary plow.

To assist the autonomous vehicle to touch the ground in excessive ups and downs, three optical radars were added in addition to the existing GPS-RTK. Two of the three optical radars were placed on the front left and right sides of the vehicle to detect both sides of the vehicle and to calibrate the lateral accuracy of the vehicle. The remaining optical radar was mounted in the front of the vehicle to detect obstacles. When an obstacle is detected within a defined distance in front of the vehicle, the operation of the vehicle will be stopped. The vehicle was also equipped with an image processing unit to keep the vehicle stable, as shown in Figure 15. After the camera captures the image, the desired targets in the region of interest (ROI) are processed. The image is then converted to grayscale and binarized. Then the Canny tracks the edges of the objects and performs dilate processing. Then, Hough transfers the edges to calculate the centerline of the road as the driving trajectory.

**Figure 15.** Image processing and control flowchart.

The vehicle control uses a NVIDIA TX2 to collect all the information from sensors, calculate the vehicle offset, the current position, and actuation function, and to send signals to the corresponding MCUs through the CAN bus to the control motors. The control system flow chart is shown in Figure 16.

**Figure 16.** Control system flowchart.

#### *4.3. Vehicle System Integration and Function Testing*

The Smart Farm of Pingtung University of Science and Technology was selected for the functional test of the tractor, as shown in Figure 17. The field is a 10 hectares smart agricultural production demonstration base. The crops in the field can be planted and cultivated according to research needs. In this study, both dry and wet arable land was used for field testing. The greenhouse was also one of the indispensable test areas. Figure 18 is the configuration diagram of the vehicle control system. The software architecture was divided into manual mode and automatic mode. In the manual mode, the operator gave the accelerator signal to the motor controller to achieve the driving requirement, and the steering signal was transmitted to the electronic assisted steering system to steer the whole vehicle. The automatic driving mode processed and captured the current position data at the first second, calculated the driving route with the current position and the set driving route, and then informed the controller and the electronic assisted steering system to make the tractor follow the route. Figure 19 is the completed diagram of the small electric tractor of the study.

**Figure 17.** Smart Farm of Pingtung University of Science and Technology.

**Figure 18.** Configuration of vehicle control system.

**Figure 19.** The small electric tractor.

#### **5. Conclusions**

This study focused on the development of a small electric tractor with complete design and fabrication of the whole vehicle system. The conceptual design of a lightweight vehicle body was obtained through topological optimization analysis and the finite element model analysis, which was used to obtain the rigidity, strength, and fatigue life analysis of the vehicle body. Finally, the vehicle body structure, chassis, and electrical system were completed with the integration of the vehicle control system. Based on the results of the above analysis, the following conclusions can be summarized:



**Table 5.** Field tests on different kinds of road.



**Table 7.** Influence of motor power consumption on battery discharge time.


Ploughing field 15 cm, for low-speed, the current was 50.3 A, for high-speed, the current was 126.6 A.

**Author Contributions:** Y.-C.C., M.-Y.C. and L.-W.C. conceived the idea. We developed the theory and Y.-C.C. performed the CAE. L.-W.C. developed the control. M.-Y.C. and Y.-C.C. verified the analytical methods and supervised the findings of this work. All authors discussed the results and contributed to the final manuscript. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was funded by the Pingtung University of Science and Technology (NPUST).

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Acknowledgments:** We thank Pingtung University of Science and Technology (NPUST) for funding implementation and providing the venue for the experiment.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**

