International Scientific Platform
Serving Researchers Since 2012

Smart Water Safety: An Integrated IoT Framework for Microplastic and Chemical Contamination Detection

DOI : https://doi.org/10.5281/zenodo.19950141
Download Full-Text PDF Cite this Publication

Text Only Version

Smart Water Safety: An Integrated IoT Framework for Microplastic and Chemical Contamination Detection

Mr. B. Lokesh

Department of Information Technology Mahatma Gandhi Institute of Technology Hyderabad, Telangana

D Ashrith Reddy

Department of Information Technology Mahatma Gandhi Institute of Technology Hyderabad, Telangana

Aruri Nikhil

Department of Information Technology Mahatma Gandhi Institute of Technology Hyderabad, Telangana

Abstract – Safe water is crucial for health and requires effective monitoring of not only chemical contaminants, but also emerging contaminants like microplastics. Existing IoT solutions that monitor pH, turbidity, and TDS (Total Dissolved Solids) to assess the quality of drinking water do not consider the presence of microplastics or combine the two detection methods.

Here, we propose an intelligent IoT-based water monitoring system that can assess chemical pollution for drinking water quality and microplastic contamination for overall water quality. The proposed system incorporates an ESP32-based microcontroller and pH, TDS, turbidity sensors, and optical microplastic detection mechanism.

The microplastic detection is achieved using a blue LED and a Light Dependent Resistor (LDR) at 90° angles, along with Nile Red dye-based fluorescence and light scattering. Model microplastics of size in the range of 500-1000 m made of Expanded Polystyrene (EPS) were used to test the system.

The sensor signals are converted into voltage signals, where microplastics are detected by voltage thresholds. A live web interface presents all metrics and a Water Quality Index (WQI), indicating water as safe, caution or unsafe. The system has a bigger picture of the safety of drinking water (chemicals) and pollution (microplastics).

Keywords Water Quality Monitoring, Microplastics Detection, ESP32, IoT, Optical Sensors, Nile Red Dye, LDR Sensor, Blue LED, Water Quality Index.

  1. Introduction

    Water Quality is important for the environment and human health. As more factories are built and plastic pollution increases, our water is becoming more contaminated. Microplastics are ending up in our rivers and lakes, and not only are they hiding, but they are also harming the environment and humans. It’s not simple or cheap to test the water. Typically you need to have a lab and some fancy gear, and to wait for results. But recently, we have new technology such as IoT devices and small computers that allow us to test water quality and at a lower price. However, they measure the basic things like pH (acidity) and cloudiness of water. They don’t detect microplastic materials. This research aims to solve this problem. It proposes a Smart Water Monitoring System that not only monitors the conventional water parameters but also detects microplastics via sensors and optical sensing. The whole system runs in real-time and sends updates to web

    dashboard, so that we can observe the changes as they occur. Controlled microplastic models like polystyrene particles are highly utilized in experimental studies, because their optical properties are well defined and they are highly reactive to fluorescent dyes such as Nile Red. Expanded polystyrene (EPS) particles were also utilized in this work as a model microplastic material to achieve reproducibility and consistency in detection. It is worth highlighting that, although chemical properties like pH, TDS and turbidity are important for determining the drinkability of water, microplastic detection is used in this system to indicate the overall contamination of water rather than its potability. This is because, in the experimental system, particles with sizes in the range of 500-1000 m are used, which are larger than microplastics found in the environment and are mainly used to validate the optical techniques used for detection.

  2. RELATED WORK

    Due to the blistering development of artificial intelligence and Recent progress in the Internet of Things(IoT), optical sensing and environmental monitoring has pushed forward intelligent systems for water quality analysis and detecting contamination. However, existing approaches mostly focus on either traditional water parameters (pH, turbidity, etc) or microplastics by itself. They do not have a framework which can integrate both of these approaches and provides both the solutions.

    IoT-based Water Quality Monitoring Systems: Several research has been done on. IoT has been extensively used to monitor water quality parameters including pH, turbidity and Total Dissolved Solids(TDS). Rao et al. [5] developed a water monitoring system based on ESP32 that can monitor multiple metrics and transmit data wirelessly. Similarly, Forhad et al. [6] proposed a real-time water quality monitoring system for water treatment plants with emphasis on scalability and continuous monitoring. Lakshmikantha et al. [7] developed a smart IoT system that uses multiple sensors to control water quality, and Singh and Walingo [9] demonstrated the use of wireless sensor networks at scale. Quanshah et al. [12] and Murti et al. [13] pushed this further by looking into cloud-based and long-range IoT systems, which can be monitored from further away and provide greater access to the information. These provide good real-time monitoring and scalability but they still only deal with

    conventional water quality parameters and not new challenges such as microplastics.

    Microplastics Detection Methods: With the growing environmental concerns, there has been a growing interest in microplastics detection. Sarkar et al. [3] developed an automated system which uses image processing and machine learning techniques to detect microplastics in water. This method is accurate, but needs high computational resources and controlled conditions. Colson and Michel [8] suggested using impedance spectroscopy to quantify microplastics in water. This is accurate, but costly and unsuitable for field measurements. Gugliandolo et al. [14] developed an inexpensive optical method, which is based on the transmission of light for microplastics detection. This makes the system cheaper and simpler than conventional spectroscopy and cost-effective, But the technique is not connected to IoT for data representation. Burgohain et al. [11] examined laser-based optical systems with advanced microscopy for detection. These are reliable, but expensive and lab-based, so cannot be used in the field. Abimbola et al.

    [10] have reviewed in-situ detection of microplastics highlighting the need to overcome issues of costs, complexity and portability. Song et al. [15] also surveyed detection methods, noting the need for effective and scalable solutions.

    Hybrid and Optical Sensing Approaches: Some recent studies focus on hybrid sensing which implies combining optical and electrical approaches. Park et al. [2] developed a cost-effective fluorometer sensor to detect compounds in water. Similarly, Colson and Michel [8] and Gugliandolo et al. [14] have shown that optics and impedance enhance detection. These approaches relate to detection, but do not relate to real-time IoT platforms, and so do not involve continuous monitoring (yet).

    Research Gap: These literature gaps are apparent: Existing IoT systems focus only on chemical/physical parameters such as pH, TDS and turbidity [5][6][7][9]. Microplastic detection tends to be in the lab, expensive or consumes a lot of computational resources [3][8][11][14]. Optical systems exist, but no one is connecting them to IoT systems [2][14]. Lack of integrated system for real-time monitoring and microplastic detection Th proposed system fills the gap between traditional water quality monitoring systems and microplastic detection.

  3. METHODS AND MATERIALS

    The new system combines all the components you need to monitor water quality and detect microplastics, in a real-time IoT system. Rather than using traditional chemical sensors, it adds in optical detection, giving you more information about the quality of the water. The basis of the system is an ESP32 microcontroller which is linked to pH, TDS, turbidity and microplastic sensors. ESP32 gathers all sensor signals, crunches the numbers and handles wireless connections. Once its done, it beams the results straight to a web dashboard over Wi-Fi. It is designed to be cheap, portable and easy to use.

    1. Hardware Components:

      • ESP32 Microcontroller: It’s small, low power and can connect to Wi-Fi. It is a microcontroller that

        reads in all the analog sensor data, converts it to digital and runs the web dashboard.

      • pH Sensor: Checks for acid or base. It outputs a voltage correlated to hydrogen ions in water and with accurate calibration we get pH value.

      • TDS Sensor: Measures the dissolved solids based on how much current flows through it. The analog reading is converted to TDS (parts per million or ppm).

      • Turbidity Sensor: Measuring the cloudiness of water, by detecting how much is light is scattered.

      • Microplastics (Optical Fluorescence) : LED is a blue LED which passes through water. A Light Dependent Resistor (LDR) is situated at 90° to detect scattered light and fluorescent light from the dye particles. The detection technique uses Nile Red dye which preferentially sticks to the hydrophobic plastic and fluoresces under blue light. The LDR has a red cellophane filter to block the scattered light and allow the fluorescent light to be detected. The changing intensity is converted into voltage by the voltage divider.

      • Resistor : Used with the LDR to allow the ESP32 to compare the small variations in light as variations in voltage.

    2. Circuit Design:

      All the sensors are connected to the ESP32s analog input pins. Each sensor outputs a voltage, and the ESP32 uses its 12-bit ADC to read a value from 0 up to 4095. For the microplastic detector, there is a simple voltage divider, the resistor sits between 3.3V and the ESP32 analog pin. As lighting shifts, the voltage at that connection changes, letting the ESP32 keep the tabs on the analysis. The output follows this equation:

      VOUT = VCC × r

      R+r

      Where , VCC = Supply Voltage, r = Fixed resistor,

      R = Resistance of the LDR

    3. Microplastic Sample Preparation:

      Microplastic samples were made of expanded polystyrene (EPS), a material that is widely used in thermocol and packaging materials, to be experimentally validated. EPS is made of polystyrene, which is one of the most experimented microplastics in laboratories. The substance was mechanically broken down to fine granular particles that have a rough size between 0.5 mm and 1 mm. The size of the particles was selected to be large enough to have sufficient optical scattering and fluorescence response, and applicable for microplastic detection. The particleswere then coated Nile Red dye that binds to hydrophobic surfaces of polymers and enhances fluorescence response with the blue light source.

    4. Microplastic Detection Mechanism:

      It’s the light scattering that does the job. A Blue LED is used to illuminate the sample. If it is just water, it hardly blocks

      the light, so there is not much of a change in the signal. But if there are microplastics, they block the LED light and the LDR will read the change. The measurements are more precise when we use dye on the plastic called Nile Red Dye, which sticks to it. This can make the scattered light easier to detect, so we can find even tiny amounts of plastic. The ESP32 picks up changes in the ADC readings to determine the plastic concentration.

    5. Data Acquisition and Signal Processing:

      The ESP32 does not take a single sample but samples the sensors repeatedly. It removes the occasional outlier using a median filter and then smoothes the data by taking averages. For microplastic detection, it takes exponential moving averages which allow it to ignore stray light or disturbances. The ADC values are converted to voltages using following formula:

      1. Results appear on the dashboard, in real time where all parameters get their own status.

      2. User interprets the data and then acts if needed.

      Fig 1. Architecture Diagram of the proposed system.

      V = ( ADC ) X 3.3

      4095

      Then, these voltages are calibrated to units like pH, TDS or turbidity.

    6. Water Quality Index (WQI) Calculation:

      To turn complex data from sensors into easy-to-understand visuals, you compute a Water Quality Index (WQI). Our system combines the sensors’ scores, weighted by their importance:

      WQI 100 – (WpH + WTDS + Wturb + Wmicro ) The closer a sensor value is to the safe limit, the more its weighting detracts from the ideal score. The resulting value allows you to categorise the sample as “safe”, “warning” or “danger”, so you can instantly know if it is good to drink.

    7. Web-based Monitoring System:

      The ESP32 doubles as a Wi-Fi hotspot, spinning up its own network and a real-time dashboard. Connect your phone, laptop or tablet without any cloud login requirement. The dashboard gives you :

      • Live sensor readings

      • Sparkline graphs for quick trends

      • Instant status

      • A visual snapshot of WQI

        Updates arrive continuously over HTTP, keeping everyone in the loop without outside servers.

    8. System Workflow and Process:

    1. ESP32 initializes the ADC, all sensors and setting up Wi-Fi Access Point mode.

    2. The ESP32 cleans up the raw data from sensors and uses median filtering to get stable values.

    3. The raw ADC values get converted to voltage and are mapped to real-world parameters like pH, TDS and turbidity using calibration equations.

    4. In case of microplastics, LDR sensor readings are smoothened to remove external noise.

    5. The system calculates the overall WQI by pulling in all required parameters.

  4. EXPERIMENTAL STUDY

    In this section we will describe the design and implementation of an experiment to test the proposed multi-sensor water safety system. This system was assembled to test how the IoT system will perform in a controlled environment to detect microplastics and monitor water quality. The system uses the ESP32 microcontroller, pH, TDS and turbidity sensors, and a microplastic detection sensor. The microplastic unit is an LED sensor, a blue LED and a LDR (light dependent resistor) sensor at right angles. They face each other with a clear test tube with a water sample in between. All of this is enclosed in a light-proof chamber to prevent outside light from interfering with the results. We add a red cellophane to the LDR sensor to filter out the fluorescent light from dye particles to increase accuracy. The microcontroller reads the analog data from the sensors and does all the processing on the fly, in real time. Once the ESP32 has new readings, it will transmit the data to a web dashboard for you to view the water quality. I the experiment, the team has set up various water samples to test the system. First, they prepared a reference sample, in which there’s no microplastic. Then, a dye added clean water sample is used. The dye enhances optical signals, for better sensitivity and visibility of microplastics. Finally, a water sample containing real microplastics is used to simulate real world conditions. These test samples were prepared in beakers of the same size. Acidic, Alkaline, Tap and normal water were used in different beakers as test samples for chemical contaminations. The analog-to-digital converter (ADC) on the ESP32 is a 12-bit one and was used in a loop to measure values between 0 and 4095. It sampled all the sensors several times, filtered the data and then used it. The changing intensity detected by the LDR was mapped to the ADC values, signaling microplastics. This information was sent to the web dashboard in real-time so we could keep an eye on the experiment.

    Fig 1. Experimental Setup.

  5. RESULTS

    We conducted experiments with varying water conditions to test the effectiveness of the proposed system to identify microplastics, along with other water quality parameters. Data was taken from sensor readings in real-time using the ESP32 microcontroller.

    To measure the chemical parameters of water, the researchers used pH, turbidity and total dissolved solids (TDS) sensors and compared the results to the permissible limits.

    • pH: Safe Range (6.5-8.5)

    • TDS: Safe Range ( < 500 ppm)

    • Turbidity: Acceptable Range ( < 3 NTU)

      Tests revealed the system reliably picked up changes in these parameters across different samples.

      Fig 1. Dashboard display of Chemical Readings.

      The ESP32 measures the intensity of the light in terms of the voltage using its 12-bit analog-to-digital converter (ADC). The voltage values are used to categorize the presence of microplastics. The observed readings are shown in Table 1.

      Condition

      Voltage Range

      Clean Water

      0.5 – 0.95 V

      Low Microplastic Presence

      1.0 – 1.2 V

      High Microplastic Presence

      > 1.2 V

      Table 1 : Microplastic Detection Readings

      The rise in voltage is due to increased light scattering and fluorescence from Nile Red-stained microplastics. This result demonstrates the success of the optical detection method with a low-cost LED-LDR.

      Fig 2. Light scattering principle in Microplastic Detection.

      Fig 3. WQI Score and Microplastic Readings

      This figure shows a score called Water Quality Index(WQI) which is computed by the system by combining all measured parameters. The WQI provides a single numerical value representing the water quality.

    • High WQI indicates Safe water

    • Moderate WQI indicates a Warning

    • Low WQI indicates Contamination

    The inclusion of microplastic detection in WQI calculation improves the reliability of water quality assessment.

  6. CONCLUSION

The IoT-based smart water quality monitoring system integrated with microplastic detection has been successfully designed and implemented. The experimental results indicate that the system can differentiate between clean and contaminated water using both chemical and optical data. The microplastic detection module relies on LED light scattering and an LDR sensor which gives distinct ADC readings that reliably flag contaminated samples.

By connecting all the sensing modules to an ESP32 microcontroller, we achieve real-time data collection, processing and visualization on a web-based dashboard. Compared to typical lab methods and existing IoT setups, our

system stands out with its low cost, portability , real-time measurements and ability to analyze multiple parameters. It helps in easier outreach and usage of the detection module, allowing a much wider set of people to be able to use it.

In general, the offered system proves that the multi-sensor model offers a practical and scalable solution to keep tabs on water safety across various parameters that are highly essential to our well-being. It addresses the existing contamination threats related to chemicals along with emerging pollutants such as microplastics that are not yet widely detected on a larger scale.

It’s crucial to note that chemical parameters are used to determine the safety of drinking water, and microplastics detected in this system reflect the level of contamination. Thus, the system offers a double-readout: drinking water safety determined by chemical parameters and environmental contamination determined by microplastics.

The proposed system works successfully, but it can be improved by adding advanced optical sensors like photodiodes or spectrometers to improve accuracy and usage of machine learning algorithms to better classify different microplastic types.

REFERENCES

[10] [11] [12] [13] [14] [15]

. Abimbola et al., “In-situ

Microplastics in the Aquatic Environment: Environment: A Review, Science of the Environment, vol. 934, 2024.

. Buragohain et al., Laser Scanning Optical Beam Induced Current Microscope, IEEE Photonics Journal, vol. 16, no. 1, 2024.

. Quansah et al., An IoT Cloud-Based Water

J. Science, J. Science,

Mathematics and Technology Learning, 2022.

. A. Murti et al., Smart System for Water Quality Monitoring Utilizing Long-Range IoT, Applied Water Science, vol. 14, no. 4, 2024.

. Gugliandolo et al., Measurements of Transmitted Light

Measurements, Acta IMEKO, vol. 13, no. 2, 2024.

. Song et al., “Progress in

Detection and Interception, 2025.

  1. . Junior et al., “Internet of Water Things:

    Remote Raw Water Monitoring and Control System,

    IEEE Access, vol. 9, pp. 3579035800, 2021.

  2. . T. Park et al., A Low-Cost Fluorometer Applied to the Gulf of Saint Lawrence Rhodamine

    Rhodamine Tracer Experiment, IEEE Sensors Journal,

    pp. 1677216787, 2023.

  3. . A. B. Sarker et al., Automatic Detection of Microplastics in the Aqueous Environment, in Proc. IEEE CCWC, 2023, pp. 768772.

  4. . Park et al., THE PIXIE, Oceanography,

    vol. 38, no. 2, pp. 6672, 2025.

  5. T. S. Rao et al., “ESP32 Based

    System for Water Quantity and Quality

    System, in Proc. ICIIC, 2021, pp. 122129.

  6. . M. Forhad et al., “IoT-Based

    Water Quality Monitoring System in Water

    Treatment Plants, Heliyon, vol. 10, no. 23, 2024.

  7. . Lakshmikantha et al., IoT-Based Smart Water Quality Monitoring System, Transitions Proceedings, vol. 2, no. 2,

    pp. 181186, 2021.

  8. . C. Colson and A. P. Michel, “Flow-Through Microplastics Using

    Impedance Spectroscopy, ACS Sensors,

    vol. 6, no. 1, pp. 238244, 2021.

  9. . Singh and T. Walingo, Smart Water Quality Sensing using IoT Wireless Sensor Networks, Sensors, vol. 24, no. 9, 2024.