Easy ESP and DS18B20 as flood sensor

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
mlody
New user
Posts: 2
Joined: 12 Jul 2023, 22:57

Easy ESP and DS18B20 as flood sensor

#1 Post by mlody » 12 Jul 2023, 23:20

I built a flood detection sensor based on DS18B20. The system detects and communicates the state of flood detection by changes of the DS18B20 parasite "power" output state. In short, the power pin have a power cut off circuit when the sensor detects water through the probes. The advantage of such a system is the fact that such a sensor still function as a temperature measurement and still communicates via a one wire line (1 cable + ground) and does not require connection using a protocol, e.g. I2C.

Everything works fine, but is it possible in Easy ESP to enable the option of sending a topic via MQTT in a situation when the parasite power supply state for DS18B20 changes?

Thanks in advance.

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Easy ESP and DS18B20 as flood sensor

#2 Post by TD-er » 13 Jul 2023, 00:03

Not yet, but I like the idea as it can also be used to detect (wiring) issues via events.

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Easy ESP and DS18B20 as flood sensor

#3 Post by TD-er » 13 Jul 2023, 00:05


mlody
New user
Posts: 2
Joined: 12 Jul 2023, 22:57

Re: Easy ESP and DS18B20 as flood sensor

#4 Post by mlody » 15 Jul 2023, 18:46

Great to hear! Thanks. Looking forward for that funcionality in next versions.

Manual for those who would like to build such sensor...

Sensor works using 1W (one wire) protocol, so you should remember about proper wire connections to ESP (e.g.):
  • Line (at the end) termination (pull-up resistor between DATA pin and 5V) with R=4k7 (or less, if whole 1W line is much longer - a dozen, several dozens meters; minimum resistor value is 2k2).
  • If some of your DS18B20 are still not stable (you can obseve that when your multiple DS18B20 sensors periodically appear and disappear in ESP Easy UI detected sensor list) you can add 10uF [microfarads] electrolytic capacitor between 5V and GND (directly before each of those non stable sensors).
Advantages of 1W solution:
  • As I mentioned before this leaks monitoring method uses only 2 from 3 1W cables: DATA and GND (no Vdd 3-5V cable needed). - In my case I'm using ground and a one of free cables from the alarm system (which is present in every room).
  • Long distance installations (several dozen or even hundreds of meters).
  • Possibility to connect multiple sensors in one line or star structure using same cables (in some cases mixing line with star structures works too).
  • Possibility to connect all sensors to 1 GPIO in ESP.
  • You can use other different (light, smoke, etc.) sensors on the input (with open/close output) and make them work via 1W.
In this case in normal conditions (no water leak) DS18B20 is powered from DATA cable and his POWER state is set to 1 (no parasite powered). When Probe #1 will be shorted (with water) to Probe #2, T1 and T2 transistors will short Vdd of DS18B20 to GND and POWER state of DS will be changed to 0 (parasite powered). So you have 2 scenarios:
  • no leak - ...28.DSIDXXXXXXXX\power = 1
  • leak - ...28.DSIDXXXXXXXX\power = 0
Connections diagram:
Czujnik zalania (2 kable).png
Czujnik zalania (2 kable).png (27.71 KiB) Viewed 843 times

You can mount all parts on very small (like 18mm x 22mm) universal PCB board. Part placement diagram (this is parts side view - drawn connections should be made from tin on the other side of PCB [mirror view]):
Czujnik zalania #3.jpg
Czujnik zalania #3.jpg (1.49 MiB) Viewed 843 times
  • P1 and P2 are probe connectors (you can use jumper pins).
  • Doted lines are wire connections between those points.
  • To make it waterproof, after assembly:
    • put all in heat shrinkable tube (tube should be about 1-2cm longer then PCB board on both ends),
    • fill tube (at least bottom of tube/senor) with e.g. sanitary silicone from both tube ends,
    • heat up/shrink the tube and squeeze righ away each tube end (when tube is still warm) making top and bottom surface to stick together, what will make botch ends sealed (around the cable too),
    • make point holes in places where probe pins are trying to sick out and if you wish, above head of DS too (for better temperature sensing - in this case think about a way to seal this point to make whole sensor waterproof again).
  • Now you can just lay down sensor in place when the leakage risk exist.
Everything sholud more or less look like this (one of my old sensors - with tube taken off and silicone partly removed):
Czujnik zalania #4.jpg
Czujnik zalania #4.jpg (390.57 KiB) Viewed 843 times
Few of those works fine in my system for several years now.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 42 guests