News:

;) This forum is the property of Proton software developers

Main Menu

Back on the old probe sensing question

Started by TimB, Mar 20, 2023, 02:09 PM

Previous topic - Next topic

TimB

Hi all

I'm back on the water level probe sensing issue.

The set up I have is very accurate but does not cope well with changes in resistance in the water I'm testing.

Due to tracking in some cases the top conducts more than the bottom probe and sometimes its the other way round. The only thing you can be certain of is there is a big jump in conductivity when the water connects the probes.
I have tried getting a reading across the top gnd line and the bottom probe to try and make sense of the signals to figure out what is happening but while it kind of worked it was not 100% reliable with normal water but did not work with Pure water

The only solution that worked reliably was an external 3rd party sensor strapped to the out side. The logic was if the 3rd party level sensor saw water then I can be sure the bottom probe was in water and could work out a threshold and if the 3rd party sensor did not see water then I can work out the top threshold.
 
I needed to run through a sequence to force the water up and down past the 3rd party sensor on start up but once that was done it would self adjust as the thresholds were calculated all the time.

However strapping a sensor to the out side is not elegant and a pain.
I have used a IR led and sensor that sat in the vessel and when the water covered them I could detect the presence and that worked ok but botching holes in my vessel is not ideal and the wires were a pain.

So what Ideally I need is a system that either is way more reliable to detect the presence of the water (very low resistance most of the time) using some system or a way to get crude water level detection using one of the existing probes.

The issue is that the resistance connected and not connected changed a lot. The only thing you can be sure if is that there will be a big jump IF you can work out at the start what the conditions are.

NOTE I can connect the Drive lines to the pic

PLEASE DO NOT SUGGEST SENSOR  LIKE TIME OF FLIGHT OR OTHER SUCH DEVICES I HAVE TO USE PROBES

WL Sensor.png


trastikata

Hi TimB,

can you give more information about the probes? Can they be used for capacitance measurements or as part of an oscillator?

TimB

#2
Hi trastikata

The Sensing Probes are pointy Stainless steel screws and can be VERY finely adjusted

The "Vsupply" probes are just flat ended screws

Yes I can modify the schematic to what ever I'm happy to do anything but cannot change the pointy probes and the others really need to be kept to the m3 screws I'm currently using

The pic is currently a 16F1823 and is an 12c slave

trastikata

Quote from: TimB on Mar 20, 2023, 02:26 PMThe Sensing Probes are pointy Stainless steel screws and can be VERY finely adjusted

The "Vsupply" probes are just flat ended screws

I am not sure what would be the capacitance between those electrodes, but water can hold a charge for a brief period and can be used as a capacitor.

Maybe this thought is worth pursuing and investigating since the dielectric constant of water is about 100x that of air.

TimB


Hi

I agree the the capacitance between the probes would be just about non exitance as the surface area is very small and the distance large.

As for the storing of a charge I'm not sure there would be any I could measure.

In my current system the top +5v prove is actually longer and I drive the lines in a way to test the voltage across the 3 probes

eg

Drive Bottom non pointy probe
Measure voltage at Bottom pointy Probe
Measure voltage at Top drive (middle) probe
Make Bottom None pointy probe (middle) an input

Drive Top drive probe (middle)
Measure voltage at Top pointy probe

Using this figures I worked out and algo that would presume that the Bottom voltage would be higher than the voltage at middle due to the greater distance

It worked 99% of the time but as soon as I changed to pure water the top had a higher voltage than the bottom even when the bottom was under water.

The only thing you could be certain of was that there is a big change from no water to water. BUT you need to know before hand if the water position hence the 3rd party sensor


rick.curl

#5
Hi Tim- My biggest concern about measuring the presence of liquid using DC is that over time you will get corrosion. Here's a circuit I have used for many years.  It applies AC to the sensing electrodes. 
This works well from distilled water to very contaminated water.  Drive it with PWM out of the PIC.  Frequency is not important.  Duty cycle should be 50%

-Rick

Sorry- Can't get the image to show up.  I'll email it to you.

dr-zin

Hi Tim,

Sorry I'm reading this weeks too late.  Yes, pure water has extremely high resistance.  Indeed, ordinary DMM's that have a resistance scale that maxes out at 20 Mohm will just peg.  Sophisticated meters that use conductivity measured in Siemens (milli or micro) are used in industry to measure distilled water.  If you are collecting rainwater, it can be quite pure, although it can absorb a tiny amount of CO2 in the air to give ions.  If you experience erratic resistance due to sample variations, try adding just a few granules of table salt to your collection tube.  Baking soda also works or a drop of vinegar.  It takes a tiny amount and will give a more standard variation in your results.  If you use a solid and your tube dries out, the powered salt will remain and reactivate the next rain collection.  If you drain and clean your tube between samples, you will have to repeat and process and may have to calibrate your readings again.

BTW, have you tried running 2 lengths of nichrome wire that have several ohms of resistance/ft [or meter] from top to bottom of your collection tube?  Use the above ionized water or fluid to short out a portion of the resistance of the lengths of nichrome that is submerged and measure the remaining resistance to compute the level of the liquid?  Might work for you...

TimB

Thanks for the reply

The water is pure steam condense and has a very high resistance. If it were always reading water of that resistance I could hard code the threshold levels. However the issue is that I cannot be sure what crud might turn up in the system.

From the tap water I put in when I calibrate the volume to a slug of something that has been sitting in a pipe for weeks

I think I have a solution, basically I have 4 probes

1 Right at the bottom that will be always in water. (Drive)
1 That is the bottom sensing probe connected to the ADC and that can be Driven
1 In the middle that is connected to and ADC and can be driven
1 Right at the top that is connected to and ADC

By running a sequence of driving pins and reading ADC values I can build a picture of what is happening without ever using a hardcoded threshold

It runs a series of tests and then calculates the thresholds on the fly

Not that I think it will be of use to people but here is the code I use to analyse the results

    ProC AnalyseProbes()

        Dim bNoWaterCounter as byte
        DIm cNoWaterCntValue as 10

    ; Work out a viable +/- set of values to make a range for the middle probe
        ; MiddleProbe
        If wMiddleADC > cProbeMinMaxChng then
            wMProbeMin = wMiddleADC - cMProbeMinMaxChng
        Else
            wMProbeMin = 0
        Endif

        If wMiddleADC < (1023 - cProbeMinMaxChng) then
            wMProbeMax = wMiddleADC + cMProbeMinMaxChng
        Else
            wMProbeMax = 1023
        Endif


        ; Work out a viable +/- set of values to make a range for the Top probe
       ; TopProbe
        If wTopADC > cTProbeMinMaxChng then
            wTProbeMin = wTopADC - cTProbeMinMaxChng
        Else
            wTProbeMin = 0
        Endif

        If wTopADC < (1023 - cTProbeMinMaxChng) then
            wTProbeMax = wTopADC + cTProbeMinMaxChng
        Else
            wTProbeMax = 1023
        Endif


    ; Look at the results and work out probes

        bWLStatus = cNoProbes

        If wBottomADC >= wMProbeMin and wBottomADC <= wMProbeMax then
            ; if we have previously worked out the threshold then
            If wTopThreshold > 0 then
                ; if the value is > calced threshold
                If wTopADC > wTopThreshold then
                    ' Set the flags to say boottom middle and top are seen
                    bWLStatus = cBtm_Mid_TopProbes
                    bNoWaterCounter = 0
                    ExitProc
                Endif
            Endif
        Endif

        ; Check if Bottom probe is is same as middle +/- range
        If wBottomADC >= wMProbeMin and wBottomADC <= wMProbeMax then
        ' Yes so now check if Bottom probe is > expected max top
            If wBottomADC > wTProbeMax then
                wTopThreshold = wTopADC + cProbeStepChng
                wBottomThreshold = wBottomADC - cProbeStepChng
                bWLStatus = cBtm_MidProbes
                bNoWaterCounter = 0
                ExitProc
            Endif
        Endif

        If wBottomADC > wMProbeMax and wBottomADC > wTProbeMax then             ' if bottom probe higher than max middle and max top then                                                                               ' Looks like only Bottom probe is active
             wTopThreshold = wTopADC + cProbeStepChng
            ' We are clear here that the bottom probe is set
            bWLStatus = cBtmProbeOnly
            bNoWaterCounter = 0
            ExitProc
        Endif


        If wBottomThreshold > 0 then
            if wBottomADC > wBottomThreshold then
                bWLStatus = cBtmProbeOnly
                bNoWaterCounter = 0
                ExitProc
            Endif
        Else
            bWLStatus = cProbesNoteSure
        Endif

        ' Before we use the buffer counter we will try another method to double check if the there really is no water


        ' if we get to here it looks like we have no water, however it will do no harm to make say 3 passes and if they all say no water we will let it slide

        If bNoWaterCounter < cNoWaterCntValue then
            inc bNoWaterCounter
        Else
            bWLStatus = cNoProbes
        Endif


    EndProc


dr-zin

Oh, I see.  You are looking for low/med./high threshold levels rather than exact volume heights.  I thought you were collecting and logging rain water levels for a weather station-type application.  Guess I should read more carefully...  Hope your solution works in your application.  --Cheers