Clear Sky Science · en
An Intelligent, low-cost water quality monitoring system with on-device machine learning and cloud integration
Why smarter water checks matter
Safe drinking water is something most people take for granted, yet pollution and aging infrastructure mean that what comes out of the tap is not always as clean as it looks. Traditional water tests often require sending samples to a distant laboratory and waiting a day or two for results—a dangerous delay if that water is already being used in homes, schools, or farms. This paper describes a low-cost, suitcase-sized system that can sit directly on a pipe or storage tank, continuously watch the water with simple sensors, and use built‑in artificial intelligence to decide in real time whether the water looks normal, diluted by rain, or tainted by harsh chemicals.

How a small box keeps watch on your tap
The heart of the system is a tiny but powerful microcontroller board called an ESP32, which acts like a stripped‑down computer. It is wired to four inexpensive sensors that measure basic properties of water: how acidic or alkaline it is (pH), how many dissolved salts and minerals it contains (total dissolved solids, or TDS), how clear it is (turbidity), and its temperature. Together, these readings provide a quick health check: for example, very cloudy water or an unusual jump in dissolved solids may hint at runoff from streets or a leak of cleaning fluids. The ESP32 collects hundreds of raw measurements each second, cleans up the noisy signals, and converts them into physically meaningful values that can be compared over time.
Bringing intelligence to the edge
Most existing “smart” water systems simply stream this sensor data to the internet and let distant servers decide what it means. That approach fails when the network is slow, expensive, or simply unavailable. In this work, the authors train a compact neural network—a form of machine learning model—so small that it fits in about 14.5 kilobytes of memory, then store it directly on the ESP32. Using 6,000 carefully collected examples from their own prototype (normal tap water, rainwater, and water spiked with household bleach to mimic chemical spills), the model learns patterns linking the four sensor readings to three categories: Normal, Rainwater Runoff, and Chemical Contaminant. Once trained, it can make a decision in roughly one thousandth of a second, with a reported accuracy of about 99 percent on their test data.
Saving power, storage, and response time
Because such systems may need to run for months in remote areas, the design focuses on frugality as much as on brains. Instead of saving every single second of data, the device can switch into a “fluctuation‑based” mode that writes information to a memory card only when the water readings actually change by more than normal sensor jitter. In a 24‑hour test, this cut the number of memory writes by more than 98 percent, which helps extend the card’s life and reduces power draw. At the same time, the ESP32 uses built‑in wireless networking to send snapshots of readings and model decisions to a cloud database, where a simple web and mobile dashboard shows live graphs and status indicators for remote users.

From insight to automatic safety
The system does more than simply label the water; it can act on those labels. The authors connect the ESP32 to a relay that controls a small pump feeding water from a tank to the rest of a system, such as a household line. When the on‑board model or basic safety thresholds suggest that the water is outside a user‑defined safe range, the controller immediately cuts power to the pump—without waiting for any signal from the cloud. A built‑in buffer, known as hysteresis, prevents the pump from rapidly switching on and off when readings hover near the limit. In a day‑long trial, the complete setup ran continuously without crashing, while sensor checks showed that its measurements were accurate enough for everyday monitoring.
What this means for everyday water safety
To a non‑specialist, the promise of this work is straightforward: for under eighty dollars in parts, it is now possible to build a compact “guardian” device that keeps constant watch over basic water quality and can shut off a supply in seconds if something looks suspicious. The current prototype is tuned to just a few kinds of contamination and uses hobby‑grade sensors that slowly drift and need periodic cleaning and recalibration, so it is not yet a full replacement for certified testing. But as the authors argue, combining low‑cost electronics with smart, on‑site learning models offers a powerful new layer of protection, especially for rural or low‑resource communities that cannot rely on fast lab work or rock‑solid internet connections to know whether their water is safe.
Citation: Sharma, S., Mishra, D., Yadav, A. et al. An Intelligent, low-cost water quality monitoring system with on-device machine learning and cloud integration. Sci Rep 16, 11106 (2026). https://doi.org/10.1038/s41598-026-37287-3
Keywords: water quality monitoring, IoT sensors, edge machine learning, TinyML, drinking water safety