PDA

View Full Version : Best choice for detecting water?



ShortBus
- 10th October 2009, 22:33
All I want to do is create a sensor that beeps when water bridges a pair of contacts. However, I'm an electronics newbie and don't know how to evaluate which is the best method. The sensor will be battery powered and I would like to maximize battery life. I'm using a 16 series PIC and PBP. I realize that a PIC is overkill for this application, but I'm also using the chip for a couple of other things (serial I/O, etc).

Some of the ideas that I've researched/considered:

- Simply using digital I/O: one probe is connected to gnd, the other to a digital I/O pin though a 1M resistor. When the pin goes low, sound the alarm.

- Using and ADC channel to read the resistance across the probes. Normal state should be infinite resistance; anything less and sound the alarm. However, I don't know how to use ADC to measure resistance. According to the datasheet, the max recommended impedance 10k for ADC is anyhow. So I don't know if this is a poor idea besides the point.

- Using a comparator. It would make the coding portion easier since it's a simple bit (and one that I can use with an interrupt and sleep mode). However, I don't know how to design the necessary circuit. And I don't know if it would be flexible enough since the resistance of water varies with temperature and dissolved impurities.

- Using an 555 IC and COUNT. This idea seems to be fairly popular several (http://www.emesystems.com/OL2mhos.htm) places (http://www.electronic-circuits-diagrams.com/alarmsimages/4.gif) online (http://www.redcircuits.com/Page103.htm). However, it might be overkill for my needs. I only need a binary "water present" / "no water present" sensor.

Anyhow... I've been at this for days and my head is spinning. Any help would be greatly appreciated. Thanks!

mackrackit
- 11th October 2009, 00:50
Personally I have had god luck detecting a high water level with the digital IO method.
I have the PIC pin pulled low and apply a positive voltage to the probe. No current is used untill the water makes contact. When contact happens you will want to turn the power off to the probe to save power and to cut down on oxidation on the probe.

You can use a timer off of the PIC to periodically turn the power on to the probes and check for conductivity.

What kind of water is this? Potable, seawater, sewer? Decide what to use for the probe material? If it is sewer watch for sparks :)

ShortBus
- 11th October 2009, 01:12
Thanks for the reply. It's just ordinary tap water; no worries about explosions. ;-)

I was hoping that the simple solution would work. Can you explain your circuit a bit more? Are you using a resistor between the i/o pin and ground? If so, what value?

mackrackit
- 11th October 2009, 03:38
I apologize. I failed to mention the LM339 comparator driving the PIC IO. :o
It is still a simple solution. I built the one for my water system back in my basic stamp days. Still working.

Again I am sorry for the misleading post.

ShortBus
- 11th October 2009, 05:04
No problem. I don't imagine that you have a schematic of your circuit? Could it be adapted to use the integrated comparator onboard the pic?

aratti
- 11th October 2009, 08:40
All I want to do is create a sensor that beeps when water bridges a pair of contacts

You could use a simple floating switch. See an example @

http://www.homesecuritystore.com/p-843-sb2-sump-bobber-water-level-sensor.aspx?affiliateid=10054&zmam=55691497&zmas=1&zmac=4&zmap=SB2

Al.

ardhuru
- 11th October 2009, 13:27
I was looking for something similar a few weeks back, except my requirement was more complex as I wanted to detect 10 different levels of water using a simple 2 wire probe.

Anyway, while I cant pretend to have found the perfect solution, Arrati's suggestion in that thread (http://www.picbasic.co.uk/forum/showthread.php?t=11468) came pretty close.

So, my vote would be stainless steel nut-bolts to make the actual contact, with a good resin epoxy sealant around the wire connected to the bolt. This coupled with a software arrangement to drive the sensor with a duty cycle of perhaps 1:10, or even 1:100 would give you years of maintenance-free use.

Incidentally, I used the adc of the pic, rather than the comparator, although in your case the comparator (or even a digital input) should be fine.

Regards,

Anand Dhuru

ShortBus
- 11th October 2009, 16:06
Arrati, thanks for the idea, but I'll need an electrical solution rather than mechanical in this application.

Anand, any chance you could post an example circuit?

ardhuru
- 11th October 2009, 18:04
- Using and ADC channel to read the resistance across the probes. Normal state should be infinite resistance; anything less and sound the alarm. However, I don't know how to use ADC to measure resistance. According to the datasheet, the max recommended impedance 10k for ADC is anyhow. So I don't know if this is a poor idea besides the point.


You could use the ADC input, or use the input as a digital pin. Essentially, the resistor between the pin and ground, and the water body would form a potential divider. With no water, your ADC reading would be almost, or equal to zero. When water bridges the probe, it should get close to the full Vdd (200+, for the resistor value I have used).

Alternately, if you're using the pin as a digital input, it would be low till water bridges the probe, and then swing high.

The 2nd version of the schematic would be even better, where you control current going thru' the water, as you could reduce the corrosion by a very significant amount.

BTW, please excuse the shabby drawing, thought it would be faster than drafting it.

Regards,

Anand

Acetronics2
- 11th October 2009, 18:20
Hi,

I think a fair solution could be to use capacitive detection using the RC oscillator :

The probe being the ... Capacitor.

just compare the duration of, say 256 osc periods to an external RCTime result ...

With water , the capacity of the probe is high ... Osc runs slow ...

When dry, the capacity is low and osc runs faster ...


Interest ??? can even run the 32 Khz clock for power saving, no direct contact of the electrodes and the water ( works with " pure" water also - no corrosion or dirt disturbing measurements )

Some level MEASURES can also be made using the RCTime command, but less power savings ...

Alain

ShortBus
- 12th October 2009, 23:52
Anand,

Thank you for taking the time to sketch out your schematics! It's a big help.


Alain,

I'd have no idea how to implement something like that (I'm a software guy who's muddling through electronics); though it does sound interesting.

Charles Linquis
- 13th October 2009, 00:52
About 40 years ago, I needed electrodes for electrolyzing water. All the metal ones had problems, but I found a great solution in the carbon rods that go down the middle of zinc-carbon dry cell batteries. They even have a metal cap crimped on one end that you can solder to.

If you can still find them.

ardhuru
- 13th October 2009, 07:20
You should be fine with stainless bolts as sensors, as long as you've properly insulated / epoxied the connection between them and the wire. Plus, if you can, run the pic off a 3 volts supply, the probes will last that much longer.

Regards,

Anand

Melanie
- 13th October 2009, 09:04
This device is extremely reliable (as long as it's not sewage which tends to coat the optics!) and is actually manufactured by Honeywell Microswitch in the USA. Connect with minimal components directly to your PIC (or even Relay).

http://docs-europe.electrocomponents.com/webdocs/001a/0900766b8001adaf.pdf

It is a little power-hungry for Battery applications though.

You don't have to go Stainless Steel if you use AC exitation on your probes... PWM say a 1kHz signal to one probe (via a 100nF Capacitor, the other probe (again via a 100nF) can be used to detect the signal returning. To minimise power consumption, turn the PIC on only every few seconds (typical Rain Detector application to alert you to take the washing indoors).

Acetronics2
- 13th October 2009, 13:28
Hi, Folks

This one doesn't show any Pic ... is not a " Bling-Bling" device, but works perfectly ...

Published in ... 1983 !!!

DUS means: general use Silicon diode : 1N4148, BAW62 ...

Alain

Acetronics2
- 13th October 2009, 14:29
The " Bling Bling " device :

http://a110a.free.fr/SPIP172/article.php3?id_article=29

Alain

ErnieM
- 13th October 2009, 20:18
Ive done two "water" sensors in my time. First was decades ago using a CMOS quad gate, 1 gate to detect rain, 2 to make a gated multivibrator, and 1 spare.

Theory is CMOS has near infinite input resistance, so you use a megaohm pull-up resistor on the gate input, and the probe is the input and ground signals. Any liquid bridges the input pulling it to ground. I have not tested this with a PIC, but since the PIC is CMOS based I would expect this trick to still work. Even better would be to set the input as analog and use a A2D to sense (immune to half-VDD input level disasters). A baseline 10F part should work.

The next version was a continuous level sensor similar to this: http://www.innovativesensing.com/html/products.asp?id=18

The probe is a tube within a tube to form a capacitor. Changing liquid heights change the dielectric which changes the capacitance linearly with level height. My "boss" used a 555 timer to convert the capacitance to a frequency, I used a PIC to measure the frequency, calibrate the levels for whatever fluid was being used, and drive the output.