Sistem Deteksi Hama Tanaman Bawang Merah Menggunakan Algoritma K-Means Clustering - Muhammad Reza Fahlevi; Dini Ridha Dwiki Putri; Rahmad Doni; Elvin Syahrin; Miftahul Mardiayah (Politeknik Kampar, 2025)
Farmers often have difficulty detecting pest attacks on shallots early due to limited experience and the use of manual methods that tend to be subjective. To address this issue, this study aims to develop an Android application that can detect pest attacks quickly and accurately using the K-Means Clustering algorithm. This algorithm analyzes five main plant symptoms: leaf color, leaf shape, soil moisture, leaf spots, and plant growth. The research method includes several stages, namely system requirements analysis, application design, implementation using the Java programming language and SQLite database, and testing with a black-box testing approach to ensure application functionality. In the classification process, user data is converted into numeric vectors and the distance is calculated using the Euclidean formula to three cluster centroids: Pest Free, Alert, and Pest Attacked. The application then displays the classification results directly and stores the detection history using RecyclerView. Based on manual calculations of the test data, the centroid of the “Alert” cluster shows the closest distance of 10.10 in the first iteration and gets closer to 5.05 in the second iteration after the centroid is updated. Test results show that the application can accurately classify plant conditions based on symptoms, effectively store and display detection history, and provide an easy-to-use interface that can function offline. Therefore, this application can be a useful tool for farmers in detecting pest attacks on shallots.