(TDS Sensor with ESP32 – Water Quality Monitoring System)
💧 Project Overview
In this lesson, we will connect the Analog TDS Sensor Module with ESP32 to measure water quality (TDS value in PPM).
This lesson focuses on:
-
Understanding hardware connections
-
Proper wiring of TDS sensor
-
Safe power connections
-
Preparing system for coding
📦 Components Used in This Project



🔹 1️⃣ ESP32
-
Main controller
-
Reads analog voltage from TDS sensor
-
Converts voltage into PPM value
🔹 2️⃣ Analog TDS Sensor Module
-
Measures water conductivity
-
Converts conductivity into analog voltage
🔹 3️⃣ TDS Probe
-
Placed inside water
-
Contains two electrodes
-
Measures electrical conductivity
🔹 4️⃣ Water Sample
-
Used for testing
-
Can be tap water, RO water, salt water, etc.
🔌 Pin Configuration of TDS Module
Most Analog TDS Modules have:
| Pin | Function |
|---|---|
| VCC | Power Input (3.3V–5V) |
| GND | Ground |
| AO | Analog Output |
🔌 TDS Sensor → ESP32 Connections
| TDS Module Pin | ESP32 Pin |
|---|---|
| VCC | 3.3V |
| GND | GND |
| AO | GPIO 34 |
✔ GPIO 34 is ADC (Analog Input) pin
✔ Safe for analog reading
✔ Do NOT connect AO to digital pin
📊 Circuit Diagram Overview
⚡ Power Considerations
✔ ESP32 powered by USB
✔ TDS module powered by 3.3V
✔ All grounds must be connected together
⚠ Important Notes:
-
Do not power TDS module with 5V if using 3.3V analog reference
-
Keep probe fully submerged while testing
-
Avoid touching probe during measurement
🧠 How the Circuit Works
1️⃣ TDS probe placed in water
2️⃣ Probe measures conductivity
3️⃣ Module converts conductivity to analog voltage
4️⃣ ESP32 reads voltage using ADC
5️⃣ Code converts voltage to PPM value
📐 ADC Reading in ESP32
ESP32 ADC resolution:
-
12-bit ADC
-
Range: 0 – 4095
Voltage range:
-
0V – 3.3V
Formula:
Then voltage is converted to TDS value.
🔧 Best Practices for Accurate Reading
✔ Calibrate using known TDS water sample
✔ Use stable power supply
✔ Keep probe clean
✔ Avoid air bubbles on probe
✔ Take average of multiple readings
🚨 Common Mistakes
❌ Connecting AO to digital pin
❌ Using 5V reference with 3.3V ADC
❌ Leaving probe dry
❌ Not connecting common ground
🎯 What Students Learn in This Lesson
-
Analog sensor interfacing
-
ESP32 ADC working
-
Proper wiring technique
-
Voltage measurement concept
-
Environmental monitoring hardware
📌 Lesson Summary
In this lesson, we:
-
Connected Analog TDS Sensor with ESP32
-
Understood ADC reading process
-
Learned correct wiring method
-
Prepared system for TDS measurement coding
This hardware setup is the foundation for:
💧 Smart Water Quality Monitoring System (Module 8)