Working Principle
A TDS (Total Dissolved Solids) sensor measures the total concentration of dissolved ions in water by measuring electrical conductivity. Two parallel electrodes are immersed in the water; an AC voltage is applied (to prevent electrode polarisation), and the resulting current is proportional to the ion concentration. Higher TDS = more dissolved salts = higher conductivity.
TDS is expressed in parts per million (ppm), approximately equal to mg/L. A conversion factor (typically 0.5–0.7) relates conductivity (µS/cm) to TDS (ppm). Pure distilled water: <10 ppm. Tap water: 100–500 ppm. Seawater: ~35,000 ppm.
Electrical Characteristics
| Parameter | Typical (DFRobot/Keyestudio TDS) |
|---|---|
| Measurement Range | 0–1000 ppm |
| Accuracy | ±10% (after temperature compensation) |
| Probe Type | 2-electrode waterproof probe |
| Output | Analog voltage (0–2.3 V for 0–1000 ppm) |
| Supply Voltage | 3.3–5.5 V |
| Excitation | AC signal (on-board oscillator, prevents polarisation) |
| Temperature Dependence | ~2%/°C (must compensate) |
| Cable Length | ~60 cm waterproof probe |
Interfacing with an MCU
Connect VCC, GND, and analog output to an ADC pin. The probe connects to the module via a 2-pin header. For accurate readings, a temperature sensor (DS18B20 or NTC thermistor) must be used alongside the TDS probe for temperature compensation.
Calibration
- Reference solution: Use a 342 ppm (or 1000 ppm) NaCl calibration solution; adjust the potentiometer on the module until the reading matches
- Temperature compensation: Apply the formula: TDS25 = TDSraw / (1 + 0.02 × (T − 25)), where T is water temperature in °C
- Cross-check: Compare against a commercial TDS pen meter for verification
Code Example
/*
* TDS Water Quality Sensor — Arduino
* Module: DFRobot/Keyestudio TDS Meter V1.0
* Wiring: VCC → 5V, GND → GND, Signal → A1
*/
#define TDS_PIN A1
#define VREF 5.0
#define TEMP 25.0 /* Replace with actual measurement */
float readTDS() {
/* Average 20 samples */
long sum = 0;
for (int i = 0; i < 20; i++) {
sum += analogRead(TDS_PIN);
delay(10);
}
float voltage = (sum / 20.0) * VREF / 1024.0;
/* Temperature compensation */
float compCoeff = 1.0 + 0.02 * (TEMP - 25.0);
float compVolt = voltage / compCoeff;
/* Voltage-to-TDS conversion (module-specific curve) */
float tds = (133.42 * compVolt * compVolt * compVolt
- 255.86 * compVolt * compVolt
+ 857.39 * compVolt) * 0.5;
return tds;
}
void setup() {
Serial.begin(9600);
Serial.println("TDS Water Quality Sensor Ready");
}
void loop() {
float tds = readTDS();
Serial.print("TDS: ");
Serial.print(tds, 0);
Serial.println(" ppm");
delay(2000);
}
Real-World Applications
Drinking Water Testing & Hydroponic Nutrient Monitoring
TDS sensors are used in water purifier (RO system) output monitoring, hydroponic nutrient solution management, aquarium water quality, pool and spa maintenance, well water testing, and industrial water treatment. Smart water filters use TDS to signal when the filter cartridge needs replacement. Hydroponics growers use electrical conductivity (EC, closely related to TDS) to control nutrient dosing.
Limitations
- Non-specific: Measures total ions, not individual contaminants; cannot distinguish safe minerals from harmful substances.
- Temperature dependent: Conductivity changes ~2%/°C; uncompensated readings are unreliable.
- Electrode fouling: Biofilm and mineral deposits on electrodes degrade accuracy over time.
- Limited range: Hobby modules max at ~1000 ppm; industrial/seawater needs higher-range probes.