📜 ⬆️ ⬇️

Build time, network speed and routing: how we improved our mesh network and a little about neural networks

On this resource they regularly write about mesh networks. We want to tell how we use them in our project to create an adaptive room automation system. The technology of self-organizing networks allows us not only to quickly deploy the system, but also to achieve high levels of resiliency and speed. We successfully tested our solution on a real facility with a network capacity of 120 devices.

Why do we need a mesh network


From the moment the concept of “smart home” appeared, the head unit was considered its “heart” and “brain”. But gradually the hubs cease to be necessary and will soon completely disappear. This trend is confirmed by large players like Google and Amazon. Google has been offering cellular routers for several years now, and Amazon recently bought Eero to strengthen its position in the smart home market.

We use mesh networks in our products, as they solve several problems at once. First, ensure the smooth operation of the system. Usually, if the hub fails or loses connection to the Internet, the system is in fact disconnected, the devices stop responding and perform their basic functions. Mesh networks allow you to avoid this. Even if one device fails, the rest will continue to work as before. The user will only receive a failure notification.
')
Secondly, mesh networks help route traffic. In our system, all devices are able to relay the signal so that the network coverage becomes almost unlimited. In the case of a network configuration change, the system will independently determine the best route.

In the network created on the basis of our solution, an almost unlimited number of devices can work at a considerable distance from each other. The figure obtained by the calculation method is 10 to 10 degrees, which is currently impossible to ensure due to the limited amount of RAM in the devices.

What is "smart home" (in our opinion)


Most of the solutions on the market today are simply a set of sensors and actuators that are limited in capabilities. As a rule, it is a remote control in the form of a mobile application, a separate tablet or a smart speaker, which allows you to adjust the temperature, turn on / off household appliances, adjust the lighting and tune up primitive battery life scenarios. Let's admit that there is little “smart” in this, it's just another toy.

Therefore, we set out to create an adaptive home automation system based on a mesh network. As it is used, our system analyzes user habits and behavior. Due to this, over time, it begins to adapt all the scenarios and settings for a specific user, to offer new scenarios and, after the approval of the owner, to customize them independently.

The system architecture is built in such a way that the head box is not required. A single device can work by itself, using all the functionality it contains.

Another feature of our solution: before making a decision, the system collects data from several sources at once (for example, from a camera, an air quality sensor, a presence sensor, etc.). This became possible due to the fact that all devices of the system are self-sufficient and able to exchange information with each other directly. This allowed us to significantly reduce the likelihood of incorrect implementation of actions under a given scenario.

All information is processed internally (and not by a server or a central hub) in a distributed way. What is meant? If one of the devices with autonomous power supply needs to perform complex and energy-intensive calculations, the system will redirect this task to the nearest device having constant network power. This approach provides an acceptable battery life for self-powered devices and speeds up the decision-making process.

Separately, I would like to note the simplicity of the connection procedure. To do this, you do not need to configure anything, scan QR codes and so on. Enough to attach the phone with the application to the device - that's all: it is already on the network, has received the basic settings and is ready to go!

Key features of our mesh network


Initially, we wanted to use Espressif’s affordable ESP-MESH solution. But after analyzing it, we realized that it did not quite fit us. So I had to reinvent my own. Our key advantages are build time, automatic channel change when it is loaded, network speed and routing.

Self-healing is the automatic detection and elimination of network failures. If suddenly some device fails and the signal is lost, the network of the remaining devices will rebuild itself. Building the network from the moment it is turned on takes up to 15 seconds, and a rebuilding takes no more than 6 seconds. Support between nodes when forwarding - less than 10 milliseconds. And these are real numbers obtained during testing at one of our large sites. In general, this is the average for military facilities and redundant in our segment. We can say we have a huge stock!

Another important parameter is routing, as the signal is transmitted from one device to another. Usually, all elements of similar solutions work on the same frequencies as Wi-Fi - 2.4 Hz. Protocols use algorithms based on the state of terrestrial channels. Our solution allows you to change the channel without affecting network performance. For example, at the facility, all devices around the perimeter work on channel 13. But in the center of the room on this channel interference occurred. In this case, the device that transmits the signal will automatically change the channel and bypass the problem area. The rest of the devices equipped with our module will be organized among themselves and will choose the optimal frequencies.

To achieve high speed routing, we optimized all software for hardware. Under each processor and the coprocessor wrote the code on the Assembler. This allowed to reduce power consumption and increase the network speed by 15 times.

The theoretical maximum capacity of our network is huge. Obviously, in practice we will not be able to verify it. During the tests, we connected more than 300 devices to the network, and the system worked stably. That is, our solution will make it easy to cover the shopping center and you don’t have to make walls, make additional wiring, and set up a network for a long time and painfully. It is enough to install our devices where necessary. Even if it is on a mobile object, they will always be online.

For the safety of user data, we use double encryption, which is based on the AES protocol, which is recognized as one of the most reliable. Traffic is tunneled between the server and the device or between a pair of devices. This eliminates the possibility of gaining access to the system through hacking WI-FI network.

We have applied for a patent for a utility model on the application of our self-organizing network algorithm for the automation of premises. She has passed a preliminary assessment and is currently under review.

An example of the implementation of our solution


Our team has implemented a large-scale project to modernize the lighting of the ice palace "Chemist" in Novopolotsk. There all the lighting equipment (in the amount of 120 units), is made with the function of remote control of the intensity of the luminous flux and remote on / off with access via Wi-Fi and Bluetooth.

It is also possible to configure offline scripts. For example, in standby mode, the level of illumination, in order to save electricity, should not exceed 100 lux. During training - 600. And during a hockey match with a TV broadcast, this figure should be at least 1,200 lux. To install the system did not need to lay additional wiring, change the network configuration and other expenses. The system architecture is completely built on the basis of our mesh network. It was enough to install new LED lights with control units.

After modernization, the ice arena, in terms of illumination level, began to comply with the stringent requirements of the Ice Hockey Federation of the Republic of Belarus for direct international television broadcasts.

Why do we need neural networks and how we train them


In our decision, we also use artificial intelligence technologies, in particular, neural networks. As noted earlier, all data is collected by modules installed in the room automation system devices and all calculations are performed within the system. Therefore, the more devices in the system, the better and faster they distribute complex calculations among themselves.

As a rule, developers train neural networks on large data arrays. But in our case, training is specific. Our neural network does not need to know what African monkeys look like, conditionally. At the same time, learning the network requires triggers. We figured out how to make the devices at the hardware level train for certain events, the system purposefully studies the habits of users. At first, the network implements pre-designed scenarios to understand which conditions are most comfortable for users. Then, using the accumulated experience, it selects the modes of lighting, heating and ventilation, as comfortable as possible for a specific user. Over time, the system takes over some of the functions of managing a house, apartment, or other object.

Our task is to make the users as comfortable as possible and they themselves practically did not change anything in the system settings, they were all arranged.

Due to the fact that the system is completely autonomous, the data is stored in the nonvolatile memory of the devices themselves, the operation of the system does not depend on access to the Internet. If he suddenly disappeared, she will continue to work, offer scripts and self-study. In our case, the Internet is needed only for organizing remote access and communication with the server if the user wants to store certain data in the cloud (for example, recordings from video cameras).

Vision plans


By the end of the year, we are planning a partial release of a line of devices for our adaptive room automation system. It will include almost everything listed above, with the exception of video cameras.

A video camera with elements of technical vision is now in development. We plan to transmit video data from several cameras at once. Here we also try to introduce an innovative approach. Our solution uses two neural networks to detect and track people indoors (the multitracking problem is being solved) in real time using the CUDA technology. For support, a neural network model was proposed and trained, which, according to test results, surpasses in four main parameters DeepSort, which showed the best results in the MOT16 competition, as part of the MOTChallenge.

It is known that designing models of neural networks requires considerable time resources for development, it is also necessary to conduct many experiments. Thus, the system not only knows the number of people in the room, but also ensures their tracking, which works steadily even in a situation when people leave the frame. and then come back. Our neural network already recognizes people based on 128 attributes and identifies them according to the “own / alien” system. Today, it is promising to implement work on the adaptation of technology to accompany people using video sequences obtained from different cameras indoors. Over time, we plan to add a definition of non-standard behavior patterns (for example, a fall or a fight) and the detection of a flame or smoke. Developments in these areas already exist.

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


All Articles