PIC water sensor


Closed Thread
Results 1 to 29 of 29
  1. #1
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697

    Default PIC water sensor

    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

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    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...

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    . . . 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 . . . ?
    Last edited by Archangel; - 23rd October 2008 at 06:22.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default

    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

  5. #5
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    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

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    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.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    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 on google about the 741 so i can start learning now.

    Thanx for your help

  8. #8
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    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.
    Dave
    Always wear safety glasses while programming.

  9. #9
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    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

  10. #10
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default

    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.

  11. #11
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by T.Jackson View Post
    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

  12. #12
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    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.
    Dave
    Always wear safety glasses while programming.

  13. #13
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    Maybe...I guess so...
    Well you should know Dave, you're the one with the Phd.

    What does your psychoanalysis equate to?

  14. #14
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by T.Jackson View Post
    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
    Last edited by mackrackit; - 23rd October 2008 at 16:33.
    Dave
    Always wear safety glasses while programming.

  15. #15
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default

    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.

  16. #16
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by T.Jackson View Post
    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
    Dave
    Always wear safety glasses while programming.

  17. #17
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    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.

  18. #18
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by T.Jackson View Post
    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?
    Dave
    Always wear safety glasses while programming.

  19. #19
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    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.

  20. #20
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default

    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.

  21. #21
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default

    Get ready to run Sue.

  22. #22
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default

    Any solicitors here interesting in a 6 million lawsuit?

    Guaranteed win.

    50/50

  23. #23
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by T.Jackson View Post
    Any solicitors here interesting in a 6 million lawsuit?
    Oh dear, what did you do?

  24. #24
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    Oh dear, what did you do?
    Hi-jacked one too many threads with philosophical bovine defecate...
    http://www.marlerblog.com/Cow-Pie-3.jpg

  25. #25
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    Oh dear, what did you do?
    Not a suspect.

    Next.

  26. #26


    Did you find this post helpful? Yes | No

    Default

    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

  27. #27
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    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.

  28. #28


    Did you find this post helpful? Yes | No

    Default

    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

  29. #29
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    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

Similar Threads

  1. Need a cheap touch sensor idea.. here it is
    By mister_e in forum Code Examples
    Replies: 20
    Last Post: - 16th April 2016, 22:42
  2. how to connect ac sensor to PIC ?
    By iugmoh in forum Schematics
    Replies: 3
    Last Post: - 1st June 2008, 18:35
  3. Water Level Detection using Ultrasonic Sensor
    By Balachandar in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th November 2007, 04:59
  4. hot water flow sensor
    By jessey in forum Off Topic
    Replies: 16
    Last Post: - 24th January 2007, 04:05
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts