Page 1 of 1

Simple Water Detection Circuit

Posted: Thu Sep 23, 2004 12:55 am
by Shing
Has anyone any ideas on how to implement a simple circuit to detect the presence of water with the Basic Stamp 2?<p>I'd imagine that it'd involve two probes, and the water would conduct the electricity and therefore complete the circuit.<p>Regards,
Wai Shing

Re: Simple Water Detection Circuit

Posted: Thu Sep 23, 2004 2:52 am
by bodgy
Your idea will work, but you have a problem in that ideally you need to send an AC voltage to the probes to stop electrolysis happening to the probes.<p>Now Parallax actually have some ideas for you in their free download Earth Science file.<p>getting down to the nitty gritty - you could use the Stamp to send out a square wave to the probes, you'd then rectify this DC with two diodes and a capacitor so that the Stamp would see a high or a low voltage at a pin.<p>With your basic idea (no AC wave) all you need is to output a high from one pin and connect that to one probe and then set another pin as an input and connect that to the other probe. When the water shorts out the probes the input pin will go high, ready for whatever you want to happen after that.<p>I would be inclined to add some 'safety' components to this basic idea, such as some 1K resistors in series from the pins to the probes (the value may need tinkering with, but you want to be sourcing no more than 20mA so at 5v minimum value would be 250 ohms) I might also consider some protection diodes across the stamp pins, that is a diode from the pin to ground and one from pin to V+.<p>
Colin<p>PS. I can email you a PDF of a discrete version of a water sensor - the idea could be easily converted into stamp land.<p>[ September 23, 2004: Message edited by: bodgy ]</p>

Re: Simple Water Detection Circuit

Posted: Thu Sep 23, 2004 10:17 am
by haklesup
I'm sure you can convert the output from any type of sensor to provide the necessary 5V digital input to the basic stamp indicating presense of water.<p>The unknown (to me) is where is the water and how much do you want to detect. Let me make a few assumptions for this example.<p>Take for example one of those water probes from the hardware store (less than $10 kind) it has two pieces of dissimilar metal at the tip which generate a voltage when in contact with wet soil. This voltage is applied to a meter movement typically and the resulting current flow indicates the moisture level. Totally passive,no batteries. I think you can do the same with a penny and a nickel (6 cent sensor).<p>It would not be difficult to connect the probe to an op amp configured as a comparator instead of the meter and compare it to a preset level on the other input. When the probe voltage crosses the threshold, the output will swing from ground to Vdd (or vice versa). If Vdd is 3.3V or 5V or whatever you need for inputs, this signal becomes a digital output which can be connected to the basic stamp or any other digital circuitry. The comparitor is a signal conditioning circuit in this case.<p>You can use the same circuit to connect to an A/D input. You just need to add feedback to the comparitor to make the output change gradually. This reduces the gain of the opamp from near infinity (open loop) to a more managable level like 1X to 10x (whatever is needed to scale the input to the right level)<p>On your idea of using water to complete a circuit. This will depend on the purity of the water. Any probe that measures conductivity of the water would work better in dirty (especially salty) water. There are also the safety, complexity and reliability drawbacks indicated by bodgey. Best if done at low current and conditioned like in the above paragraph<p>There are other water sensing methods available if you clue us into more details about where and how much water, we can suggest a few.

Re: Simple Water Detection Circuit

Posted: Thu Sep 23, 2004 3:05 pm
by Shing
Thanks Colin and Haklesup for the response.<p>It's a project for college. It's meant to be able to detect the presence of water in the case of a flood, so the body of water would be substantial.<p>As for the problem with electrolysis, the probes would rarely have the chance to conduct water (hopefully!), so that wouldn't be that much of a problem.<p>I'd like to keep everything as simple as possible until I get a working prototype. After that, I might refine it with more complexity.<p>Regards,
Wai Shing

Re: Simple Water Detection Circuit

Posted: Thu Sep 23, 2004 9:56 pm
by bodgy
Well depending on your personal budget or that allocated to your project, a float sensor (ready made or build yourself) is what you want.<p>ready made ones just close a contact or microswitch when the float paddle moves upwards.<p>Elektor magazine had an interesting variant but is probably more complicated than you were looking for. <p>if you have the knowhow, you might be able to use something like and infra red beam - or an ultrasonic transmitter reciever pair. Again the latter might be more complicated than you want at this stage.<p>Have a look at Rapid Electronics site for the float switch, I assume as you're in Ireland that is one of the countries they export to without the exorbitant £70.00 minimum.<p>Colin<p>Rapid Electronics<p>[ September 23, 2004: Message edited by: bodgy ]<p>[ September 24, 2004: Message edited by: bodgy ]<p>[ September 24, 2004: Message edited by: bodgy ]</p>

Re: Simple Water Detection Circuit

Posted: Fri Sep 24, 2004 1:44 am
by rshayes
In theory, pure water is an insulator, with a high dielectric constant. In practice, getting water pure enough to measure its dielectric constant was probably the subject for a PhD thesis.<p>Practically any sample of water you encounter will be fairly conductive.<p>Probes can be many shapes. A piece of printed circuit board with a narrow gap (1/16 to 1/8 inch) cut down the middle would probably work. An enclosed version might be a rod mounted in the center of a tube and insulated from it. Or two solid wires glued to a piece of plastic. Or two parallel plates spaced by 1/8 inch or so.<p>The interface to digital logic can be as simple as a transistor with a pull up resistor. A 4.7K resistor to 5 volts would probably work. This will require a base current of 100 microamps to insure saturation. A 43K resistor to 5 volts can supply this. If the sensor is connected from base to ground, a resistance less than 5000 ohms will turn off the transistor and give a high output signal.<p>If you need more sensitivity, add an emitter follower to the input. A 6.8K resistor from base to ground of the output transistor will guarentee that it can turn off. Tie the emitter of a second transistor to this point. This transistor will have to deliver about 200 microamps to turn on the output transistor (100 for the transistor and 100 for the resistor). Since this transistor is not saturated, the base current needed will depend on the beta of the transistor, but a beta of at least 40 is probable for any reasonable transistor. The base current needed will be less than 5 microamps. Since the input voltage will be less than 1.4 volts, this can be supplied by a resistor to 5 volts of 680K. Turning on both transistors will require a base voltage greater than 1 volt. If the sensor resistance is less than 170K, the transistors will be shut off. This might be a little too sensitive. Some electrode designs might reach this value due to condensed moisture from the air.<p>Practically any small signal transistor should work, such as the 2N3904 or some similar european type.<p>[ September 24, 2004: Message edited by: stephen ]</p>

Re: Simple Water Detection Circuit

Posted: Fri Sep 24, 2004 4:41 am
by toejam
since you are dealing with a sizable amount of water and dependability is needed, a mechanical bilge pump switch may be the best thing. It uses no ambient current and most of them cam handle a 10 amp load.

Re: Simple Water Detection Circuit

Posted: Fri Sep 24, 2004 11:19 am
by ljbeng
Put a 750K resistor from a microprocessor input to +5. Now put a stripped wire to the processor input and lay the other end where you want to detect water. Now put another stripped wire from ground to near the other stripped wire. This works on a pic. You should see a simple high/low when dry/wet.<p>[ September 24, 2004: Message edited by: ljbeng ]</p>

Re: Simple Water Detection Circuit

Posted: Fri Sep 24, 2004 12:18 pm
by Chris Smith
Use a 555 moisture circuit, and out put it to the stamp. <p>Sensitivity is great and adjustable and it cost about 50 cents overall.

Re: Simple Water Detection Circuit

Posted: Sat Sep 25, 2004 5:06 am
by jwax
Oh! College project? That requires a different approach guys! A MOSFET and a Sonolert will do it. Anything less than air resistance would switch on the fet. Use a 6 v or 9v battery, and PC board traces, or wires in air.
John

Re: Simple Water Detection Circuit

Posted: Sat Sep 25, 2004 11:15 pm
by Shing
Thanks for all the replies. I'll have to explore all the different possible solutions. Thanks again!<p>Regards,
Wai Shing