Course Content
IoT Engineering Course using ESP32 with 12 Real-World Projects

(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

https://m.media-amazon.com/images/I/61MDW%2BU%2BrvL.jpg
https://m.media-amazon.com/images/I/51TxSRqbv3L._AC_UF1000%2C1000_QL80_.jpg
https://m.media-amazon.com/images/I/71pF54VdGJL._AC_UF1000%2C1000_QL80_.jpg
4

πŸ”Ή 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:

Β 
Β 
Voltage = ADC_Value Γ— (3.3 / 4095)
Β 

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)

Scroll to Top