THE USE OF IOT IN WATER UTILIZATION STRATEGIES FOR SMART IRRIGATION SYSTEMS BASED ON MACHINE LEARNING
Authors: Junaidi Junaidi 
Published: January 2025

Abstract: Water irrigation is a crucial aspect of agriculture that often becomes the primary concern for farmers, especially because suboptimal management can lead to decreased crop yields and reduced income. So far, farmers have been practicing irrigation manually, where plants are watered twice a day, in the morning and evening, based on weather conditions without considering soil temperature or moisture levels. Based on the observations conducted, it was found that excessive water application increases water accumulation, resulting in nutrient loss from the soil and even root diseases. The objective of this study is to develop a system utilizing an ESP32 microcontroller and sensors to detect soil moisture, with a machine learning-based K-Nearest Neighbor (KNN) model, enabling farmers to remotely monitor and control their crops using an Android device. The testing results showed that with input data of 32°C temperature, 40% soil moisture, and 60% air humidity, the system produced a nearest distance of 0.000 and 0.541 from the closest k-nearest neighbors, with a status label of "needs water." As a result, the relay activates the water pump to irrigate the field. Meanwhile, for data with a nearest distance of 0.897, the system identified the status as "does not need water," indicating that the soil remains wet or moist. This study is expected to help reduce farmers' workloads by optimizing water usage according to plant needs and improving crop quality and yield.        Keywords: k-nearest neighbor (KNN); mikrokontroller ESP32; machine learning; water irrigation Abstrak: Irigasi air merupakan aspek penting dalam pertanian yang menjadi perhatian utama petani, terutama karena pengelolaan yang kurang optimal berdampak pada penurunan hasil panen dan pendapatan. Selama ini, praktik irigasi oleh petani dilakukan secara manual, di mana penyiraman tanaman dilakukan dua kali sehari pada pagi dan sore berdasarkan kondisi cuaca tanpa memperhatikan suhu atau kelembaban tanah. Berdasarkan hasil observasi yang dilakukan, ditemukan masalah yaitu pemberian air secara berlebih menyebabkan akumulasi air meningkat mengakibatkan kehilangan nutrisi tanah dan bahkan penyakit akar. Tujuan penelitian ini menciptakan sistem yang dirancang menggunakan mikrokontroler ESP32 dan sensor untuk mendeteksi kelembaban tanah, dengan model K-Nearest Neighbor (KNN) berbasis machine learning sehingga memudahkan petani untuk mengontrol tanaman mereka dari jarak jauh menggunakan android. Hasil pengujian yang dilakukan dengan data inputan berupa suhu 32°C, kelembaban tanah 40% dan kelembaban udara 60%, sistem menghasilkan jarak terdekat sebesar 0.000 dan 0.541 dari k-nearest terdekat dengan label status "butuh air". Maka relay akan mengaktifkan pompa air untuk mengairi lahan. Kemudian, pada data dengan jarak terdekat 0.897, sistem mengidentifikasi status "tidak butuh air", menunjukkan bahwa kondisi tanah masih basah atau lembab. Penelitian ini diharapkan dapat membantu meringankan beban kerja petani mengoptimalkan penggunaan air sesuai dengan kebutuhan tanaman dan meningkatkan kualitas hasil panen.Kata kunci: irigasi air; k-nearest neighbor (KNN); mikrokontroller ESP32; machine learning