Temperature Compensated Arduino TDS Meter

In this article, you will learn about the effect of temperature on the TDS of water and finally, you will learn how to make a “Temperature Compensated Arduino TDS Meter”.

TDS (Total Dissolved Solids) is the sum of organic and inorganic substances dissolved in water and, the methods used for the measurement of TDS value are Gravimetric Analysis and the Measurement of Electric Conductivity (EC). The gravimetric analysis provides reliable TDS value but it is time-consuming and is not very applicable when analyzing a lot of samples. So the measurement of TDS through Electric Conductivity is extensively used. Previously we had posted about the TDS sensor and its interfacing with Arduino in this article.

The electric conductivity of the liquid is the ability to conduct an electric charge. It depends on the concentration of ions and the temperature of measurements. The relationship between the EC and TDS can be represented by

TDS (mg/L) = k x EC (μS cm)

The value of correlation factor k will increase along with the increase of ions in water and varies between 0.55 and 0.8. The above relation may show that the relationship between TDS and EC is directly linear but that’s not true. It depends on the activity of specific dissolved ions, the average activity of all ions in the liquid, and ionic strength.

As TDS is directly related to conductivity, conductivity increases as the temperature increases, eventually affecting TDS. For every 1℃ rise in temperature, conductivity rises by 2–4%. If water temperature increases, the mobility of an ion increases, increasing conductivity. Also, the solubility of the many salts and minerals increases as the temperature increases, affecting the ion concentration in water, and as a result, conductivity increases.

If the temperature of the water increases, the evaporation rate of water increases, which in turn increases the concentration of the dissolved ion resulting in higher conductivity, eventually leading to a higher TDS value.

How TDS Sensor Works

TDS sensor uses conductivity to measure TDS value and since the temperature has a direct effect on conductivity, almost every TDS sensor is calibrated at a specific temperature i.e at 25℃. So, temperature compensation needs to be done to get accurate readings at specific temperatures. Some TDS sensors come with temperature compensation which allows you to directly read the TDS value at any temperature. If your TDS sensor does not contain any temperature compensation, you need to introduce it and calculate the correct TDS value at that temperature. For this, you need a waterproof temperature sensor for the measurement of water temperature. The Electric Conductivity (EC) at that temperature can be calculated by using the formula given below.

EC at 25 = 1+0.020 (temperature measured−25)

Thus, calculating the Electric Conductivity (EC) at the temperature measured by the temperature sensor allows the calculation of the TDS value at that temperature.

To calculate TDS with temperature compensation, first, we have to calculate Compensation Factor.

Compensation_Factor = 1.0*0.02*(Measured_Temperature-25-0)

TDS_Voltage = Measured_Voltage/Compensation_Factor

TDS = (133.42/TDS_Voltage*TDS_Voltage-255.86*TDS_Voltage*TDS_Voltage + 857.39*TDS_Voltage)*0.5

Information on the “Interfacing of a TDS sensor with Arduino” can be obtained in this article.

Circuit Description of Temperature Compensated Arduino TDS Meter

For the temperature measurements, we have used a waterproof version of the DS18B20 temperature sensor and for the display, we used a 16×2 I2C LCD but we can also use an I2C OLED Display or any other that you are compatible with.

Temperature Compensated Arduino TDS Meter

The circuit connection between the DS18B20 temperature sensor data pin (DQ) is connected to the Digital pin D5 of the Arduino NANO. Also, the analog signal pin SIG of the TDS sensor is connected to the analog pin A0 of the Arduino NANO. Similarly, for the 16×2 I2C LCD connection SDA and SCL pins are connected to the SDA and SCL (analog pin A4 and A5) respectively of Arduino NANO.

The temperature sensor DS18B20 used here is discussed in more detail in this article.

Software Code:

Software code is very simple and easily understandable. At first, it includes two libraries for LCD and DS18B20 temperature, and then a few variables are defined and declared. After that in the setup function, the initialization of the temperature sensor and LCD is done. In the Loop function, at first, we measure the temperature and voltage output of the TDS sensor. Here for accuracy, we measure voltage multiple times and took the average value. After that, we calculate the compensate_factor and then compensate voltage. Now, this compensating voltage is converted to a TDS value. At last Temperature value and TDS, value is displayed over LCD.

author prototype of temperature compensated arduino tds meter

PCB Diagram: PCB of Temperature Compensated Arduino TDS Meter is designed using Altium Design. The actual side Solder side and component side PCB are shown in figure 3 and 4 respectively. Click on download for the printable PCB File.

solder side pcb of tds meterFigure 3: Solder Side PCB

component side pcb of tds meterFigure 4: Component Side PCB

2 Thoughts to “Temperature Compensated Arduino TDS Meter”

  1. Great info, thanks! for sharing it.

  2. Mandy

    maybe anyone can help, what is the meaning (133.42), (255.86), (857.39), (0.5) what value is?
    TDS = (133.42/TDS_Voltage*TDS_Voltage-255.86*TDS_Voltage*TDS_Voltage + 857.39*TDS_Voltage)*0.5

Leave a Comment