Page 1 of 1

water leak sensor

Posted: 31 Oct 2017, 10:56
by karl222
hi there,

has anyone built a water leak sensor with the esp? I would like to put it next to our washing machine on a battery powered Basis which sends a message to my homeautomation system...

From my point of view there are two Options:
1. having esp in deep sleep and waking it up via interupt coming from a leak sensor which is more or less two wires which are "shortcutted" by the leaking water and get a gpio on high.
2. have a Transistor which is driven by a current which Comes form the leak sensor and the Transistor supplys the esp with power and esp sends message to a home Automation System on boot.

Any ideas?

regards
karl

Re: water leak sensor

Posted: 01 Nov 2017, 11:25
by toffel969
Check for LM 393. It basically is an IC that allows you to convert "two short circuit wires" into a reliable 1/0, sensitivity adjusted by poti. You can buy them as ready to use block.
They have 2 outputs, digital and analog, where analog is proportional / inverse proportional to resistance between wires.
Hook up the digital to interupt deep sleep, the analog to analog input. Then logic is: when wake up then send message with analog value. If you put the "wires " upright, the analog value can be an indication of water depths.

http://www.electrodragon.com/analog-and ... omparator/

https://diyhacking.com/arduino-soil-moisture-sensor/

Re: water leak sensor

Posted: 01 Nov 2017, 11:30
by toffel969
This one should work for you.
https://www.ebay.de/i/322626735255?chn= ... 1575298798
Moisture and rain version of LM393 block have inverse output afaik

Re: water leak sensor

Posted: 01 Nov 2017, 11:31
by toffel969
You will probably have to remove the leds from block for battery op

Re: water leak sensor

Posted: 01 Nov 2017, 14:43
by Shardan
I'd try another way.
(Beware - just my ideas, not tested)

I'd use a rule which sends message and then puts the ESP to sleep.

Then I'd try to use a 4011 or 4012 cmos logic gate for sensoring and use the output signal to reset the ESP8266.
The reset will restart the ESP, send message and put it back to sleep.

The MOS 40xx take up typically around 0,25µA quiescent current so this might be a nice way to provide long battery life.

Regards
Shardan

Re: water leak sensor

Posted: 01 Nov 2017, 20:11
by toffel969
Given the battery operation, Shardans way is probably better. Also leaves the option to measure supply voltage once a day with analog, probably a good idea to get a warning notification before the juice runs out.

Re: water leak sensor

Posted: 02 Nov 2017, 10:03
by karl222
Hi
Thanks for inputs...

Concerning NAND, you mean I should connect both NAND inputs and use it as one electrode and put + on another electrode. In case of water shortcutting electrode NAND goes on high...

Right?

What would i have to set as parameters in espeasy?

Regards
Karl

Re: water leak sensor

Posted: 02 Nov 2017, 12:20
by kimot
I think about water leak sensor too.
I want long battery life and let my controller ( Domoticz ) now, that sensor is alive + send me message, if not.
Circuit, witch switch on power for ESPEasy when water leak is detected, its not big problem. All other time ESPEasy is switched completely off.
But sending periodic messages to controller ( maybe with battery level ) can be done by two ways.
1) Use deep sleep with timer, but max time between messages is cca 71 minutes.
2) Switch on power for ESPeasy through external signal, for example one per day.
This can be done by many different ways.
For example:
1) Program rtc Chip, like DS3231 for alarm one per day
2) Use some CMOS counter chips, maybe cascaded, (with oscilarẗors built in? ) CMOS4060
3) ...

ESPEasy will send signal with battery level for example, witch means " Hi, I am alive "
And if Domoticz detect two day absence of this message, it will send me e-mail: " Your water leak sensor No. xx is dead ! "

I Think, it can work for years with Alcaline batteries.

Re: water leak sensor

Posted: 03 Nov 2017, 10:34
by karl222
you say "Circuit, witch switch on power for ESPEasy when water leak is detected, its not big problem. "

how are you going to solve it?

regards
karl

Re: water leak sensor

Posted: 03 Nov 2017, 22:36
by kimot
Something like this:
https://e2e.ti.com/blogs_/b/powerhouse/ ... te-mosfets
datasheet:
http://www.ti.com/product/TPS22910A
Quiescent Current (Iq) (Typ) (uA):

But it is possible with discrete parts too.

Re: water leak sensor

Posted: 08 Nov 2017, 21:11
by KampfHund
Hi Guys,

I have the same Problem...
I want a simple Solution to Connect 2 wires to nodemcu8266 with easyesp in deepsleep and wakes up from deepsleep when the two wires are in contact with water.
next step should be a message to my telegram bot.

Is there a simple Solution?

Re: water leak sensor

Posted: 18 Nov 2017, 17:06
by karl222
Hi,

I have just tried a solution where I start the ESP out of deep sleep by giving a GND Signal to RST via a BS170 MOSFET Transistor. the current on the gate of the BS270 which is led through water is sufficient to errect the BS170...

regards
karl

Re: water leak sensor

Posted: 18 Nov 2017, 23:41
by papperone
karl222 wrote: 18 Nov 2017, 17:06 Hi,

I have just tried a solution where I start the ESP out of deep sleep by giving a GND Signal to RST via a BS170 MOSFET Transistor. the current on the gate of the BS170 which is led through water is sufficient to errect the BS170...

regards
karl
Great, woudl you mind to share the schematic or at least some pictures of your test sensor?

Re: water leak sensor

Posted: 19 Nov 2017, 08:14
by karl222
Hi,

I just did a fritzing for you.

As a casing I ordered a few of these and will take out electronics in order to replace it with esp: https://www.ebay.de/itm/Wireless-Buzz-W ... 2749.l2649

regards
karl

edit: I am using the BS170 NOT the BS270

Re: water leak sensor

Posted: 19 Nov 2017, 12:24
by papperone
thanks, any specific reason you used a mosfet instead of a simple NPN transistor?

Re: water leak sensor

Posted: 19 Nov 2017, 12:48
by karl222
It was a hint from an other user. I think a standard transistor needs a higher current but maybe it works with a BC237 as well...

with the BS270 it works, I can confirm ;)

Re: water leak sensor

Posted: 19 Nov 2017, 15:30
by karl222
I'd like to challenge another approach.

why not use the bs170 to power up the esp. this saves standby power at all. bs170 doesn't consume any power at all, when there is no water detected, only in case of high water gain of bs170 is errected and esp is powered up and sends a message on boot.

I have tried this already but the esp doesn't come up properly. instead of consuming 70mA it consumes 180mA and the blue led blinks slowly...

any ideas on my idea... ;-)

regards
Karl

Re: water leak sensor

Posted: 19 Nov 2017, 16:04
by Shardan
Nearly any small N-FET should work (BS270, BSS138, 2N7000, 2N7002.....)

Just one point:
These FETs are somewhat sensitive to electrostatic discharge.
So a serial resistor between gate and sensor and a small ceramic capacitor 10nF .. 47nF between gate and ground
gives at least some protection against static voltage.
Remember, this makes the sensor a bit slow (3..5 Seconds).

Standard NPN transistors won't work reliable with such simple circuit, it needs
more electronics around to make that work.
The reason: Standard Transistors are driven by current, FET's are driven by (nearly pure) voltage.
For a standard transistor it needs a low resistance of water on the sensor, about 10..100KOhm.
It needs a big sensor and a lot of water, some drops of pure water won't do.

Re: water leak sensor

Posted: 19 Nov 2017, 16:22
by papperone
Shardan wrote: 19 Nov 2017, 16:04 Nearly any small N-FET should work (BS270, BSS138, 2N7000, 2N7002.....)

Just one point:
These FETs are somewhat sensitive to electrostatic discharge.
So a serial resistor between gate and sensor and a small ceramic capacitor 10nF .. 47nF between gate and ground
gives at least some protection against static voltage.
Remember, this makes the sensor a bit slow (3..5 Seconds).

Standard NPN transistors won't work reliable with such simple circuit, it needs
more electronics around to make that work.
The reason: Standard Transistors are driven by current, FET's are driven by (nearly pure) voltage.
For a standard transistor it needs a low resistance of water on the sensor, about 10..100KOhm.
It needs a big sensor and a lot of water, some drops of pure water won't do.
Thanks Shardan for the clear explanation :)

Re: water leak sensor

Posted: 19 Nov 2017, 21:06
by KampfHund
Hi guys,

nice :mrgreen:

I will Test it.

I tested before a Flip Flop with 3 transistors, this Works Perfect but you need many things...
https://github.com/esp8266/Arduino/issues/1488
( Fritzing - Monostable Flip Flop )

Re: water leak sensor

Posted: 25 Nov 2017, 15:55
by karl222
Shardan wrote: 19 Nov 2017, 16:04 Nearly any small N-FET should work (BS270, BSS138, 2N7000, 2N7002.....)

Just one point:
These FETs are somewhat sensitive to electrostatic discharge.
So a serial resistor between gate and sensor and a small ceramic capacitor 10nF .. 47nF between gate and ground
gives at least some protection against static voltage.
Remember, this makes the sensor a bit slow (3..5 Seconds).

Standard NPN transistors won't work reliable with such simple circuit, it needs
more electronics around to make that work.
The reason: Standard Transistors are driven by current, FET's are driven by (nearly pure) voltage.
For a standard transistor it needs a low resistance of water on the sensor, about 10..100KOhm.
It needs a big sensor and a lot of water, some drops of pure water won't do.
Hi,
I don't understand what you mean exactly
it is clear that there should be a small capacitor between gate and ground
you mean gate --- resistor 10k --- water --- +

but it doesn't work. esp vdd goes to 3,0V only and consumes 120mA instead of 70mA.

any ideas how to get the MOSFET powering up the ESP properly. via the VDD pin..

thanks
karl

Re: water leak sensor

Posted: 03 Dec 2017, 23:37
by kimot
But do not forgot, that if you wake up your sensor only when water leak, you will never know, if your sensor is still alive after some time.
Better way is wake up sensor periodically and send some data to controller ( with battery voltage for example ).
And if controller do not receive any data for some period, it will send alert to you.
Then you have assurance, that your sensor is ready detect water leakage all the time.

You can use simply internal timer and wake up cca every hour with 20 mikroAmp. consumption in this time.
Or build something sophisticated and wake up every 2 hours with consumption 1 mikroAmps between wake ups.
Look here for inspiration:
http://www.kevindarrah.com/wiki/index.php?title=Pusher

Re: water leak sensor

Posted: 05 Dec 2017, 10:31
by karl222
You are right, probably the better way...

Thx

Re: water leak sensor

Posted: 05 Dec 2017, 14:53
by papperone
kimot wrote: 03 Dec 2017, 23:37 But do not forgot, that if you wake up your sensor only when water leak, you will never know, if your sensor is still alive after some time.
Better way is wake up sensor periodically and send some data to controller ( with battery voltage for example ).
And if controller do not receive any data for some period, it will send alert to you.
Then you have assurance, that your sensor is ready detect water leakage all the time.

You can use simply internal timer and wake up cca every hour with 20 mikroAmp. consumption in this time.
Or build something sophisticated and wake up every 2 hours with consumption 1 mikroAmps between wake ups.
Look here for inspiration:
http://www.kevindarrah.com/wiki/index.php?title=Pusher
I agree this page bring a lot of inspiration but still... I don't see this guy using deepsleep for waking up on a regular interval! Am I missing somethign so obvious that I can't see in his schematic?
I will brainstorm with myself (the best way to come up with bright or sh***y ideas :mrgreen: ) as I'd like to build such setup for several sensors (including water leak which is in my high priorities when few months ago I had my ground floor flooded after a broken water pipe while nobody was at home... Murphy's law) and the "must" are (1) running on batteries (2) last at least 6 months between recharging cycle (3) send out battery level status to prevent sensor dying without alert

Re: water leak sensor

Posted: 05 Dec 2017, 16:26
by kimot
He do not use deep sleep because high consumption 20 mikroAmp and wake up interval max 74 minutes.
His solution uses timer to wake up possibility every max 7 200 seconds ( not wake up really - switch on ESP and through sw action switch off then ) or through external event.
Consumption 1 mikroAmp.
Will bi nicer "wake up" one time per day - maybe with some RTC chips with alarm pulse possibility or another long interval timer.

Re: water leak sensor

Posted: 05 Dec 2017, 18:01
by papperone
kimot wrote: 05 Dec 2017, 16:26 He do not use deep sleep because high consumption 20 mikroAmp and wake up interval max 74 minutes.
His solution uses timer to wake up possibility every max 7 200 seconds ( not wake up really - switch on ESP and through sw action switch off then ) or through external event.
Consumption 1 mikroAmp.
Will bi nicer "wake up" one time per day - maybe with some RTC chips with alarm pulse possibility or another long interval timer.
Yes got it, I was before looking the only IC I didn't know (TLP5111) and it looks perfect for such a job.
I've already a latch circuit I designed to allow micro to turn off completely itself, but it was for a project where the turn on was to be manually activated then the micro performs itw own cycle of actions and turn itself off completely once done using a GPIO as a trigger.
I think I will try to add this IC to my latching switch circuit so to have the timely wake up and as well the sensor wake up, thanks a lot for the link!!

Re: water leak sensor

Posted: 02 Mar 2018, 21:27
by kimot

Re: water leak sensor

Posted: 07 Mar 2018, 10:50
by Finnarduino
hi! is it possible to create water flow sensor by using sound detection?

How this works?
streamlabswater.com

Re: water leak sensor

Posted: 08 Mar 2018, 07:51
by ziancolins
Finnarduino, I think you should go to the youtube, and watch videos for understanding the process or work of water flow sensor.