How not to overpay for a Smart House. Flood protection (anti-leakage)

    The article presents a pragmatic approach to creating one of the elements of the Smart House - economical flood protection (anti-leakage) based on a universal home automation controller.

    The main differences from the solutions of this problem previously presented on the hub are ease of implementation, relatively cheap + you don’t need to be a programmer to repeat. True, you still have to solder, but only 2 times.


    On the hub, as on the resource of technically active people, to which the afflicted go for advice and problem solving, there are many articles on the topic Smart Home.
    And often in the comments there are regrets that no one supposedly gave birth at the same time to a powerful, easy to learn and economical way to implement a Smart House for ordinary people. It is necessary to solder, then code, often in different languages: for the microcontroller, and for the web, and so on.
    And so that I took it, bought spare parts, cubes for inexpensive and personally launched it myself - this is rarely seen.

    So I decided to insert my 5 kopecks, because it looks like I just came across one of the options for implementing Smart Home, which can be suitable for many pragmatic consumers.

    I will tell you by the example of the implementation of flood protection, although already, on the same controller I have a system of burglar alarms, temperature registration and automatic shutdown of the necessary sockets when leaving home.

    So, according to my “Maslow’s pyramid of needs for a Smart Home” (c), the importance of signaling and preventing a flood is at the same level as the importance of signaling an intrusion or smoke.

    Maslow's Pyramid of Needs for Smart Home

    For the scale of the tragedy can be terrifying:

    Due to the fact that I recently acquired a universal smart home controller and have already implemented more important functionality, I decided that it was time to “lay straws”.


    So, in case of detecting a water leak, I wanted to receive an alert (SMS and / or email) and to automatically shut off the water supply to the apartment. And also be able to open and close the water "manually", including remotely via the Internet.


    There are a number of ready-made sets for a complete or partial solution to this problem, but, firstly, they are a little expensive to put it mildly, and secondly, having a universal smart home control controller in your hands, you can do all this yourself and it will not be worse, or even better because That everything will be integrated into a single system and will interact exactly as I want, and not as the system manufacturer decided. And given that the most expensive part of the system is already there (controller), we get rid of duplication and redundancy.

    The current structure of my Smart Home system. The components directly involved in the Anti-leakage system are highlighted in red.

    The desktop layout of the application part of the anti-leakage system looked like this:

    I now get hot water by heating cold water in a boiler. Therefore, only one pipe needs to be shut off.

    If necessary, the system can be easily increased and the second pipe is shut off simply by adding another valve and connecting it in parallel to the radio relay.

    Leakage sensor

    The most difficult moment in the whole system.
    The trouble is that if the issues of controlling the intrusion and the appearance of smoke or gas are elementarily solved by standard sensors, then with the control of water leakage everything is somewhat different. In the list of compatible sensors of my universal controller there is no sensor for water leakage yet. At least there wasn’t ...

    Search on the hub quickly showed the path of least resistance : take a standard wireless reed switch and instead of a reed switch, or rather parallel to it, remove the wires with the contacts and close them with water.

    This approach has several disadvantages: one of the main ones is the oxidation of ungold contacts over time.

    I previously read on the Internet that there are other ways to determine water leakage, for example, non-contact, but low cost, promptness and elementary implementation of the above option interrupted the flight of engineering toward innovative approaches.

    The basis was taken by the Chinese wireless magnetocontact (reed) sensor MD-209R. In my case, a relatively cheap clone sensor was selected that is compatible with the PowerCode (Visonic) transmission protocol, as this is one of the wireless protocols supported by my controller.

    In parallel to the built-in reed switch, I soldered 2 wires, the closure of which actually leads to the sensor triggering.

    So, after some simple manipulations with a soldering iron, this turned out:

    Electric valve

    As a valve that blocks the water, you can use any valve having an electric actuator and the appropriate size of the connection to the pipe.

    I tested my model on a Chinese valve with an electric actuator for a 1/2 inch pipe .

    The valve actuator design automatically shuts off power to the coil after opening or closing. Thus, there is no need to remove voltage through the radio relay commands from the controller after the operation.

    Radio relay

    To supply power to the drive, I bought on ebay this two-channel radio relay from the list of compatible with the controller. Type YKT-02XX-433

    Inside, the 1527 encoder chip, so beloved by Chinese manufacturers, is installed inside

    it. There are 10-ampere relays, therefore, in principle, they can switch almost any household load up to 250V. Limit 2 kW.

    To control the electric drive, this is more than enough, since the valve drive is powered by 12 V and consumes only 4 W according to the passport, and only during a change in the state of the valve.

    This radio relay can work in several modes, one of which we just need: a mutual blocking of channels. In this mode - when the relay of one channel is turned on, the relay of the other channel is automatically turned off. Thus, we are "almost hardware" protected from the simultaneous supply of voltage to the "opening" and "closing" of the solenoid valve actuator due to any glitches.

    Connection diagram of valve, receiver:


    As the "brains" of the system, I used the Nanoserver NS1000 - a universal controller of the domestic manufacturer 1-M Smart Home .

    Features of the controller, which are somehow used in this project:
    • Support for extra-budgetary wireless sensors and radio relays.
    • Executing scripts offline (even without the Internet).
    • Notification of events via SMS and email.
    • Elementary preparation of “scenarios” of the system without writing code.
    • Ability to manage devices from a smartphone (Android).
    • Management via WEB.
    • Maintaining "logs".


    In the process of setting up the controller, you need to take into account the following nuance: The
    reed switch sends a warning message when it opens, and we need to make it when it closes. Accordingly, in the condition for starting the script, it is necessary to indicate not turning on the sensor, but turning it off. And not by condition, but by change. To prevent alerts from repeating cyclically.

    Scenario 1 trigger condition: If the Leakage Sensor Channel has turned off.
    Script steps:
    . Alert "Master, we have a flood!"
    . Turn on the channel "Close the water valve"

    And the script for opening the valve on command from a remote control or from a smartphone:
    Scenario 2 trigger condition: If the Channel "You can open the water valve" Channel is turned on.
    Script steps:
    . Turn on the channel "Water valve open"

    In the WEB-interface of the cloud service, it looks like this:

    For manual device management, you do not need to “program” anything - after adding to the system, the management of each device automatically becomes available from the Personal Account via the WEB interface and from the Android application.

    View of WEB-control panel of Smart Home via the Internet:

    Appearance of Android application

    What is the result?

    The goal is achieved. When the leakage sensor is triggered, I get an SMS alert like “Master, we have a flood!” And the valve automatically shuts down in less than 30 seconds.
    Also, I have the opportunity not to automatically open and close the valve, by pressing the remote control buttons, from a smartphone or from a browser via the Internet.
    The operation of each sensor and device is recorded in the logbook.

    At the same time, I did not have to write a code and an independent repetition of this solution is quite affordable for most (of course, not counting the installation of valves on pipes).

    Setting up the system, knowing what you want, takes 10 minutes on the strength. Including sensor activation and radio relay, creation of all scenarios.

    It is clear that in the form as it is presented in the photographs, in reality it will not be able to work for a long time and reliably.
    The valve drive power supply, radio relay, and the sensor itself must also be placed in plastic boxes with at least some degree of protection.

    Plus, there are already different thoughts on the development of the system, for example, duplicating alerts on the light signaling, periodic “training” of the valve so that it does not “stagnate”, etc. By the way, I personally have serious doubts about the need for a backup power supply function of the solenoid valve, which some “purchased” anti-leakage kits so boast of.

    In other words, appetite comes with eating.

    The good thing is that to increase the functionality you do not need to call "certified" specialists so that they twist something in the system. All this can be done elementarily yourself, thanks to the simplicity of the principles of setting up a universal controller.

    A little about prices:

    Nanoserver NS-1000 - $ 44
    Magnetic contact sensor MD-209R - $ 13
    Radio relay - $ 10
    Valve- $ 15

    Total (excluding delivery) = $ 82

    Not so cheap. But this is if you do not take into account that the nanoserver is used not only for the anti-leakage function. After all, it implements a security and fire alarm system and other features ...


    In the process of implementation, having already bought the valve, I found that there are electric drives that are installed on conventional ball valves with manual control.
    An additional and important bonus of this approach - in which case, in a few minutes you can return the manual control of the valve.
    I immediately got sick of embedding additional shutoff valves in the water supply system and I ordered such a drive. I'm waiting.

    Update 2:
    As long as the salt and the matter, the controller manufacturer announced a leak sensor.

    Judging by the information , the sensor uses the non-contact principle of determining the appearance of water, which in itself is already quite unusual. It is also interesting in that it is not “sharpened” under the “brand” and can be used not only with the 1-M Smart Home system, but also with any system running the PowerCode protocol. In fact, it sends a package similar to the MD-209R sensor, which I used for my anti-leakage.
    The price, it seems, will also be comparable - $ 9.9.

    Let's see ...

    Also popular now: