Smart Home Architecture - With Black Swift and More

    Hello, Habr!

    If earlier we looked at the projects of “smart home” with interest, but somewhat from the outside, now, after Black Swift entered the public field, we ourselves began to receive questions and suggestions on using it as a base for “smart home” - and naturally , I could not help but pay special attention to this topic.

    The result upset me, and I would like to talk about it.

    Smart home projects are now born (and die) like mushrooms - but, unfortunately, in most cases they are caused not by the awareness of the shortcomings of existing solutions, but by the very fact of the presence of technological platforms on which something can be built. This is clearly seen by Habré: as this or that solution is popularized, a wave of the next “wireless sockets” passes on it. So it was with NRF24LE1, now the same wave goes with ESP8266. Some promising projects in their life manage to change two or three platforms - depending on the current fashion and the availability at hand of someone who can solder something on one of them.

    All this is often too much like searching for lost keys where it is lighter, as well as hammering the screws simply because the hammer and screws were at hand at the same time.

    I will not touch upon any serious problems of “smart homes” yet, but talk about why and what technologies should be considered as a basis - so as not to explain in the comments for the fiftieth time why I do not consider embedding Wi-Fi in every outlet neither a necessary nor a reasonable decision.

    Oh yes, I almost forgot the KDPV. Here:

    It’s not about the “smart home”, but about the fact that Black Swift can be found at MWC at the booth of Imagination Technologies. Now let's talk about the "smart home".

    The natural desire of a person who first saw a Black Swift, EL-M150, ESP8266 or other similar solution for the first time is to shove it everywhere. After all, it would seem that it’s easier - since every smartphone has Wi-Fi, then connecting all the lights, sockets and switches to Wi-Fi in the house, we get the very “smart home”, which for many looks like a smartphone application that allows blink light in the chandelier. About the same fate befell Bluetooth modules, albeit with a lower frequency.

    It turns out here is a roughly similar scheme:

    However, it quickly becomes obvious that it does not solve the problem of creating a “smart home”, because all this set of devices does not have a unifying element - they just got access to the network. Unfortunately, for some reason, the user does not want to remember the IP addresses of all twenty-three light bulbs in his apartment, and it is completely incomprehensible to the consoles what to do in this network.

    It is technically possible to build a distributed system in which the devices themselves will detect each other and find out about each other’s state and capabilities, and the smartphone application will just get information about all currently available devices from the network and display them in a beautiful interface. It is tempting, flexible, but difficult - especially if the questions begin that it would be nice to have access from the outside, and a web browser interface ...

    Therefore, the central controller naturally appears in the system, on which all available devices are registered, and it already provides a web interface, scenarios, and the transfer of commands between devices, and women with gambling:

    Stop! But we used Wi-Fi in order to bring all devices into an accessible and understandable data transmission medium in one step - and in this scheme there is already more than one step, because access to a Wi-Fi outlet and a teapot no longer plays a role for whom other than the central controller. That is, Wi-Fi is starting to lose its main advantage.

    At the same time, Wi-Fi has quite serious drawbacks:

    • power usage. To ensure a quick response, the device must always be connected to the network. For the same ESP8266, this means a power consumption of about 0.3 mW - which means that on an AA battery with its ~ 1750 mW * h under ideal conditions, it will be possible to get 8 months of operation. In reality, it takes no more than 6 months, since there is still DC-DC with an efficiency of about 85% between the battery and the chip, in fact, at the time of data transfer, the chip consumes much more, and so on. Believe me, you don’t want to change batteries all over the house every six months. Moreover, even AA makes the device already quite cumbersome - if you want, for example, a flat switch that can be glued anywhere on the wall or furniture, you need a CR2032 or, maximum, a CR2450. You will change them every two to three months. The alternative is to take the ESP8266 into a deep sleep,
    • Range . Wi-Fi is pretty well jammed by the walls even in the 2.4 GHz band, and in the wall outlet, your antenna will not only be installed inside the wall, but also covered from above by the steel frame of the outlet block. In the corners of the house, where the network reception is weak, sockets may simply not see it. And this is without touching the issue of scalability: for some reason, the authors of most “smart homes” limit their imagination to an apartment, not thinking that such technologies can be in demand on a building scale. Have you ever tried to catch Wi-Fi under the door of a hotel room, because it is not caught anywhere else in the room? I - repeatedly. Therefore, the project of such a “smart home” will have to put in place the provision of stable Wi-Fi coverage throughout the building.
    • Interference immunity . The 2.4 GHz band is not just overwhelmed by access points - it is perfectly muffled by microwaves operating at 2.45 GHz. Weak reception of the network in this corner of the house and a microwave behind the wall at the neighbors - and that's it, periodically your sockets disappear.
    • Scalability . In general, when I pronounce this word, I usually mean the transition from the scale of the apartment to the cottage and further to large buildings, but in the case of Wi-Fi everything is simpler - it does not scale well even within the apartment. A full-fledged “smart home” on the scale of an ordinary 2-3-room apartment implies one and a half to two dozen devices using the network - and so, a typical home router with so many clients who have rushed to it behind the network lays its paws up: it either completely leaves for the astral , or manages to issue a network to the top ten. That is, at the moment of turning on the electricity in the apartment, your “smart house” will simply arrange a DDOS attack on your router.

    In general, you can continue, but it’s already obvious enough that Wi-Fi in such a scheme becomes a strange choice for intra-system communication. And all of them, in general, grow from the fact that Wi-Fi is a network designed for the constant presence of devices in it and large amounts of transmitted data. It has never been designed by anyone, taking into account the features of the light switch, which must be transmitted three bytes ten times a day.

    At the same time, it cannot be said that there are no other radio-frequency solutions - firstly, a mode on NRF24LE1 operating in the 2.4 GHz band came and passed not so long ago. I must say right away that we tried them in the role under discussion and were almost instantly disappointed - the range of stable communication in real conditions is regrettable for them. Secondly, there is simply a bunch of classics in the ranges 433.92 and 868 MHz - the same TI CC1101 or single-chip solutions like CC430F6137, which include both a radio frequency module and a processor core. In these ranges, a license for the use of transmitters up to 10 mW is not needed, such solutions have a pretty good communication range, and the only drawback is the antenna dimensions - a quarter of the wavelength for 433.92 MHz is still 16.5 cm. these solutions are easily bought both in the form of modules and in the form of chips themselves.

    Everything is fine with them and with efficiency - we do not need to constantly maintain an air presence with such systems (moreover, in 868 MHz there are legislative restrictions on this), and in a dream they consume a maximum of a few microamps, waking up only for data transfer. Accordingly, for the control panel, 1-2 years of work on the CR2032 immediately become a reality.

    But at the same time, Wi-Fi remains a place - you just need to understand where exactly it is:

    So, we have a central controller that provides the logic of the system and the interface to the outside world - Wi-Fi or Ethernet (obviously connected to a Wi-Fi router). It has a wired and / or wireless interface for communicating with the subordinate elements of the “smart home” - the specific choice is determined by the specific conditions, although if you get into a slightly different topic, the wireless interface has a great merit: for installation, it does not require repairs. No, while you are guided by the traditional Russian market of “elite installers”, taking from 300 thousand rubles for a single “smart home” project for a two-room apartment on Biryulyovo-Tovarnaya, this is not a problem. But as soon as you want to enter a larger segment, or, God forbid, enter the B2B market, persuading a client to overhaul may not be so easy.

    Moreover, although in principle such a controller can be built on much, the use of Black Swift provides compactness - in the case of, for example, one wireless interface, all the electronics can easily be removed into the housing on a DIN rail the size of a standard RCD, 35.5 mm wide.

    Actuators in this scheme are simple and cheap, and most importantly - they provide you with a clear communication quality and power consumption that makes normal battery power possible (for less than a year of work, I insistently ask you not to consider normal power). And their penny microcontroller (integrated with a radio module or a separate one, the same PIC) fully provides all their capabilities, because no complex network protocols are required from a dimmer or a wall switch.

    At the same time, it is not necessary to completely eliminate Wi-Fi from communications within the system - you just need to understand when you need it. Let's say we want to integrate there any home appliances or climate equipment, which has a number of features:

    • Complex control algorithms with a large number of parameters working on the device itself
    • The desirability of an interface that does not depend on the functioning of your “smart home” - that is, a normal web interface that lives on the device itself (the same technique can be installed where a “smart home” is not even planned, for example)
    • Indifference to the size and power consumption of the "brains" - within reasonable limits

    In this case, there is no practical reason to uniquely attach to a specific specific radio interface - it’s easier to put powerful “brains” with Wi-Fi inside, as a result of which the technique can be used as part of various “smart houses”, or without it at all.

    At the same time, note that I did not make a frame with the caption “apartment” around the entire flowchart — in practice, it can be applied at different scales, from the room (each room has its own controller, and due to its dimensions it can fit in a standard 68- mm socket) to a large cottage, it all depends on the specific requirements of a particular project. The system is easily scaled to large buildings - put several controllers in different parts of the building, since it’s not KNX with its $ 3k per box, and let them communicate with themselves via normal Ethernet or Wi-Fi, since they have such brains to communicate more than enough.

    However, I already went to talk about other topics related to the "smart home", but traditionally forgotten in the vast majority of projects - scalability, integration of various equipment, different levels of management into the system ... In 99 projects out of 100, alas, the authors do not even try think larger than your own apartment.

    But this is the next step. In the meantime, please stop trying to put every Wi-Fi or Bluetooth light bulb in every outlet. They are not needed there. And do not hammer the screws.

    Also popular now: