Applying AI Technology to the Operation of Smart Farm Robot

The purpose of this research is to apply an artificial intelligence (AI) technology to manage the operation of a farm robot. AI technology can also help farmers analyze environmental conditions, such as weather, and diseases in rice. The researchers have designed a robot for the farming of rice and its control system based on AI. The robot can move automatically in accordance with the data collected. The organization of the robot with AI consists of the following: (1) a subsystem to control movement, (2) a sensor control subsystem, and (3) an analysis subsystem. The sensors monitor environmental and weather conditions, including temperature, humidity, and water level, and transmit images. The AI robot is designed to operate at four positions as required. When the AI robot operates at position 1, the sensors store data after a successful operation, then the robot changes to positions 2, 3, and 4, in sequence progressively. Accordingly, the robot analyzes the collected data and judges the priorities from the data in order to move to the corresponding position. While the robot moves to the correct location, the installed camera scans rice fields to compare images and analyzes the surfaces of rice plants for diseases. When the images captured by the camera indicate a disease, the robot automatically sprays a chemical and a message is sent to inform the farmers. To complete the above operation, power consumption is an important issue, which is discussed in depth in this article.


Introduction
Nowadays, artificial intelligence (AI) technology has a broad range of applications. AI also plays a crucial role in university education, with some universities offering courses in code programming, for example, in the Department of Robots and Smart Electronics Engineering at Phetchaburi Rajabhat University, Thailand. The department has courses named AI for robots I and AI for robots II in its Bachelor of Engineering Program, (1) which have attracted the interest of many students. AI technology helps the data analysis widely and makes the process convenient. This technology is also applied to the analysis of systems. Usually, the results of data analysis by AI are accurate. Moreover, we can use AI for convenience in farms. There are many challenging tasks for farmers worldwide. (2) The rice products of one country that are too much to consume should be exported to other countries. The procedure for rice growing depends on the rice variety. However, rice plant diseases for all rice varieties occur and become a major problem for farmers because they spread widely and ruin the rice industry. Thus, there should be an instrument to accurately analyze and thus prevent rice plant diseases. AI technology can help to analyze and mitigate the spread of rice plant diseases. Such analysis will have a high efficiency if AI is employed in the robot system discussed in this research. The robot can move and gather information in different positions, allowing us to thoroughly analyze the results obtained at any location. The AI technology and automatic robot system can help to support farmers in terms of the use of instruments. Moreover, the technology can be applied to obtain the maximum benefit, (3,4) and it can also reduce the risks and cost of production. This new agricultural model uses many advanced technologies to assist agriculturists, and such a management system for farms adopting high technology will enable the realization of "smart farms". The data gathered from sensors can be used for calculations to prevent the problems occurring during rice production. The previously mentioned results are obtained from the operation of smart farms or AI robots.
In this paper, the design of a robot with AI technology for use in smart farms to assist farmers (5) is described. This robot system technology has been used with some new instruments for farming rice and has succeeded in reducing the hazards of growing rice. (6) The paper is organized as follows. The design of the mechanism is presented in Sect. 2. The design of the robot is described in Sect. 3. In Sect. 4. the elements of the AI robot are discussed. A brief conclusion is given in Sect. 5.

Design of Mechanism with Creative Methodologies
The design scheme of the AI robot is implemented on the basis of a creative innovation process and shown in the diagram in Fig. 1. This diagram consists of five steps, which are explained as follows.
In the first step, the robot starts operating at position 1. It automatically lowers a soil moisture sensor. The robot remains at this position for 30 min and records the amount of moisture (Device 1) and stores it in the memory along with pictures captured by an embedded camera. The temperature and humidity are also measured by a DHT22 sensor. In addition, the water level is obtained from an ultrasonic sensor.
In the second step, when the time at position 1 reaches 30 min, the robot automatically raises the soil moisture sensor and moves to position 2. If the robot moves to position 2 incorrectly, it will check and adjust the scale of the right position 2 itself using the image captured by a camera. If the robot moves to position 2 correctly, it will remain at position 2 and then keep the recorded values (Device 2) in the memory for 30 min.
In the third step, if the time at position 2 expires after 30 min, the robot will move to position 3. If the robot moves to position 3 incorrectly, it will check and move to position 3 again by itself. Certainly, if the robot moves to position 3 correctly, it will remain at this position and keep the recorded values (Device 3) in the memory for 30 min.
In the same manner, in the fourth step, if the time at position 3 expires after 30 min, the robot will move forward to position 4. If the robot moves to position 4 with a wrong scale, it will check and return to position 4. If the robot moves to position 4 correctly and occupies the position for 30 min, it will also record the values (Device 4) in the memory. The AI robot moves to the next step, which depends on the data captured by the camera.
After all the procedures are completed, the robot is expected to keep going to position 1 iteratively. Normally, the robot will analyze all the data gathered from the four positions before it goes back to position 1. Then, it will present the results in a list by improving the important technologies that cause problems. After all, the improvement should be prioritized. Some examples of farm hazards after the analysis are shown in Table 1.
As shown in Table 1, for instance at position 4, a 50% error for the camera factor was obtained. Such an error problem should be improved at that position and a commanded station will give a command to spray a chemical at position 4 upon the first order. Specifically, the conditions assumed for the experimental farm are shown in Table 2.
The AI robot will work and keep on gathering data consecutively. Owing to the environmental working conditions, the robot will be allowed to work from 6.00 AM to 6.00 PM every day.

Robot Design
The main mechanism of constructing a robot is proposed and expressed in the last section. The implementation concept of robot hardware and the algorithm of the operation are described in this section.

Implementation of robot hardware
The methodologies of the robot have been discussed in Sect. 2, in which all operation steps are held. To arrive at the targets of the designed robot, a detailed construction method is graphed orderly. The robot design has a structure that is explained as follows: firstly, the parts used are listed in Table 3.
The structure of the robot in the front view design is shown in Fig. 2(a). The structure of the robot in the back view design is shown in Fig. 2(b). The structure of the robot in the left view design is shown in Fig. 2(c). The structure of the robot in the ISO of the back view design is shown in Fig. 2(d) and that of the robot in the ISO of the front view design is shown in Fig. 2(e). A camera (A) is used to capture photographs in order to track the path for the detection of the water level and an ultrasonic sensor (B) is embedded below the robot. Since soil moisture is an important factor in plant growth, a soil moisture sensor (C) is applied to gather soil moisture signals. Then, an encoder (D) is applied to give the precision length for the motor to move. All the energy is supplied by a solar cell (E). Certainly, an encoder motor (F) and a servo motor (G) are adopted to control the up/down and forward/backward directions, respectively. The microcontroller for controlling and collecting the sensed data is put in a controller box (H), which also contains the temperature and humidity sensors. The battery (I) is used for storing all the energy coming from the solar cell.

Proposed neural network (NN) algorithm
The total number of layers including the hidden and output layers is designed to be 5, in which there are 4 hidden layers and 1 output layer. The signal coming from the sensor control   subsystem becomes very clean passing through a low-pass filter (LPF) and then into the hidden layer. There are many neuronal nodes that are combined together to form the output layer.
The output values of the n-th neuronal node located in the l-th layer are expressed as l n U . The connection weighting between the n-th node of the l-th layer and the h-th node of the (l + 1)-th layer is denoted as , l h W n. The total value of weighted output node i is written as where N is the total number of neuronal nodes. Moreover, the activation function uses a nonlinear sigmoid function for the proposed NN and is expressed as where exp(•) is the exponential function. The probability distribution is calculated by statistical modeling. Then, the normalized power is forwarded to the NN system after the robot is started to optimize the total random signal from the sensor control device. The weighting value is simulated simultaneously. There is an activation function called softmax presented as where ( )

Architecture and Analysis of Advantages
According to the architectural views shown in Figs. 2(a)-2(e), the proposed AI robot in this paper has three subsystems, namely, the moving control, sensor control, and analysis subsystems. They are described in detail as follows.

Moving control subsystem
The total block diagram of the moving control subsystem is shown in Fig. 4; such a subsystem is combined with five devices, namely, the high loading motor, motor controller, battery, camera, and controller. The moving control subsystem is responsible for driving the robot toward the right places. It is also applied to capture an image through a camera similarly to a person's eye.
To achieve a much higher accuracy, an encoder motor is adopted for the AI robot. In addition, the motor exhibits a high loading; thus, the drive motor board should be designed with a rating current that can tolerate 10 amperes. The high-loading motor will be driven after it receives the command signal coming from the microcontroller board. The corresponding signal is a result of using different sensors. On the other hand, the rotation direction of the highloading motor depends on the signal coming from the microcontroller. The position at which the motor remains is determined by the necessary codes programmed for the farmers. The camera built in front of the AI robot is used to detect the real direction for the AI robot. The AI robot is expected to remain at the exact position after the microcontroller determines the labeled position from the photograph.

Sensor control subsystem
There are different sensors installed in the sensor control subsystem. The gathered data include temperature, humidity, water level, soil moisture, and photograph. All the collected data are stored in the USB memory after the robot starts to work.
Form the NN algorithm flow chart in Fig. 3, a clean signal is obtained from the sensor control subsystem. Normally, the analog signal captured from the separated sensors is passed to a LPF to filter high-frequency noise. The clean signal is received at the LPF output, and becomes a testing signal, which is then transmitted to the NN system to compare it with the training signals. The corresponding activation starts once the comparison is completed. The next event is initialized and treated by the procedure shown in Fig. 3.

Analysis subsystem
The AI robot uses the collected data described previously. Firstly, the AI robot instructs the pump to spray a chemical in the corresponding area if the photograph reveals the occurrence of rice diseases. Secondly, the system instructs the pump to spray water in that area if the detected temperature is higher than 35 °C and the detected humidity is more than 80% at a soil moisture of less than 80%. Finally, the lower and upper water levels are preassigned as 10 and 30 cm, respectively. Once the water level is lower or higher than the preset values, the pump motor is activated or stopped.

Experimental results
Some of the advantages for the proposed AI robot and the obtained conclusions are shown as follows. 1. A camera is installed in the sensor control subsystem to detect the movement path of the robot, and the captured photographs are compared in terms of the growth of rice plants. This can detect diseases that may occur in rice paddies accurately. The identification of diseases in rice fields can occur accurately and precisely. 2. An ultrasonic sensor is installed in the sensor control subsystem to determine the water level in rice fields. When the water level in a rice paddy decreases to less than a preset level threshold, the robot orders the main station to pump water into the farm at a rate of 20 cm/min. 3. The temperature and humidity sensor is installed in the sensor control subsystem to measure the temperature and humidity in air. When the temperature is currently set at 30 °C, the robot instructs the main station to spray water into the air to help reduce the air temperature immediately. 4. A soil moisture sensor is installed in the sensor control subsystem to measure soil moisture.
When the robot arrives at the target location, the humidity sensor normally mounted in front of the robot slides down to the ground automatically and the time is set to 30 min. After the humidity sensor in the soil slides up, it moves to the next target automatically. 5. A phonic controller is installed in the sensor control subsystem to control the AI robot in the manual mode. The manual mode for the control of the AI robot uses voice commands once the AI robot encounters a problem. Moreover, the robot is controlled alternately by voice commands. 6. In SMS notifications, the robot has the ability to send messages personally to report the measurement results. These data include temperature, humidity, water level, soil moisture, and diseases in a rice. Specifically, a prototype robot is constructed under the previously listed conditions. There are a few differences between the proposed and prototype robots with direct concepts. However, all the initially considered conditions are similar.
The prototype robot proposed in this article is shown in Fig. 5(a). In the experiment conducted to compare the performance with that observed in the existing work, some factors are illustrated. Certainly, the energy consumption capability (ECC) is the first issue explained by the data shown in Table 4. It is easy to see that the ECC is 1 h 5 min in the 1st time test. A 13.06, V 7 amp/h YUASA NP7-12 battery is adopted in the experiment. The robot is controlled by start and stop commands at a distance of 240 cm. However, an atypical event occurs in the 2nd trail where the ECC decreases to 30 min under the same conditions as the 1st trail except the voltage. This is explained by the fact that the battery is charged without a suitable "rest", that is, the temperature may exactly reduce the ECC performance in the 2nd trail.
The other interesting issue is the speed determined by pulse width modulation (PWM). The speed of the robot depends on the PWM percentage whose measurement results are shown in Table 5. The trail is implemented forward and backward 6 times each at a distance of 120 cm. In Fig. 5(b), the energy escape is illustrated, and the experiment is implemented with different PWM percentages from 30 to 90%. The measured voltages are recorded in Table 5. It is easily known that energy consumption depends on the PWM percentage. However, it is reasonable to see that there is so much more power for the lowest PWM percentage of 30%. The motor needs more starting power for the heavy weight.
The robot has much more significant functions than the currently published robot as proposed in Refs. 1, 3, and 5. Because the AI robot works automatically, it stores values gathered from several points and then analyzes them to solve the problem in advance. One user personally selects a robot to operate in the automatic or manual mode. Moreover, the robot   has a camera system that detects obstructions accurately and alerts the user/farmer to solve the existing agricultural problems. In addition, the robot has the ability to store and send the measured values to the other user located far away. Finally, the robot accurately diagnoses rice fields, reducing the risk of loss and facilitating further processing.

Conclusions
In this study, an AI robot is designed and built with three subsystems proposed. The interweaving between AI technologies and robotic systems is a very important issue for discussion. Not only problems can be solved by applying relevant technologies, but also the technologies help the farmers in monitoring their rice paddies. Furthermore, the proposed system can be adopted as a surveillance system for detecting rice diseases. On the basis of the proposed system, smart robots for farming management are becoming a reality. The prototype of the AI robot built with many interesting issues, such as the speed and power consumption, is implemented and discussed in this study.
Pisith Hengjinda received his B.S. and M.S. degrees in electrical engineering from King Mongkut's University of Technology Thonburi (KMUTT), Thailand, in 2012 and 2014, respectively. He is currently pursuing a Ph.D. degree in the Department of Electrical Engineering at Da-Yeh University (DYU), Taiwan. He has been a lecturer at Phetchaburi Rajabhat University (PBRU), Thailand. His research interests are in AI technologies, robotics, microcontrollers, and sensors.