HOME  >  Research    
Forecasting water quality levels for community development

Introduction

The Problem: Salinity Intrusion in Bang Krachao Bang Krachao, an "artificial island" on the Chao Phraya River, is suffering from poor water quality that threatens local agriculture. The primary concern is salinity, caused by seawater flowing in from the Gulf of Thailand.

While the community has built 28 water gates to control inflow, the system remains flawed:

  • Manual Operation: Gates require operators to be present in person to open or close them.
  • Lack of Data: Operators have no real-time information to help them decide when to optimally close the gates to prevent salt damage.

The Solution: Proactive Management This project transitions manual water gate control to a proactive system using Time Series Forecasting (Nixtla) and Low-Cost IoT Sensing. This integration allows for real-time monitoring and early warnings, significantly mitigating agricultural losses.

Key Features

  • AI-Powered Forecasting: Uses historical data to predict salinity levels up to 7 days in advance, allowing operators to act before the salt arrives.
  • Low-Cost IoT Hardware: A device built around the ESP32 microcontroller featuring analog pH and electrical conductivity (salinity) sensors.
  • SoftAP Connectivity: The device hosts its own Wi-Fi network, allowing users to connect via a mobile phone to view data locally or sync it to the cloud (Google Sheets).
  • High-Frequency Data Analysis: The model was trained on a massive dataset of 4,044,065 hourly recordings from 10 monitoring stations (2014–2024).
  • Real-Time Alerts: Enables the community to "project the occurrence of salinity incursion events at least seven days before the event."

Fundamental Theory and Development

Deep Learning for Water Quality Deep learning offers faster, more reliable alternatives to traditional laboratory testing.

  • LSTMs (Long Short-Term Memory): These are suited for continuous sensor data, forecasting changes in pH or turbidity before they reach harmful levels.
  • CNNs (Convolutional Neural Networks): Can analyze patterns such as algal blooms or turbidity from satellite imagery.

The IoT Device Architecture The prototype was developed as a cost-effective "proof of concept":

  • ESP32 Board: Acts as the brain and Wi-Fi host.
  • EC (Electrical Conductivity) Sensor: Measures minerals in the water to determine salinity.
  • pH Sensor: Monitors the acidity/alkalinity of the water.
  • Voltage Divider: A critical safety feature that steps down the 5V pH sensor reading to a safe 3.3V for the ESP32 board.

Results and Performance

Forecast Accuracy Analysis Three models from the StatsForecast library were compared: AutoARIMA, AutoETS, and AutoTheta.

  • Top Performer: AutoARIMA outperformed the others in all measures, showing a superior ability to model temporary changes in salinity patterns.
  • Accuracy Metrics:
    • MAE (Mean Absolute Error): 1.26 ppt
    • RMSE (Root Mean Squared Error): 2.85 ppt
  • Observations: The model performs best in freshwater-dominated environments. However, uncertainty increases during high-salinity events (Heteroscedasticity).

Impact and Future Directions

Socioeconomic Benefits Research indicates that low-cost IoT systems can minimize crop losses by up to 30% through early identification of salinity. For Bang Krachao, this means greater agricultural stability and better community health.

Future Refinements:

  1. Handheld vs. Stationary: Future development will test battery life for a portable version and "strong housing to handle harsh weather" for fixed versions.
  2. External Variables: Accuracy can be further improved by adding external data such as rainfall, tides, and upstream flow data.
  3. Durability: Transitioning from a "working demo" to a ruggedized product for long-term real-world use in the river environment.

Project Advisor(s)

No items found.

Research Team member(s)

Uea-angkun Sriviriyalertkul
Undergraduate Student
Thanakit Jianwanalee
Undergraduate Student