Author Topic: Water-detecting circuit activates on its own  (Read 962 times)

0 Members and 1 Guest are viewing this topic.

Offline KayamonTopic starter

  • Newbie
  • Posts: 2
  • Country: us
Water-detecting circuit activates on its own
« on: July 02, 2019, 08:05:51 pm »
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. The problem is, sometimes it'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 saw Dave's video where 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?  :)
« Last Edit: July 02, 2019, 08:07:40 pm by Kayamon »
 

Offline Audioguru

  • Super Contributor
  • ***
  • Posts: 1507
  • Country: ca
Re: Water-detecting circuit activates on its own
« Reply #1 on: July 02, 2019, 08:35:14 pm »
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.
 

Online ledtester

  • Super Contributor
  • ***
  • Posts: 3282
  • Country: us
Re: Water-detecting circuit activates on its own
« Reply #2 on: July 02, 2019, 08:40:46 pm »
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/2LwMTG0

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

The resistor and timing thresholds you use will depend on the construction of your probes - you'll just have to determine them experimentally.




« Last Edit: July 02, 2019, 08:54:37 pm by ledtester »
 

Offline KayamonTopic starter

  • Newbie
  • Posts: 2
  • Country: us
Re: Water-detecting circuit activates on its own
« Reply #3 on: July 02, 2019, 08:49:20 pm »
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.
 

Online ledtester

  • Super Contributor
  • ***
  • Posts: 3282
  • Country: us
Re: Water-detecting circuit activates on its own
« Reply #4 on: July 02, 2019, 09:02:32 pm »
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.

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

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 7681
  • Country: ca
Re: Water-detecting circuit activates on its own
« Reply #5 on: July 02, 2019, 09:17:42 pm »
I don't expect the circuit to work well for three four possible reasons:

The schematic is wrong, can you clarify where the 470k resistor is. The transistor E-B junction is drawn shorted out. An MPSA29 Darlington has 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)
« Last Edit: July 03, 2019, 04:32:12 am by floobydust »
 

Offline garethw

  • Regular Contributor
  • *
  • Posts: 88
  • Country: gb
Re: Water-detecting circuit activates on its own
« Reply #6 on: July 03, 2019, 08:42:07 am »
Would it not be better to use a magnetic float and detect it with a hall sensor?


Sent from my iPhone using Tapatalk
Father
Husband
MENG Electronic Engineering student
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf