PDA

View Full Version : PIC water sensor



The Master
- 22nd October 2008, 23:37
Hi, How would i go about detecting water with a PIC?

I remember as a kid i made a little water sensor that turned an LED on. I think it used 2 transistors as a darlington pair but i cant find the book i got the circuit from. What about having pulldown resistors to make sure the PIC wont get a signal when there is no water.

Am i overcomplicating things again? It would be nice if i could have a high value pulldown resistor and just put the wires straight in the water but i would need a higher value resistor than the water and im not sure if that would be enough for a reliable pulldown

skimask
- 23rd October 2008, 00:08
Built a level sensor for a friend's aquarium a couple of years ago. Took a small plastic ball (say 1/2 red, 1/2 white for arguments sake), weighted down 1/2 a bit so that end would stay in down in water, put a small piece of tin foil on the top end, then hung a small chunk of copper over the side, under 'tension'. I used the ball so the 'electrical bits' wouldn't get submerged and mess with his fish. Water level would drop, alarm would sound when the connection was broken. Since I was using a PIC, I set it up so it would only check once every minute or so instead of a continuous current flow. Once the alarm was tripped, then it would go continuously.

Or you could treat the water as the dielectric of a capacitor or a variable resistor, put 2 'probes' in there and use ADCIN or POT to check the resistance/voltage across the probes, looking for a major change.

Or a float and a lever switch, or an IR LED/detector pair, or, or, or, or...

A thousand different ways of doing it...

Archangel
- 23rd October 2008, 02:59
. . . or put a magnet on that little ball and use a reed switch or hall effect device . . . How much water are we talking about here? A puddle under the water heater, a sump pump , a fish tank . . . ?

Normnet
- 23rd October 2008, 05:01
The Quantum touch sensors are very good at detecting water.
The human body is 9x% H2o.
These sensors can also detect through non metallic containers.

Norm

The Master
- 23rd October 2008, 09:16
How much water are we talking about here? A puddle under the water heater, a sump pump , a fish tank . . . ?

I hope your ready for this one. I need 2 sensors. One to go in a skull and one to go in a coffin.

Now before anyone starts making assumptions about me let me explain that these are halloween props that have misters in. They are going outside and will run for a few hours but they use water pretty quick. Ive got valves etc all ready to top them up but i need to know when they go below a certain level. To make it simple im only having the 1 sensor. Instead of a high level sensor im just going to turn the valve on for a set amount of time.

I am i bit short on space so i was thinking of 2 wires dipped in the water. I like some of the other ideas. I never thought about doing them before. I do want to keep the cost down though. Things like "Quantum touch sensors" sound expensive.

One other thing i should mention. The PIC thats controlling it will be controlling a lot of other things aswell. I cant use any blocking commands. Ive never used ADCIN or POT before so im not sure if they are or not

mackrackit
- 23rd October 2008, 10:39
Use the wires and a 741 op amp.

When the water conducts across the wires the op amp triggers with the out put of the amp going high going to the pic. Or low if you wire the op amp the other way.

The Master
- 23rd October 2008, 10:50
Sounds good. Ive found an "LM741 SINGLE OP AMP DIL-8 (NSC) RC" in rapid. Ive not done much with opamps before but i found a page (http://www.uoguelph.ca/~antoon/gadgets/741/741.html) on google about the 741 so i can start learning now.

Thanx for your help

mackrackit
- 23rd October 2008, 11:22
The light/dark sensor on that page is pretty much what you want.

Basically the op amp will be a comparator. When the voltage difference between pins 2 and 3 is greater than 1.2 (if I remember) then pin 6 outputs. Single power supply is all that is needed with this setup.

The Master
- 23rd October 2008, 11:36
Ive only just got past the bit about boosted output. Some things are making sense but i think its gonna take a while to sink in properly.

Would i be right in saying an op amp is very similar (if not the same) as a MAX485 receiver? Now i think about it the MAX485 does have opamp type symbols in the datasheet

T.Jackson
- 23rd October 2008, 11:58
You know I always make dead certain first, before I pull that trigger, on my de-soldering gun to remove MAX485s. Gotta be properly grounded, because they're very static sensitive.

The Master
- 23rd October 2008, 12:06
Gotta be properly grounded, because they're very static sensitive.

I hadnt notice that. Im sure the ones ive got must have had pleanty of static with all the things they have been near and they are still working for the moment. One of them even got shorted out when the wires on the biasing resistors accidentally touched but even that still works fine.

For now im working on breadboards so soldering/desoldering hasnt been a problem

mackrackit
- 23rd October 2008, 15:25
Would i be right in saying an op amp is very similar (if not the same) as a MAX485 receiver? Now i think about it the MAX485 does have opamp type symbols in the datasheet
Maybe...I guess so...
The 484 is comparing a voltage difference.

T.Jackson
- 23rd October 2008, 15:32
Maybe...I guess so...


Well you should know Dave, you're the one with the Phd.

What does your psychoanalysis equate to?

mackrackit
- 23rd October 2008, 16:17
Well you should know Dave, you're the one with the Phd.

What does your psychoanalysis equate to?

I would say mine is more "I guess so" while my wifes is "maybe". I used them both so I would not have to be gender specific. Gotta keep the Freudians happy.

And that is
MR. Post Hole Digger

T.Jackson
- 23rd October 2008, 16:25
I usually rely predicate logic mostly. This is enough for me, it's all I need.

Anyway, I'm off to go and clean that gun of mine, gotta a lot of work ahead of me.

mackrackit
- 23rd October 2008, 16:30
Anyway, I'm off to go and clean that gun of mine
Keeping up with the Freud thing.
I bet mine is bigger than yours :D

T.Jackson
- 24th October 2008, 04:26
Keeping up with the Freud thing.

Dave,

I'm gonna be counting numbers while look'n down the barrel of a sawn off shotgun soon. I've only got to blink or look the wrong way.

mackrackit
- 24th October 2008, 09:17
Dave,

I'm gonna be counting numbers while look'n down the barrel of a sawn off shotgun soon. I've only got to blink or look the wrong way.
Did you get a new video game?

T.Jackson
- 24th October 2008, 10:36
Did you get a new video game?

It's ironic you know, I absolutely love making games, but I don't like playing them much.

But you've given me a good idea for a game: "Dead or Alive" (an RGP for the innocent)

Play it, complete it and you're off the hook.

T.Jackson
- 24th October 2008, 11:53
Anyway, I've got no more time for games, I've gotta get ready to be charged with defamation of character and hindering a police investigation.

T.Jackson
- 24th October 2008, 12:17
Get ready to run Sue.

T.Jackson
- 24th October 2008, 13:18
Any solicitors here interesting in a 6 million lawsuit?

Guaranteed win.

50/50

The Master
- 24th October 2008, 14:19
Any solicitors here interesting in a 6 million lawsuit?

Oh dear, what did you do?

skimask
- 24th October 2008, 14:25
Oh dear, what did you do?
Hi-jacked one too many threads with philosophical bovine defecate...
http://www.marlerblog.com/Cow-Pie-3.jpg

T.Jackson
- 24th October 2008, 14:25
Oh dear, what did you do?

Not a suspect.

Next.

Nicmus
- 24th October 2008, 16:27
Mister_e has a nice touch sensor I’m sure you can use to detect water.
You can change its sensitivity both software and hardware.
I used it for some other application and I’m sure it will work for you too.
All you need is a resistor and two parallel pieces of wire (ground and signal) for each sensor and n+1 I/Os for n sensors. You don’t want the wires too close to each other.
Just do a search for “touch sensor” and you’ll find his post.

Regards,

Nick

The Master
- 24th October 2008, 16:42
I think i understand it. It appears to be one of those capacitance type things mentioned earlier (like touchlamps). Im not sure if this would work well in my situation. The control circuit will be inside and the sensors will be outside so there will be a fairly long wire between them, im not sure if that would affect it at all because ive never tried anything like that before.

My prefered method is using the water to conduct between 2 wires but ill get some of those resistors so i always have that method as a backup.

Nicmus
- 24th October 2008, 17:10
You can build the sensor using a 10F or 12F PIC and remote it with only 3 wires (VDD, VSS and output). In this case you will need one PIC per sensor and your master controller.

Nick

The Master
- 24th October 2008, 18:29
I was hoping to keep the cost down too. This circuit will only be used once so i didnt want to buy too many things especially if they are things i wouldnt use on other projects.

If it will work with PIC16F87's then i have a few of those spare. The problem is that i only have 1 small breadboard spare so i cant have a circuit at each mister unless i etch some PCBs out