Arduino UNO Smart Water Quality Monitoring System Using pH and Turbidity Sensor | IoT Water Testing Project

Arduino UNO Smart Water Quality Monitoring System | pH, Turbidity, TDS Sensor
💧 Environmental Monitoring 🔬 3 Sensors ⚙️ Arduino UNO 📡 IoT Ready

Smart Water Quality
Monitoring System

Measure pH, turbidity, and TDS (Total Dissolved Solids) in real time using Arduino UNO. This advanced environmental monitoring project is ideal for drinking water testing, aquaculture, wastewater analysis, and IoT-based smart water management.

~15 min read 7 Components Arduino C++
🧪
pH Sensor
A1 (Analog)
pH 7.2
🌊
Turbidity
A2 (Analog)
312 NTU
⚗️
TDS Sensor
A0 (Analog)
248 ppm
0Requirements

Components Required

🔵
Arduino UNO
ATmega328P microcontroller
🧪
pH Sensor Module
Analog output → A1
🌊
Turbidity Sensor
Analog output → A2
⚗️
TDS Sensor
Analog output → A0
📟
16×2 LCD Display
4-bit mode (optional)
🔋
Power Supply
5V battery or USB
🔌
Jumper Wires
For all connections
🔬 Science

How the Monitoring System Works

Sensor 01
🧪 pH Sensor — Acidity / Alkalinity
Measures hydrogen ion concentration to determine whether water is acidic, neutral, or alkaline.
Analog pin A1
  • pH < 7 → Acidic water
  • pH = 7 → Neutral (pure water)
  • pH > 7 → Alkaline water
  • Drinking water: pH 6.5 – 8.5
Sensor 02
🌊 Turbidity — Water Clarity
Detects suspended particles using infrared light scattering. Higher turbidity = more contamination.
Analog pin A2
  • Measures in NTU (Nephelometric)
  • Clear water: < 1 NTU
  • Drinking limit: < 4 NTU (WHO)
  • High NTU signals contamination
Sensor 03
⚗️ TDS — Total Dissolved Solids
Measures concentration of dissolved minerals, salts, and metals — indicates overall water purity.
Analog pin A0
  • Measures in ppm (mg/L)
  • Excellent: < 300 ppm
  • Acceptable: 300 – 600 ppm
  • Poor quality: > 900 ppm
pH Scale Reference
01234 56789 1011121314
🔴 Acidic
pH 0 – 6.9
🟢 Neutral
pH 7.0
🔵 Alkaline
pH 7.1 – 14
1Wiring

Circuit Connections

Component Pin/Terminal Arduino Pin Wire
TDS Sensor VCC5VRed
GNDGNDBlack
AOUTA0Orange
pH Sensor VCC5VRed
GNDGNDBlack
AOUTA1Yellow
Turbidity Sensor VCC5VRed
GNDGNDBlack
AOUTA2Green
16×2 LCD (4-bit) VCC / VSS5V / GND/
RS / E / R/WD12 / D11 / GNDBlue
D4–D7D10 / D9 / D8 / D7Purple

All three sensor modules output a 0–5V analog signal proportional to their respective measurements. The Arduino's built-in 10-bit ADC converts these to values ranging from 0–1023.

2Wokwi Config

diagram.json

Paste this into Wokwi's diagram.json tab. Three potentiometers simulate the sensor analog outputs — turn each to change readings.

diagram.json
{
  "version": 1,
  "author": "Arduino Water Quality Monitor",
  "editor": "wokwi",
  "parts": [
    {
      "type": "wokwi-arduino-uno", "id": "uno",
      "top": 0, "left": 0, "attrs": {}
    },
    {
      "type": "wokwi-potentiometer", "id": "tds_pot",
      "top": -120, "left": -200,
      "attrs": { "label": "TDS Sensor (A0)" }
    },
    {
      "type": "wokwi-potentiometer", "id": "ph_pot",
      "top": -120, "left": 0,
      "attrs": { "label": "pH Sensor (A1)" }
    },
    {
      "type": "wokwi-potentiometer", "id": "turb_pot",
      "top": -120, "left": 200,
      "attrs": { "label": "Turbidity (A2)" }
    },
    {
      "type": "wokwi-lcd1602", "id": "lcd1",
      "top": 200, "left": 200, "attrs": {}
    }
  ],
  "connections": [
    // TDS sensor (potentiometer) → A0
    [ "tds_pot:VCC", "uno:5V",   "red",    [ "v0" ] ],
    [ "tds_pot:GND", "uno:GND.1", "black",  [ "v0" ] ],
    [ "tds_pot:SIG", "uno:A0",   "orange", [ "v0" ] ],

    // pH sensor (potentiometer) → A1
    [ "ph_pot:VCC",  "uno:5V",   "red",    [ "v0" ] ],
    [ "ph_pot:GND",  "uno:GND.1", "black",  [ "v0" ] ],
    [ "ph_pot:SIG",  "uno:A1",   "yellow", [ "v0" ] ],

    // Turbidity sensor (potentiometer) → A2
    [ "turb_pot:VCC", "uno:5V",   "red",    [ "v0" ] ],
    [ "turb_pot:GND", "uno:GND.1", "black",  [ "v0" ] ],
    [ "turb_pot:SIG", "uno:A2",   "green",  [ "v0" ] ],

    // LCD (4-bit mode)
    [ "lcd1:VSS", "uno:GND.2", "black",  [ "v0" ] ],
    [ "lcd1:VDD", "uno:5V",    "red",    [ "v0" ] ],
    [ "lcd1:V0",  "uno:GND.2", "black",  [ "v0" ] ],
    [ "lcd1:RS",  "uno:12",   "blue",   [ "v0" ] ],
    [ "lcd1:RW",  "uno:GND.2", "black",  [ "v0" ] ],
    [ "lcd1:E",   "uno:11",   "blue",   [ "v0" ] ],
    [ "lcd1:D4",  "uno:10",   "purple", [ "v0" ] ],
    [ "lcd1:D5",  "uno:9",    "purple", [ "v0" ] ],
    [ "lcd1:D6",  "uno:8",    "purple", [ "v0" ] ],
    [ "lcd1:D7",  "uno:7",    "purple", [ "v0" ] ],
    [ "lcd1:A",   "uno:5V",   "red",    [ "v0" ] ],
    [ "lcd1:K",   "uno:GND.2", "black",  [ "v0" ] ]
  ],
  "dependencies": {}
}
3Code

Arduino Code

The code reads all three sensors every second and outputs formatted readings to the Serial Monitor. Extend it with the LCD library to show values on the 16×2 display.

sketch.ino — Arduino C++
/*
 * Arduino UNO Smart Water Quality Monitoring System
 * Sensors: TDS (A0), pH (A1), Turbidity (A2)
 * Output: Serial Monitor + 16x2 LCD
 * Use potentiometers in Wokwi to simulate sensor values
 */

// ── PIN DEFINITIONS ───────────────────────────────────────────
const int tdsPin       = A0;   // TDS sensor analog output
const int phPin        = A1;   // pH sensor analog output
const int turbidityPin = A2;   // Turbidity sensor analog output

// ── CALIBRATION CONSTANTS ─────────────────────────────────────
// These map 0–1023 ADC range to real-world units.
// Adjust these values for your specific sensor modules.
const float TDS_FACTOR  = 0.5;    // ppm per ADC unit (approx)
const float PH_OFFSET   = 14.0;   // pH 0–14 mapping offset
const float TURB_FACTOR = 1.0;    // NTU per ADC unit (approx)

void setup() {
  Serial.begin(9600);
  pinMode(tdsPin,       INPUT);
  pinMode(phPin,        INPUT);
  pinMode(turbidityPin, INPUT);

  Serial.println("========================================");
  Serial.println("  Smart Water Quality Monitoring System");
  Serial.println("  Sensors: TDS | pH | Turbidity");
  Serial.println("========================================");
  Serial.println();
}

void loop() {
  // Read raw ADC values (0–1023)
  int tdsRaw       = analogRead(tdsPin);
  int phRaw        = analogRead(phPin);
  int turbidityRaw = analogRead(turbidityPin);

  // Convert to real-world values
  float tdsValue       = tdsRaw * TDS_FACTOR;
  float phValue        = (phRaw / 1023.0) * PH_OFFSET;
  float turbidityValue = turbidityRaw * TURB_FACTOR;

  // Determine water quality labels
  String phStatus  = (phValue < 6.5) ? "ACIDIC" :
                     (phValue > 8.5) ? "ALKALINE" : "NORMAL";
  String tdsStatus = (tdsValue < 300) ? "EXCELLENT" :
                     (tdsValue < 600) ? "GOOD" :
                     (tdsValue < 900) ? "ACCEPTABLE" : "POOR";

  // Print formatted output to Serial Monitor
  Serial.println("──────────────────────────────────────");
  Serial.print("TDS Value:      "); Serial.print(tdsRaw);
  Serial.print(" raw  →  "); Serial.print(tdsValue, 1);
  Serial.print(" ppm  ["); Serial.print(tdsStatus); Serial.println("]");

  Serial.print("pH Value:       "); Serial.print(phRaw);
  Serial.print(" raw  →  pH "); Serial.print(phValue, 2);
  Serial.print("  ["); Serial.print(phStatus); Serial.println("]");

  Serial.print("Turbidity:      "); Serial.print(turbidityRaw);
  Serial.print(" raw  →  "); Serial.print(turbidityValue, 1);
  Serial.println(" NTU");

  Serial.println();
  delay(1000);   // Read every 1 second
}

/* ── SERIAL MONITOR OUTPUT EXAMPLE ──────────────────────────────
   ========================================
     Smart Water Quality Monitoring System
     Sensors: TDS | pH | Turbidity
   ========================================

   ──────────────────────────────────────
   TDS Value:      512 raw  →  256.0 ppm  [EXCELLENT]
   pH Value:       372 raw  →  pH 7.23  [NORMAL]
   Turbidity:      290 raw  →  290.0 NTU

   ──────────────────────────────────────
   ...
*/
✨ Features

Key Features

Arduino UNO environmental monitoring
Real-time pH level measurement
Turbidity detection for water clarity
TDS dissolved solids monitoring
16×2 LCD live data display
Analog sensor interfacing (3 channels)
Serial Monitor formatted logging
Water quality status labels (GOOD/POOR)
Portable battery-powered design
Expandable to IoT cloud monitoring
Calibration constants for accuracy
Wokwi simulation with potentiometers
🌍 Use Cases

Applications

🚰 Drinking water quality testing
🌊 River & lake pollution monitoring
🐟 Aquaculture water management
🌾 Smart irrigation systems
🏭 Industrial wastewater analysis
🔬 Environmental research projects
🏙️ IoT smart water management
🎓 Engineering final year projects
🏫 Science exhibition models
🧬 Research lab water studies
🏊 Swimming pool monitoring
🌱 Hydroponic nutrient control
🚀 Extend It

Upgrade to IoT-Based Water Monitoring

This project can be expanded into a fully connected cloud-based monitoring solution suitable for smart cities, industrial automation, and agricultural management.

📶
ESP8266
Add WiFi connectivity for remote monitoring
ESP32
Advanced IoT integration + Bluetooth
☁️
Cloud Platform
ThingSpeak, Blynk, or Firebase logging
📱
Mobile Dashboard
Real-time data on any smartphone
📡
GSM Module
SMS alerts when quality thresholds exceeded

With ESP8266 or ESP32 integration, the system becomes a real-time cloud-based water quality monitoring solution deployable for smart cities and precision agriculture.

More Projects by Category

📡 IoT & Smart System Projects
🤖 Robotics Projects
🔬 Sensor & Detection Projects
🏭 Industrial & Automation Projects
💡 LED, Lighting & Fun Projects

© 2026 MakeMindz · Arduino & IoT Environmental Monitoring Projects for Engineers & Students

Comments

try for free