Why not simply use 3.3V for the water detection electrodes?
If you're that worried about corrosion, then use AC, rather than DC. Make one electrode 0V and send a square-wave to the other one, via a capacitor and high value resistor. Monitor the voltage on the electrode and if the square-wave falls to 0V, that means it's detected water.
hsn93,
This is overcomplicated. I don't see why there's a requirement for 24V. Just connect one of the electrodes to an output on the MCU, via a resistor. A small capacitor to filter out any noise is also a good idea.
The values of R1 and C1 are experimental.
If you want to sense the resistance of something, a good way is to charge a capacitor through it and see how long it takes to charge. Therefore I suggest to use 2 pins of your MCU. One for each side of the sensing probe. Configure one as an output and the other as an input. Ideally make the output a timer PWM pin and the input a timer input capture pin. Put a capacitor from the input to ground. Then as another (high-ranking) poster suggested, output a square wave. Measure the phase delay of the square wave coming back (treat as infinite if no square wave comes back).
cheers, Nick
It can be done with one MCU pin, toggled from high to charge capacitor, to input with a high impedance, when the voltage on the capacitor is monitored. When the electrodes are dry, the capacitor should be charged for a long time, only discharging slowly via internal leakage and the MCU input. When electrodes are wet, the capacitor will discharge fairly quickly, through the water.
hello Hero999, thank you.. i think its good idea to measure with two pins, once im sure there is water i can pull both pins to ground eliminating the potentional between electrodes. having water to the sensor is abnormal and when it happens it will need intervention from service. thats why i dont need to measure the water all the time and can do it once every 5 minute and then pull two pins to ground.
the thing is that im always afraid to expose mcu pins to outside board thats why i was putting the 24V with a high resistance on series.
but i guess its safe? i will just put 3v3 zener on both pins to ground and should be ok (i assume
).
BTW, that link from analog devices doesn't work but i will search for it from the keywords. thanks.
Hi hsn93
You haven't asked this, but I seem to remember that stainless steel as a resistive water level sensor has problems and other materials are more appropriate.
There are a number of ways to detect water level, but the best compromise, in my opinion, is to use insulated terminals and capacitive sensing. If you are interested in this approach we can discuss- the circuitry is well proven, simple, and low cost.
hello, I'm always interested to learn, what are the other materials. the thing is that this sensor is going to be for abnormal situation so i thought a cheap way to do it (im not expert). so would that simple circuitry be simple for me also..
To prevent electrolytic corrosion, neither electrode may have a DC path to ground, so both must be isolated by a transformer or capacitors, or the whole sensing circuit must be galvanically isolated, and use balanced AC excitation.
Even if DC bias is time or current limited, it *will* cause electrolytic corrosion of the electrodes. The only question is: how much? If the electrode surface area is large enough and the average current low enough, you probably be able to get sufficient electrode life to be practical.
However there is another problem with stainless electrodes - pitting aka: crevice corrosion, as it has two different electrode potentials depending on whether or not its surface chromium oxide layer is present. In an aerobic environment, the chromium oxide layer maintains itself and protects the iron component of the alloy from rusting. In an anerobic environment, the chromium oxide layer becomes depleted then the iron is free to rust. It only takes a little inter-granular corrosion due to electrolytic action (e.g. due to DC bias or dissimilar metals with an electrical connection, immersed anywhere in the system) , providing a microscopic pit or crevice, a bit of lime scale obscuring the pit and some trace organics to tip the balance towards an anerobic environment at which point the stainless eats itself, forming an electrochemical cell between the anodic crevice and the cathodic exposed surface, preferentially eroding the metal in the pit or crevice. I've personally seen a stainless pump shaft eroded by crevice corrosion that over the course of one winter without use, lost a chunk of metal about the size of a large split pea from under a lip seal leaving a sharp edged pit , leading to immediate failure in the spring the first time the shaft moved.
You'll probably get away with DC bias if the electrodes are rarely immersed, and are mounted protruding downwards from a very smooth surfaced PTFE or HDPE plate, with no supports or other parts touching the electrodes except at their mounting plate so biofilm buildup between the electrodes is limited. Ideally the mounting plate should *NEVER* be immersed.
very informative thank you. I'm having the sensor rarely immersed. but once it is. (i don't know how much it will stay immersed) since this needs intervention from service team. so what if i put both outputs to ground once the water is detected. (yes its planned to have the two electrodes between PTFE in distance of 20mm).. although I'm weak at chemical and corrosion but I've seen way before so i thought i will need some plastic that will not be affected by waste water.
Here's a LTspice sim of a rearrangement of the squarewave sensor drive idea to eliminate DC bias at the electrodes. A practical implementation could use a MCU with a PWM ouput and an analog comparator input, or for a standalone implementation, a dual comparator, one half as the 50% duty cycle squarewave oscillator, and the other as the threshold detector on the charge pump output.
thank you i will look and study. capacitors dc coupling was always a question mark for me im not good with analog. so i have to study that effect of c1 and c2 and imagine what will happen (basics but im newbie)..
a question, having c1 and c2 with high Voltage rating will be protected input, outputs (with zeners after them)? (galvanic isolated) ?
================================================
hello everybody thanks for your valued replies it teach me a lot.
from different comments i get that:
-capacitive sensing is more correct way to do it.
-water conductive method is not very good because of corrosion. (to use AC is ok)
-my application has (vibration and waste water feces / or tab water).
-having water to the electrodes is abnormal situation in my application.
-thats why i though to remove the potential difference by having HI-Z on the output of one electrodes (once i detect the water). (do i still need to have AC?)