My smart home implementation

    A year and a half ago, I wrote an article about the development of my own bus “CLUNET” for connecting devices in a “smart home”. Many are asked to talk about what I got as a result, which I’ll try to do now.

    I tried to draw a diagram of my room with all the devices connected to the network, the picture is clickable: The whole idea rests on three pillars:





    • Decentralization - the whole system operates without any main module;
    • Simplicity - a minimum of components and ease of connection;
    • Cheapness - the cost of the device is easy to put in 100 rubles.


    With this approach, you can easily create and add devices to the CLUNET network, each of which is responsible for some simple function. All devices have their own address, while they can exchange packets between themselves directly, without the participation of any main module, and this is very actively used:

    • The packages from the remote control receiver receive a switch and a window opener, which allows you to control the light and open the window from any remote control or Nintendo Wii U;
    • Motion sensors inform the switch that there is no one in the room, and you can turn off the light;
    • The display in the corridor always displays the actual outdoor temperature received from temperature sensors;
    • At the command of the code panel, a door lock is opened;
    • The device with a squeaker emits sounds when it learns about opening the lock, pressing a button or making a call to the intercom.

    This list is easily changed and supplemented with the fact that the firmware of each device can be updated directly over the network. And no, I have no problems with misunderstanding my sources. The code for all firmware is extremely simple.

    The only main device, perhaps, can only be called a power supply. At the moment, I have one for almost all home-made devices, and copes with it perfectly. Many will most likely say: “Yes, you probably have wires everywhere!”, This is partly true, but I don’t have any phobia in relation to wires. In addition, a small loop with power and a data line is almost invisible against the background of other cables.

    Router with CLUNET adapter


    In addition to traffic routing, my router has another role - traffic routing is a “window” for CLUNET devices on the Internet. Or rather the opposite - allows you to command all devices from the Internet and local network. For this, a special device is included in its USB port. I will not repeat much, I talked about this in an article about the CLUNET protocol . The idea is simple - a Linux-based router, and it runs a daemon that accepts incoming connections from a local network or the Internet and provides access to the network of smart home devices. In addition, the router is used as a simple web server so that you can manage devices via the web interface in case ... well, just in case: It’s very convenient to use









    cron on the router for a variety of tasks - from opening a window or heating a room on a schedule to a trivial alarm clock. For the latter, I have made a simple web interface and scripts:



    No alarm is nicer than waking up from a radio that increases its volume very slowly over several minutes. The main thing is to turn it off before it can wake up the neighbors.

    In response to packets coming from devices, various scripts are also executed. This is how logs are kept for various events such as calls to the intercom, temperature charts ( http://clusterrr.com/sensors/t/ ) and other data are drawn , a push notification is sent to my phone if the door is open in the room, and me not at home, and so on.

    Software for Windows


    The computer runs an application that connects to the daemon on the router and allows you to fully manage everything and everything. In the main window, you can track all traffic between devices and send them any command: In it you can watch how a smart home lives a full life, but in practice it is only necessary for debugging. Everything can be done by clicking on the icon in the notification area: In addition, many actions have special keyboard shortcuts. Yes, laziness is the engine of progress, and it’s damn convenient for me to open a window or turn on the light with hot keys without getting up from my chair.









    But you can’t stop at controlling the light, you must also manage household appliances! To do this, I use a remote control that simulates the pressing of buttons on the remote controls. By pressing a hot key, on-screen remote controls appear on the screen: Of these, you can control the receiver, TV, heater and laser. It is difficult to describe how much this made life easier. Remotes always have to look for, they are lying anywhere, but not nearby. Now they are completely covered in dust. In addition, this software also performs the opposite role - it receives button codes from the remote control and imitates a WinLIRC server, a popular program for working with remote controls. Work with it supports, for example, MPC-HC, there is a plugin for foobar2000. In this way, you can do the other way around - manage applications on your computer using any remote control.







    Soft for phone


    Well, how can you manage all this from your phone from anywhere in the world? The Android application has about the same functionality. In general, activity can be switched between different modes by horizontal swipe.



    The tablet


    At first I had a thought - to solder the wall control panel that would hang over the bed to perform the simplest actions from it - turn on the light, adjust the volume, control the TV, etc. I would like to add a screen there to display basic information.

    But it soon dawned on me that the times were not the same. It’s much easier to buy a cheap Chinese Android tablet and hang it on the wall. Yes, such tablets are usually slow and very poor quality, but for my purposes this is quite enough. No sooner said than done. I had to compose various desktop widgets:







    But it was still not convenient enough, especially when I wanted to do something by touch. After some time, I remembered that Android has an excellent voice recognition API. It took only half an hour for the tablet to start executing its first voice commands. Soon, the set of possible teams has grown significantly.

    Meet my electronic wife:



    Needless to say, how convenient is it to open a window at night without opening the eye? It is a pity that this drive is very noisy - when the window closes according to the timer, it is impossible to wake up.

    A similar service was eventually installed on the phone. It works only when charging is connected. It would probably be great to use Google Glass for this.

    More about devices


    In the end, I’ll tell you a little about which devices function in my smart home. Attention! Below the hellish amount of collective farm and wires! I don’t know how to do beautifully; my hands are growing out of the right place.

    Light switch

    Nothing special, just turn the lamps on the chandelier on and off.



    Touch buttons - one adds the number of lamps, the other decreases. It is possible to set the off timer, but its need has disappeared with the advent of the wall-mounted tablet. Friendly with remote control and motion sensors.

    Reed controller with squeaker

    This very strange device appeared long before I started making a smart home, which is why it was done very clumsily and without a case.



    The bottom line is that mice lived in my room, and cats in the rest of the apartment. The whole point of the device was to squeak wildly if you forgot to close the door, because cats in no case should enter the room to the mice. Now the device sends packets to the network when opening and closing the door. The router writes the logs of its opening and sends me a push notification if it is suddenly open when I am not at home. My location is determined by mobile phone. In addition to all this, the squeaker is now used for a variety of sound notifications - intercom, opening the lock, pressing buttons on the code panel.

    Remote control and remote control

    I kind of already talked about them above. The receiver is at the computer, the transmitter is hidden on the cabinet.



    Motion sensors

    Two such motion sensors are hanging in the room.



    They contribute to turning off the light when there is no movement for a long time, and also changing my status to “away” in instant messengers. In addition to them, four cameras determine the movement.

    Door lock and code panel

    When I became the proud owner of a 3D printer, I really wanted to experiment with mechanics. As a result, I designed and printed a door lock mechanism. The first pancake was lumpy, and we got a wild collective farm, but it functions perfectly. From the outside of the door I made a code panel, it has already come out better. Better to just watch the video.



    Now I have everything like serious adult uncle!

    Temperature and light sensors

    There is nothing special to tell. The device hangs under the windowsill and polls for 1-wire temperature sensors; in addition, an additional light sensor was experimentally made. I don’t know why.

    Window opener

    You could already see it a little in the video above. The mechanism itself is purchased and is a chain with an engine. It was nice to know that there are companies that make such things.



    The drive itself is powered by 220V. On the left in the box is a circuit with two relays that supply power. I took one loop from the window, which allowed me to open it twice as wide, so I can open it completely and halfway.

    Display in the hallway

    Once upon leaving the house, I wanted to see the current temperature in the street and time. That's all.



    And there Pac-Man runs, for which several custom characters were drawn.

    Intercom

    About my intercom with answering machine, I wrote a separate article: http://habrahabr.ru/post/188906/

    Mouse cells

    Mouse cells transmit in the form of infrared signals information about how much each mouse ran in the wheel. About this, too, was a separate article: http://habrahabr.ru/post/165269/
    Alas, now there is only one mouse left, and it runs a little.

    Camcorders

    There are four IP cameras with rotation mechanisms in the room.



    They send a short video to the remote server when the door opens. Or long, if I'm not at home. If there is movement, they periodically take photos. In addition to all this, the cameras work as additional motion sensors. If something begins to move, they request a link on the router, and that in turn sends a broadcast packet to the network.

    Conclusion


    I hope that the article is not too boring. I did not know how to tell about everything in such a way that it was interesting, there was a lot of information, I tried to state it briefly.

    Many people will probably ask me: “Why do you need so many cameras?”, “Why do you need a code panel?”, “Why do you need motion sensors?”, “Why do you need all this?”
    I will answer all such questions with one picture:


    Also popular now: