EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: Simon on March 10, 2010, 07:00:26 pm

Title: detecting water
Post by: Simon on March 10, 2010, 07:00:26 pm
ok this post is part academic but if a simple solution is found I may impelment it (just to show the idiots at work what an ass we made of ourselves in choosing the supplier)

Now we (my company) design and build air conditioning for vehicles, we have units that had a problem with condensation turning the air con into a shower ! so two small pumps were installed to pump out condensation from the bottom of the unit, the pumps came with sensors that go in the base so that when water is between the electrodes in the sensors the pump that has sensing electronics starts pumping the water out.

Just one snag these stupid things just pump at any random time until they run dry ! and burn out due to overheating.

Now I heard the guy that supplies these saying something about the circuit in the pump turning the DC to AC so assume a section of the circuit is generating pulses for another section to pick up, this now means that when one pump goes off the other one in the same unit (there is a left and right pump) also goes off, it would seem in his opinion that one pump is picking up the signal iradiated by the sensor wire of the other (like arials).

Surely this is simple ? to detect water isn't it sufficient to have a DC detection method that will use the small current passed by water to say run the base of a darlington transistor so that it can then set off other circuitry ? like a mosfet ? or is there something really that tricky about picking up water.

I'm going to have a play around myself - any comments welcome
Title: Re: detecting water
Post by: Simon on March 10, 2010, 07:20:11 pm
well I have carried out an initial test: according to my meter the resistance of water with probes about 10mm apart varies from 2 Mohms  with just tips imersed down to 700 Kohms with all of the bare probes submerged, so there looks like room for being selective about the depth of water before "ignition" the other thing is though I'm using tap water, now that's not the same as ondensed water is it ?

Tap water = H2O
condensed = HO

any ideas ?
Title: Re: detecting water
Post by: Simon on March 10, 2010, 08:29:18 pm
well using tap water a single 2N2222 Transistor is sufficient to get a led to light, so there we have it !

only thing is that my wire (breadboard jumper) in the water on the negative side has tiny bubbles rising from it, i suppose some sort of reaction , am I desolving my "probe" or just putting electrons into the water ?

I expect to get this to work properly I would have to introduce a comparator so that I have a determined on/off at a set level of water
Title: Re: detecting water
Post by: rossmoffett on March 10, 2010, 11:41:49 pm
Pure water is non-conductive, it must have some salt or sediment in it to conduct.  You may find that method unreliable with increasingly pure water.

Typically a water detector will use two plates and check capacitance between the plates.  I have a friend who designed soil moisture sensors this way.
Title: Re: detecting water
Post by: Simon on March 11, 2010, 07:48:33 am
well it should be pure water as it is condensed water but from what I have seen of the units in operation there is dust/sand in the water collecting tray
Title: Re: detecting water
Post by: DJPhil on March 11, 2010, 09:13:40 am
I recently did a bit of research into rust removal and the like, so I might be able to help a bit.

All manner of water you will experience in nature is essentially H2O with impurities. Water is very stable chemically as H2O where as HO is highly unstable and very eager to bond with something, so you won't encounter it under normal circumstances. Condensation can be more or less pure than tap water, it really depends on what else is in the air with it. I would guess that unless you are heavily filtering the air before it's allowed to condense you are likely to have enough impurities to sense it's presence with electricity.

As for sensing water there's a decent writeup here (http://freecircuitdiagram.com/2008/11/25/lm1830-single-chip-water-level-sensor-circuit-basically-a-conductive-liquid-level-sensor/) about the LM1830 from National Semiconductor (datasheet (http://www.datasheetcatalog.org/datasheet/nationalsemiconductor/DS005700.PDF)) which is designed as an all purpose fluid level sensor IC. The application hints on the datasheet are excellent, and include electrode calculation and sensing other fluids as well as a heap of example circuits. It's possible that this is the actual IC used, you might be able to reverse engineer their sensor box if they haven't moisture proofed it with black goop. It might be properly designed, but it's probes are shorting somewhere or it's calibrated incorrectly and always thinks it's in a puddle. If you can find a problem with it you might have some good evidence to bring to your supplier, after all, you're doing their engineering for them!

The bit about the AC signal involves extending the life of the probes used to detect the fluid, helping reduce galvanic corrosion (http://en.wikipedia.org/wiki/Galvanic_corrosion). Galvanic corrosion and electrolysis (http://en.wikipedia.org/wiki/Electrolysis) are closely related electrochemical concepts dealing with how electricity, metals, and conductive fluids interact. The bubbles you saw from your breadboard negative side (cathode) were hydrogen gas, the other conducting lead (anode) will produce half as much oxygen (remember, H2 O1). This is basic electrolysis of water (http://en.wikipedia.org/wiki/Electrolysis_of_water), and the presence of that oxygen in particular helps corrode the anode. Sometimes that's desireable, as with electrolytic rust removal (http://www.instructables.com/id/Electrolytic-Rust-Removal-aka-Magic/).

Hope that helps some. Please let me know what you learn solving this, I'm actually planning to build an overflow sensor in a future project. :)
Title: Re: detecting water
Post by: Zero999 on March 11, 2010, 09:36:01 am
Well I think you now know why DC shouldn't be used: it causes electrolysis, AC doesn't.

The problem is that if a high frequency is used and the cables are long, capacitive coupling might cause false triggering.

The only solution is to keep the cable as short as possible.

Not that it matters because the circuit used to detect moisture is so simple that it can be made from SMT components, potted and put on a tiny PCB at the end of a long piece of cable.

If a hex Schmitt trigger IC is too large, a tiny dual Schmitt trigger is available.
http://focus.ti.com/lit/ds/symlink/sn74lvc2g14.pdf

You should be able to get a dual diode which will save space.
Title: Re: detecting water
Post by: Simon on March 11, 2010, 01:00:26 pm
I recently did a bit of research into rust removal and the like, so I might be able to help a bit.

All manner of water you will experience in nature is essentially H2O with impurities. Water is very stable chemically as H2O where as HO is highly unstable and very eager to bond with something, so you won't encounter it under normal circumstances. Condensation can be more or less pure than tap water, it really depends on what else is in the air with it. I would guess that unless you are heavily filtering the air before it's allowed to condense you are likely to have enough impurities to sense it's presence with electricity.

As for sensing water there's a decent writeup here (http://freecircuitdiagram.com/2008/11/25/lm1830-single-chip-water-level-sensor-circuit-basically-a-conductive-liquid-level-sensor/) about the LM1830 from National Semiconductor (datasheet (http://www.datasheetcatalog.org/datasheet/nationalsemiconductor/DS005700.PDF)) which is designed as an all purpose fluid level sensor IC. The application hints on the datasheet are excellent, and include electrode calculation and sensing other fluids as well as a heap of example circuits. It's possible that this is the actual IC used, you might be able to reverse engineer their sensor box if they haven't moisture proofed it with black goop. It might be properly designed, but it's probes are shorting somewhere or it's calibrated incorrectly and always thinks it's in a puddle. If you can find a problem with it you might have some good evidence to bring to your supplier, after all, you're doing their engineering for them!

The bit about the AC signal involves extending the life of the probes used to detect the fluid, helping reduce galvanic corrosion (http://en.wikipedia.org/wiki/Galvanic_corrosion). Galvanic corrosion and electrolysis (http://en.wikipedia.org/wiki/Electrolysis) are closely related electrochemical concepts dealing with how electricity, metals, and conductive fluids interact. The bubbles you saw from your breadboard negative side (cathode) were hydrogen gas, the other conducting lead (anode) will produce half as much oxygen (remember, H2 O1). This is basic electrolysis of water (http://en.wikipedia.org/wiki/Electrolysis_of_water), and the presence of that oxygen in particular helps corrode the anode. Sometimes that's desireable, as with electrolytic rust removal (http://www.instructables.com/id/Electrolytic-Rust-Removal-aka-Magic/).

Hope that helps some. Please let me know what you learn solving this, I'm actually planning to build an overflow sensor in a future project. :)

thanks for all you helpful info. unfortunately these sensors are comapny property and I'd need to take one home to properly analyze it (maybe swipe one this weekend) It's a case of getting the labels off to unscrew the box, the circuit is not protectd so easily accessible
Title: Re: detecting water
Post by: PetrosA on April 05, 2010, 03:06:36 am
This sounds like some serious over-engineering to my layman ears. Wouldn't it be easier to just let gravity rid you of the water? If there's enough of a bottom in the unit to collect water for a pump, shouldn't there be enough to drain it?
Title: Re: detecting water
Post by: Simon on April 05, 2010, 07:49:52 am
alas you are right and yes this is dick head over engineered. I think part of the problem is that it is a military vehicle so you can't just drill a hole in the side to put a drain tube through that would be the eaiest by far. they want the water to go up and out the roof where there is already a hole for other stuff.

I did actually get that fed up that I took one of the pumps apart and I'm highly baffled by the diagram I worked out. To be blunt it is utter giberish, the only part that mkes sense is the mosfet/pump driver circuit, the "AC" is not rectified and it looks like the pic's own clock is being used as the signal but it seems tied to VCC via a resistor, basically a real mess, frankly I can't explain how it can possibly work at all let alone work. I'm positive this guy possibly did not design them but if he did he is an asshole !

I'd love to go over the thing with a scope but I can't as it's not my job to trouble shoot this thing just send them back wen found faulty.

my main gripe is that I cannot identifiy a distinct "ouput" and a distinct "input" and assuming he is using the clock of the pic as the signal it is not being retified
Title: Re: detecting water
Post by: saturation on April 16, 2010, 07:48:26 pm
Capacitance seems to be a reliable method to detect water.

A comparator circuit can be used to detect the difference.

Detecting resistance between 2 terminals has pitfalls, one being the electrolysis of ionized substances will cause deposits on the electrodes and foul the sensor.  But, many consumer products are made using conductance, and work well.


(http://ecx.images-amazon.com/images/I/31RXWIBu0%2BL._SS400_.jpg)

[edited, errors corrected, conductance not capacitance is more common in consumer water detectors ]
Title: Re: detecting water
Post by: Simon on April 16, 2010, 11:15:29 pm
well things have rather developed on these, as they have proven to be the cockup I have thought they were I was officially allowed to open one and take a look and report findings after showing the engineer (who really knows nothing of electronics) how I would design such a device.

So how does capacitive water detection work ? we do have the extra challenge of the water being contained in an earthed unit (vehicle chassy - negative), would the capacitive method be suitable for a moving vehile on rough terrain ?
Title: Re: detecting water
Post by: ElektroQuark on April 17, 2010, 05:47:24 am
Tap water = H2O
condensed = HO

Water is always the same H2O. The difference between distilled water and the rest is that distilled/pure water hans't any salts disolved in it. Disolved salts makes water conductive, tap water has them.
Title: Re: detecting water
Post by: Simon on April 17, 2010, 06:47:57 am
when your in the desert I think you will have water with lots of crap in it so no need to worry
Title: Re: detecting water
Post by: saturation on April 17, 2010, 02:27:43 pm
well things have rather developed on these, as they have proven to be the cockup I have thought they were I was officially allowed to open one and take a look and report findings after showing the engineer (who really knows nothing of electronics) how I would design such a device.

So how does capacitive water detection work ? we do have the extra challenge of the water being contained in an earthed unit (vehicle chassy - negative), would the capacitive method be suitable for a moving vehile on rough terrain ?


Hi Simon,

I think yes as its a common method to detect bilge water in boats.  See links.

http://www.ece.msstate.edu/classes/design/ece4512/.../water_detector/LastFinal.ppt

Basically you use some known way to measure water purity and use these phenomena to detect water's presence.

The easiest sensor to make is to detect conductivity.  

Pure ideal water has very low conductivity but its not zero.  Typically worst case is 20 megaohms/cm between the contact terminals; after that contaminants will raise conductivity.  In real world use, gases in the air, mainly C02, will dissolve in pure water easily and raise conductivity, so 'real world' water always has conductivity you can use to build an electronic detector.

However, for a permanent installation, you need a sensor that won't foul; eventually the contacts of a conductance probe will need periodically cleaning or changing.  To minimize fouling, design AC on the sensor probe to keep ionization minimal.  This sounds like your device, my guess is your sensor is dirty causing it to still be on without water or its too sensitive and sensing humidity in the container.   You could also have condensation inside the sensor or circuits, triggering it too.

Capacitance requires more work and circuitry.  The sensor is made of 2 parallel plates, and it compares water as a dielectric versus air.  The no-go state is when the capacitance plates have only air, and the go state is when any water, pure or contaminated, appears between the plates.  You want the sensor again to use AC, not DC, to prevent fouling of the plates.


Here's a sample circuit but I think it can be simplified still:

http://www.discovercircuits.com/PDF-FILES/capgage.pdf

Title: Re: detecting water
Post by: saturation on April 17, 2010, 02:45:57 pm
I typically don't build from scratch, but take modules and interface them together.

If I were to build your circuit, I would buy something premade then improve on it for reliability, such as this it runs between $5-10, I own 2 already.  Its main IC is CD 4069, both as the oscillator and the triggering circuit.

(http://www.basementwatchdog.com/images/water_alarm.jpg)

http://www.basementwatchdog.com/water_alarm.htm

You can easily tap this circuit, and improve on its probes.  The probes sense using DC.  This model is rarely advertised but its superior to the Zircon because its cheaper, its probe is removable, extensible can be inserted into small crevices.

DC is used in these consumer devices as 99.99% of the time, the device is dry, and in the standby mode, i.e., it has a fair low duty cycle.  Thus, the likelihood of the sensors fouling is fairly small, and it can easily be cleaned to be workable again.

But, in your need, it likely gets wet very often, and simply needs to shut off once all the water is pumped out.

Title: Re: detecting water
Post by: Simon on April 17, 2010, 03:33:09 pm
thanks for that link, so basically that highly solves my problem because we have an issue with the water being contained in a "ground" anyhow as the metal case the unit is made in is the vehicle chasis. I'm attaching the diagram I worked out of ous suppliers sensing circuit be not amazed it is the biggest pile of **** I have ever seen in my life, the sensor consists of a metal "U" stape peice of metal that has a small PCB in it holding 3 terminals and then the board is potted so you normally (when the idiot remembers to pot the thing) only see 3 terminals coming out of the potting compound. the things are tempremental at best. two of the probes are connected together, the use of 3 and not  2 still remains a mystery
Title: Re: detecting water
Post by: Simon on April 17, 2010, 04:41:56 pm
well having looked at the capacitive version you linked to I can see that this needs to be a little more complicated than what I or the supplier developed, We both used pic's and the reason being that the pump needs to run in cycles of 10 minutes on and 5 off to stop overheating, so the easy solution was a pic to run the timming (and yes he cocked that up too !). the capacitive method clearly need high impedence input circuitry that only op amps can provide as the beleive the pic ADC input is 250 ohms but in any case no higher than 10 Kohms. So while i would still need the pic I must introduce opamps, the convenient thing about the pic is that it will provide a 1 MHz output so saves some circuitry
Title: Re: detecting water
Post by: PetrosA on April 17, 2010, 09:28:44 pm
I had a thought - if you can use electronics to run this thing, why not have a probe measure ambient humidity which would control a programmed duty cycle for the pump? You could have maybe 3 or 4 duty cycles based on different ambient humidity levels and the pump would simply run by program instead of trying to figure out a dependable way to monitor the water levels inside the sump. It would also make maintenance easier since a humidity probe could be mounted somewhere relatively easy to reach. Just a thought...
Title: Re: detecting water
Post by: Simon on April 17, 2010, 09:36:50 pm
well firstly this needs to be inside the air conditioner unit anyhow so that the customer does not have extra work and we are certain that a malfunction is not due to poor installation. The other things is that if your sensing humidity you are not guaranteeing whether or not the sump has water in it and if the pump runs with no water it can overheat and burn out and makes a horrible noise when it runs dry as it is not a rotary pump
Title: Re: detecting water
Post by: XynxNet on April 17, 2010, 09:49:23 pm
Maybe you could try to measure ir-absorption (900nm+), if the water collecting facility stays reasonably dirt free..
Title: Re: detecting water
Post by: Simon on April 17, 2010, 09:54:18 pm
I would not guarantee it dirt free, I saw a bit of grit in the units after just a bit of testing let alone field use and I mean literally field use, desert field use at that
Title: Re: detecting water
Post by: PetrosA on April 17, 2010, 10:38:55 pm
well firstly this needs to be inside the air conditioner unit anyhow so that the customer does not have extra work and we are certain that a malfunction is not due to poor installation. The other things is that if your sensing humidity you are not guaranteeing whether or not the sump has water in it and if the pump runs with no water it can overheat and burn out and makes a horrible noise when it runs dry as it is not a rotary pump

I don't know how fast it fills up or empties and it's capacity would be a deciding factor, but my idea is this:

All programs would assume a full crew in vehicle (humidity to be removed from bodies)

Program 1 would work between 0-35% humidity and would work the least

Program 2 would work from 35-65% humidity

Program 3 would work from 65-100% humidity

Duty cycles would only start when the AC is on and could be a short as you want to maintain whatever spread of levels in the sump can be tolerated. It would take some testing to determine the optimum duty cycles, but I think it should work and be more dependable than a level sensor system.
Title: Re: detecting water
Post by: saturation on April 18, 2010, 02:24:30 am
thanks for that link, so basically that highly solves my problem because we have an issue with the water being contained in a "ground" anyhow as the metal case the unit is made in is the vehicle chasis. I'm attaching the diagram I worked out of ous suppliers sensing circuit be not amazed it is the biggest pile of **** I have ever seen in my life, the sensor consists of a metal "U" stape peice of metal that has a small PCB in it holding 3 terminals and then the board is potted so you normally (when the idiot remembers to pot the thing) only see 3 terminals coming out of the potting compound. the things are tempremental at best. two of the probes are connected together, the use of 3 and not  2 still remains a mystery

I'm short on time tonight just some quick thoughts on the schematic:

This design uses conductance to trigger the PIC by putting 5V onto pin 2.

This triggers Pin 7 to bias the MOSFET into conduction and the pump's negative terminal is now grounded. Otherwise, its floating?  Floating grounds often cause problems; if water and high humidity enter the chamber were the pump stays it could ground itself and bypass your switch, causing the device to not shut off. Its better to switch the positive side of the pump power supply.

Is this really an IRF540N MOSFET?  The symbol used is unusual.

(http://www.simreal.com/mediawiki/images/2/26/Fig06-02.jpg)


Title: Re: detecting water
Post by: Simon on April 18, 2010, 06:46:44 am
I'm not well up on mosfet symbols and the drawing software is the free express pcb one, it is indeed an IRF540N.

What is amusing is that he told our engineer that the circuit "converts DC to AC puts it throught the water and then reconverts it to DC and detects the water", I see no diodes ! except for power protectors, I think basically he is relying on the water to "pull down" the input pin but he has forgotten that pic inputs are not high impedence like opamp and comparator inputs, I've also seen what I hope is a prototype of this unit that our engineer gave to me to look at. he put the filter capacitor for the LM78L05 quite a distance from the reg with an extremely thin trace to it and has only used an input cap and no output cap, the input cap is 25 V for a 24 V vehicle system, very helpful ! basically I get the impression he is designing with the mind of a teenager that is learning electronics. I know I'm no expert and that sets me ahead, I don't try stupid things without researching them first, if he came on the web and had a little look around or even read a damn 78L05 datasheet he would have not made so many basic errors, we have paid £ 60 a peice for over  200 of these pumps and circuitry and have just had to declare them unfit for purpose with many of them already on vehicles that we will need security clearance to access because they are now armed and full of high tech electronics that the goverment does not like showing every tom dick and harry.

while this guy has spent 3 months trying to get the things to work amid lies about how he has the final fix I designed a perfectly competent solution in 2 evenings complete with cycling software !

another thought I had for a capacitance detector, what if i formed a potential divider on the sensor and a know capacitor and rectified the output and sent it to the ADC of the pic ? or maybe this project needs an opamp stage aded to it for high impedence inputs ? an opamp could be configured as a signal rectifier at the same time couldn't it ?
Title: Re: detecting water
Post by: Zero999 on April 18, 2010, 09:14:26 am
I have another idea involving capacitive detection.

Build a similar circuit to the one I posted previously but rather than using discrete capacitors, use two large metal plates coated in an insulating material, such as two planes on a PCB with solder resist on top.This has the advantage of not having any exposed metal electrodes to get corroded by chemicals. You could use a double sided PCB, one side for the water sensor, the other for all the components which will be potted.
Title: Re: detecting water
Post by: Simon on April 18, 2010, 09:27:47 am
so if the electrode are coated they will still act as a capacitor ? that would be very good as it would eliminate the waters resistance from the equation. discussions about how to solve the particular problem my company has are academic as they are not officially looking to me for a solution and are thinking of having the water drain out of the sump into something like a car screenwash bottle with a pump in that, of course they still have to get that pump to detect water, the engineer told me to keep my ideas handy as they may need some input later. at the end of the day I could design the thing and the idiot supplier could make it for us. So the game is still a-foot even if for my personal satisfaction of getting it to work
Title: Re: detecting water
Post by: Zero999 on April 18, 2010, 09:37:52 pm
It still relies on the conductivity of water, it's just that the solder resist and PCB ground plane is acting as a capacitor.

However, I think water has a higher dielectric constant than air anyway so the capacitance should increase slightly even if the water isn't conductive.

I think you need to perform some experiments to find out for sure but I'm sure it's possible.
Title: Re: detecting water
Post by: MoJo on April 19, 2010, 01:47:05 am
A little more info would be nice, as to what type of pump and what is its sensor? I think building another sensing mechanism when this should already contain one is not the right approach. It would be better to spend energy troubleshooting the current setup. Is the pumps sensor false triggering, or is it missing a comparator component that tells it the off state compared to the on state (what the PIC should be doing in this case, a voltage comparator would be better).

I think the motors built in sensor is a pressure sensor, or it needs a pressure sensor to complete it (again more info would be great).

Read up on Liquid Level Detecting, might be of interest to you

http://www.freescale.com/files/sensors/doc/app_note/AN1516.pdf

I'm a student going into the Biomedical field, (Medical equipment meets Electronics Engineering), we primarily always discuss the significance of sensors and sensor design. Another alternate approach which probably is simple but I would rank second after the above mentioned setup is to create a displacement based sensor, in this case a capacitive sensor. Having a top floating conductive material and an anchored bottom material you create a capacitor with changing distance of plates. This can be used to set a lower bound threshold that is checked every 10 minutes ... if it isn't met, than the pumps are turned on ... they only turn off when that threshold is met again.

Hope it helps,

EDIT: Oish, I should of read Hero999's post more clearly. He mentions exactly what I just repeated like an echo :( ... but nonetheless a good idea still.
Title: Re: detecting water
Post by: Simon on April 19, 2010, 06:38:03 am
the pumps are reciprocal and are housed in a small plastic case along with the custom build circuitry and the sensor is in the sump. so far many ideas have already been tried to improve the current setup but it is now clear to us that the whole design is garbage and does not match what the supplier is telling us. Many have said in the workplace that a float sensor should have been used in the first place but as always with management and design the wrong people make the decisions. I think our engineer not having any real knowledge of electronics (although not wanting to admit it to the point he carries an oscilloscope he does not know how to use) and has trusted the supplier who seemed quite reputable and acustomed to these sorts of military projects. It is now chear that it is all garbage.

My intent was to see if there are better methods of doing this, I came up with a similar circuit myself to the suplier but one that worked ! however as has been pointed out a capacitive sensor is best. How will a pressure sensor cope in a moving hehicle over rough terrain ? the ide is that this thing will be tipped all over the place.

your pressure sensor looks interesting but having looked at your link a bit it says that the output is a very low voltage that needs amplifing, we already have an issue with interfearance i think the sensor output may be drowned in the surrounding EMI