ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING An improved version of the control system software. Encyclopedia of radio electronics and electrical engineering Encyclopedia of radio electronics and electrical engineering / Radio amateur designer The changes and additions that the author of the article made to the software of the "amateur" smart home control system described by him in [L] are described. First of all, bugs affecting the stability of the ihsc.exe module have been fixed. To increase the stability of the entire system, a controlling process (module ihsc_guard.exe) was created, which starts working automatically when ihsc.exe is launched. If the main module fails, it will automatically restart. In the new version of the software, the web server has learned to accept information from the browser. The "action" attribute of the web form must contain a script that will be passed to the server and executed when the screen button on the html page is clicked. Access to the system via the Internet is made using an android smartphone with the Mozilla Firefox browser. The microcontroller program for UD universal devices has also been updated. The changes affected the system component "Single output control line". Now this component can have a sensor that controls the actual supply of voltage to the load, which can be assembled, for example, according to the circuit shown in the figure. With it, you can control the health of the power part of the device or the fusible link. When creating a device configuration, the value of the "Voltage sensor: Anti-bounce 0,1 s * per..." field for this sensor must be set to 30 (3 s) to avoid false alarms.
An exit statement has been added to the scripting language, which stops the execution of the current script. I will give an example of how you can expand the capabilities of device No. 12 described in [L] by changing the set of scripts. It can be loaded into a working device by opening the menu item "Tools→Script Editor..." on the graphical terminal. Let's teach device No. 12 to turn on the lamp if the motion sensor is triggered within a minute after it was automatically turned off. This will make it possible to turn on the lighting again, for example, by waving his hand, if before that he had not been noticed by a motion sensor for more than 15 minutes, which turned off the lighting, considering that there was no one in the room. A set of scripts that solve this problem is given in Table. 1. Table 1 I note that it is not necessary to check the current state of the motion sensor. Usually, the pulse of this sensor lasts only a few seconds - any difference in its level is taken as the presence of movement. Consider two more examples using a motion sensor. Suppose there are two doors installed at the entrance to the house - external and internal. They are located at a short distance from one another, so when entering or leaving the house there is a period of time during which both doors are open at the same time. A street lamp is installed above the outer door. Ceiling lights are installed in the hallway, controlled by some device No. 4. It is necessary to make sure that in the dark, when leaving the house, a street lamp is turned on for several minutes, and when entering the house, the lighting in the hallway is turned on. This task is solved by a set of scripts given in Table. 2. Table 2 Device No. 10, a home weather station equipped with a light sensor, owns information about the current illumination. The illumination thresholds at which you need to turn on or off the lamps will be different for the street and the hallway, since the natural illumination inside the room is always lower than outside. Ordinary luminaires with built-in motion sensors are unsuitable in this case, because the configuration of the room and the possible locations of the luminaires do not allow their sensors to work when the door is opened. Because of this, discomfort arises: the first step has to be taken in the dark, only after that the motion sensor will turn on the light. And you need to ensure that it turns on even when the door is opened. We will assign the number 3 to the created device. We will connect two reed switches to it - these are open door sensors (outer and inner), hidden inside the door frame. Let's add a call button. The device will be controlled by an external lamp and a bell. The step variable is set to 1 when the device assumes the person is leaving the house, or 2 when the person enters the house. The variable still is intended to block the automatic switching on of lighting. For example, if you want to look out the window at dusk or not open the door to unwanted guests. The dark variable contains the ambient light level expressed in conventional units. The higher it is, the lower the value of this variable. Since the necessary illumination threshold is chosen experimentally, there is no need to express it in standard units. The sensor itself is a photoresistor connected to the ADC. 2 minutes after the device is started, the dark variable is assigned the value of the current illumination level received from device No. 10 (weather station). In the future, the value of this variable is updated every 15 minutes. Local storage of a slowly changing parameter allows you to speed up the execution of the script, since you do not have to waste time every time polling a neighboring device. And a two-minute delay is needed so that the weather station has time to measure the illumination, if power is supplied to all devices of the system at the same time. Script 1 is executed by the device when the state of the reed switches of the outer and inner doors changes. The direction of movement is determined based on which door is open first. The disadvantage of this method is that if the door is forgotten to close, then the decision will be wrong and the lighting will not turn on automatically. Script 2 is executed by the device when the call button is pressed. In conclusion, consider the task of automating lighting in a bathroom, toilet or other utility room. A set of scripts for solving it is given in Table. 3. For the reasons described above, motion sensors alone could not be dispensed with. It was also necessary to install open door sensors. Table 3 The variable t takes on the value 0 if the door to the room is closed and no one is there; value 1 - if the door is opened and a person enters the room; value 2 - if he entered the room and closed the door behind him; value 3 - if the door opens and the person leaves the room. The algorithm works correctly if the entire cycle is performed without errors, i.e. the door is not forgotten to be opened and closed. If the person leaves the room and the lights are off after 6 minutes, the variable t will remain equal to 3 in anticipation that the door will be closed. If after some time a person enters the open door, the motion sensor will work, and the required value of 1 will be assigned to the variable t. You can improve this algorithm by resetting the variable t if no movement was detected in the room for several minutes after the door was closed. This will restore normal operation of the device after a person leaves the door open when entering the room, and after a while leaves and closes the door behind him. Thanks to the open door sensor, the lighting turns on immediately when the door is opened. But since the motion sensor only responds to the presence of a person inside the room, the lighting does not turn on when passing by the door, if for some reason it is left open. When using standard fixtures with built-in motion sensors, this effect could not be achieved. Especially in the bathroom and toilet. The fact is that it is very difficult to set the optimal duration of the lamp. If it is too small, a person has to constantly move in order to prolong his work, and if it is too large, then after leaving the room, the lighting remains useless for a long time. To check scripts for syntax errors when loading into the controller, you can use the built-in script editor in the graphical terminal ("Tools→Script Editor..."). It must be remembered that variables are created the first time they are used in an assignment statement. Therefore, before checking the operation of a conditional statement, which contains variables, they must be created.And when using the values of the parameters of the system components of neighboring devices, the program will prompt you to enter the value manually, simulating sending a request and receiving the value of the desired parameter. The program also has features that have not yet been used in practice, but are available for testing: - the ability to run a third-party application for sound synthesis. To do this, in the field where you previously indicated the name of the wav file to play, you need to enter a command line that launches a third-party application;
The modified software can be downloaded from ftp://ftp.radio.ru/pub/2017/02/ihsc.zip. Literature
Author: M. Antonov See other articles Section Radio amateur designer. Read and write useful comments on this article. Latest news of science and technology, new electronics: A New Way to Control and Manipulate Optical Signals
05.05.2024 Primium Seneca keyboard
05.05.2024 The world's tallest astronomical observatory opened
04.05.2024
Other interesting news: ▪ How the brain understands grammar ▪ WD Passport Pocket external hard drive ▪ Before the event, envy is stronger News feed of science and technology, new electronics
Interesting materials of the Free Technical Library: ▪ section of the site Data transfer. Article selection ▪ article Thermal power plant. History of invention and production ▪ article What physical law helped to convict speculators of illegal insider trading? Detailed answer ▪ article Working with an odorant. Standard instruction on labor protection
Leave your comment on this article: All languages of this page Home page | Library | Articles | Website map | Site Reviews www.diagram.com.ua |