Development of a prototype of an automated control system for household devices based on the “smart home” technology

The relevance of the studied and solved problem lies, on the one hand, in the possibility of automated control of your home devices, and on the other, in the absence of unified control systems for a smart home as a project. The latter thesis implies the actual absence of such an automated control system among the existing and sold ready-made solutions, which could be expanded by the user himself, that is, by the buyer. In this regard, there is a need to improve and develop our own product in this area. This approach will allow you to combine both the creation of your own working prototype of a smart home, and your own implementation of the automated control system, which will allow each user to refine, modify and implement new devices independently in an already assembled system based on his house or apartment. This article presents the main aspects of the design and software solution used. The software implementation is performed in the JetBrains PhpStorm development environment in PHP, Apache web server, MySQL DBMS.


Introduction
Modern technologies everywhere conquer all spheres of life of a modern person. Currently, it is unthinkable to fully exist without the things we are familiar with-mobile phones, laptop computers, communication technologies have long been part of our daily lives. This is a given, dictated by the crazy pace of development of modern society.
Automation has also affected personal space, which makes the smart home system more and more popular every year. Such a system saves time, effort and resources, and creates a comfortable environment around a modern person. Abroad, the system has long gained popularity, in Russia, at present, such services are not yet widely used.
The technology covers the following aspects: • Lighting.
• Operation of power grids.
• Control of the dwelling, including imitation of the presence of people.  This list can be continued for a long time -cars, refrigerators, irons, stoves, vacuum cleaners, etc., all these familiar things are endowed with "computer intelligence" in order to make our life as comfortable, safe and economical as possible. There are no clear rules and requirements for compliance with all the points. Individual customer preferences play a key role. In Europe, ready-made solutions with pre-defined functions are used, but often buyers do not want to overpay for extra services and additional equipment.
Research shows an increase in the number of fans of the intelligent system. New suppliers of these products are appearing on the market, but the niche is not fully filled yet -entrepreneurs have wide opportunities to build a business.
The study of the software analogues available on the market revealed the following shortcomings of the existing systems: • High cost of installing even the simplest system with temperature control (due to the fact that the technology is relatively new). • Problems of integration and repair of equipment from different brands.
• Complexity in the perception of smart home applications and automated control systems by users. • Insufficient security of the control systems themselves (the possibility of hacking and interception of control over all devices in the house). • Automated control system management is available only via the Internet.
The course of development of the considered automated control system (ACS) provides for solving the shortcomings of existing similar systems, and also at the design stage, additional functionality was proposed, described below. So, for example, the last item from the list of disadvantages means the complete absence of the ability to control and regulate the processes of a smart home without an Internet connection. The system under development will initially be able to control the automated control system via a local network, without connecting to an external Internet.
In the process of developing automation tools that use microcomputer electronics, significant progress has been made in indoor climate control systems. However, most systems are used in production, and not for personal purposes of a particular person due to the high cost of equipment and its integration into the home. Therefore, in [1], the author explores the ways of implementing climate control systems in a smart home. The positive aspects of solving the problem, as well as the prerequisites for the development of these systems in Russia, are given.
In the article on algorithms for temperature control in buildings [2], the authors propose to use the PID control algorithm to solve the problem of temperature control. The abbreviation PID means "proportional"," integral", "differential". Each of these elements performs its own task and has its own impact on the functioning of the system.

Methods
The design of any automated control system is the process of creating a set of technical documentation, models and prototypes that are necessary and sufficient for the manufacture, installation, operation and commissioning of an automated control system. The set of technical documentation required to create an automated control system is called the project of this system. The process of creating a project is called design, or the design process.
Observing the stages of the automated control system development lifecycle, it is necessary to design Use-case diagrams [3]. The Use-case diagram will then become the basis for testing and documentation, and in the next stages of design, it is supplemented and drawn up in the form of a diagram. At this point in time, the following usage diagram is presented ( figure 1).  This diagram shows the functionality that will be implemented in the prototype being created. In addition, it is necessary to design sequence diagrams [4] of user interaction with the system. This type of diagram allows for a certain set of objects on a single time axis to display the life cycle of the object (creation-activity-destruction of a certain entity) and the interaction of actors and the information system within the precedent. A design solution for user interaction with the control panel (figure 2) is presented.  In the future, the project will expand, and there will be a need to rework the existing diagrams in the project documentation, but it is at this stage that the very possibility of expanding and finalizing the project in real time is laid.

Software implementation
For the software implementation, the PhpStorm development environment was used. This is a commercial cross-platform integrated development environment for PHP by JetBrains based on the IntelliJ IDEA platform. PhpStorm is an intelligent editor for PHP, HTML, and JavaScript with on-thefly code analysis, error prevention, and automated refactoring tools for PHP and JavaScript.
In this environment and the designed database, using MySQL [5], a prototype of the smart home automated control system was developed. The program code of the server and logical part is written in the PHP 7 programming language [6], the design and layout in the HTML page markup language using cascading CSS style sheets, using the JavaScript scripting language to add interactivity.
In order to start managing and initially configuring the system, the user needs to download the system to their computer. The user also needs to configure their Apache server and MQTT broker [7]. The MQTT broker is used to communicate modules with the Hub. After setting up the system, the user needs to log in, after which the user gets to the page (figure 3). The main page is used for a quick preview of the information about the modules, and the data received from them. The page itself contains the main menu items, each of which has its own role in displaying information on the user's screen. The main task of the automated control system is remote control of modules using such means as: MQTT, wireless Internet. Initially, you need to connect a user-installed module to the system, for this the user is provided with a page for creating/editing the module (figure 4), which has an intuitive interface. There are three types of modules available in the system: numeric (the module transmitting numeric information, suitable for temperature modules), string (the module receiving and transmitting string values), Boolean (the modules receiving 2 states '1 ' and ' 0', suitable for switches). The user also needs to enter a unique index to control the system via the Google Home mobile app (Voice Assistant). For easy control using voice commands on your mobile device, the user can use the built-in Android Google Assistant ( figure 5). In addition, management is also available through the Google Home service ( figure 6). The Google Home app lets you customize your devices. With this app, the user can control thousands of compatible lights, cameras, speakers, and other smart home devices, as well as open reminders and recent notifications. At the initial stage, the user can control the light, read the temperature, and control the curtains. To do this, the user must log in to the online service by entering the personal IP of their Hub, as well as log in through a Google account. A service linking Google Chrome and Hub is required if the user does not have a personal Internet domain and an SSL certificate [8]. If the user has all this, then he can do with the service that redirects requests to the personal Hub.  Thus, the user is provided with a lot of control modes, such as: The Administrative panel in the system, Voice and manual control mode in Google Home. The modules themselves can be implemented both on Arduino boards, and use ready-made ones from various companies that use the MQTT protocol. One example is a module that controls light through an electronic switch and transmits humidity in a room. The implementation requires an ESP8266 board, an electronic switch, and a DHT humidity sensor. The user also needs to write the program code. To facilitate the implementation of the system, you can purchase ready-made self-made modules, or order them according to the personal requirements of the client. Our team has developed modules, with the boards soldered together, and a ready-made software part, having previously created a designed connection model (figure 7).