Hi, Habr!
If earlier we looked at the projects of the “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 the “smart home” - and of course I could not help but pay special attention to this topic.
The result upset me, and I would like to talk about it.
')
Projects of the “smart home” are now born (and dying) like mushrooms - but, unfortunately, in most cases they are not due to the awareness of the shortcomings of existing solutions, but by the very fact that there are technological platforms on which something can be built. This is clearly seen by Habr: as one or another solution is popularized, a wave of next “wireless sockets” on it passes. So it was with the NRF24LE1, now the same wave is coming from the ESP8266. Some promising projects in their life have time to change two or three platforms - depending on the current fashion and the presence of someone who can solder something on one of them.
All this is often too similar to finding lost keys where it is lighter, as well as hammering screws with a hammer simply because there were a hammer and screws at hand at the same time.
I will not touch any serious problems of “smart houses”, but I will talk about why and what technologies should be considered as a basis - not to explain in the comments for the fiftieth time why I do not consider embedding Wi-Fi in each outlet Neither necessary nor reasonable decision.
Oh yeah, I almost forgot KDPV. Here is:

It is not about “smart home”, but about the fact that Black Swift can be found on the MWC at the stand of Imagination Technologies. And now let's talk about “smart home”.
The natural aspiration of a person who saw Black Swift, EL-M150, ESP8266 for the first time in his life, or some other similar solution, is to shove him everywhere. After all, it would seem that it is simpler - since in any smartphone there is Wi-Fi, then by connecting all the lights, sockets and switches to Wi-Fi in the house, we will get that “smart home”, which for many looks like a smartphone application that allows flashing light bulb in the chandelier. About the same fate befalls and Bluetooth-modules, albeit with a lower frequency.
It turns out this is about the scheme:

However, it quickly becomes obvious that it does not solve the task 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 memorize the IP addresses of all twenty-three light bulbs in his apartment, and what to do on this network to the remotes is completely incomprehensible.
Technically, you can build a distributed system in which the devices themselves will detect each other and learn about each other’s status and capabilities, and the smartphone application will also get information about all the devices currently available from the network and show them in a beautiful interface. It is tempting, flexible, but difficult - especially if questions start that it would be nice to have access from the outside, and a browser-based web interface ...
Therefore, a central controller appears in the system in a natural way, on which all existing devices are registered, and it already provides a web interface, scripts, and command transmission between devices, and women with games of chance:

Stop! But after all, we used Wi-Fi to bring all the devices into an accessible and understandable data transfer medium in one step - and in this scheme it is already more than one step, because access to Wi-Fi sockets and a kettle does not play any more role for anyone except the central controller. That is, Wi-Fi begins to lose its main advantage.
At the same time, Wi-Fi has quite serious drawbacks:
- Power consumption . To ensure quick response, the device must always be connected to the network. In 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 in ideal conditions, it will be possible to get 8 months of work. In reality - no more than 6 months, since there is still DC-DC between the battery and the chip with an efficiency of about 85%, the chip itself consumes much more at the time of data transfer, and so on. Believe me, you do not want to change the batteries throughout the house every six months. Moreover, even AA makes the device 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, at most, a CR2450. You will change them once every two or three months. The alternative is to take the ESP8266 into a deep sleep, but then the response to the touch of the switch will be up to a second late (yes, it quickly connects to the network, but not so fast that it is not easily noticeable to the naked eye).
- Range Wi-Fi is quite well silenced by the walls, even in the 2.4 GHz band, and in the wall socket you will not only have an antenna installed inside the wall, but also covered on top with a steel frame of the socket block. In the corners of the house, where the reception of the network is weak, sockets can simply not see it. And this is not touching the issue of scalability: for some reason, the authors of the majority of “smart houses” limit their imagination to apartments, without thinking that such technologies can be in demand on the scale of buildings. Have you ever tried to catch Wi-Fi under the door of a hotel room, because nowhere else is it caught in the room? I - repeatedly. Therefore, the project of such a "smart home" will have to lay down yet ensuring stable Wi-Fi coverage throughout the building.
- Immunity . The 2.4 GHz band is not just forgotten by access points - it is perfectly muffled by microwaves operating at 2.45 GHz. Weak reception of a network in this corner of the house and a microwave behind a wall at neighbors - and everything, periodically your sockets disappear.
- Scalable . In general, when I say this word, I usually mean the transition from the scale of an apartment to a cottage and further to large buildings, but in the case of Wi-Fi everything is simpler - it doesn’t scale well even within an apartment. A full-fledged “smart home” of the scale of an ordinary 2-3-room apartment implies a half or two dozen devices using the network - and so, with so many clients who simultaneously rush to it behind the network, the feet go up: either it goes completely to the astral , or manages to give out the network to the top ten. That is, at the moment of switching on the electricity in the apartment, your “smart home” will simply arrange a DDOS attack on your router.
In general, you can continue, but it is already quite obvious 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 was never designed by anyone, taking into account the peculiarities of the operation of the light switch, which needs to 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, the NRF24LE1 mode, operating in the 2.4 GHz band, arrived and passed not so long ago. I must say at once that we tried them in the role we were discussing and almost instantly became disillusioned - the range of stable communication in real conditions is regrettable for them. Secondly, there is simply a bunch of classics on the 433.92 and 868 MHz bands - the same TI CC1101 or single-chip solutions of the type CC430F6137, having both a radio frequency module and a processor core. In these bands, a license for using transmitters up to 10 mW is not needed, these solutions are quite good with the 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 purchased both in the form of modules and in the form of the chips themselves.
Everything is good with them and with efficiency - we do not need constant maintenance of the presence on the air with such systems (moreover, at 868 MHz there are legal restrictions), and in a dream they consume a maximum of a unit of microamps, waking up only for data transmission. Accordingly, for the control panel immediately become a reality 1-2 years of work on the CR2032.
But at the same time, there is a place for Wi-Fi - you just need to understand exactly where 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” - a specific choice is determined by specific conditions, although if you get into a slightly different topic, the wireless interface has a great advantage: it does not require repairs to be installed. No, as long as you are focusing on the traditional Russian market of "elite assemblers", taking from 300 thousand rubles for only one project of a "smart home" for a two-room shop on Biryulyovo-commodity, this is not a problem. But as soon as you want to enter a more massive segment, or, God forbid, the B2B market, customer persuasion for overhaul may not be so easy.
Moreover, although in principle such a controller can be built a lot on what, using Black Swift provides compactness - in the case of, for example, one wireless interface, all electronics easily retract into a DIN-rail housing the size of a standard RCD 35.5 mm wide.
Executive devices in such a scheme are simple and cheap, and most importantly - they provide you with clear communication quality and power consumption, which makes normal battery power possible (less than a year of work, I insistently ask you not to consider normal power). And the kopek microcontroller in them (integrated with the radio module or separate, the same PIC) fully provides all their capabilities, because no complex network protocols from a dimmer or wall switch are required.
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 household appliances or climatic 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 the "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 sense to unambiguously bind to a specific specific radio interface - it is easier to put powerful “brains” inside with Wi-Fi, as a result of which the equipment can be used as part of various “smart houses” or without it.
At the same time, notice that I didn’t have a box labeled “flat” around the whole block diagram - in practice it can be used on different scales from the room (each room has its own controller, while due to its dimensions it can fit in the standard 68- mm socket 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, the benefit is not KNX with its $ 3k per box, and let them communicate with themselves via normal Ethernet or Wi-Fi, the benefit of the brains in them for such communication 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 into the system of various equipment, different levels of management ... In 99 projects out of 100, alas, the authors do not even try think in scale larger than your own apartment.
But this is the next stage. In the meantime, please stop trying to shove every Wi-Fi or Bluetooth light bulb into each outlet. They are not needed there. And do not hammer in the screws.