Air Quality Classification Using the K-Nearest Neighbors Algorithm: A Case Study in Juwana District

Authors

  • Tanzila Bagus Ramadhan Universitas Negeri Yogyakarta, Indonesia
  • Dessy Irmawati Universitas Negeri Yogyakarta, Indonesia

DOI:

https://doi.org/10.21831/jraee.v4i1.2553

Keywords:

Air Quality Detector, K-Nearest Neighbors, Internet of Things, Graphical User Interface, Engineering Design Process

Abstract

Air quality is an important factor in maintaining human health and environmental sustainability. Increasing transportation activity in Pati Regency contributes to higher air-pollutant emissions. This study develops a real-time air-quality monitoring and classification system using the K-Nearest Neighbors (KNN) algorithm. The system uses MQ-7, MQ-135, and SDS011 sensors to measure CO, CO₂, PM2.5, and PM10 concentrations. Measurement data are transmitted to Firebase Realtime Database and classified through a graphical user interface using Euclidean distance. Experimental results show that the system achieves 83% accuracy, 85% precision, 83% recall, and an F1-score of 82%. These results indicate that the proposed system can provide reliable real-time air-quality information for environmental monitoring applications.

Downloads

Download data is not yet available.

References

[1] World Health Organization, WHO Global Air Quality Guidelines: Particulate Matter (PM2.5 and PM10), Ozone, Nitrogen Dioxide, Sulfur Dioxide and Carbon Monoxide. Geneva: World Health Organization, 2021.

[2] Badan Meteorologi, Klimatologi, dan Geofisika (BMKG), “Laporan Kualitas Udara Indonesia,” 2025.

[3] Badan Pusat Statistik Kabupaten Pati, “Kabupaten Pati dalam Angka 2022,” Badan Pusat Statistik Kabupaten Pati, 2022.

[4] Badan Pusat Statistik Provinsi Jawa Tengah, “Jumlah Kendaraan pada Kabupaten Pati dalam Angka 2021,” Badan Pusat Statistik Provinsi Jawa Tengah, 2021.

[5] R. K. Halder, M. N. Uddin, M. A. Uddin, S. Aryal, and A. Khraisat, “Enhancing K-Nearest Neighbor Algorithm: A Comprehensive Review and Performance Analysis of Modifications,” Journal of Big Data, vol. 11, no. 1, Art. no. 113, 2024, doi: 10.1186/s40537-024-00973-y.

[6] Z. Ahmad and S. Hussain, “Real-Time Monitoring of Air Pollution Using IoT and Machine Learning,” Journal of Environmental Informatics, vol. 10, no. 1, pp. 15–28, 2024.

[7] L. Atzori, A. Iera, and G. Morabito, “The Internet of Things: A Survey,” Computer Networks, vol. 54, no. 15, pp. 2787–2805, 2010, doi: 10.1016/j.comnet.2010.05.010.

[8] S. N. Aini, D. N. Munahefi, A. S. Pramasdyahsari, and R. D. Setyowati, “Engineering Design Process STEM: Projek Miniatur Gazebo Joglo,” in PRISMA, Prosiding Seminar Nasional Matematika, 2024, pp. 37–43.

[9] H.-Y. Liu, P. Schneider, R. Haugen, and M. Vogt, “Performance Assessment of a Low-Cost PM2.5 Sensor for a near Four-Month Period in Oslo, Norway,” Atmosphere, vol. 10, no. 2, Art. no. 41, 2019, doi: 10.3390/atmos10020041.

[10] D. Margaritis, C. Keramydas, I. Papachristos, and D. Lambropoulou, “Calibration of Low-Cost Gas Sensors for Air Quality Monitoring,” Aerosol and Air Quality Research, vol. 21, no. 11, Art. no. 210073, 2021, doi: 10.4209/aaqr.210073.

[11] M. Erik, F. Nurdiyanto, and R. Hidayat, “Aerosense Monitor: Integrasi Sensor DHT11 dan MQ135 untuk Pemantauan Kualitas Udara Berbasis Arduino Uno,” Jurnal Komputer dan Elektro Sains, vol. 2, no. 2, pp. 8–11, 2024.

[12] M. R. Siregar, D. Hartama, S. Solikhun, et al., “Optimizing the KNN Algorithm for Classifying Chronic Kidney Disease Using GridSearchCV,” JITK (Jurnal Ilmu Pengetahuan dan Teknologi Komputer), vol. 10, no. 3, pp. 680–689, 2025.

[13] A. Maulana, A. I. Purnamasari, and I. Ali, “Analisis Klasifikasi Indeks Kualitas Udara Kota di Indonesia Menggunakan Metode K-Nearest Neighbor dan Naïve Bayes,” JATI (Jurnal Mahasiswa Teknik Informatika), vol. 8, no. 1, pp. 215–222, 2024.

[14] P. Astuti, N. Nuris, et al., “Penerapan Algoritma KNN pada Analisis Sentimen Review Aplikasi Peduli Lindungi,” Computer Science (Co-Science), vol. 2, no. 2, pp. 137–142, 2022.

Downloads

Published

2026-08-31

How to Cite

Tanzila Bagus Ramadhan, & Dessy Irmawati. (2026). Air Quality Classification Using the K-Nearest Neighbors Algorithm: A Case Study in Juwana District. Journal of Robotics, Automation, and Electronics Engineering, 4(1), 250–259. https://doi.org/10.21831/jraee.v4i1.2553

Issue

Section

Articles

Citation Check

Similar Articles

1 2 3 > >> 

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