DECISION TREE METHOD FOR AUTOMATION OF PLANT SPRINKLERS AND MONITORING BASED ON SOIL MOISTURE

Watering the plants is an important part of plant care, but due to our busy schedules, we frequently forget to do it. It can be caused by a number of variables, including the weather, in addition to human irresponsibility. The goal of this research is to apply the Decision Tree method to automatic plant sprinklers and plant monitoring based on soil moisture. The decision tree method for determining the action of the microcontroller is to turn the pump on or off to water plants based on soil moisture. Using the C 4.5 algorithm, determine microcontroller action to find values from the data set used in this study. Automatic sprinklers using NodeMCU, ESP8266, and Telegram bots The tools used to design and create this tool are the Arduino IDE, Fritzing, and VS Code. It also uses the Telegram universal bot library to configure Telegram bots. The configuration of the telegram bot uses the universal telegram bot library, The configuration of the telegram bot uses the universal telegram bot library, while the website configuration for plant monitoring uses the native PHP language. The results obtained on automatic plant sprinklers are based on soil moisture values; namely, the relay on the microcontroller turns on the water pump when the soil moisture level touches a value of less than 50%. Then the water pump will stop when the soil moisture value exceeds 75%. In addition, the results of this study are in the form of websites and telegram bots for monitoring soil moisture values.


INTRODUCTION
Other than planting fertilizer, taking care of plants. Watering the plant's soil is an additional factor that should be taken into account. The limits of humans as forgetful beings, often even unconscious while humans themselves are caring for their plants, come into play frequently. Due to the busyness of other things, watering plants is a minor task that is frequently overlooked. In addition to being brought on by human error, there are other possible causes. One of them is the weather, which has an impact on how we grow plants.
Technological advancement is one of the things that must be followed in their development. For example, activities that are usually carried out by humans have been replaced by the existence of robotic technology. In addition, there is a science called "artificial intelligence" (AI), where this AI technology can be made to have humanlike logic. [1], [2].
Automatic sprinklers are needed to overcome the obstacle of forgetting to water plants. The use of microcontrollers to make plant sprinkler automation tools, where the process to detect soil moisture levels uses a soil moisture sensor [3], [4], Soil moisture can also be detected using IoT-based telegram bots [5], [6].
The plants used for research are tonguein-law plants (Sansiviera) in potted planting media. Sansiviera is one type of ornamental plant that is quite popular among ornamental plant lovers and is a plant that is familiar to Indonesian society. This plant is known by the people of Indonesia by the name "tongue-in-law," and it has many fans in Indonesia and around the world. Sansiviera is known to be able to absorb air pollution and eliminate radiation from the surrounding environment. Sansivieria ornamental plants are widely used as indoor freshening plants, which is not surprising. [7] The creation of this automatic sprinkler uses the decision tree method for configuration on the microcontroller. Based on soil moisture sensors, a microcontroller is programmed to automatically control plant watering [8]. The Decision Tree method is a flowchart in the form of a tree structure, where each branch represents the results of the test attributes and the leaf node represents certain classes. [9], [10], [11].
Research [12] on the decision tree algorithm on an Internet of Things-based automated plant sprinkler system In this study, Firman used elephant grass plants as the object of his research and used the decision tree method to get a decision on the value given by the soil moisture sensor. The variable used was soil moisture.
This automatic plant sprinkler is based on soil moisture values using the NodemCu ESP8266 microcontroller, microcontroller configuration using decision trees, monitoring soil moisture values via websites, and telegram bots.

METHODS
Data collection occurs through direct observation of plants, especially soil moisture values, and literature studies. The plant used in the trial was the tongue-in-law plant on potted planting media.
System analysis using cases, sequence diagrams, and activity diagrams. The decisiontree method uses the C4.5 algorithm for decisiontree leaf determination. C4.5 algorithm to simplify the data set, looking for entropy values and gains from two attributes, namely minimum humidity and maximum humidity. Look up the entropy and gain values [13], [14] using the following formula Decision trees are made based on the results of the entropy and an information gain calculation process. Figure 1 shows a flowchart of how the automatic crop sprinkler works.
Testing carried out on tools is sensor and relay testing, while functional testing using black boxes is carried out on the web and with messaging bots.

Calculation of the C 4.5 algorithm
This calculation case study uses 12 tongue-in-law plants with minimal humidity and different maximum humidity, such as the dataset in Table 1. The data was obtained through interviews with several flower shop owners and some friends who grow tongue-in-law plants. The data used includes how many times to water, how much water is used, and the minimum and maximum watering times. Based on the data in Table 1, next determine the value of entropy using formula (1) and gain using formula (2). In Table 2, it is the result of calculating the gain value at minimal humidity, which has a higher value, and then the attribute becomes a root when applying the decision tree method later. If there are other attributes, the next calculation will be performed for the case where the humidity value is less than 50.  (2)   As per Table 4, it can be concluded that a value less than or equal to 75 has a watered caption, while at a value greater than 75 it has an unwatered caption. From tables 2 and 4 above, root, branch, and leaf have been obtained. Then it will subsequently be applied to the creation of a decision tree.

Application of the Decision Tree Method
This decision tree method is used as a representation of the calculation of the C4.5 algorithm. In this method, the results of the C4.5 calculation will be changed into the form of a decision tree. As for the structure of the decision tree, it can be seen in figure 3.

. Decision Tree Results
From figure 4 above, it can be concluded that the initial humidity or minimum humidity, if the value is less than or equal to 50 then the plant will be watered, and when it gets a minimum humidity value greater than 50 it will continue as the max humidity value. If the maximum moisture value is less than or equal to 75, the plant will be watered, and when the maximum moisture value is greater than 75, it will stop watering.

Use Case Diagram
In this study, the author uses a use-case diagram to analyze the system to be created. The use case can be seen in Figure 5. The automatic plant watering process depicted in Figure 5 above has a relationship with the process of determining the minimum and maximum levels of soil moisture, so a running input is needed, namely soil moisture sensor data. In addition, users can also send commands to telegram bots to water plants, and they can monitor ongoing humidity data (in real time) through telegram bots or websites. Figure 6. Activity Diagram Figure 6 shows how the prefix or start can be initiated from the soil moisture sensor, which is reading data when the tool is turned on, or from the telegram bot itself, which is entering commands from the previous program. And in the diagram, the microcontroller or tool reads the input provided by the sensor, and the microcontroller processes the decisions that have been made by applying the decision tree method to a case that has occurred.

Figure 7. Sequence Diagram
In Figure 7, there are six objects: telegram bots, soil humidity, soil moisture sensors, microcontrollers, water pumps, and websites. In this system, the first step that will be executed is the installation of soil moisture censor that will directly send byte-shaped data to the censors. .

Input
In Figure 8, this system is contained in the soil moisture sensor, which is input into the microcontroller, and the microcontroller will be uploaded to a database.

Output
The monitoring website is used to display data that has been uploaded by NodeMCU, and the data is stored in the database. On this monitoring website, a graph display of soil moisture values is also provided; this graph refers to the last 10 data points uploaded by NodeMCU ESP8266. The output produced on the web, as shown in Figure 9, in the form of a soil moisture sensor graph, can be used to monitor plants based on their humidity.  Figure 10 is the display of the Telegram chat application. In the chat box, there are several menus that can be used, such as: "/start","/ turn on the pump", "/turn off the pump", "/ceck".

System Testing
In testing, we are testing the automatic plant sprinklers and also the functionality on the monitoring website.

-Sensor test
This test was carried out by placing a soil moisture sensor on a planting medium, namely a pot, as shown in Figure 11. This soil moisture sensor test was carried out by placing the position of the moisture sensor on the soil in the pot of tongue-in-law plants.
The results of the data observations were successfully read on the serial monitor in the Arduino IDE application. Figure 11. Sensor Testing -Testing of uploading data to the database. This test uses a time range of approximately 2 seconds to receive values from the soil moisture sensor. After receiving data from the sensor, the microcontroller will upload the data on the website, and the value of the sensor data can also be displayed on the telegram bot with certain commands. After that, check the website for plant monitoring to see whether the data has been entered or not. When the data is successfully displayed on the website, such as in Figure 12, that means that the sensor is working properly. The 0% value is when the soil moisture sensor is being lifted or is not being placed on the planting media. In testing this relay and pump, we used a tub filled with water and an empty tub, likening the tub filled with water to wet or moist soil and the empty tub to dry soil. Testing relays used to turn on the pump, such as those in Figure 14, work well and can turn on the water pump when the soil moisture sensor has a value of less than 50%. The water pump will stop if the soil moisture sensor detects more than 75 feedings.
-Website monitoring testing In this test, the post data method will be used, which will be directly processed on datatables as well as graphic data. The test result is that the data was successfully uploaded, the tables and graphs on the display were also updated, the relay stopped flowing power, and the water pump was also turned off immediately.
-Testing telegram bots In testing this Telegram bot, using the Telegram application and also going to the bot account that has been created, write down the available commands. The result is that the microcontroller manages to get the message. and can also send a reply message; the microcontroller successfully reads the message and relays on or off.

CONCLUSION
From research using 12 tongue-in-law plants, it can be concluded that by applying the decision tree method to a microcontroller-based automatic plant sprinkler, it can be used as a means to be able to care for plants more easily.
Automatic plant sprinklers are based on soil moisture values, which will make the relay on the microcontroller turn on the water pump when the level of soil moisture touches a value of less than 50%. And the water pump will stop when the soil moisture value is greater than 75%.
Automatic plant sprinklers can be monitored via the web and telegram bots based on soil moisture values.