One of the common method in determining the quality of water is the measurement of Total Dissolved Solids (TDS). TDS meter is a widely used water quality sensor which measures the conductivity of water sample to calculate TDS. The conductance pure water is intrinsically very less; the addition of impurities increases the conductance, which can be calculated from the measured conductivity value. The most commonly used TDS meters uses a lot of external blocks such as Oscillator, Op-amp based non-inverting amplifier, Rectifier etc. PSoC (Programmable System on Chip) gives the advantage of built-in configurable analog and digital blocks, which can be used to build the complete solution with a few external discrete components. A comparison of a few of the existing implementations and the advantages of building a TDS meter using PSoC is presented in this article.
Measurement of water quality is one of the important topics in both industrial and commercial applications. One of the direct methods to measure the quality of water is the measurement of TDS in water. There are different methods to measure TDS, of which measuring the conductivity of the water sample is one method which gives moderate to fairly high accuracy.
Conductivity of pure water is very low (approx. 5uS/cm). The addition of impurities increases the conductivity of water. The concentration of impurities can be calculated by measuring the conductivity of water samples. TDS meter is a commonly used instrument which measures the TDS using conductivity method.
In the existing methods, two electrodes are placed in the water sample and a sine wave of known amplitude and frequency is applied to one electrode. The received sine wave at the second electrode is compared with the applied sine wave to calculate the conductance. This circuit includes a Wein bridge oscillator to generate sine wave, an Op-amp based amplifier/comparator to calculate the relative gain (attenuation) of the received signal and an ADC to convert the calculated analog conductance value to digital. An MCU will be required to process/convert the ADC output to required format as well as the interface different user interface components such as Display, buttons etc.
Programmable System on Chip (PSoC) is the combination of MCU and configurable analog and digital blocks. PSoC includes DAC which can be used to generate Sine wave and configurable Op-amps which can be used to build amplifier/ comparator to calculate the relative gain of received signal. The output of the comparator can be fed to the internal ADC which can be read directly by the MCU. The MCU makes necessary calculations to convert the conductance value to TDS value in ppm which can be output to a display.
PSoC includes built-in driver for LED and LCD displays, which can be used to interface a Segment LCD, Graphic LCD or Character LCD for displaying the TDS value. PSoC additionally supports CapSense technology, which can be used to implement buttons, sliders Proximity sensing etc. Another feature available in PSoC is BLE radio with a royalty-free BLE stack which could be helpful in building wireless TDS sensors.
Theory of Operation.
As mentioned in the previous section, TDS can be calculated by measuring the conductivity of water sample. Conductivity, the reciprocal of resistance, can be measured directly using an Ohm meter in solids. However, the measurement of conductivity in fluids is not quite as straight forward. Ohm meters (or voltmeters) pass a DC current between two electrodes to measure the resistance. In water, the conductivity is caused by the dissolved salt molecules. DC current injected by the voltmeter or ohm meter will cause these molecules to break down (ionize) and migrate to the electrodes. The conductivity value measured will be keep on varying, thus making the reading useless. This limitation can be overcome by passing an AC current instead of DC current. When the frequency of the AC signal applied is sufficiently large (> 5kHz), the molecules no longer break down, thereby giving a more accurate reading.
The conductivity measured need to be converted to ppm which is the more common unit used for TDS values. The conversion of conductivity to ppm may seem trivial, but in reality, this is not the case. There are many factors which decide the conductivity of water sample such as the type of dissolved solids, the material used for electrodes, the physical dimensions of the electrodes, the spacing between electrodes and so on. To standardize the measurement, the conductivity values (EC) are measured using two probes spaced 1cm apart and the value is expressed in terms of uS/cm. The EC value measured can be converted to ppm by multiplying with a conversion factor, depending on the type of dissolved salts. Since the type of dissolved salt is unknown in most of the cases, the conversion factor of 500 for NaCl is most commonly used in TDS meters. Thus 1 us/cm of conductivity measurement corresponds to 500 ppm of TDS.
Another important factor which affects the conductivity is the temperature of the water sample. The conductivity of water sample increases with temperature since the mobility of molecules or ions increases. It is essential to measure the temperature of water sample and to include temperature compensation in the calculation.