📜 ⬆️ ⬇️

My implementation of "smart home"

A year and a half ago, I wrote an article about developing my own CLUNET bus for connecting devices in a smart home. Many people ask me to talk about what I got in the end, which I will now try to do.

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:



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 among themselves directly, without the participation of any main module, and this is very actively used:


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

The only main device, perhaps, can be called only the 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 have no phobia with respect to the wires. In addition, a small cable with power and data line is almost imperceptible from the rest of the cables.

Router with CLUNET adapter


In addition to routing traffic, my router performs another role — it is the “ routing” of traffic 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 told about this in an article about the CLUNET protocol . The idea is simple - a Linux-based router that runs on a daemon that accepts incoming connections from the 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 through the web interface for a case ... well, just in case:



It is very convenient to use cron on a router for various tasks - from opening a window or heating a room on a schedule to a banal alarm clock. For the last, I have a simple web interface and scripts:



No alarm is more pleasant than waking up from a radio, which very slowly increases the volume in a few minutes. The main thing is to turn it off before it can wake up the neighbors.

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

Windows software


On the computer running an application that connects to the daemon on the router and allows you to fully manage everything and everyone. In the main window, you can track all traffic between devices and send them any command:



In it you can observe how a smart home lives a full life, but in practice it is only needed for debugging. Everything can be done by clicking on the icon in the notification area:



In addition, many actions have special shortcut keys. Yes, laziness is the engine of progress, and it is 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 not stop at the management of light, it is necessary to control and household appliances! For this, I use a remote control transmitter, which simulates pressing buttons on the consoles. By pressing the hot key, on-screen remote controls appear on the screen:



From them you can control the receiver, TV, heater and laser. It is difficult to describe how much it made life easier. Consoles always have to look, they are lying anywhere, just not close. Now they are completely covered with dust.

In addition, this software performs the opposite role - it receives the codes of buttons from the remote control and simulates the WinLIRC server, a popular program for working with remote controls. Work with it is supported, for example, by MPC-HC, there is a plugin for foobar2000. This way you can do it and vice versa - manage applications on your computer using any remote control.

Soft for phone


Well, what if without control of all this from a telephone from anywhere in the world? The Android application has about the same functionality. In general, activations can be switched between different modes by horizontal svayp.



The tablet


At first I had a thought - to solder a wall control panel that would hang over the bed in order 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 is much easier to buy a cheap Chinese tablet on Android and hang it on the wall. Yes, these tablets are usually slowed down and of very poor quality, but for my purposes this is quite enough. No sooner said than done.



Had to nag various desktop widgets:



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

Meet my e-wife here:



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

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

More about devices


Finally, I’ll tell you a little about what devices are functioning in my smart home. Attention! Below is a hell of a collective farm and wires! Beautifully, I do not know how, my hands do not grow from the right place.

Light switch

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



Touch buttons - one adds the number of lamps, the other diminishes. It is possible to set the shutdown timer, but its need no longer with the advent of the wall plate. He is friends with the DU-receiver and motion sensors.

Reed switch controller with beeper

This very strange device appeared long before I started to make the smart home, that's why it was made quite clumsy and without a casing.



The bottom line is that the mice lived in my room, and the rest of the apartment were cats. The whole point of the device was to squeak wildly, if you forgot to close the door, because cats in no case should penetrate the room to the mice. Now the device sends packets to the network when the door is opened and closed. The router also writes the logs of its opening and sends me a push-notification, if suddenly it is 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 a lock, pressing buttons on the code panel.

Remote control receiver and remote control transmitter

About them, I seem to have already said above. The receiver is at the computer, the transmitter is hidden on the cabinet.



Motion sensors

There are two motion sensors in the room.



They help to turn off the light when there is no movement for a long time, and also to change my status to “away” in instant messengers. In addition to them, motion is also determined by four video cameras.

Door Lock and Code Pad

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



Now I have everything like a serious adult uncle!

Temperature and lighting sensors

There is nothing special to tell. The device hangs under the window sill and interrogates the 1-wire temperature sensors, in addition to this, a light sensor has been experimentally made. I do not know why.

Window opener

You could already see a little of it 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 do 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 made it possible to open it twice as wide, so you can open it fully and half.

Corridor display

Once, when I was leaving the house, I wanted to see the current outside temperature and time. That's all.



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

Intercom

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

Mouse cells

Mouse cells transmit in the form of IR 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, and he runs a little.

Camcorders

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



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

Conclusion


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

Many people will surely 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:

Source: https://habr.com/ru/post/228151/


All Articles