Water-detecting circuit activates on its own - Page 1
Forum section: electronics / beginners

author: Kayamon
author_rank: Newbie
timestamp: July 02, 2019, 08:05:51 pm
content: Hi everyone,I'm trying to build a little hobby electronics project but running into a complication (I'm a software guy normally, so a little out of my depth here).My circuit is designed to detect the presence of water, and then run a 12V DC pump for a few seconds when it sees it. (schematic attached). I built the whole thing out on a small protoboard powered from a 12V wall adapter. When the water level bridges PORT1 and PORT2 (I used a standard 2-pin header for them) the current flows and activates the Darlington transistor, which then allows a signal to reach the microcontroller. The MCU then activates the L293D for 10 seconds which pumps the water back out.So generally it works great. Theproblemis,sometimesit'll randomly activate even if there's no water there and I don't know why.I'm wondering if it might be related to static electricity possibly -- I sawDave's videowhere he caused a monitor to cut out by getting up from a chair, and I was able to get my circuit to activate using the same method.Any ideas what things would cause it, and more importantly what do I do about it?

author: Audioguru
author_rank: Super Contributor
timestamp: July 02, 2019, 08:35:14 pm
content: Your circuit uses DC that causes the sensing pins to become plated and corroded. You should use AC instead and an AC detection circuit.Pure water (distilled) does not conduct. Salt water or acid rain water or tap water conducts.Make your circuit less sensitive to interference by reducing the value of the 470k resistor (100k?) then reduce the spacing of the probes so that it is sensitive to the resistance of the water.

author: ledtester
author_rank: Super Contributor
timestamp: July 02, 2019, 08:40:46 pm
content: I don't know why your circuit is spuriously triggering, but I would suggest you use a capacitive sensor. Here's a video which explains why sensors based on allowing DC current to flow between electrodes is a bad idea:https://bit.ly/2LwMTG0And since you are using a microcontroller your sensor can just be a pair of insulated probes and a resistor. It's based on the idea that the capacitance between the electrodes will change when immersed in water. Here's an example of how to measure capacitance with an Arduino:http://www.electronoobs.com/eng_arduino_tut10_1.phpThe resistor and timing thresholds you use will depend on the construction of your probes - you'll just have to determine them experimentally.

author: Kayamon
author_rank: Newbie
timestamp: July 02, 2019, 08:49:20 pm
content: Electrolysis shouldn't be a problem -- the probes aren't in the water for any length of time. The moment the water reaches them, it drains the water right back out again.

author: ledtester
author_rank: Super Contributor
timestamp: July 02, 2019, 09:02:32 pm
content: Quote from: Kayamon on July 02, 2019, 08:49:20 pmSure - I'm a software guy too, and under ideal circumstances it wouldn't be a problem. Until the pump fails, or water enters fast than the pump can pump it out, or you leave it unattended and the pump gets triggered 20 times a day over a period of two years, or ...

author: floobydust
author_rank: Super Contributor
timestamp: July 02, 2019, 09:17:42 pm
content: I don't expect the circuit to work well forthreefour possible reasons:The schematic is wrong, can you clarify where the 470k resistor is. The transistor E-B junction is drawn shorted out. AnMPSA29 Darlingtonhas an emitter-base voltage up to 2V so when it's on, the ATTiny would at best see 3V for a logic one. You have internal pullup on or off for that input pin?You have to software debounce the water level signal sometimes several seconds due to splash and electrical noise. A small capacitor across the transistor's input can prevent RF pickup.If the water tank not stand-alone, i.e. a sump in the ground, or piping to water from/to the earth, then the tank water has a (current) path to earth-ground. Ther result is a ground potential between your project's 12V power supply and the water tank. It would corrode the electrode on Port 1 as 5VDC flows to earth ground through a complicated path, whenever the electrode is wet, and can cause false triggering.edit: a last reason for false triggering can be dissimilar metals in the tank, the electrode metal can make a galvanic potential enough to turn on the transistor even though the DC power electrode is dry. Example aluminium, zinc, galvanized metals are all over is -0.75V (chart from structx.com)

author: garethw
author_rank: Regular Contributor
timestamp: July 03, 2019, 08:42:07 am
content: Would it not be better to use a magnetic float and detect it with a hall sensor?Sent from my iPhone using Tapatalk