My basement flooding alarm
-
My basement flooding alarm was put in place because this year we have seen extreme rain on a few occasions, which in one case actually flooded the street, and as a result also my basement.
With the electrical cabinet and utility connections in the basement, that could have been very bad, if waterlevels had reached the cabinet itself, so I needed a way to measure waterlevels and have an automatic start of a sump pump when not at home (now my neighbours called me at work to tell me what was happening in the street).
As the house this alarm was built for, is not always occupied, we needed notifications via internet.
In the house I set up a MySensors network with a few nodes and a Raspberry which integrates the Controller (Domoticz) and Gateway functions (nrf24l01+ directly connected via interface board to raspi).
The basement is now being watched by a node which measures the distance to the floor using a cheap ultrasonic sensor. It will switch a relay if the "floor" rises a certain amount (10cm) and will switch off the relay when the "floor" is back within 2 cm from initial position.
The node resets itself to a start position on startup. This means that during startup a first distance measurement is done. This is the "zero" level. Any deviation from that first measured distance is "the change".
Here are some pictures of the node while not yet in the box:
And when mounted in the box:
I then installed this in the basement next to the electrical cabinet:
The node sends new distance measures to the controller only when they change. As I wanted to be able to remotely switch the relay at my discretion, the node itself is not battery based, but always on. I'm using a PCB I designed which you can find on Openhardware.io:
https://www.openhardware.io/view/11/ACDCBatteries-capable-atmega328p-boardYou can use any relay module which can be controlled by a digital pin.
I use the PA+LPA version of the nrf24l01+ radio, since the basement is covered by a slab of metal re-inforced concrete. A normal radio did not reach the gateway.
I have added the sketch below:
-
I saw your demonstration during the Dutch MySensors meetup and think this project is one of the first that demonstrates MySensors at it's fullest capabilities.
Great job!
-
@GertSanders said:
The node resets itself to a start position on startup. This means that during startup a first distance measurement is done. This is the "zero" level. Any deviation from that first measured distance is "the change".
Small caveat @GertSanders , if your basement is flooded with 9cm of water and still rising, when at that moment the power interrupts for a few seconds, your node will reset and take the 9cm as the zero level, meaning, your pump will start then when there's 19cm of water. Will not be a big issue, but your pump will need to run longer, and hoping there won't be any other power interruptions.
Great project btw.
-
@ericvdb
I considered this point and plan to add a EEPROM save of the zero line in a next version of the sketch, but as a quick fix the current version has proven adequate.
-
New version of sketch should solve the issue of powerlosses:
-
Nice project and nice board, I have ordered a bunch and they are on the way from dirtyPCB.
Why not use a water level sensor like the one below, I bought some and they are quite precise with very reproductible values, is it to avoid any risk from wires coming from the main-powered box going into the water ?
-
@Nca78 I'm just curious what's the max depth that you can measure with those water level sensors?
-
@TheoL said:
@Nca78 I'm just curious what's the max depth that you can measure with those water level sensors?
The length of the "stripes" is 4cms so that's all you've got to measure the level. But in this case it's enough to know if basement is flooded or not and start the pump. With the components on the top part + connectors protected by oxime (non acid) silicon sealant it won't be a problem if the water level rises higher than the sensor.
Just in case if someone is thinking about water level for drinkable water, I would avoid these sensors as the stripes are covered with solder. Given the very low price, there's a high chance it's not lead-free...
-
The reason I use the ultrasonic sensor is because I do not like to put a wire along the wall and a sensor on ground level. Now I only have a small case at cabinet level, with the US sensor directed to the floor. And I can measure any water level up to 255 cm with this.
A collegue of mine uses this same node to measure the amount of rainwater collected in his rainwater tank.
In Domoticz I have set up several triggers so that I get notifications on specific waterlevels. This is needed if waterlevels keep rising while the pump is working, meaning the pump can not handle the flooding and needs to be assisted by extra equipment.
-
@GertSanders I'd had a feeling that you used the ultra sonic sensors for a particular reason. Measuring the level of rain in my rainwater tank is definitely a project I've put in my todo list.
-
The 4cm sensor is nice to have some alarm under a washing machine for example, but in my "watertank" like problem (I have had up to 122cm of water in the basement) that would not tell me much.
The Ultrasonic sensor I use now also exists in a waterproof variant (as used in car-bumpers). Still need to experiment with that, as it would be nicer to use that in a watertank (is better protected against corrosion).
In my current setup, I expect the electronics to degrade after some time, since they are used in a very humid environment. The box all this is mounted in, is certainly NOT waterproof.
-
@Nca78 have you been using the Rain Water Level Sensor modules for a while? Can you run more than one on a pro mini? I was thinking, since they are small, that I could use a few at different levels to have different actions. I saw a water level eTape, but it is a bit expensive (haven't seen a Chinese knockoff yet). Or I suppose I could combine the sensor for initial water detection, then the ultra sonic to figure out depth.
-
@crodgers no I just tested them at the moment. But they all gave me close values for similar levels of water. It has an analog output, so you can combine as many as the analog pins on your arduino, so up to 8 on a pro-mini if you are not using I2C devices (I2C uses A4/A5).
I plan to use these for simple flooding or rain detection more than for the water level.I found this sensors too, they look a bit bigger and have gold coating which would solve the potential hazard of lead solder and increase durability, but there are no dimensions on the website. They also don't have the led which is an advantage for me to run on batteries, no use to remove it by hand.
http://www.aliexpress.com/store/product/Water-Level-Sensor-gold-coating/1950989_32713161293.html
-
Nice build, and great idea using the ultra sonic sensor.
This sort of thing was the exact reason I got into arduino and eventually mysensors. I had a concern about a damp basement and went looking for a water leak detection alarm but the prices were so high at the time... eventually I stumbled upon arduino and the obsession went from there.
The first node I ever made was a water leak detection system that used the 4cm thing mentioned above... then I realized I had all these left over pins so I filled them up with a gas, flame, temperature, humidity and light sensor.
Forget nest protect and commercial water leak detection systems... I now have an all in one DIY solution that probably only cost $30