Analysis of Fuzzy Logic Algorithms in Water Quality Control

Authors

  • Darma Agung STMIK KAPUTAMA BINJAI
  • Milli Alfhi Syari STMIK KAPUTAMA
  • Rusmin Saragih STMIK KAPUTAMA

DOI:

https://doi.org/10.59934/jaiea.v6i1.2986

Keywords:

Algorithm Analysis, Mamdani Fuzzy Logic, Water Quality Control, ESP32, pH Sensor 4502C, DS18B20 Sensor, Water Quality Index (WQI)

Abstract

Water is a vital natural resource for human life and other living organisms. However, fluctuations in water quality parameters such as acidity (pH) and temperature affect usability, necessitating an efficient monitoring and control system. This study aims to analyze the performance of the Fuzzy Logic algorithm in controlling water quality parameters based on a NodeMCU ESP32 microcontroller, as well as to evaluate the accuracy and response of the control system. The hardware setup includes a pH 4502C sensor and a DS18B20 temperature sensor as parameter inputs, alongside a 16x2 LCD with an I2C interface to display real-time measurement results. The fuzzy logic implementation utilizes the Mamdani method through four primary stages: fuzzification of pH (Acidic, Neutral, Alkaline) and temperature (Cold, Normal, Warm) inputs, construction of a 3x3 IF-THEN rule base, Max-Min inference method, and defuzzification via the Centroid method to yield a Water Quality Index (WQI) score ranging from 0 to 100. The analysis and test results demonstrate that the Fuzzy Logic algorithm successfully controls and determines water quality status with high reliability, consistency, and responsiveness to environmental changes. Sensor testing showed low error rates, with a pH error of 0.09 on drinking water and a temperature error of approximately ±0.06°C. Comparative verification between the microcontroller system output and manual Mamdani calculations confirms consistent classification decisions (Fair category with a WQI score of 49 on the device and 55.0 manually). Consequently, the Fuzzy Logic algorithm is proven to perform accurately, reliably, and adaptively for water quality control applications.

Downloads

Download data is not yet available.

References

A. Khaidar, M. Arhami, and M. Abdi, “Application of the Random Forest Method for UKT Classification,” J. AI Softw. Eng., vol. 4, no. 2, pp. 94–103, 2024.

G. M. Jatoi et al., “Water quality monitoring in agriculture: Applications, challenges and future prospectus,” J. Appl. Eng. Technol., vol. 7, no. 2, pp. 46–54, 2023.

M. Jafari, E. Asadi, and A. Fakheri Fard, “Operational management of water quality in hydroponic cultivation,” Water Supply, vol. 24, no. 9, p. 3046, 2024.

D. Aztisyah, T. Yuniati, and Y. A. Setyoko, “Implementasi logika fuzzy Mamdani pada pH air aquascape,” J. INISTA, vol. 4, no. 1, pp. 59–70, 2021

M. A. Hikmah and M. Misbah, “Sistem kontrol kualitas air berbasis fuzzy logic pada kolam bandeng,” J. Tek. Elektro, vol. 17, no. 1, pp. 6–10, 2024.

Y. N. Kristiantya, E. Setiawan, and B. H. Prasetio, “Sistem kontrol kualitas air kolam ikan tawar menggunakan logika fuzzy,” J-PTIIK, vol. 6, no. 7, pp. 3145–3154, 2022.

I. Elriyan et al., “Fuzzy Mamdani sebagai sistem pendukung keputusan kelayakan air minum,” J. Pengemb. Teknol. Inf., vol. 9, no. 1, 2025.

M. N. Novian, M. Walid, and M. Makruf, “Monitoring tingkat pencemaran air sungai berbasis IoT,” J. Sist. Komput. Kecerdasan Buatan, vol. 7, no. 3, 2024.

B. Siswoyo and N. A. P. Utomo, “Pemanfaatan Machine Learning untuk Klasifikasi Sentimen,” J. Teknol. Inf. Digit., vol. 1, no. 1, pp. 29–34, 2025

I. W. Suasnawa and I. G. N. B. Caturbawa, “Penerapan Machine Learning untuk Analisis Sentimen,” Ganapati, vol. 3, no. 1, pp. 36–40, 2025.

Z. Xi, F. Zhuang, G. Zhou, X. Cheng, F. Lin, and Q. He, “Domain Adaptation with Category Attention Network for Deep Sentiment Analysis,” arXiv preprint arXiv:2112.15290, Dec. 2021.

C. N. Dang, “Hybrid Deep Learning Models for Sentiment Analysis,” Complex Intell. Syst., vol. 7, pp. 1713–1723, 2021.

I. Priyadarshini et al., “A novel LSTM–CNN–grid search-based deep neural network model,” IEEE Access, vol. 9, pp. 106907–106917, 2021.

A. Alhadlaq and A. Altheneyan, “A new hybrid deep learning approach for aspect-based sentiment analysis,” PeerJ Comput. Sci., vol. 10, p. e2267, 2024.

Downloads

Published

2026-10-15

How to Cite

Darma Agung, Milli Alfhi Syari, & Rusmin Saragih. (2026). Analysis of Fuzzy Logic Algorithms in Water Quality Control. Journal of Artificial Intelligence and Engineering Applications (JAIEA), 6(1), 1389–1392. https://doi.org/10.59934/jaiea.v6i1.2986