Device Control Method, Device, Storage Medium and Electronic Device
By controlling the equipment to broadcast the equipment to control messages and measure the distance in the intelligent classroom, the problem of cumbersome equipment control is solved, simple and convenient equipment control is realized, and control accuracy and efficiency are improved.
Patent Information
- Application Number
- CN202110292160.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-18
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2041-03-18
AI Technical Summary
In smart classrooms, equipment control is cumbersome, especially in large educational institutions, servers need to take up more resources by controlling each smart device in each classroom, and each additional device needs to be configured on the device and the server.
By broadcasting device control messages through the control device, including control instructions and a specified distance threshold, the controlled device obtains the distance between the control device, and executes instructions when the distance is less than or equal to the specified threshold, using ultrasonic or radio signal ranging to realize simple control between devices.
There is no need to make complex settings for controlled equipment and control equipment, which realizes simple and convenient control between equipment, improves control accuracy and efficiency, and reduces resource occupation.
Smart Images

Figure CN115113543B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of control, and specifically, to a device control method, apparatus, storage medium, and electronic device. Background Art
[0002] In order to improve the teaching quality, intelligent classrooms are increasingly applied in teaching. An intelligent classroom is formed by setting computer devices, projection devices, interactive whiteboards, camera devices, audio devices, lighting devices, and intelligent lock devices, etc. in a traditional classroom. By controlling and operating the above devices in the intelligent classroom, the presentation of teaching content is assisted, the acquisition of learning resources is facilitated, the development of classroom teaching activities is promoted, and the intelligent management of the classroom is realized. However, in an intelligent classroom, there are many devices involved, and the control of each device is rather cumbersome. Summary of the Invention
[0003] To solve the above problems, the present disclosure provides a device control method, apparatus, storage medium, and electronic device.
[0004] In a first aspect, the present disclosure provides a device control method, which is applied to a controlled device, and the method includes:
[0005] Receiving, at a first preset reception time of each preset broadcast period, a device control message broadcast by a control device, where the device control message includes a control instruction and a specified distance threshold;
[0006] Obtaining a first device distance between the controlled device and the control device;
[0007] Executing the control instruction when the first device distance is less than or equal to the specified distance threshold.
[0008] Optionally, the obtaining the first device distance between the controlled device and the control device includes:
[0009] Sending a first ultrasonic signal to the control device;
[0010] Receiving a first ultrasonic reflection signal reflected by the control device from the first ultrasonic signal;
[0011] Calculating a first time difference between a reception time of receiving the first ultrasonic feedback signal and a transmission time of transmitting the first ultrasonic signal;
[0012] Determining the first device distance between the controlled device and the control device according to the first time difference.
[0013] Optionally, the device control message further includes a broadcast time for broadcasting the device control message, and the obtaining of the first device distance between the controlled device and the control device includes:
[0014] Calculating a second time difference between a reception time of receiving the device control message and the broadcast time;
[0015] Determining the first device distance between the controlled device and the control device according to the second time difference.
[0016] Optionally, the method further includes:
[0017] After receiving the device control message broadcast by the control device, sending a response message to the control device, where the response message includes a sending time of sending the response message, so that the control device determines a second device distance between the control device and the controlled device according to the sending time, and determines a specified distance threshold in the device control message according to the second device distance.
[0018] Optionally, the device control message further includes a transmission power. Before obtaining the first device distance between the controlled device and the control device, the method further includes:
[0019] Obtaining a reception power of receiving the device control message;
[0020] Calculating a path loss of the device control message according to the reception power and the transmission power;
[0021] The obtaining of the first device distance between the controlled device and the control device includes:
[0022] In a case where the path loss is greater than or equal to a preset path loss threshold, obtaining the first device distance between the controlled device and the control device.
[0023] Optionally, the method further includes:
[0024] Receiving a device initialization message sent by a control device at a second preset reception time of each preset broadcast period, where the second preset reception time is a time before the first preset reception time;
[0025] Performing a device initialization operation according to the device initialization message.
[0026] In a second aspect, the present disclosure provides another device control method, which is applied to a control device, and the method includes:
[0027] Obtaining a control instruction for controlling a controlled device;
[0028] Obtain the first preset broadcast time and the specified distance threshold corresponding to the controlled device;
[0029] At the first preset broadcast time of each preset broadcast period, broadcast a device control message, where the device control message includes the control instruction and the specified distance threshold, and the device control message is used to control the controlled device to obtain the first device distance between the controlled device and the control device, and execute the control instruction when the first device distance is less than or equal to the specified distance threshold.
[0030] Optionally, there are multiple controlled devices, and the multiple controlled devices are divided into one or more controlled device groups according to function types. The obtaining of the first preset broadcast time corresponding to the controlled device includes:
[0031] According to the preset correspondence between the controlled device group broadcast time, obtain the first preset broadcast time corresponding to each controlled device group, and use this first preset broadcast time as the first preset broadcast time corresponding to the controlled devices under this controlled device group, where the preset correspondence between the controlled device group broadcast time includes the correspondence between the controlled device group and the first preset broadcast time, different controlled device groups correspond to different first preset broadcast times, and the controlled devices within the same controlled device group correspond to the same first preset broadcast time.
[0032] Optionally, the obtaining of the specified distance threshold corresponding to the controlled device includes:
[0033] For each controlled device group, obtain the second device distance between the control device and each controlled device in this controlled device group;
[0034] Take the second device distance with the smallest distance as the candidate distance threshold corresponding to the controlled devices under this controlled device group;
[0035] Obtain the specified distance threshold corresponding to the controlled device according to the candidate distance threshold.
[0036] Optionally, the obtaining of the specified distance threshold corresponding to the controlled device according to the candidate distance threshold includes:
[0037] Increase the candidate distance threshold by a preset distance adjustment value to obtain the specified distance threshold.
[0038] Optionally, the obtaining of the second device distance between the control device and each controlled device includes:
[0039] Send a second ultrasonic signal to the controlled device;
[0040] Receive the second ultrasonic feedback signal returned by the controlled device according to the second ultrasonic signal;
[0041] Calculate a third time difference between the reception time of the second ultrasonic feedback signal and the transmission time of the second ultrasonic signal.
[0042] Determine a second device distance from the controlled device according to the third time difference.
[0043] Optionally, the obtaining the second device distance from the controlled device includes:
[0044] Receive a response message sent by the controlled device in response to the device control message, where the response message includes a response message transmission time.
[0045] Calculate a fourth time difference between the reception time of the response message and the response message transmission time.
[0046] Determine the second device distance between the control device and the controlled device according to the fourth time difference.
[0047] Optionally, the method further includes:
[0048] At a second preset broadcast time of each preset broadcast period, broadcast a device initialization message, where the second preset broadcast time is a time before the first preset broadcast time, and the initialization message is used to control the controlled device to perform a device initialization operation.
[0049] In a third aspect, the present disclosure provides a device control apparatus applied to a controlled device, and the apparatus includes:
[0050] A message receiving module, configured to receive a device control message broadcast by a control device at a first preset reception time of each preset broadcast period, where the device control message includes a control instruction and a specified distance threshold.
[0051] A device distance obtaining module, configured to obtain a first device distance between the controlled device and the control device.
[0052] A control instruction execution module, configured to execute the control instruction when the first device distance is less than or equal to the specified distance threshold.
[0053] In a fourth aspect, the present disclosure provides another device control apparatus applied to a control device, and the apparatus includes:
[0054] A control instruction obtaining module, configured to obtain a control instruction for controlling a controlled device.
[0055] A preset broadcast time obtaining module, configured to obtain a first preset broadcast time corresponding to the controlled device
[0056] A specified distance threshold acquisition module, configured to acquire a specified distance threshold corresponding to the controlled device;
[0057] A message broadcasting module, which broadcasts a device control message at a first preset broadcast time of each preset broadcast period, where the device control message includes the control instruction and the specified distance threshold, and the device control message is used to control the controlled device to acquire a first device distance between the controlled device and the control device, and execute the control instruction when the first device distance is less than or equal to the specified distance threshold.
[0058] In a fifth aspect, the present disclosure provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the steps of the method described in the first aspect of the present disclosure are implemented.
[0059] In a sixth aspect, the present disclosure provides another computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the steps of the method described in the second aspect of the present disclosure are implemented.
[0060] In a seventh aspect, the present disclosure provides an electronic device, including: a memory, on which a computer program is stored; a processor, configured to execute the computer program in the memory to implement the steps of the method described in the first aspect of the present disclosure.
[0061] In an eighth aspect, the present disclosure provides another electronic device, including: a memory, on which a computer program is stored; a processor, configured to execute the computer program in the memory to implement the steps of the method described in the second aspect of the present disclosure.
[0062] By adopting the above technical solution, the controlled device receives the device control message broadcast by the control device at the first preset reception time of each preset broadcast period, and the device control message includes a control instruction and a specified distance threshold; acquires a first device distance between the controlled device and the control device; and executes the control instruction when the first device distance is less than or equal to the specified distance threshold. In this way, simple and convenient control of the controlled device by the control device can be achieved without complex settings for the controlled device and the control device.
[0063] Other features and advantages of the present disclosure will be described in detail in the subsequent specific implementation part. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] The drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification, and are used to explain the present disclosure together with the following specific implementation manners, but do not constitute a limitation to the present disclosure. In the drawings:
[0065] Figure 1It is a schematic diagram of an application scenario of a device control system provided by an embodiment of the present disclosure;
[0066] Figure 2 It is a flowchart of a device control method provided by an embodiment of the present disclosure;
[0067] Figure 3 It is a flowchart of another device control method provided by an embodiment of the present disclosure;
[0068] Figure 4 It is a flowchart of yet another device control method provided by an embodiment of the present disclosure;
[0069] Figure 5 It is a schematic structural diagram of a device control device provided by an embodiment of the present disclosure;
[0070] Figure 6 It is a schematic structural diagram of another device control device provided by an embodiment of the present disclosure;
[0071] Figure 7 It is a schematic structural diagram of yet another device control device provided by an embodiment of the present disclosure;
[0072] Figure 8 It is a block diagram of an electronic device provided by an embodiment of the present disclosure;
[0073] Figure 9 It is a block diagram of another electronic device provided by an embodiment of the present disclosure. Detailed Embodiments
[0074] The following will describe in detail the specific embodiments of the present disclosure with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only for the purpose of illustration and explanation of the present disclosure, and are not used to limit the present disclosure.
[0075] It should be noted that in the present disclosure, terms such as "first" and "second" are only used for the purpose of distinguishing descriptions, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying an order. Terms such as "S101", "S102", "S201", "S202", etc. are used to distinguish steps, and it is not necessary to understand that the method steps are executed in a specific order or sequence. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements.
[0076] First, the application scenarios of the present disclosure will be described. The present disclosure can be applied to the intelligent classroom scenario, especially the device control in the intelligent classroom. In the intelligent classroom, various devices such as computer devices, interactive whiteboards, projection devices, camera devices, audio devices, lighting devices, and intelligent lock devices are set. During the teaching process, it is necessary to control and operate the above-mentioned devices in the intelligent classroom to assist in carrying out teaching activities and achieve intelligent management of the classroom. However, in the intelligent classroom, there are many devices involved, and the control of each device is rather cumbersome. In the related art, Wi-Fi can be used to connect all intelligent devices in the intelligent classroom to the network, and each intelligent device is managed by a server. However, in large educational institutions, there are generally multiple classrooms, and each classroom has multiple intelligent devices. Using this method, the server controls each intelligent device in each classroom separately, which is cumbersome and requires a lot of resources. Moreover, every time a device is added, configurations need to be made on both the device and the server respectively to control the device through the server.
[0077] To solve the above problems, the present disclosure provides a device control method, device, storage medium, and electronic device. In this method, the control device broadcasts a device control message, and the control instruction and a specified distance threshold are included in the device control message. The controlled device obtains the first device distance from the control device, and when the first device distance is less than or equal to the specified distance threshold, the control instruction is executed. In this way, it is possible to simply and conveniently control the controlled device by the control device through the broadcast method without complex settings for the controlled device and the control device, increasing the connectivity between the control device and the controlled device.
[0078] The following will describe the specific embodiments of the present disclosure in detail with reference to the accompanying drawings.
[0079] Figure 1 is a schematic diagram of the application scenario of a device control system provided by an embodiment of the present disclosure. As Figure 1 shown, the device control system includes a controlled device 101 and a control device 102. Among them, the controlled device 101 can be one or more. For example, it can include a first controlled device 1011, a second controlled device 1012,..., an Nth controlled device 101n. In the embodiments of the present disclosure, the controlled device 101 can be an intelligent device in the intelligent classroom, such as one or more of a computer device, an interactive whiteboard, a projection device, a camera device, an audio device, a lighting device, and an intelligent lock device; the control device 102 can be set in each classroom to control the intelligent devices in this classroom. Therefore, as Figure 1As shown, in the scenario of multiple classrooms, the device control system may further include a central controller 103. There may also be multiple control devices 102. The central controller 103 is connected to the multiple control devices 102, and each control device is connected to the controlled devices in the classroom where the control device is located.
[0080] It should be noted that traditional centralized cloud computing services cannot meet the requirements of real-time performance, security, and low energy consumption for device control. The device control system in the present disclosure can use an edge device as the control device. The edge device may have a processor and a memory to implement the device control method in the present disclosure. Exemplarily, the edge device may be an artificial intelligence development board, or a traditional computer or server.
[0081] Figure 2 is a flowchart of a device control method provided by an embodiment of the present disclosure. As Figure 2 shown, the execution subject of this method may be Figure 1 the controlled device in, and this method includes:
[0082] S201. At the first preset reception time of each preset broadcast period, receive the device control message broadcast by the control device.
[0083] Among them, the device control message includes a control instruction and a specified distance threshold. The control instruction is used to control the controlled device to perform related actions. Exemplarily, the control instruction may be an instruction to turn on the speaker or an instruction to play a specified piece of music. The specified distance threshold may be a pre-set distance, and the specified distance threshold may be greater than or equal to the distance between the controlled device and the control device.
[0084] It should be noted that the preset broadcast period can be determined according to the preset maximum number of controlled devices and the preset minimum broadcast interval in the device control system. That is to say, the preset broadcast period can be calculated by the following formula:
[0085] C = N * I,
[0086] where C represents the preset broadcast period, N represents the preset maximum number of controlled devices in the device control system, and I represents the preset minimum broadcast interval.
[0087] Exemplarily, the controlled devices in the classroom include five intelligent devices: a projection device, a camera device, an audio device, a lighting device, and an intelligent lock device. The preset maximum number of devices to be controlled is 5, and the preset broadcast period is 10 ms. Then, the preset broadcast device can be set to 50 ms. Every 10 ms serves as the first preset reception time for one of the controlled devices. For example, the 5th ms, 15th ms, 25th ms, 35th ms, and 45th ms of the 50-ms cycle are respectively used as the first preset reception times for the above five controlled devices.
[0088] S202. Obtain the first device distance between the controlled device and the control device.
[0089] In this step, there are multiple ways to obtain the first device distance between the controlled device and the control device.
[0090] One way to obtain the first device distance may include the following steps:
[0091] First, send a first ultrasonic signal to the control device.
[0092] It should be noted that in this method, an ultrasonic component can be set on the controlled device to send and receive ultrasonic signals through this ultrasonic component.
[0093] Second, receive the first ultrasonic reflection signal reflected by the control device for the first ultrasonic signal.
[0094] Third, calculate the first time difference between the reception time of receiving the first ultrasonic feedback signal and the transmission time of sending the first ultrasonic signal.
[0095] Finally, determine the first device distance between the controlled device and the control device according to the first time difference.
[0096] Exemplarily, in this method, the first device distance can be calculated through the following formula:
[0097] L1 = V1 * T1 / 2,
[0098] where L1 represents the first device distance, V1 represents the propagation speed of ultrasonic waves in the air, which can be 340 m / s, and T1 represents the first time difference.
[0099] In this way, through this ultrasonic device, the first device distance between the controlled device and the control device can be accurately measured.
[0100] In addition, the device control message also includes the broadcast time for broadcasting the device control message. In this way, another way to obtain the first device distance may include the following steps:
[0101] First, calculate a second time difference between the reception time of the device control message and the broadcast time.
[0102] Secondly, determine a first device distance between the controlled device and the control device according to the second time difference.
[0103] Exemplarily, in this method, the first device distance can be calculated by the following formula:
[0104] L1 = V2 * T2,
[0105] where L1 represents the first device distance, V2 represents the propagation speed of radio signals in the air, which can be 3 * 10 8 m / s, and T2 represents the second time difference.
[0106] It should be noted that the essence of radio signals is electromagnetic waves, and electromagnetic waves are a type of light wave. Therefore, the propagation speed of wireless signals in the air is equal to the speed of light, which is 3 * 10 8 m / s.
[0107] In addition, since the propagation speed of radio signals is relatively fast, in order to improve the measurement accuracy, the above broadcast time and reception time can be of nanosecond or picosecond accuracy.
[0108] In this way, by carrying the broadcast time in the broadcast message, the first device distance between the controlled device and the control device can be calculated.
[0109] S203. When the first device distance is less than or equal to the specified distance threshold, execute the control instruction.
[0110] Using the above method, the controlled device receives the device control message broadcast by the control device at the first preset reception time of each preset broadcast period. The device control message includes a control instruction and a specified distance threshold; obtains the first device distance between the controlled device and the control device; and when the first device distance is less than or equal to the specified distance threshold, executes the control instruction. In this way, simple and convenient control of the controlled device by the control device can be achieved without complex settings for the controlled device and the control device.
[0111] It should be noted that in the application scenario of this embodiment, one control device and multiple controlled devices are installed in each classroom. The controlled devices in this classroom only execute the control instructions sent by the control device in this classroom and need to avoid executing the control instructions of the control devices in adjacent classrooms. To achieve this purpose, the specified distance threshold can be preset according to the shape of the classroom where the device control system is applied, and the distances between multiple controlled devices and the control device are restricted to be less than the specified distance threshold. The setting methods can include the following two:
[0112] Method 1: The control device is installed at the center of a classroom, which is a square classroom with a side length of the first preset length. Then, the specified distance threshold can be set to the first preset length, and at the same time, the controlled device is installed within a range where the straight-line distance from the control device is less than the first preset length.
[0113] Method 2: The control device is installed at the center of a classroom, which is a rectangular classroom with a width of the second preset length. The specified distance threshold can be set to the second preset length. Similarly, the controlled device can be installed within a range where the straight-line distance from the control device is less than the second preset length.
[0114] Through the above methods, by matching different classroom shapes, it is possible to prevent the controlled device from erroneously executing the control instructions of the control devices in adjacent classrooms, thereby improving the accuracy of the execution of control instructions.
[0115] In addition, it should be noted that the controlled device can either execute the control instruction according to the device control message or implement the original manual control function of the controlled device. When the controlled device receives a manual control instruction, it can stop executing the control instruction in the device control message and execute the manual control instruction.
[0116] Figure 3 is a flowchart of another device control method provided by an embodiment of the present disclosure. As Figure 3 shown, the execution subject of this method can be Figure 1 the control device in
[0117] S301. Obtain a control instruction for controlling a controlled device.
[0118] Among them, the control instruction can be a control instruction input by a user; or it can be a control instruction actively generated by the control device according to information sent by a certain controlled device. By way of example, a plurality of controlled devices include an intelligent lock device, a lighting device, and a sound device. When the intelligent lock device is damaged, it can send an alarm message to the control device. The control device can generate a lighting turn-on instruction for controlling the lighting device and an alarm sound playback instruction for controlling the sound device according to the first alarm message.
[0119] S302. Obtain the first preset broadcast time and the specified distance threshold corresponding to the controlled device.
[0120] The control device can preset a first preset broadcast time corresponding to each controlled device. For example, the control device can store a device broadcast time correspondence relationship, which includes the correspondence relationship between each preset controlled device and the first preset broadcast time. In this way, the first preset broadcast time corresponding to the controlled device can be obtained through this device broadcast time correspondence relationship.
[0121] Similarly, the specified distance threshold can be a preset distance, and the specified distance threshold can be greater than or equal to the distance between the controlled device and the control device.
[0122] S303. At the first preset broadcast time of each preset broadcast period, broadcast a device control message.
[0123] Wherein, the device control message includes a control instruction and a specified distance threshold, and the device control message is used to control the controlled device to obtain the first device distance between the controlled device and the control device, and execute the control instruction when the first device distance is less than or equal to the specified distance threshold.
[0124] Similarly, the control instruction is used to control the controlled device to perform related actions; for example, the control instruction can be an instruction to turn on the sound or an instruction to play a specified piece of music.
[0125] By using the above method, the control device obtains a control instruction for controlling the controlled device; and obtains the first preset broadcast time and the specified distance threshold corresponding to the controlled device; at the first preset broadcast time of each preset broadcast period, broadcasts a device control message. Wherein, the device control message includes a control instruction and a specified distance threshold, and the device control message is used to control the controlled device to obtain the first device distance between the controlled device and the control device, and execute the control instruction when the first device distance is less than or equal to the specified distance threshold. In this way, simple and convenient control of the controlled device by the control device can be achieved without complex settings for the controlled device and the control device.
[0126] Figure 4 is a flowchart of another device control method provided by an embodiment of the present disclosure. As Figure 4 shown, the method includes:
[0127] S401. The control device obtains the first preset broadcast time and the specified distance threshold corresponding to the controlled device.
[0128] In this embodiment, there can be multiple controlled devices, and the multiple controlled devices are divided into one or more controlled device groups according to functional types. In this way, according to the preset corresponding relationship between the controlled device groups and the broadcast times, the first preset broadcast time corresponding to each controlled device group can be obtained, and the first preset broadcast time is used as the first preset broadcast time corresponding to the controlled devices under the controlled device group.
[0129] Among them, the preset corresponding relationship between the controlled device groups and the broadcast times includes the corresponding relationship between the controlled device groups and the first preset broadcast times. Different controlled device groups correspond to different first preset broadcast times, and the controlled devices within the same controlled device group correspond to the same first preset broadcast time.
[0130] Exemplarily, the multiple controlled devices include one intelligent lock device and two audio devices. The multiple controlled devices can be divided into an intelligent lock device group and an audio device group, and the audio device group includes two audio devices. In the above preset corresponding relationship between the controlled device groups and the broadcast times, it can include that the first preset broadcast time corresponding to the audio device group is 5 ms, that is, the first preset broadcast times corresponding to the two audio devices are both 5 ms, and the first preset broadcast time corresponding to the intelligent lock device group is 15 ms.
[0131] In this way, in the form of controlled device groups, by sending a device control message at the first preset broadcast time, multiple controlled devices of the same functional type can be controlled, thereby reducing the number of control messages and improving the control efficiency.
[0132] Furthermore, the specified distance threshold can be obtained in the following manner:
[0133] First, for each controlled device group, obtain the second device distance between the control device and each controlled device in the controlled device group.
[0134] Second, take the second device distance with the minimum distance as the candidate distance threshold corresponding to the controlled devices under the controlled device group.
[0135] Finally, obtain the specified distance threshold corresponding to the controlled device according to the candidate distance threshold.
[0136] Exemplarily, the candidate distance threshold can be used as the specified distance threshold; or the candidate distance threshold can be increased by a preset distance adjustment value to obtain the specified distance threshold. The preset distance adjustment value can be any value between 0.1 meter and 0.5 meters. By increasing the preset distance adjustment value
[0137] In this way, according to the distance of the second device which is the closest to the controlled device group, the specified distance threshold corresponding to the controlled device is obtained. In the case where there are multiple controlled devices of the same functional type, only the controlled device with the shortest distance can be controlled to execute the control instruction, thus avoiding the problem of mistakenly controlling multiple controlled devices to execute the control instruction due to broadcasting the device control message.
[0138] It should be noted that in this method, there are also multiple ways to obtain the distance of the second device. One way to obtain the distance of the second device may include the following steps:
[0139] First, send a second ultrasonic signal to the controlled device.
[0140] Similarly, in this method, an ultrasonic component can be set on the control device to send and receive ultrasonic signals through this ultrasonic component.
[0141] Second, receive the second ultrasonic feedback signal returned by the controlled device according to the second ultrasonic signal.
[0142] Third, calculate the third time difference between the reception time of receiving the second ultrasonic feedback signal and the transmission time of sending the second ultrasonic signal.
[0143] Finally, determine the distance of the second device from the controlled device according to the third time difference.
[0144] Exemplarily, in this method, the distance of the second device can be calculated by the following formula:
[0145] L2 = V1 * T3 / 2,
[0146] where L2 represents the distance of the second device, V1 represents the propagation speed of ultrasonic waves in the air, which can be 340 m / s, and T3 represents the third time difference.
[0147] In this way, through this ultrasonic device, the distance of the second device between the control device and the controlled device can be accurately measured.
[0148] Another way to obtain the distance of the second device may include the following steps:
[0149] First, the control device sends a device control message to the controlled device.
[0150] Second, the controlled device receives the device control message broadcast by the control device at the first preset reception time within the preset broadcast period and sends a response message to the control device.
[0151] Among them, the response message includes the sending time of the response message, so that the control device can determine the second device distance between the control device and the controlled device according to the sending time, and determine the specified distance threshold in the device control message according to the second device distance.
[0152] Again, the control device receives the response message sent by the controlled device in response to the device control message, and calculates the fourth time difference between the reception time of receiving the response message and the sending time of the response message.
[0153] Finally, the control device determines the second device distance between the control device and the controlled device according to the fourth time difference.
[0154] Exemplarily, in this method, the second device distance can be calculated by the following formula:
[0155] L2 = V2 * T4,
[0156] Among them, L2 represents the second device distance, V2 represents the propagation speed of radio signals in the air, which can be 3 * 10 8 m / s, and T4 represents the fourth time difference.
[0157] In this way, through the sending time and reception time of the above response message, the second device distance between the control device and the controlled device can also be calculated.
[0158] S402. The control device broadcasts a device initialization message at the second preset broadcast time of the preset broadcast period.
[0159] Among them, the second preset broadcast time is the time before the first preset broadcast time, and the initialization message is used to control the controlled device to perform device initialization operations.
[0160] Exemplarily, the second preset broadcast time can be a time 4 ms earlier than the first preset broadcast time.
[0161] S403. The controlled device receives the device initialization message sent by the control device at the second preset reception time of the preset broadcast period, and performs device initialization operations according to the device initialization message.
[0162] It should be noted that the above-mentioned controlled device can be in a sleep state when it does not receive a device control message or a device initialization message. In the sleep state, the controlled device can power off some devices with high power consumption, but still receive the messages sent by the control device according to the preset broadcast period. In this way, both the energy consumption of the controlled device can be saved and the device control message sent by the control device can be received. However, when the controlled device receives a device control message in the sleep state, it needs to power on and initialize the powered-off devices first, and then it can execute the corresponding control instruction, which will cause the controlled device to be unable to execute the control instruction in time. Thus, in this embodiment, by sending the device initialization message in advance, the controlled device can be notified to perform device initialization, thereby improving the efficiency of the controlled device in executing control instructions.
[0163] S404. The control device broadcasts a device control message at a first preset broadcast time within the preset broadcast period.
[0164] Among them, the device control message includes a control instruction and a specified distance threshold.
[0165] S405. The controlled device receives the device control message broadcast by the control device at a first preset reception time within the preset broadcast period.
[0166] S406. The controlled device obtains the first device distance between the controlled device and the control device, and executes the control instruction when the first device distance is less than or equal to the specified distance threshold.
[0167] In this way, by adopting the above method, through broadcasting the control message, the control device can simply and conveniently control the controlled device without complicated settings for the controlled device and the control device.
[0168] In another embodiment of the present disclosure, the device control message may further include a transmission power, and the method may further include:
[0169] First, the control device determines the transmission power of the device control message and sends a device control message including the transmission power and the control instruction.
[0170] Second, the controlled device obtains the reception power of the received device control message, and calculates the path loss of the device control message according to the reception power and the transmission power.
[0171] In this step, the path loss can be calculated by the following formula:
[0172] PL = PT – PR,
[0173] where PL represents the path loss, PT represents the transmission power of the control device, and PR represents the reception power of the controlled device.
[0174] For example, if the transmission power of the control device is -20 dBm and the received power of the controlled device is -75 dBm, then the path loss is 55 dB.
[0175] Finally, when the path loss between the controlled device and the control device is greater than or equal to a preset path loss threshold, the first device distance between the controlled device and the control device is obtained. When the first device distance is less than or equal to the specified distance threshold, the control instruction is executed.
[0176] It should be noted that the preset power can be determined according to the transmission distance between the controlled device and the control device and the operating frequency used. The path loss of radio waves in the air can be calculated by the following formula:
[0177] L = 32.44 + 20 * LOG(D) + 20 * LOG(F),
[0178] where L is the path loss in dB, D is the transmission distance in Km, and F is the operating frequency in MHz.
[0179] For example, when the operating frequency is 2400 MHz, if the transmission distance is 1 meter, the path loss is 40 dB; if the transmission distance is 2 meters, the path loss is 46 dB; if the transmission distance is 4 meters, the path loss is 52 dB.
[0180] According to empirical data, at the same operating frequency of 2400 MHz, the path loss of radio waves passing through the wall of a concrete brick wall is between 13 dB and 18 dB.
[0181] It can be seen that in a classroom scenario, after radio waves pass through the wall between classrooms, a relatively large path loss will occur. To avoid the controlled device from erroneously executing the control instructions of the control device in an adjacent classroom, the preset path loss threshold can be obtained in the following manner:
[0182] Determine the first path loss of radio waves propagating in the air according to the transmission distance between the controlled device and the control device and the operating frequency used;
[0183] Use the first path loss as the preset path loss threshold, or use the sum of the first path loss and a preset path loss offset as the preset path loss threshold. The preset path loss offset can be any value between 2 dB and 18 dB. For example, it can be 5 dB, 10 dB, or 13 dB.
[0184] Exemplarily, if the transmission distance between the controlled device and the control device is 4 meters and both operate at a working frequency of 2400 MHz, the first path loss can be obtained as 52 dB, and the preset path loss offset can be 5 dB, then the preset path loss threshold is obtained as 57 dB.
[0185] In this way, by adopting this method, the control accuracy can be further improved, ensuring that the controlled device only executes the control instructions of the control device in this classroom and avoiding being affected by the control devices in adjacent classrooms.
[0186] Optionally, the transmission power of the device control message can also be the sum of the above first path loss and the receiver sensitivity of the controlled device.
[0187] Among them, the receiver sensitivity defines the lowest signal strength that the receiver of the controlled device can receive and still operate normally.
[0188] Exemplarily, the receiver sensitivity of the controlled device can be -80 dBm. If the above first path loss calculated according to the distance between the control device and the controlled device is 52 dB, then the transmission power can be -28 dBm.
[0189] In this way, by determining an appropriate transmission power, it can ensure that the controlled device in this classroom receives the device control message, and can also prevent the device control message from being received by the controlled devices in adjacent classrooms and affecting the normal operation of the controlled devices in adjacent classrooms.
[0190] Optionally, in order to ensure that the time when the control device sends the control instruction is the same as the time when the controlled device receives the control instruction, in another embodiment of the present disclosure, the time synchronization between the control device and the controlled device can be achieved by any one of the following methods.
[0191] Method 1: Both the control device and the controlled device are provided with a time synchronization module, and the clock synchronization device can be a Beidou satellite navigation module, a GPS (Global Positioning System) module, or a GLONASS (Global Navigation Satellite System) module.
[0192] Through this time synchronization module, both the control device and the controlled device can be synchronized with the global standard time, thereby ensuring the time synchronization between the control device and the controlled device. The above time synchronization module can all achieve high-precision time signal output and can reach the nanosecond-level timing accuracy.
[0193] Method 2: The control device and the controlled device are respectively provided with independent clock modules. The control device periodically sends time synchronization messages to the controlled device. After receiving the time synchronization message, the controlled device calibrates its own clock module, that is, corrects the current time information of its own clock module according to the time information in the time synchronization message, so as to ensure the time synchronization between the control device and the controlled device.
[0194] It should be noted that the clock module can be a low-power real-time clock chip. Since the accuracies of different clock modules are different, the time between the control device and the controlled device will become unsynchronized after long-term operation. In this method, the clock module can be calibrated through the above time synchronization message before the time between the two becomes unsynchronized.
[0195] Among them, the sending period for the control device to send time synchronization messages to the controlled device can be determined according to the preset broadcast period, the number of controlled devices, and the accuracy of the clock module. For example, if the preset broadcast period is 50 milliseconds, there are 5 controlled devices, and the accuracy of the clock module is a maximum error of ±10 milliseconds per day, then the sending period can be set to a time period less than 1 day, which can be any value between 1 hour and 24 hours. For example, it can be 12 hours. In this way, by setting this sending period, not only can the time synchronization between the control device and the controlled device be ensured, but also the amount of data sent can be reduced, saving device energy consumption.
[0196] Figure 5 is a schematic structural diagram of a device control device provided by an embodiment of the present disclosure. As Figure 5 shown, this device is applied to the controlled device, and this device includes:
[0197] A message receiving module 501, configured to receive a device control message broadcast by the control device at a first preset receiving time of each preset broadcast period, where the device control message includes a control instruction and a specified distance threshold;
[0198] A device distance obtaining module 502, configured to obtain a first device distance between the controlled device and the control device;
[0199] A control instruction execution module 503, configured to execute the control instruction when the first device distance is less than or equal to the specified distance threshold.
[0200] Optionally, the device distance obtaining module 502 is configured to send a first ultrasonic signal to the control device; receive a first ultrasonic reflection signal reflected by the control device from the first ultrasonic signal; calculate a first time difference between a receiving time of receiving the first ultrasonic feedback signal and a sending time of sending the first ultrasonic signal; and determine the first device distance between the controlled device and the control device according to the first time difference.
[0201] Optionally, the device control message further includes a broadcast time for broadcasting the device control message. The device distance acquisition module 502 is configured to calculate a second time difference between a reception time of receiving the device control message and the broadcast time; and determine a first device distance between the controlled device and the control device according to the second time difference.
[0202] Optionally, Figure 6 is a schematic structural diagram of another device control device provided by an embodiment of the present disclosure. As Figure 6 shown, the device further includes:
[0203] A response message sending module 601, configured to send a response message to the control device after receiving the device control message broadcast by the control device. The response message includes a sending time for sending the response message, so that the control device determines a second device distance between the control device and the controlled device according to the sending time, and determines a specified distance threshold in the device control message according to the second device distance.
[0204] Optionally, the device control message further includes a transmission power. The device distance acquisition module 502 is configured to acquire a reception power of receiving the device control message; calculate a path loss of the device control message according to the reception power and the transmission power; and the acquiring the first device distance between the controlled device and the control device includes: acquiring the first device distance between the controlled device and the control device when the path loss is greater than or equal to a preset path loss threshold.
[0205] Optionally, the message receiving module 501 is further configured to receive a device initialization message sent by the control device at a second preset reception time of each preset broadcast period, where the second preset reception time is a time before the first preset reception time;
[0206] A control instruction execution module 503 is further configured to perform a device initialization operation according to the device initialization message.
[0207] Figure 7 is a schematic structural diagram of another device control device provided by an embodiment of the present disclosure. As Figure 7 shown, the device is applied to a control device, and the device includes:
[0208] A control instruction acquisition module 701, configured to acquire a control instruction for controlling a controlled device;
[0209] A preset broadcast time acquisition module 702, configured to acquire a first preset broadcast time corresponding to the controlled device
[0210] A specified distance threshold obtaining module 703, configured to obtain a specified distance threshold corresponding to the controlled device;
[0211] A message broadcasting module 704, configured to broadcast a device control message at a first preset broadcast time of each preset broadcast period, where the device control message includes the control instruction and the specified distance threshold, and the device control message is used to control the controlled device to obtain a first device distance between the controlled device and the control device, and execute the control instruction when the first device distance is less than or equal to the specified distance threshold.
[0212] Optionally, there are multiple controlled devices, and the multiple controlled devices are divided into one or more controlled device groups according to functional types. The preset broadcast time obtaining module 702 is configured to obtain a first preset broadcast time corresponding to each controlled device group according to a preset corresponding relationship between the controlled device groups and the broadcast times, and use the first preset broadcast time as the first preset broadcast time corresponding to the controlled devices under the controlled device group, where the preset corresponding relationship between the controlled device groups and the broadcast times includes the corresponding relationship between the controlled device group and the first preset broadcast time, different controlled device groups correspond to different first preset broadcast times, and the controlled devices within the same controlled device group correspond to the same first preset broadcast time.
[0213] Optionally, the specified distance threshold obtaining module 703 may be configured to, for each controlled device group, obtain a second device distance between the control device and each controlled device in the controlled device group; use the second device distance with the smallest distance as the candidate distance threshold corresponding to the controlled devices under the controlled device group; and obtain the specified distance threshold corresponding to the controlled device according to the candidate distance threshold.
[0214] Optionally, the specified distance threshold obtaining module 703 is specifically configured to increase the candidate distance threshold by a preset distance adjustment value to obtain the specified distance threshold.
[0215] Optionally, the specified distance threshold obtaining module 703 may be configured to send a second ultrasonic signal to the controlled device; receive a second ultrasonic feedback signal returned by the controlled device according to the second ultrasonic signal; calculate a third time difference between the reception time of receiving the second ultrasonic feedback signal and the transmission time of sending the second ultrasonic signal; and determine the second device distance from the controlled device according to the third time difference.
[0216] Optionally, the specified distance threshold obtaining module 703 may be configured to receive a response message sent by the controlled device in response to the device control message, where the response message includes the response message sending time; calculate a fourth time difference between the receiving time of receiving the response message and the response message sending time; and determine a second device distance between the control device and the controlled device according to the fourth time difference.
[0217] Optionally, the message broadcasting module 704 is further configured to broadcast a device initialization message at a second preset broadcast time of each preset broadcast period, where the second preset broadcast time is a time before the first preset broadcast time, and the initialization message is used to control the controlled device to perform a device initialization operation.
[0218] Regarding the device in the above embodiments, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated herein.
[0219] Figure 8 is a block diagram of an electronic device 800 shown according to an exemplary embodiment. As Figure 8 shown, the electronic device 800 may include: a processor 801, a memory 802. The electronic device 800 may further include one or more of a multimedia component 803, an input / output (I / O) interface 804, and a communication component 805.
[0220] Among them, the processor 801 is used to control the overall operation of the electronic device 800 to complete all or part of the steps in the above device control method. The memory 802 is used to store various types of data to support the operation of the electronic device 800. These data may include, for example, instructions for any application or method operating on the electronic device 800, as well as application-related data, such as contact data, sent and received messages, pictures, audio, video, and so on. The memory 802 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic memory, flash memory, a magnetic disk, or an optical disc. The multimedia component 803 may include a screen and an audio component. The screen can be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal can be further stored in the memory 802 or sent through the communication component 805. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 804 provides an interface between the processor 801 and other interface modules, and the above other interface modules can be a keyboard, a mouse, buttons, etc. These buttons can be virtual buttons or physical buttons. The communication component 805 is used for wired or wireless communication between the electronic device 800 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more of them, is not limited herein. Therefore, the corresponding communication component 805 may include: a Wi-Fi module, a Bluetooth module, an NFC module, and so on.
[0221] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components, and is used to execute the above-mentioned device control method.
[0222] In another exemplary embodiment, a computer-readable storage medium including program instructions is further provided. When the program instructions are executed by a processor, the steps of the above-mentioned device control method are implemented. For example, the computer-readable storage medium may be the above-mentioned memory 802 including program instructions, and the above-mentioned program instructions may be executed by the processor 801 of the electronic device 800 to complete the above-mentioned device control method.
[0223] Figure 9 is a block diagram of an electronic device 900 shown according to an exemplary embodiment. For example, the electronic device 900 may be provided as a server. Referring to Figure 9 , the electronic device 900 includes a processor 922, the number of which may be one or more, and a memory 932 for storing computer programs executable by the processor 922. The computer programs stored in the memory 932 may include one or more modules each corresponding to a set of instructions. In addition, the processor 922 may be configured to execute the computer program to execute the above-mentioned device control method.
[0224] In addition, the electronic device 900 may further include a power supply component 926 and a communication component 950. The power supply component 926 may be configured to perform power management of the electronic device 900, and the communication component 950 may be configured to implement communication of the electronic device 900, for example, wired or wireless communication. In addition, the electronic device 900 may further include an input / output (I / O) interface 958. The electronic device 900 may operate based on an operating system stored in the memory 932, such as Windows Server, Mac OS, Unix, Linux, and so on.
[0225] In another exemplary embodiment, a computer-readable storage medium including program instructions is further provided. When the program instructions are executed by a processor, the steps of the above device control method are implemented. For example, the computer-readable storage medium may be the memory 932 including the program instructions described above, and the above program instructions may be executed by the processor 922 of the electronic device 900 to complete the above device control method.
[0226] In another exemplary embodiment, a computer program product is further provided. The computer program product includes a computer program that can be executed by a programmable device, and the computer program has a code portion for executing the above device control method when executed by the programmable device.
[0227] The preferred embodiments of the present disclosure have been described in detail above in conjunction with the accompanying drawings. However, the present disclosure is not limited to the specific details in the above embodiments. Within the scope of the technical concept of the present disclosure, various simple modifications can be made to the technical solutions of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.
[0228] In addition, it should be noted that, in the various specific technical features described in the above specific embodiments, they can be combined in any appropriate manner without conflict. To avoid unnecessary repetition, the present disclosure does not separately describe various possible combination methods.
[0229] Furthermore, any combination can be made between various different embodiments of the present disclosure as long as it does not violate the idea of the present disclosure, and it should also be regarded as the content disclosed by the present disclosure.
Claims
1. A device control method, characterized in that, Applied to a controlled device, the method includes: Receiving, at a first preset receiving time of each preset broadcast period, a device control message broadcast by a control device, where the device control message includes a control instruction and a specified distance threshold; Obtaining a first device distance between the controlled device and the control device; Executing the control instruction when the first device distance is less than or equal to the specified distance threshold; The device control message further includes a transmission power. Before obtaining the first device distance between the controlled device and the control device, the method further includes: Obtaining a received power of receiving the device control message; Calculating a path loss of the device control message based on the received power and the transmission power; The obtaining the first device distance between the controlled device and the control device includes: Obtaining the first device distance between the controlled device and the control device when the path loss is greater than or equal to a preset path loss threshold.
2. The method according to claim 1, wherein The obtaining the first device distance between the controlled device and the control device includes: Sending a first ultrasonic signal to the control device; Receiving a first ultrasonic reflection signal reflected by the control device from the first ultrasonic signal; Calculating a first time difference between a receiving time of receiving the first ultrasonic feedback signal and a sending time of sending the first ultrasonic signal; Determining the first device distance between the controlled device and the control device based on the first time difference.
3. The method according to claim 1, characterized in that The device control message further includes a broadcast time of broadcasting the device control message. The obtaining the first device distance between the controlled device and the control device includes: Calculating a second time difference between a receiving time of receiving the device control message and the broadcast time; Determining the first device distance between the controlled device and the control device based on the second time difference.
4. The method according to claim 3, wherein The method further includes: After receiving the device control message broadcast by the control device, sending a response message to the control device, where the response message includes a sending time of sending the response message, so that the control device determines a second device distance between the control device and the controlled device based on the sending time, and determines the specified distance threshold in the device control message based on the second device distance.
5. The method according to any one of claims 1 to 4, characterized in that, The method further includes: Receiving, at a second preset receiving time of each preset broadcast period, a device initialization message sent by the control device, where the second preset receiving time is a time before the first preset receiving time; Performing a device initialization operation according to the device initialization message.
6. An apparatus control device, characterized in that, Applied to a controlled device, the apparatus includes: A message receiving module, configured to receive, at a first preset receiving time of each preset broadcast period, a device control message broadcast by a control device, where the device control message includes a control instruction and a specified distance threshold; A device distance obtaining module, configured to obtain a first device distance between the controlled device and the control device; A control instruction execution module, configured to execute the control instruction when the first device distance is less than or equal to the specified distance threshold; The device control message further includes a transmission power, and the device distance acquisition module is configured to: acquire the received power of the received device control message; calculate the path loss of the device control message according to the received power and the transmission power; acquire a first device distance between the controlled device and the control device when the path loss is greater than or equal to a preset path loss threshold.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the steps of the method according to any one of claims 1 to 5.
8. An electronic device, characterized in that, Comprising: a memory storing a computer program thereon; a processor configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Control method of intelligent household appliance, electronic remote controller and electronic equipment
CN112034750A
Methods and apparatuses for distance measurement
US20200041633A1