Geek magazine hacker daily blog

3 years, 3 months ago
Pragmatic approach on creation of one of elements of the Smart House — economical protection against a flood (anti-leakage) based on the universal controller of house automation is presented in article.

The main differences from the solutions of this task which are earlier provided on Habré – simplicity of implementation, it is not necessary to be rather cheap + for repetition by the programmer. The truth it is necessary to solder all the same, but only 2 times.

How not to overpay for the Smart House. Protection against a flood (anti-leakage)


Introduction


On Habré as on a resource of technically active people on which sufferers follow council and a solution of problems the set of articles on a subject the Smart House is placed.
And often regrets that nobody gave rise to a pier at the same time powerful, simple in mastering and an economical method of implementation of the Smart House for inhabitants yet occur in comments. It is necessary to solder, to incense, and it is frequent in different languages: both for the microcontroller, and for a web and so on.
And so that took, purchased spare parts cubes for cheap and itself personally started – it seldom meets.

Here I also decided to insert 5 kopeks as it is similar, one of options of implementation of the Smart House which can be suitable for many pragmatically configured consumers just got to me.

I will tell on example of implementation of protection against a flood though already, on the same controller at me the alarm system, registration of temperature and auto disconnect of the necessary sockets functions at withdrawal from the house.

So, on my "pyramid of needs of Maslou for the Smart House" (c) – importance of signaling and prevention of a flood is at the same level, as importance of signaling about invasion or emergence of a smoke.

Pyramid of needs of Maslou for the Smart House

How not to overpay for the Smart House. Protection against a flood (anti-leakage)


Because the scale of the tragedy can be terrifying:
How not to overpay for the Smart House. Protection against a flood (anti-leakage)

In view of the fact that I got the universal controller of the smart house recently and already implemented more important functionality — I decided that it is time "to lay straws".

Problem


So, there was a wish – to receive in case of detection of a leakage of water the notification (SMS and/or email) and that water supply to the apartment was automatically blocked. And also to have an opportunity to open and block water "manually", including far off on the Internet.

Solution


There is a number of ready sets for a complete or partial solution of this task, but, first, they are to put it mildly expensive, secondly, having the universal controller of management of the smart house in hands all this can be made most and it will not be worse, and even better in view of the fact that everything will be integrated into a single system and will interact quite so as I want, but not as the system manufacturer solved. And considering that the most expensive part system is already (controller), we get rid of duplication and redundancy.

Current structure of my system Smart House. Red the components which are directly participating in Antiprotechki's system are selected.

How not to overpay for the Smart House. Protection against a flood (anti-leakage)


The desktop model of applied part of system of an anti-leakage looked so:

How not to overpay for the Smart House. Protection against a flood (anti-leakage)


At me now hot water turns out by heating in a boiler of a cold water. Therefore it is necessary to block only one pipe.

If necessary, the system can be increased and made elementary overlapping of the second pipe just having added one more valve and having connected it in parallel to the radio relay.

Leakage sensor


The most difficult moment in all system.
The trouble is that if questions on control of invasion and emergence of a smoke or gas elementary are solved standard sensors, then with water leak control all a little differently. In the list of compatible sensors of my universal controller there is no water leakage sensor yet. At least was not …

Search on Habré quickly showed a line of least resistance: to take the standard wireless gerkonovy sensor and instead of the sealed-contact, to be exact parallel to it, to display wires with contacts and to close them water.

This approach has a number of shortcomings: one of main is oxidation not of gilded contacts with time.

How not to overpay for the Smart House. Protection against a flood (anti-leakage) Earlier read on the Internet that there are other methods of determination of a leakage of water, for example, contactless, but low cost, efficiency and simplicity of implementation of the option described above interrupted flight of engineering thought towards the innovation approaches.

The Chinese wireless magnetocontact (gerkonovy) MD-209R sensor was taken as a basis. In my case rather cheap sensor clone compatible to the transfer protocol PowerCode (Visonic firm) as it is one of the wireless protocols supported by my controller was selected.

Parallel to the built-in sealed-contact I soldered 2 wires which short circuit is actually led to operation of the sensor.

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

How not to overpay for the Smart House. Protection against a flood (anti-leakage)

The valve with the electric drive


How not to overpay for the Smart House. Protection against a flood (anti-leakage)As the valve blocking water it is possible to use any valve having the electric drive and the corresponding amount of connection with a pipe.

I tested the model on the Chinese valve with the electric drive under a pipe for 1/2 inches.

How not to overpay for the Smart House. Protection against a flood (anti-leakage)

Construction of the electric drive of the valve automatically powers off on the coil after opening or closing. Thus, there is no need commands from the controller to remove stress via the radio relay after operation execution.

Radio relay


For giving of power supply on the drive I bought on ebay here such two-channel radio relay from the list compatible to the controller. YKT-02XX-433 type

How not to overpay for the Smart House. Protection against a flood (anti-leakage)

Inside the chip coder of 1527 loved by the Chinese vendors is set so.

In it there are 10-ampere relays therefore, in principle, them it is possible to switch almost any household loading to 250B. Restriction of 2 kW.

For control of the electric drive of it more than it is enough as the drive of the valve is powered from 12 V and according to the passport only 4 W, and only in modification time of a status of the valve consume.

This radio relay can work in several modes, one of which just and it is necessary to us: interlock of channels. In this mode — at turning on of the relay of one channel, the relay of other channel is automatically switched off. Thus, we "almost hardware" are protected from simultaneous giving of tension on "opening" and "closing" on the valve electric drive solenoid owing to any glitches.

Scheme of connection of the valve, receiver:

How not to overpay for the Smart House. Protection against a flood (anti-leakage)

Management


How not to overpay for the Smart House. Protection against a flood (anti-leakage)
As "brains" of system I applied Nanoserver NS1000 — the universal controller of domestic producer 1-M the Smart House.

Possibilities of the controller which are anyway used in this project:
• Support of extra budget wireless sensors and radio relay.
• Execution of scenarios offline (even without the Internet).
• The notification about events through SMS and by e-mail.
• Elementary drawing up "scenarios" of system operation without writing any code.
• An opportunity device management from the smartphone (Android).
• Management through WEB.
• Maintaining "logs".

Scenarios


In the course of setup of the controller it is necessary to consider the following nuance:
The Gerkonovy sensor sends the message on operation when it is disconnected, and it is necessary to us that at short circuit. Respectively, it is necessary to specify not turning on of the sensor, but switching off in a condition of start of the scenario. And not on a status, and on change. That notifications did not repeat cyclically.

Condition of start of the scenario 1: If the Leakage Sensor Channel was switched off.
Scenario steps:
. The notification "The owner, we have a flood!"
. To include To Close the Valve of Water channel

And the scenario on opening of the valve on command with a brelka or from the smartphone:
Condition of start of the scenario 2: If the It Is Possible to Open the Water Valve Channel joined.
Scenario steps:
. To include To Open the Valve of Water channel


In the WEB INTERFACE of a cloud service it looks so:

How not to overpay for the Smart House. Protection against a flood (anti-leakage)

For manual control by devices it is not necessary "to program" anything – after adding in system, the control of each device becomes automatically available from the Personal account via the WEB INTERFACE and from an Android-application.

Type of a panel of WEB MANAGEMENT of the Smart House on the Internet:

How not to overpay for the Smart House. Protection against a flood (anti-leakage)

Appearance of an Android-application

How not to overpay for the Smart House. Protection against a flood (anti-leakage)

What as a result?


The objectives are achieved. At operation of the sensor of a leakage, I receive the SMS notification of a type "The owner, we have a flood!" and the valve is automatically blocked within less than 30 seconds.
Also, I have an opportunity not automatically to open and close the valve, by clicking buttons a brelka, from the smartphone or from the browser on the Internet.
Operation of each sensor and device is registered in the log of logs.

At the same time, it was not necessary to write a code and independent repetition of this solution is quite available to the majority (of course, apart from installation of valves on pipes).

Setup of system, knowing that you want, takes at most 10 minutes. Including activation of the sensor and radio relay, creation of all scenarios.

It is clear, that in that type as it is provided in photos, in reality it long also will not be able reliably to work.
The power supply unit of the drive of the valve, the radio relay and the sensor need to be placed in plastic boxes with though some degree of protection.

Plus there are already different thoughts on development of system, for example, to duplication of the notification on the signal light, periodic "training" of the valve that "did not stand" and tp. By the way, personally I have serious doubts in need of function of back supply of the electrovalve of which some "purchased" sets of an anti-leakage so brag.

In other words — appetite comes during a meal.

The benefit put that for accumulation of functionality it is not necessary to call the "certified" specialists that they tightened up something in system. All this can be made elementary most, thanks to simplicity of the principles of setup of the universal controller.

It is a little about the prices:


The NS-1000 nanoserver — $44
The sensor magnetocontact MD-209R — $13
The radio relay — $10
The valve - $15

Total (without delivery) = $82

Not so cheap. But it if not to consider that the nanoserver is used not only for an anti-leakage fukntion. On it the system of the security and fire warning and other opportunities is implemented …



How not to overpay for the Smart House. Protection against a flood (anti-leakage)

P.S.


In implementation process, having already purchased the valve, I found out that there are electric drives which are installed on normal a hand-operated sphere cranes.
Additional and important bonus of such approach – if something happens, in several minutes it is possible to return manual control by the valve.
To me was right there ceased to want to cut additional shutoff valves in a water supply system and I ordered such drive. I wait.

Update 2:
While salt yes business, the vendor of the controller announced the leakage sensor.

How not to overpay for the Smart House. Protection against a flood (anti-leakage)

How not to overpay for the Smart House. Protection against a flood (anti-leakage)

Judging by information, the sensor uses the contactless principle of determination of emergence of water that in itself is already quite unusual. Also it is interesting that it "is not ground" under "brand" and the Smart House, and and with any system working under the PowerCode protocol can be used not only with system 1-M. Actually it gives sending similar to the MD-209R sensor which I used to the anti-leakage.
The price, seemingly, too will be comparable — $9.9.

Let's have a look …

This article is a translation of the original post at geektimes.ru/post/245086/
If you have any questions regarding the material covered in the article above, please, contact the original author of the post.
If you have any complaints about this article or you want this article to be deleted, please, drop an email here: sysmagazine.com@gmail.com.

We believe that the knowledge, which is available at the most popular Russian IT blog geektimes.ru, should be accessed by everyone, even though it is poorly translated.
Shared knowledge makes the world better.
Best wishes.