Hello everyone
This is my frits post on the forum, I use an arduino uno.
I want to measure three different levels in a water tank
with the analog input A0. A resistor R1 in series with
the electrodes polarizes the sensor. The measurement is
taken at the midpoint.
I apply 5V on D2 and 0V on D8, we measure the voltage on
A0 20mS for exemple.
I apply 0V on D2 and 5V on D8, we measure the voltage on
A0 20 mS.
I reset D2 and D8 to 0V for a long time (the system can
remain on standby for several hours). Of course we will
get two different voltages, but with a calculation it
should be possible to detect the water between the
electrodes, as long as the resistors R1, R2 and R3 are
known.
The objective of the sampling is to avoid electrolysis
of the water and the change of polarity to prevent an
oxide deposit on one or the other of the electrodes.
When the system is not on standby the water is very
quickly renewed.
My problem is that I don't know much about electronics,
I can't determine the values of R1, R2 and R3 to have enough
sensitivity on A0 and not destroy my arduino.
All your voltage sources come from digital pins of the Arduino itself. Therefore, there is no configuration of connections that can damage the Arduino. The only thing that could, is connecting two outputs together, but I think you are smarter than that. The resistance of the water and electrodes is very hard to estimate, so there are no resistor values that can be calculated properly. This is actually a problem, because there will be too much uncertainty in the readings to know which electrode is active. You could calibrate it in situ, but there is no guarantee that the values won't drift significantly with electrode and water chemistry.
The greater the ratio between the resistors and the tank resistance, the better. So begin by using megohm values.
To begin with ------ see if you can get some resistance measurements for assessing whether or not you can get resistance values that are going to be workable for this system.
For example, grab a multimeter and see what resistance values you get between the middle level terminal and the common terminal of your tank system. And then do it for the low level terminal and common terminal.
For the moment ----- having just a few terminals (low, medium, high) won't provide fantastic resolution of water level. But knowing what we got for resistance values (or changes in resistance values) will definitely help to begin with.
Do mind that beyond a short proof of concept science fair kind of project, this is pretty hopeless as the current will make your probes corrode very very fast.
You can improve on this by connecting the common to a digital pin, setting it to INPUT to switch off the current when not in use. Still that doesn't make it a reliable long term solution. For that, use float switches.
The “ resistance” of the water is a tricky one as it may ( not sure here) a voltage caused by the electrode / water interface , then the bulk resistance of the liquid ( which could change depending on its purity ) , so it’s not a great method using electrodes .
Having said that I’d try values in the range of 10k or so . You don’t need the first resistor connected to the Arduino .
Float switches are good and simple , or a tube with Reed switches in it , surrounded by a float with a magnet in it .
True! And if assuming the resistivity of this particular liquid or water stays pretty much the same ----- then the measuring device has a way to do some calibration. But if the liquid somehow changes resistivity, then a resistivity measuring system could become inaccurate. And as other people mentioned - if electrodes corrode, then resistance measurements can change too.
I carried out some tests with demineralized water and water saturated with salt,
resistance R1, R2 and R3 100 kOhms,
I inject 10mSec current on D2 I cut 30 Sec I then activate D8 10mS I cut,
I calculate the difference of the two measurements and I obtain a stable
and repeatable result.
The low level gives me an int = 300 + -30 the medium level int = 500 + -30
and the high level 700 + - 30.
The electrodes are titanium screws, the current injection lasts 1/3000 of the
time and the polartity reversal at the terminals of the electrodes is allowed
after 72 hours not to notice any corrosion.
I have time I let the system run.
Thanks for your help
Those readings just don't make sense. It is impossible for them to be the same for demineralised water and brine. The water is the second half of your voltage divider, so in case of demineralised water this part should have a very high resistance (pure water does not conduct electricity) and in case of brine it should be very low. The difference between the two should be at least 8-10 orders of magnitude.
So you getting the same readings for salty water and pure water doesn't make sense at all.
Pure water certainly does conduct electricity! However its millions of times worse at it than strong
ionic solutions like strong acids, alkalis or brine.
Just had to say that to stop someone thinking its safe to mix electricity with water in certain
situations. Once there's any voltage applied across water, ions start disolving in the water,
lowering its conductivity, in a spiral of corrosion.
Any pure water exposed to the air becomes a better conductor due to CO2 dissolving into
it from the air, so the nominal conductivity of "pure water" is not seen in practice outside
a carefully designed experiment to measure it!
As I explained before.
I do not measure direct conductivity !!!
Of course that the direct values change a lot,
but the subtraction of the positive measurement
and the negative measurement it remains
approximately the same result.
For the corrosion problem I only inject current for
my measurements 10 minutes a day.
Regarding the ionization of water in my project
the content of the tank is renewed every hour.
10 minutes divided by 24 hours gives 25 seconds
of electrolysis per 100 liters of water with a very little
source of current.
and for the electrodes, the polarity reversal avoids
the destruction of one and the electrolytic deposits
on the other. The volume of each and the choice of
titanium allow me to think that it can take a few years.
But no one has the science, especially not me,
but it works, let time be.
As I explained before.
I do not measure direct conductivity !!!
Your circuit involves a resistance due to the water, and as that could vary over orders of magnitude, its
relevant as to whether your circuit functions at all... The values of the fixed resistors is dependent on
knowing the range of values of the water resistance in your setup.
Your whole measurement system depends squarely on the water being conductive. You may not try to read the conductivity from your measurements, it is an integral part of the whole process. The readings you see - the fact that you get readings to begin with - depend on it, and will vary with it.
Your polarity reversal is a bit too slow to stop corrosion. Try 10 kHz. That will do.