Application of the KNN method to check soil compatibility using a microcontroller for android-based banyuwangi citrus fruit plants

ABSTRACT


INTRODUCTION
Banyuwangi is a producer of citrus fruit which is classified as the largest contributor to the harvest in East Java [1].Besides being famous as a rice barn in East Java, Banyuwangi is currently also a center for orange production in East Java.Until now, the orange harvest area in Banyuwangi covers 3,695.34hectares.With orange production reaching 65,145.16tons.With an average productivity of oranges in Banyuwangi, 172.93 quintals per hectare [2].The achievement of citrus productivity in Banyuwangi is quite promising for citrus farmers.
And currently Banyuwangi district is one of the citrus centers in Indonesia that has implemented Bujangseta technology [3].It is hoped that all domestic citrus growers will apply this technology.Because with Bujangseta, oranges have premium quality with relatively low production costs.The Bujangseta Technology concept is that oranges can bear fruit all year round (off season) and produce uniform premium quality fruit, market-appropriate flavors (sweet and sour), smooth fruit skin at an adequate price [4], [5].
In planting citrus fruits what farmers need is to know the land or soil that will be used for planting, there have been discoveries to find out the color of a soil.The results of research [6] are that an E-Soil application can be used to assist farmers in identifying soil color on an Android-based basis that uses the Munsell Soil Color Chart and can be accessed on Google Play.soil color, latitude and longitude coordinates, detects soil color with the Munsell Soil Color Chart (MSCC) notation and integrates with the Spatial Information Web [7], [8].
Apart from the soil element, fertilization also affects the successful process of planting citrus fruits [9].The results of the analysis show that the fertilizer treatment based on soil analysis both with and without pruning was significantly different from other treatments at the level of confidence and produced the highest number of fruit, while the fertilizer treatment based on the yields transported produced the smallest number of fruit (33.75 and 69 fruit) .Meanwhile, the smallest fruit weight and diameter resulted from the application of farmer's fertilizer doses combined with pruning treatment [10], [11].
Apart from the color of the soil, the elements of fertilization and pruning, the things that need to be considered in planting citrus fruits, there are other things that a farmer can pay attention to, namely the elements of plant nutrition and evaluation of soil fertility in citrus plantations [12].The low status of soil fertility in citrus plantations at locations C2 and C3 is due to the limiting soil chemical properties, namely the low soil Corganic content.This is understandable because the presence of organic matter in the soil greatly influences the ability of the soil to maintain soil fertility and productivity through the activity of soil microorganisms in improving the physical, chemical and biological properties of the soil [13]- [15].Thus it can be said that soils with low organic matter content will reduce their buffering capacity against all chemical, physical and biological activities of the soil [16].
The development of smartphone technology is now starting to penetrate every aspect of modern life [17].With such high levels of access and utilization, there is currently a lot of potential for the development of smartphones as high-performance tools in several countries industry [18].Traditionally, smartphones have been used as an example of point-of-care testing devices in developing countries, now a similar approach could be extended to agriculture [19], [20].Today, many organizations are using this technology to create smart objects.IoT plays an important role in the development of society at an advanced level [21], [22].In this paper, we summarize IoT-based devices which are useful in agriculture and play a major role in helping users to know about crop cultivation.
Research [23], [24] stated that the increase in the number of application malware, the diversity in techniques, and the increase in damage.Therefore, it is very important to detect this software and improve user's mobile security.Static and dynamic analysis, behavior monitoring, machine learning methods are used to ensure security.In this study, the K-nearest neighbor (KNN) classifier, one of the machine learning methods, is used.Thus, it aims to detect malicious mobile software successfully and quickly.The KNN algorithm classifies by comparing unknown data points with similar training data points, measured by Euclidean distance [25]- [27] Attribute values are normalized to prevent attributes with a larger range from exceeding attributes with a smaller range [28]- [30].
For this research, researchers are trying to help in terms of checking the soil that will be planted with citrus fruits.In order for the land to be used optimally in planting citrus fruits, farmers must know the elements contained in the soil.Research applies the KNN method and utilizes a microcontroller for data input, by combining methods and microcontroller tools to assist the application process land [31], [32].

METHOD 2.1 Research Stages
In the research process, researchers carried out research stages with the first stage, namely data collection, designing input data, applying the KNN method, nutrient detection results, the research flow image is in Figure 1.

Tools and Ways
In this study a tool is needed to check agricultural land in the form of soil.The resistance that is checked is in the form of elemental content found in the soil including nitrogen, calcium, phosphorus, pH and soil moisture [33]- [35].So in this study to find out the contents of the elemental content in the soil an Androidbased application will be made using a microcontroller.The tools needed to create research results are : 1) For Android applications, an Android smart phone is required Microcontroller tool as the detection of elements in the soil.The workings of the microcontroller are based on the modules in this tool which will later process the search for soil nutrients based on the instructions in the module.In the module there are instructions that instruct steps and flowcharts for collecting soil nutrient data including nitrogen, calcium, phosphorus, pH and soil moisture.From the data that has been taken using Bluetooth will be sent to the android application [36].
2) Bluetooth is used to send data in the form of a signal on the microcontroller device to the android application [37], [38].
The method used in the series of system designs that will be created in this research is: a) The first stage activates the existing application on Android.b) Activate the function of the microcontroller tool.c) After the tool and application are active, then plug the microcontroller into the soil to check the soil nutrient content.d) Then the microcontroller device will send data via a Bluetooth signal to the Android application.e) The application then processes the data to produce output in the form of information.f) The information conveyed is in the form of resistant content elements that are checked.

Algorithm Design
In a system, of course there is a workflow that is carried out in it, on the microcontroller the workflow is according to the instructions in the module.The microcontroller workflow on the module can be described in a flowchart in Figure 2.An input can be in the form of data input through an input device, in the form of a barcode or signal.In this study the input used was in the form of a signal using Bluetooth, while the Bluetooth workflow in this study can be described by flowchat Figure 3.

Figure 3. Bluetooth workflow
Before making an application, the process that must be carried out is to prepare the algorithm first so that the application to be made can provide the expected results in the form of the desired output [39]- [41].The algorithm that we present is in the form of a flowchart because this presentation can be easily seen and understood.In this study, the algorithm design created is in Figure 4.

KNN Calculation
In the table below is a sample data sheet which I think is in accordance with the content data for citrus plants, and in the data in Determining attribute weights and proximity values the researcher provides an explanation of the function of the determining attributes, and the function of the proximity value of the soil sensor.Before looking for the percentage of similarity in soil content, normalization is carried out on the 5 criteria for citrus fruit soil content used in calculations using the KNN method [42], [43].For normalized values on the values of the elements nitrogen, calcium, phosphorus, PH and moisture resistance is done by dividing by 100 [44], [45] After the normalization process is carried out, the data in the master data and test data are carried out by the closeness process.Meanwhile, to find the percentage of closeness.For this study, the weight value was given a value of 1, the percentage calculation was carried out for 5 similarities in the soil content of citrus fruits in the datasheet.The example of the calculation in the trial of the first soil content in the datasheet and the calculation of the percentage of similarity with the KNN method.Calculation of the Proximity Percentage, namely (

Application Development Plan
In designing a software development system, a microcontroller device will be created that is used to retrieve soil nutrient data.This collection is done by plugging the tool into the soil, then the data collected includes the nutrients nitrogen, calcium, phosphorus, pH and soil moisture will be sent.By using a Bluetooth signal, the existing data will be sent to the Android application.In addition to making a microcontroller tool, this research also created an Android-based application to display data.This application will select existing data to produce information that will be presented to application users, namely citrus farmers and prospective citrus farmers.The information that will be conveyed from the android application is the nutrient content received from the microcontroller and whether this nutrient content is suitable for planting citrus fruits.The system design is in Figure 5.

RESULTS AND DISCUSSIONS
In this study a tool is needed to check an agricultural land in the form of soil.And the soil that is checked is in the form of elemental content found in the soil including nitrogen, calcium, phosphorus, pH and soil moisture.So in this study to find out the contents of the elemental content in the soil an Android-based application will be made using a microcontroller.The tools needed to create the results of this research are: a.For Android applications, a smartphone is needed in the form of an Android with a minimum of 2GB RAM.b.For the microcontroller tool as a detection of soil content elements, the series of data input devices that are made can later be seen in Figure 6.
Figure 6.Series of data input devices c.The workings of the microcontroller are based on the modules in the tool, which will process the search for soil nutrients based on the instructions in the module.In the module there are instructions that instruct steps and flowcharts for collecting soil nutrient data including nitrogen, calcium, phosphorus, pH and soil moisture.From the data that has been taken using Bluetooth will be sent to the android application.d.Bluetooth is used to send data in the form of a signal that is on the microcontroller device into the android application.e.The methods used in the series of system designs that will be created in this study are: 1) The first stage opens an existing application on Android.
2) Turn on the microcontroller.
3) After the tool and application are active then connect the Bluetooth Tool to the Smartphone after it is connected then plug the sensor device into the soil which will be checked for soil nutrient content, Then the microcontroller device will send data via Bluetooth signal to the android application.The next step is to prepare datasets for trials or testing, here the researcher uses a datasheet of 6 datasets as shown in table 2. The design of the index for implementing the KNN function in checking the suitability of soil nutrients in the dataset will consist of 6 datasets.In the table it is explained that the researcher uses an index to collect each data for soil nutrients, including elements of nitrogen, phosphorus, potassium, pH and soil moisture.If the value of the average index called is similar or close to the tested nitrogen, phosphorus, and calcium values, the classification application will display output according to the arrangement in the dataset.In the early stages of testing, all data input devices were activated and connected to each other and in the application the microcontroller was connected to Bluetooth.pH and Humidity sensors are plugged into the soil which will detect soil nutrient compatibility.After everything is connected, the sensor values will appear as pH and humidity values, while nitrogen, phosphorus and potassium values will be input manually.After all the input data is filled in, click the import dataset button, then click the classification results button to see the results.From the results of research conducted in [28] using the KNN algorithm in the classification process, it shows a significant improvement with the right choice of k parameters, using appropriate distance metrics, combining attribute weighting and pruning data containing points.From the results of checking the suitability of soil nutrients, it produces information about the suitability of the trial data with the dataset whether the soil can be planted with citrus fruits or not. Figure 7 shows the results of the classification according to the datasheet, so the command "results of classification can be planted" appears in the output.If the variable value is different from the dataset, the command "cannot be planted" appears in the output classification.

CONCLUSION
The results of the research that has been carried out produce an application to check soil nutrients by applying the KNN method and utilizing a microcontroller as an input device.The application of the KNN method to the soil nutrient check application can be produced with a suitability value of 89.6% through the trial stages produced with the existing dataset.With the Android-based soil nutrient compatibility application, it can help citrus fruit farmers to find out the nutrient content of the soil before planting citrus fruits.From the results of the research that has been carried out, researchers can conclude that the application of the KNN method can help in the process of detecting soil nutrients and the microcontroller tool can help with the automatic data input process.In future research developments, it is necessary to add automatic NPK input and apply new methods to increase the accuracy of detection results.

Figure 5 .
Figure 5. Application development design

Figure 7 .
Figure 7. Display of soil nutrient compatibility applications

Table 1 .
Soil normalization values of citrus soil content

Table 2 .
Design Index for the Implementation of KNN Functions