water leak sensor

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
karl222
Normal user
Posts: 88
Joined: 23 Aug 2017, 17:18
Location: Vienna

water leak sensor

#1 Post by karl222 » 31 Oct 2017, 10:56

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

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: water leak sensor

#2 Post by toffel969 » 01 Nov 2017, 11:25

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/
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: water leak sensor

#3 Post by toffel969 » 01 Nov 2017, 11:30

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
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: water leak sensor

#4 Post by toffel969 » 01 Nov 2017, 11:31

You will probably have to remove the leds from block for battery op
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

Shardan
Normal user
Posts: 1120
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: water leak sensor

#5 Post by Shardan » 01 Nov 2017, 14:43

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
Regards
Shardan

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: water leak sensor

#6 Post by toffel969 » 01 Nov 2017, 20:11

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.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

karl222
Normal user
Posts: 88
Joined: 23 Aug 2017, 17:18
Location: Vienna

Re: water leak sensor

#7 Post by karl222 » 02 Nov 2017, 10:03

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

kimot
Normal user
Posts: 165
Joined: 12 Oct 2017, 20:46

Re: water leak sensor

#8 Post by kimot » 02 Nov 2017, 12:20

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.

karl222
Normal user
Posts: 88
Joined: 23 Aug 2017, 17:18
Location: Vienna

Re: water leak sensor

#9 Post by karl222 » 03 Nov 2017, 10:34

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

kimot
Normal user
Posts: 165
Joined: 12 Oct 2017, 20:46

Re: water leak sensor

#10 Post by kimot » 03 Nov 2017, 22:36

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.

KampfHund
Normal user
Posts: 3
Joined: 06 Nov 2017, 08:30

Re: water leak sensor

#11 Post by KampfHund » 08 Nov 2017, 21:11

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?

karl222
Normal user
Posts: 88
Joined: 23 Aug 2017, 17:18
Location: Vienna

Re: water leak sensor

#12 Post by karl222 » 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 BS270 which is led through water is sufficient to errect the BS170...

regards
karl
Last edited by karl222 on 26 Nov 2017, 18:01, edited 3 times in total.

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: water leak sensor

#13 Post by papperone » 18 Nov 2017, 23:41

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?
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

karl222
Normal user
Posts: 88
Joined: 23 Aug 2017, 17:18
Location: Vienna

Re: water leak sensor

#14 Post by karl222 » 19 Nov 2017, 08:14

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
Attachments
Water Leak Sensor_Steckplatine.jpg
Water Leak Sensor_Steckplatine.jpg (552.27 KiB) Viewed 5030 times
Last edited by karl222 on 26 Nov 2017, 18:01, edited 1 time in total.

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: water leak sensor

#15 Post by papperone » 19 Nov 2017, 12:24

thanks, any specific reason you used a mosfet instead of a simple NPN transistor?
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

karl222
Normal user
Posts: 88
Joined: 23 Aug 2017, 17:18
Location: Vienna

Re: water leak sensor

#16 Post by karl222 » 19 Nov 2017, 12:48

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 ;)

karl222
Normal user
Posts: 88
Joined: 23 Aug 2017, 17:18
Location: Vienna

Re: water leak sensor

#17 Post by karl222 » 19 Nov 2017, 15:30

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
Last edited by karl222 on 26 Nov 2017, 18:01, edited 2 times in total.

Shardan
Normal user
Posts: 1120
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: water leak sensor

#18 Post by Shardan » 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.
Regards
Shardan

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: water leak sensor

#19 Post by papperone » 19 Nov 2017, 16:22

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 :)
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

KampfHund
Normal user
Posts: 3
Joined: 06 Nov 2017, 08:30

Re: water leak sensor

#20 Post by KampfHund » 19 Nov 2017, 21:06

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 )

karl222
Normal user
Posts: 88
Joined: 23 Aug 2017, 17:18
Location: Vienna

Re: water leak sensor

#21 Post by karl222 » 25 Nov 2017, 15:55

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

kimot
Normal user
Posts: 165
Joined: 12 Oct 2017, 20:46

Re: water leak sensor

#22 Post by kimot » 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

karl222
Normal user
Posts: 88
Joined: 23 Aug 2017, 17:18
Location: Vienna

Re: water leak sensor

#23 Post by karl222 » 05 Dec 2017, 10:31

You are right, probably the better way...

Thx

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: water leak sensor

#24 Post by papperone » 05 Dec 2017, 14:53

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
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

kimot
Normal user
Posts: 165
Joined: 12 Oct 2017, 20:46

Re: water leak sensor

#25 Post by kimot » 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.

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: water leak sensor

#26 Post by papperone » 05 Dec 2017, 18:01

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!!
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

kimot
Normal user
Posts: 165
Joined: 12 Oct 2017, 20:46

Re: water leak sensor

#27 Post by kimot » 02 Mar 2018, 21:27


Finnarduino
Normal user
Posts: 3
Joined: 19 Jun 2017, 19:48

Re: water leak sensor

#28 Post by Finnarduino » 07 Mar 2018, 10:50

hi! is it possible to create water flow sensor by using sound detection?

How this works?
streamlabswater.com

ziancolins
Normal user
Posts: 1
Joined: 08 Mar 2018, 07:47

Re: water leak sensor

#29 Post by ziancolins » 08 Mar 2018, 07:51

Finnarduino, I think you should go to the youtube, and watch videos for understanding the process or work of water flow sensor.

romanheber
Normal user
Posts: 1
Joined: 13 Mar 2018, 14:21

Re: water leak sensor

#30 Post by romanheber » 13 Mar 2018, 14:40

I have contacted commercial leak detection contractor near me for that issue and they fixed it really well and used the best quality water sensor for detecting leaks. Anyone in that area if needing such services they must contact them for sure.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests