Analog TDS Sensor Hydroelectric Conductivity for Arduino Compatible Liquid Detection Water Quality Monitoring

The Arduino compatible TDS sensor is used to measure the TDS value of water. The TDS value can reflect the cleanliness of water. It can be used in water quality detection of domestic water, hydroponics and other fields.

TDS (Total Dissolved Solids), Chinese name: total dissolved solids, also known as total dissolved solids, shows how many milligrams of soluble solids are dissolved in a liter of water. Generally speaking, the higher the TDS value, the more dissolved the water contains, the more unclean the water is. Therefore, the size of TDS can be used as a basis for reflecting the cleanliness of water.

Categories: , , Tags: , , , ,

Range Standard:

0-100: Ideal Drinking Water

200-400: Acceptable Tap Water

> 500: Poor State

TDS pen is commonly used for TDS detection. Although it is cheap and easy to use, it can not transmit data to the control system for long-term on-line monitoring and water quality analysis. The use of specialized instruments, although the data can be transmitted, the accuracy is high, but the price is very expensive. To this end, we specially introduced this Arduino compatible TDS sensor, connected to the Arduino controller, can be used to measure the TDS value of water.

The product is specially designed for Arduino, plug and play, and is simple and convenient to use. 3.3-5.5V wide-voltage power supply, 0-2.3V analog signal output, so that this product is compatible with 5V, 3.3V control system, can be very convenient to connect to the ready-made control system. The AC signal is used as the excitation source in the measurement, which can effectively prevent the polarization of the probe, prolong the life of the probe and increase the stability of the output signal. The TDS probe is a water-proof probe and can be immersed in water for a long time.

The product can be applied to water quality detection in the fields of domestic water and water culture. With this sensor, you can easily DIY a set of TDS detector, easy to detect the cleanliness of water, for your water quality close.


Be careful:

TDS probe can not be used in water above 55 C.

The location of TDS probe should not be too close to the edge of the container, otherwise it will affect the indication.

The head and wire of TDS probe are waterproof and can be immersed in water, but the connection interface and signal transfer board are not waterproof. Please pay attention to the use.

Product characteristics

1. wide voltage work: 3.3~5.5V

2. 0~2.3V analog signal output, compatible with 5V and 3.3V two control systems.

3. the excitation source is AC signal, effectively preventing probe polarization.

4. waterproof probe can be immersed in water for a long time.

5. Arduino compatible, simple connection, plug and play, no need to soldering.


technical specifications

Signal adapter board:

  • Input voltage: 3.3~5.5V
  • Output signal: 0~2.3V
  • Working current: 3~6mA
  • TDS measurement range: 0~1000ppm
  • TDS measurement accuracy: ± 10% F.S. (25 C)
  • Size: 42*32mm
  • Module interface: XH2.54-3P
  • Electrode interface: XH2.54-2P

TDS probe:

  • Number of probes: 2
  • Overall length: 83cm
  • Connection interface: XH2.54-2P
  • Color: white
  • Other: Waterproof probe

Arduino source code

#define TdsSensorPin A1

#define VREF 5.0 // analog reference voltage(Volt) of the ADC

#define SCOUNT 30 // sum of sample point

int analogBuffer[SCOUNT]; // store the analog value in the array, read from ADC

int analogBufferTemp[SCOUNT];

int analogBufferIndex = 0,copyIndex = 0;

float averageVoltage = 0,tdsValue = 0,temperature = 25;

void setup



void loop

static unsigned long analogSampleTimepoint = millis();

if(millis()-analogSampleTimepoint > 40U) //every 40 milliseconds,read the analog value from the ADC

analogSampleTimepoint = millis();

analogBuffer[analogBufferIndex] = analogRead(TdsSensorPin); //read the analog value and store into the buffer


if(analogBufferIndex == SCOUNT)

analogBufferIndex = 0;

static unsigned long printTimepoint = millis();

if(millis()-printTimepoint > 800U)

printTimepoint = millis();

analogBufferTemp[copyIndex]= analogBuffer[copyIndex];

averageVoltage = getMedianNum(analogBufferTemp,SCOUNT) * (float)VREF / 1024.0; // read the analog value more stable by the median filtering algorithm, and convert to voltage value

float compensationCoefficient=1.0+0.02*(temperature-25.0); //temperature compensation formula: fFinalResult(25^C) = fFinalResult(current)/(1.0+0.02*(fTP-25.0));

float compensationVolatge=averageVoltage/compensationCoefficient; //temperature compensation

tdsValue=(133.42*compensationVolatge*compensationVolatge*compensationVolatge - 255.86*compensationVolatge*compensationVolatge + 857.39*compensationVolatge)*0.5; //convert voltage value to tds value



Serial.print("V ");

Serial.print("TDS Value:";



int getMedianNum(int bArray[], int iFilterLen

int bTab[iFilterLen];
for (byte i = 0; i

bTab[i] = bArray[i];

int i, j, bTemp;

for (j = 0; j < iFilterLen - 1; j++)

for (i = 0; i < iFilterLen - j - 1; i++)

if (bTab[i] > bTab[i + 1])

bTemp = bTab[i];

bTab[i] = bTab[i + 1];

bTab[i + 1] = bTemp;

if ((iFilterLen & 1) > 0)

bTemp = bTab[(iFilterLen - 1) / 2];


bTemp = (bTab[iFilterLen / 2] + bTab[iFilterLen / 2 - 1]) / 2;

return bTemp;