K-Nearest Neighbor Algorithm for Intelligent Monitoring and Control System Integration in Renewable Energy Applications

Authors

DOI:

https://doi.org/10.31961/eltikom.v9i2.1565

Keywords:

biogas monitoring, IoT, k-nearest neighbor, methane prediction, predictive control

Abstract

A real-time biogas monitoring and control system was developed by integrating the K-Nearest Neighbor (KNN) algorithm into an IoT-based framework for methane pressure prediction and automated control. The system uses an ESP32 microcontroller connected to temperature, gas, and pressure sensors (DHT22, MQ-4, MPX5700) to continuously collect data, with cloud connectivity provided through Firebase and Blynk platforms. The predictive model operates within a live feedback loop, allowing immediate actuation based on forecasted methane conditions. With an optimal parameter of k=4, the KNN model achieved 93.33% accuracy, supported by a mean absolute error (MAE) of 0.18 and a root mean square error (RMSE) of 0.21. A comparative evaluation with Random Forest and Gradient Boosting algorithms showed that, although these models yielded slightly higher accuracy, KNN provided superior computational effi-ciency for embedded deployment. The system maintained stable operation during tests involving sensor anomalies, network interruptions, and data noise. However, redundancy mechanisms and improved vali-dation strategies are recommended to enhance robustness. The findings demonstrate that methane pro-duction can be effectively predicted using temperature and pressure data, with further accuracy im-provements possible through additional process variables such as pH and fermentation age.

Downloads

Download data is not yet available.

Author Biography

  • Mochammad Junus, State Polytechnic of Malang

    BIOGRAFI Statement Prof. Dr Mochammad Junus, ST,.M.T

    https://orcid.org/0000-0002-4607-8730.

    BIOGRAPHY Prof. Dr Mochammad Junus

    Mochammad Junus is a Professor of Environmental Science, majoring in Renewable Energy Utilization at the State Polytechnic of Malang. He holds a doctorate (Dr) in Environmental Science, Renewable Energy Utilization.

    Latest PUBLICATIONS:

    1. Solar Panel Performance Monitoring Using WSN in State Polytechnic of Malang 2020..
    2. WSN For Energy Monitoring Based on Hybrid Power Plants AH Buildings 2021.
    3. Technoeconomic Study of Hybrid Energy Systems for Use in Public Buildings in Malang, Indonesia 2021.
    4. In Malang, Indonesia, a techno-economic analysis of hybrid energy systems in public buildings 2022.
    5. Modeling, Simulation, and Enhancement of Hybrid Renewable Energy Systems for Purification Utilization 2023.
    6. System Design Renewable Energy using Applications Bright Energy Solar Meter Panel Based on the IoT 2024.
    7. IoT enabled landfill gas pollution monitoring 2025.
    8. Development of a Pollutant Monitoring System at a Final Processing Place Based on IoT.

    Latest RESEARCH :

    1. EcoBin: Smart Waste Management System Based on Artificial Intelligence of Things (A-IoT)
    2. Design & implementation of gas, temperature monitoring system for waste management at TPS With Machine Learning based on internet of things.
    3. Implementation of Non-Invasive Cholesterol & Hypertension Level Detection Using BPW34, MPX5050GP Sensors With Android-Based Application Program
    4. Innovation of Production System & Business Behavior to Penetrate National Market
    5. Commercialization of Robotics Education Module through Development of Early Childhood Robotics Learning
    6. Design of Renewable Energy System & Implementation of Smart Energy Meter Application Using Solar Panels Based on Internet Of Things.
    7. Application of Fuzzy Logic for Roasting Maturity Determining System and Coffee Grinding Machine Based on IoT
    8. Creation of Energy Saving Management Prototype System Between Solar Cell & Windmill Based on Wireless Sensor Network at Malang State Polytechnic
    9. Temperature Humidity Control System, Water Content and Light Intensity on BSF Maggot Growth Media Based on IOT
    10. Implementation of Wireless Sensor Network for windmill monitoring at Malang State Polytechnic
    11. Monitoring solar panel efficiency using WSN at Malang State Polytechnic

    Reviewing Interest :

    Renewable Energy; Environmental Engineering; Solid Waste Management; Air Polution; Environmental Monitoring; Climate Change In The Environment; Waste Water Treatment; Noise Polution; Internet of Things (IoT); Artificial Intelligent (Ai)

References

[1] M. Wahyu Kurniawati, A. Nur Rizkia Putri, and C. Firdaus Ivana, “Pemanfaatan limbah sayur dan kotoran sapi sebagai sumber energi terbarukan vegetable waste and cow dung utilization as a renewable energy source.” [Online]. Available: https://ejournal.pnc.ac.id/index.php/jppl

[2] A. Putri, M. G. Gumay, and A. Pemanfaatan, “Konferensi Nasional Sistem Informasi 2018 STMIK Atma Luhur Pangkalpinang,” 2018.

[3] A. Amalia et al., “Prediksi kualitas udara menggunakan algoritma k-nearest neighbor.” [Online]. Available: https://data.jakarta.go.id/.

[4] Zhang, Y., Li, Y., & Wang, X. (2020). Application of K-Nearest Neighbors Algorithm in Biogas Prediction. Renewable Energy, 145, 1234-1240. DOI: 10.1016/j.renene.2019.06.015.

[5] M. Junus, D. F. Putradi, F. A. Soelistianto, M. A. Anshori, and R. Ardiansyah, “Internet of things enabled landfill pollution gas monitoring,” Indonesian Journal of Electrical Engineering and Computer Science, vol. 37, no. 1, pp. 48–55, Jan. 2025, doi: 10.11591/ijeecs.v37.i1.pp48-55.

[6] R. Nurfarida Mukti, A. Salsabilla, A. Salsabila Muamar, E. Cahya Prima, and M. Nurul Hana, “Biogas effectiveness test from household waste (vegetable waste) with cow dung starter and em4 indonesian journal of multidiciplinary research,” Indonesian Journal of Multidiciplinary Research, vol. 1, no. 1, pp. 73–78, 2021, doi: 10.17509/xxxx.vxix.

[7] H. Setyawati, S. A. Sari, D. Nathania, and N. Zahwa, “The effect of variations of vegetable solid waste types (cabbage, mustard, lettuce) and em4 levels on composting with fermentation process.”

[8] Medilla Kusriyanto, “Rancang bangun kendali suhu dan tekanan pada ekstraktor soxhlet terintegrasi pembatas waktu ekstraksi menggunakan mikrokontroller atmega 16,” Journal of Islamic University of Indonesia, vol. Vol.19, No.1, 2013, doi: https://doi.org/10.20885/.v19i1.4408.

[9] Y. Zaky Jacoeb, R. Yasirandi, and M. M. Qusyairi, “Implementasi teknologi dan proses produksi biogas sebagai pengendalian limbah di area RRA,” e-Proceeding of Engineering, vol. Vol.12, No.1, Feb. 2025.

[10] . S., “Sistem kendali dan monitoring kelembapan, suhu, dan ph pada proses dekomposisi pupuk kompos dengan kendali logika fuzzy,” Telekontran : Jurnal Ilmiah Telekomunikasi, Kendali dan Elektronika Terapan, vol. 8, no. 2, pp. 154–164, Apr. 2021, doi: 10.34010/telekontran.v8i2.4710.

[11] K. Diantoro, R. Rahmadewi, J. Teknik Elektro Universitas Singaperbangsa Karawang, and K. H. Jl Ronggowaluyo Telukjambe Timur -Karawang, “Implementasi sensor MQ 4 dan sensor DHT 22 pada sistem kompos pintar berbasis IoT (SIKOMPI).”

[12] R. E. Putri, I. P. Maharani, and I. Putri, “Real-time monitoring system for temperature, humidity, and ph for composting process,” Jurnal Teknik Pertanian Lampung (Journal of Agricultural Engineering), vol. 14, no. 2, p. 380, Mar. 2025, doi: 10.23960/jtep-l.v14i2.380-390.

[13] M. Junus, S. Wahyudi, and C. Author, “Technoeconomic study of hybrid energy systems for use in public buildings in Malang, Indonesia,” 2021.

[14] R. F. Karunia Dewi, Obert, and R. Gusmana, “Implementasi metode K-Nearest Neighbor (KNN) dalam pengelompokan status ekonomi warga,” Journal of Big Data Analytic and Artificial Intelligence, vol. Vol. 4, No. 1, 2018.

[15] M. M. Baharuddin, H. Azis, and T. Hasanuddin, “Analisis performa metode k-nearest neighbor untuk identifikasi jenis kaca,” ILKOM Jurnal Ilmiah, vol. 11, no. 3, pp. 269–274, Dec. 2019, doi: 10.33096/ilkom.v11i3.489.269-274.

[16] E. Purnama Dewi, J. Sumarsono, and I. Gusti Made Kompyang, “Pengembangan akuisisi data pada sistem pemantauan biogas berbasis IoT development of data acquisition biogas monitoring system based on IoT,” vol. 11, no. 1, p. 2024.

[17] B. R. Japutra, S. A. C. Luthfi, B. Handoko, and M. Rayhan, “Pemanfaatan kotoran ternak dengan penambahan limbah pasar sebagai energi alternatif untuk pembangkit listrik tenaga biogas di desa Sibrama Kabupaten Banyumas,” Jurnal Abdi Masyarakat Indonesia, vol. 4, no. 4, pp. 769–776, Jun. 2024, doi: 10.54082/jamsi.1169.

[18] A. A. Nur Rohman, R. Hidayat, and F. Rizky Ramadhan, “Pemrograman mesin smart bartender menggunakan software arduino ide berbasis microcontroller ATmega2560,” Prosiding Seminar Nasional Teknik Elektro, 2021.

[19] M. Mungkin, H. Satria, J. Yanti, and G. A. Boni Turnip, “Perancangan sistem pemantauan panel surya polycrystalline menggunakan teknologi web firebase berbasis iot polycrystalline solar panel monitoring system design using iot-based firebase web technology,” Journal of Information Technology and Computer Science (INTECOMS), vol. 3, no. 2, 2020.

[20] A. Refalista et al., “Pengunaan sensor MQ-2,4,7,135 dan ESP32 untuk air pollution monitoring berbasis internet of things,” Jurnal TICOM: Technology of Information and Communication, vol. 12, no. 1, 2023.

[21] L. Nurdini, R. D. Amanah, and A. N. Utami, “Prosiding seminar nasional teknik kimia ‘kejuangan’ pengolahan limbah sayur kol menjadi pupuk kompos dengan metode takakura”.

[22] O. K. Wardani, R. T. W. Broto, F. Arifan, J. P. Sudarto, K. Semarang, and J. Tengah, “Pembuatan mikroorganisme lokal berbasis limbah organik sebagai aktivator kompos di desa sikunang, kecamatan kejajar, kabupaten wonosobo,” Oktober, 2021.

[23] M. Junus, Marjono, Aulanni’am, and S. Wahyudi, “Modelling, simulation, and enhancement of hybrid renewable energy systems for purification utilization,” International Energy Journal 23 (June 2023) 71 – 82, 2023.

[24] A. Z. M. Badruddin, M. A. Al-Ghamdi, and F. N. Ani, “Application of K-nearest neighbors (KNN) machine learning for prediction of biogas production,” Bioresource Technology, vol. 390, p. 129708, Apr. 2024, doi: 10.1016/j.biortech.2024.129708.

[25] P. S. Arul et al., “Low-cost methane and hydrogen gas sensor system for safety monitoring in industrial environments,” Sensors and Actuators Reports, vol. 2, no. 1, p. 100032, Mar. 2020, doi: 10.1016/j.snr.2020.100032.

[26] M. Rajasekar, A. Kumaravel, and N. Nallusamy, “Design and implementation of an IoT based low-cost portable biogas analyzer,” Renewable Energy, vol. 138, pp. 460–469, Aug. 2019, doi: 10.1016/j.renene.2019.01.099.

[27] T. Hastie, R. Tibshirani, and J. Friedman, The Elements of Statistical Learning: Data Mining, Inference, and Prediction, 2nd ed. New York: Springer, 2009.

[28] L. Breiman, “Random forests,” Machine Learning, vol. 45, no. 1, pp. 5–32, 2001, doi: 10.1023/A:1010933404324.

[29] J. H. Friedman, “Greedy function approximation: A gradient boosting machine,” Annals of Statistics, vol. 29, no. 5, pp. 1189–1232, 2001, doi: 10.1214/aos/1013203451.

[30] J. Demšar, “Statistical comparisons of classifiers over multiple data sets,” Journal of Machine Learning Research, vol. 7, pp. 1–30, Jan. 2006.

[31] A. M. Arifin, S. P. Putra, and T. W. Wibowo, “Comparison of machine learning algorithms for prediction of methane gas production in anaerobic digestion,” International Journal of Renewable Energy Development, vol. 11, no. 2, pp. 389–399, 2022, doi: 10.14710/ijred.2022.42945.

[32] Z. Wang, Y. Zhang, L. Yang, and H. Chen, “Methane production from anaerobic digestion of food waste: A review focusing on the role of pH and microbial community,” Bioresource Technology, vol. 341, p. 125795, 2021, doi: 10.1016/j.biortech.2021.125795.

[33] J. Zhang, H. Chen, Q. Huang, and D. Chen, “Effect of pH control on anaerobic digestion of kitchen waste for biogas production,” International Biodeterioration & Biodegradation, vol. 105, pp. 153–159, 2015, doi: 10.1016/j.ibiod.2015.09.010.

[34] A. K. Singh and D. K. Tiwari, “Impact of operational parameters on biogas production from biomass: A review,” Energy Sources, Part A: Recovery, Utilization, and Environmental Effects, vol. 43, no. 4, pp. 463–481, 2021, doi: 10.1080/15567036.2019.1618984.

[35] H. Kumar, S. K. Sharma, and R. S. Dhillon, “Internet of Things (IoT) based smart biogas plant monitoring and controlling system,” Materials Today: Proceedings, vol. 49, pp. 276–281, 2022, doi: 10.1016/j.matpr.2021.07.168.

[36] S. K. Raut, M. M. Rahman, and M. M. Hassan, “IoT-based methane gas detection and automatic control system for biogas plants,” Sensors, vol. 21, no. 12, p. 4201, 2021, doi: 10.3390/s21124201.

[37] S. Mandal, S. Dutta, and P. Banerjee, “Low-Cost IoT-Based Biogas Plant Monitoring System,” International Journal of Renewable Energy Research, vol. 12, no. 3, pp. 1158–1167, 2022.

[38] M. Ahmad, A. Latif, and R. M. Noor, “Economic Analysis of Biogas Production for Rural Electrification,” Renewable Energy, vol. 182, pp. 456–466, 2022.

[39] B. P. Singh and P. Kumar, “Performance Evaluation of Biogas Plants Under Different Feedstocks and Environmental Conditions,” Energy for Sustainable Development, vol. 65, pp. 12–21, 2021.

[40] Y. Zhang, L. Wang, and X. Li, “Adaptive Machine Learning Models for Environmental Prediction in IoT Systems,” IEEE Internet of Things Journal, vol. 9, no. 15, pp. 13827–13837, 2022.

Downloads

Published

22-12-2025

Issue

Section

Articles

How to Cite

[1]
2025. K-Nearest Neighbor Algorithm for Intelligent Monitoring and Control System Integration in Renewable Energy Applications. Jurnal ELTIKOM : Jurnal Teknik Elektro, Teknologi Informasi dan Komputer. 9, 2 (Dec. 2025), 157–175. DOI:https://doi.org/10.31961/eltikom.v9i2.1565.

Similar Articles

1-10 of 45

You may also start an advanced similarity search for this article.