TDS measurement.

I have a Deonisation unit for water that needs periodic regeneration.

I wish to automate this.
I can handle the control side but am not so sure about measurement.

I do not need an absolute value (although this may be useful during the regeneration process) just a switch that indicates when the water has a conductivity of 15 uS or more.
I gather that this low conductivity would be difficult to measure directly.
Searching the net most circuits i see require a hardware solution.

The regenerant solutions are also highly ionic so flushing to achieve low residue is likely to be needed to ensure accurate results.

I am thinking that ph sensors may be needed also.

Hi,
First, you have to make the conductivity measurement in a working system, right??

So: What conductors are unavoidably there? Typically water systems are connected to building ground through various piping. Or is your system totally isolated from ground?

I made a "conductivity Meter" as a high school Chemistry project but it was battery powered. And 50+ years ago!

You might research Arduino-based soil moisture measurement circuits. That would usually be a LOT more conductivity. But selectively applying 5 volts through 1 megohm or more and reading with an Arduino Analog input which is many megohms might be workable. You would have to characterize the Arduino values against samples of water measured with conventional instruments.

Hopefully someone knows more...

Currently i use a cheap 'water stick' commercially available for drinking water.

They use conductivity measurement.
Different dissolved solids require different conversion factors though.

Unexpected dissolved solids like salt or acid throws the readings considerably.
Regenerants typically are sodium hydroxide salt and hydrochloric acid.
Salt regenerating domestic softeners are unsuitable as i require super pure water that only the anionic/cationic resins can supply.

I think that a simple conductivity measurement will give me the GO/NO go use of the supplied water.
This will me a very low value however and i am not sure how that is measured, i believe that AC measurement is required..

I would try a 50% PWM signal, connected to one electrode, via a series circuit of a 1k resistor (pin protection) and a 100n cap (DC removal).

And a 2x ~100k voltage divider, connected to an analogue pin.
One resistor from 5volt to A-in, one from A-in to ground.
With a ~10k resistor (pin protection) and 100n cap (DC removal) series circuit going to the second electrode.

The analogue pin should now have a reduced p/p voltage, depending on conductivity.

Software could also be:
Make output pin high, measure/update A/D value, make output pin low, measure/update A/D value, etc. etc.
The difference between the A/D values is conductivity.
Leo..

Thanks, i will have a play tomorrow.

10 u siemens corresponds to about 100K though.
From memory arduinos are not much good on their own for much above 10K without external circuitry.

100k is not that bad if you don't mind readings to be off by a few A/D values.
You can always try two consecutive readings, and only use the second one.

I could only find one DIY TDS circuit diagram on the net (in many places).
This could be an interesting Arduino project. Keep us updated.
Leo..

I did find this which uses a microprocessor.

http://www.nipne.ro/rjp/2011_56_3-4/0540_0549.pdf

Looks good for municipal water but does not give the lower reading i require.

Some experimentation is needed i think.
Had a water stick apart and given the cost i was a bit surprised at its complexity.
I was expecting a single chip solution.

Interesting paper.
They use discharge time of a small cap with the conductivity of water.
Could potentially give a higher resolution that the voltage method I described.
Leo..

Possibly, it also takes care of the eloctrolosis problem that can arise above 1.23V.

They purposly selected the pic for its features but i wonder if adding a shmitt triger and using the arduino comparator input may work.

3n3/100k has a time constant of ~330uSec.
Don't know how fast an Arduino can switch between input and output, maybe with custom code.
Maybe a programmer (not me) can answer that question.
Leo..

"Don't know how fast an Arduino can switch between input and output"

I'd say pretty fast
pinMode (pinX, INPUT);
pinMode (pinX, OUTPUT);

or
DDRD = DDRD & 0b11111011; // clear bit 2 for PortD data direction register
DDRD = DDRD | 0b00000100; // set bit 2 for PortD data direction register
tho I forget whether high or low defines input or output.

1 is Out
0 is In
Go figure, the opposite to what is intuitive.
:confused:
.

Wawa:
3n3/100k has a time constant of ~330uSec.

Leo..

That correlates with the suggested min frequency of 3KHz.

Resolution of micros() is 4 microseconds though and i am not sure if its good enough to make the measurment.

I suspect you are on a path towards timer 1 running free (no prescaler) using input capture. That gives you a granularity of 1 / F_CPU.

I believe Nick Gammon has just what you need on his site. There is also a "measure capacitance" thread on this forum that may have what you need. One of Paul Stoffregen's frequency measurement libraries would also make a good starting point. And, the otherwise worthless True Random library would make a rough starting point.

Thanks, useful stuff there.

Will i need to build this on a pcb do you think, i suspect that a breadboard and stray capacitance effects may be important.

Afterthought,

Im away from my PC at the moment, can anyone say if the comparator has a schmitt trigger input please ?
I have not used it before.

Boardburner2:
Will i need to build this on a pcb do you think, i suspect that a breadboard and stray capacitance effects may be important.

Given the necessity to calibrate I don't think it will make any difference. If the stray capacitance is high enough you may even be able to forgo an actual capacitor. (Though I don't recommend that.)

Obviously, if the project is moved from one to the other the stray capacitance will be different requiring another calibration.

Boardburner2:
Im away from my PC at the moment, can anyone say if the comparator has a schmitt trigger input please ?

I assume you are referring to the internal AVR analog comparator. It does not. The way it is typically used has the side effect of being like a Schmitt trigger.

However, I don't think the comparator brings much if anything to the table.

I think it can be used as an interrupt source.
I was hoping to keep components down but an external schmitt trigger would do.

AVR digital pins already have a Schmitt trigger. Why would you need an external one?