Smart Water Quality Monitoring System with Automated Flow Control and IoT Dashboard

Dual-MCU Architecture with ESP32 and Arduino Nano for Multi-Parameter Water Analysis, Flow Rate Measurement, Turbidity Sensing, and Blynk IoT Cloud Integration

Category: IoT, Embedded Systems, Water Quality, Dual-MCU Architecture
Tools & Technologies: ESP32 (Main Controller), Arduino Nano (pH Processor), HC-SR04 Ultrasonic Sensor, DS18B20 Temperature Sensor, Turbidity Sensor, Water Flow Meter, pH Sensor, Relay Module (Pump), 20x4 I2C LCD, Blynk IoT Platform, UART Serial Communication, Arduino IDE

Status: Completed

Introduction

This project implements an advanced water quality monitoring system using a dual-microcontroller architecture for comprehensive multi-parameter water analysis. The ESP32 serves as the main controller, reading ultrasonic water level, DS18B20 temperature, turbidity, and water flow rate sensors while managing WiFi connectivity and Blynk IoT cloud communication. An Arduino Nano operates as a dedicated pH processing unit, reading the analog pH sensor and transmitting calibrated pH values to the ESP32 via UART serial communication. This dual-MCU design separates the analog-sensitive pH measurement from the WiFi-active main controller to minimize interference. The system monitors six parameters simultaneously — pH, turbidity percentage, temperature (°C), water level (cm), flow rate (L/min), and cumulative volume (L) — displayed on a 20x4 LCD and streamed to a Blynk IoT dashboard with automated pump control.

System Overview System Overview


Aim and Objectives

Aim:
Design and implement a dual-MCU IoT water quality monitoring system with multi-parameter sensing, automated pump control, and cloud-based data visualization.

Objectives:

  • Implement dual-MCU UART architecture separating pH sensing (Nano) from main processing (ESP32).
  • Monitor six water parameters: pH, turbidity, temperature, water level, flow rate, and volume.
  • Stream all sensor data to Blynk IoT dashboard using virtual pins (V0–V4).
  • Automate water pump control based on water level thresholds.
  • Calculate flow rate from pulse-counting water flow meter with interrupt-driven measurement.
  • Display real-time readings on a local 20x4 LCD for on-site monitoring.

Features & Deliverables

  • Dual-MCU Architecture: ESP32 (main controller) + Arduino Nano (pH processor) communicating via UART serial for interference isolation.
  • pH Monitoring: Dedicated Arduino Nano reads analog pH sensor, calibrates, and sends values to ESP32 via Serial.
  • Turbidity Sensing: Analog turbidity sensor reading mapped to percentage for water clarity assessment.
  • Temperature Measurement: DS18B20 waterproof sensor for accurate water temperature monitoring.
  • Water Level Tracking: HC-SR04 ultrasonic sensor for non-contact tank level measurement in centimeters.
  • Flow Rate & Volume: Pulse-counting water flow meter with interrupt-driven flow rate (L/min) and cumulative volume (L) calculation.
  • Blynk IoT Dashboard: Cloud-based real-time monitoring with virtual pin data streaming.
  • Automated Pump Control: Relay-managed pump with water level threshold activation.

Process / Methodology

Hardware Assembly

Components: ESP32, Arduino Nano, HC-SR04, DS18B20, Turbidity Sensor, Water Flow Meter, pH Sensor, Relay, Pump, 20x4 LCD.

  • Configured ESP32 as main controller with WiFi, LCD, and multiple sensor interfaces.
  • Set up Arduino Nano as dedicated pH processor with analog pH sensor and UART output.
  • Connected UART serial link between Nano TX and ESP32 RX for pH data transfer.
  • Attached water flow meter with interrupt pin for pulse-counting flow measurement.

Software Development

  • Developed ESP32 firmware for multi-sensor polling, Blynk integration, and pump control.
  • Programmed Arduino Nano for pH analog reading, calibration, and UART transmission.
  • Implemented interrupt-driven flow rate calculation with pulse frequency to L/min conversion.
  • Created LCD display rotation showing all six parameters across multiple display pages.

Testing & Calibration

  • Calibrated pH sensor using standard buffer solutions on the Nano processor.
  • Validated turbidity percentage mapping against known turbidity standards.
  • Tested flow meter accuracy with measured water volumes at different flow rates.

Challenges & Solutions

  • Challenge: ESP32 WiFi activity introducing noise into pH analog readings.
    Solution: Dedicated Arduino Nano for pH reading with UART data transfer to ESP32, isolating analog from RF circuits.
  • Challenge: Synchronizing sensor data from two independent microcontrollers.
    Solution: Implemented periodic UART communication protocol with pH data parsing on ESP32 main loop.
  • Challenge: Flow meter pulse counting accuracy at varying flow rates.
    Solution: Used hardware interrupt with timing-based flow calculation and averaging for stable readings.

Results & Impact

  • Comprehensive Monitoring: Six-parameter simultaneous monitoring provided complete water quality picture.
  • Noise Isolation: Dual-MCU architecture eliminated WiFi-induced pH reading interference.
  • Remote Access: Blynk dashboard enabled water quality monitoring from any location.
  • Automated Control: Pump management maintained consistent water levels without manual intervention.

Future Enhancements

  • Add dissolved oxygen and conductivity sensors for expanded water quality parameters.
  • Implement data logging with historical trend analysis and anomaly detection.
  • Add multi-tank support with valve-based flow routing.
  • Develop water quality compliance reporting against regulatory standards.

Demonstration / Access

  • GitHub Repository: Coming soon
  • Live Demonstration Video: Coming soon

Thank You for Visiting My Portfolio

I sincerely appreciate you taking the time to explore my portfolio and learn about my work and expertise. If you have any questions or wish to discuss potential collaborations, please feel free to reach out via the Contact section.

Best regards,
Damilare Lekan, Adekeye.