
Water Quality Monitoring System
Build a water quality monitoring system that measures temperature, TDS, pH, and turbidity, shows an alert status, and can be extended to send real-time data over MQTT. Suited for monitoring fish tank, hydroponic, or water tank quality, or as a reference monitoring model. Note: readings from consumer-grade sensors do not replace certified testing equipment or lab analysis.
Overview
The ESP32 Water Quality Monitoring System project guides learners through building an IoT prototype that measures basic water parameters such as temperature, TDS, pH, and relative turbidity. The system reads sensor data, processes it on the ESP32, evaluates water status, and can send real-time data to an MQTT broker for dashboard display or alerting.
This project suits IoT learning, fish tanks, hydroponics, water storage tanks, or a reference water-monitoring model. Readings from consumer-grade sensors do not replace certified testing equipment or lab analysis.
Main Goals
- Connect an ESP32 to a DS18B20, TDS sensor, pH sensor, and turbidity sensor.
- Read analog and digital data in the Arduino IDE.
- Filter noise and compute TDS, pH, and relative turbidity.
- Perform basic calibration of the pH and turbidity sensors.
- Evaluate water status as NORMAL, WARNING, DANGER, or SENSOR_ERROR.
- Extend with MQTT to send real-time data to a dashboard or backend.
Outcome
Learners will end up with an ESP32 system that can read water quality, print data to the Serial Monitor, drive LED/buzzer alerts, and publish JSON data to a per-device MQTT topic.
Detailed guide
List of extended articles for this project.
Part 1: Preparing Components and Safety Notes
Introduces the component list, each module's role, and safety notes for working with water and electronic circuits.
Part 2: System Architecture and Wiring Diagram
Covers the data architecture, pin connection table, and how to protect the ESP32's ADC pins when using analog sensors.
Part 3: Setting Up the Arduino IDE and Testing Sensors
Guides you through installing the ESP32 board, required libraries, and testing raw ADC/DS18B20 readings before combining the full system.
Part 4: Programming the Water-Quality-Reading Firmware
Build the complete Arduino IDE program to read temperature, TDS, pH, and turbidity, and evaluate water status.
Part 5: Sensor Calibration and Troubleshooting
Guides you through calibrating pH and turbidity, checking TDS, and fixing common issues when sensor data is unstable.
Part 6: Extending with MQTT for the Water Quality Monitoring System
Upgrades the project into a full IoT system by connecting to WiFi, publishing JSON data over MQTT, and sending alerts when an anomaly is detected.
Part 7: Testing MQTT, Building a Dashboard, and Extension Ideas
Guides you through checking MQTT data with MQTT Explorer, designing a dashboard, and the project completion checklist.