Method and device for detecting the status of a door or window
By determining the magnetic field distortion before detection and selecting appropriate sensor data for door or window status detection, the problem of inaccurate detection caused by magnetic field distortion and angular velocity deviation is solved, achieving higher detection accuracy.
Patent Information
- Application Number
- CN202010764652.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-31
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2040-07-31
AI Technical Summary
In existing technologies, door or window status detection based on angular velocity data is easily affected by offset, while detection based on magnetometer data is affected by magnetic field distortion, resulting in inaccurate detection results.
First, determine if magnetic field distortion exists. If there is no distortion, use magnetometer data to detect the status of the door or window. If distortion exists, use angular velocity data for compensation and combine it with acceleration data for accurate detection.
It improves the accuracy of door or window status detection, ensuring reliable detection results in both stable and unstable magnetic field environments.
Smart Images

Figure CN114061437B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of doors and windows, and in particular to detecting a door or window. BACKGROUND
[0002] With the progress of society, more and more detection means are applied to our daily life to provide convenience and safety for our life, such as detecting the state of a door or window, especially the opening and closing state, and even providing the opening angle of the door or window. Common detection methods include detection based on angular velocity data and detection based on magnetometer data.
[0003] In the detection method based on angular velocity data, the angular velocity data is integrated to calculate the opening angle of the door or window, and then the state of the door or window is detected based on the calculated opening angle. The angular velocity data measured by the angular velocity sensor usually contains an offset, and the offset increases over time, thereby causing the calculated opening angle to deviate from the actual value.
[0004] In the detection method based on magnetometer data, it is required that the detection environment is magnetically stable, but in reality, there are often magnetic field distortions in the detection environment, and it is difficult to ensure its magnetic stability. SUMMARY
[0005] It is desirable to provide a method and device for detecting the state of a door or window, which first detects whether there is a magnetic field distortion, and only when there is no magnetic distortion, detection is performed based on magnetometer data, thereby improving the accuracy of the detection result.
[0006] According to one aspect, a method for detecting the state of a door or window is provided. The method includes receiving sensor data from a sensor disposed on the door or window, the sensor data including at least one of angular velocity data and acceleration data and magnetometer data; determining whether there is a magnetic field distortion based on the sensor data; and when it is determined that there is no magnetic field distortion, determining the state of the door or window based on the magnetometer data.
[0007] According to another aspect, a device for detecting the state of a door or window is provided. The device includes a receiving unit configured to receive sensor data from a sensor disposed on the door or window, the sensor data including at least one of angular velocity data and acceleration data and magnetometer data; a determining unit configured to determine whether there is a magnetic field distortion based on the sensor data; and a state determining unit configured to determine the state of the door or window based on the magnetometer data when it is determined that there is no magnetic field distortion.
[0008] According to another aspect, there is provided a system for detecting a state of a door or window, comprising an acceleration sensor, an angular velocity sensor and a magnetometer mounted on the door or window; and a processor for performing the method according to any one of the various embodiments.
[0009] According to still another aspect, there is provided a machine readable storage medium storing computer program instructions which, when executed, cause a computer to perform the method according to the various embodiments of the present disclosure.
[0010] According to the various embodiments of the various aspects of the present disclosure, firstly, it is determined whether there is a magnetic field distortion based on the sensor data, especially firstly it is determined whether the door or window is in a static state, and different ways are used to determine whether there is a magnetic field distortion for the static state and the non-static state. In the case of determining that there is no magnetic field distortion, the state of the door or window, especially the open or closed state, or even the door opening angle, is determined based on the magnetometer data, which improves the accuracy of the detection result. BRIEF DESCRIPTION OF DRAWINGS
[0011] In the drawings, the embodiments are illustrated by way of example, and not limitation, in which like reference numerals refer to similar elements.
[0012] Figure 1 A method for detecting a state of a door or window according to an embodiment is shown;
[0013] Figure 2 A method for setting a predetermined corresponding relationship according to an embodiment is shown;
[0014] Figure 3 A method for detecting a state of a door or window based on magnetometer data according to an embodiment is shown;
[0015] Figure 4 A method for detecting a state of a door or window based on angular velocity data according to an embodiment is shown;
[0016] Figure 5 An apparatus for detecting a state of a door or window according to an embodiment is shown.
[0017] Various aspects and features of the various embodiments of the present disclosure are described with reference to the above drawings. The above drawings are merely schematic and non-limiting. The size, shape, label, or appearance of each element in the above drawings can be changed without being limited to only as shown in the drawings of the specification. DETAILED DESCRIPTION
[0018] According to various embodiments of various aspects of the present disclosure, it is first determined whether there is a magnetic field distortion, and then the magnetometer data is used to determine the state of the door or window in the absence of the magnetic field distortion. Specifically, it is first determined whether the door or window is in a stationary state, and different ways are used to determine whether the magnetometer data is measured in the presence of the magnetic field distortion for the stationary state and the non-stationary state, and the state detection of the door or window based on the magnetometer data is initiated when it is determined that there is no magnetic field distortion, i.e., the state of the door or window is determined based on the magnetometer data. This ensures the accuracy of the determination of the state of the door or window based on the magnetometer data. Further, by using different ways to determine the magnetic field distortion for the stationary state and the non-stationary state, a more accurate determination of the magnetic field distortion is provided, and thus the accuracy of the state detection is improved.
[0019] Further, when it is determined that there is a magnetic field distortion, the state detection of the door or window based on the angular velocity data is initiated, and in particular, the opening angle of the door or window is calculated by taking into account the angular velocity offset data of the door or window and the initial opening angle of the door or window for the state detection. This enables an accurate detection result to be obtained even in the presence of the magnetic field distortion.
[0020] Still further, in the state detection process, the angular velocity offset data and the initial opening angle of the door or window can be updated appropriately, e.g., the angular velocity offset data is updated when it is determined that the door or window is stationary for a predetermined period of time, and / or the initial opening angle is updated when it is determined that the door or window is stationary and there is no magnetic field distortion and when it is determined that the door or window is closed, respectively. Thus, the inaccuracy caused by the drift / offset of the angular velocity data is avoided, and the accuracy of the state detection of the door or window based on the angular velocity is improved.
[0021] Figure 1 A method 1000 for detecting the state of a door or window according to an embodiment is shown. According to the method 1000, in step 1100, sensor data from the door or window is obtained. The sensor data can be measured by an inertial sensor unit installed in the door lock. The inertial sensor unit includes an acceleration sensor, an angular velocity sensor and a magnetometer, which are preferably triaxial sensors. Accordingly, the sensor data includes acceleration data, angular velocity data and magnetometer data. In some embodiments, the acceleration data can also be ignored. Thus, only the angular velocity sensor and the magnetometer are provided in the door lock.
[0022] In step 1200, it is determined whether the door or window is stationary based on the sensor data. In one embodiment, it can be determined whether the door or window is stationary by determining the stability of the sensor data. Specifically, it can be determined whether the door or window is stationary based on any one of the acceleration data, the angular velocity data and the magnetometer data alone. It can also be considered to determine whether the door or window is stationary in combination with two or three of them to increase the accuracy of the determination.
[0023] In the case of a separate determination based on magnetometer data, data indicative of a variation of the magnetometer data acquired within a predetermined time period, e.g. 1 second, such as a standard deviation, can be determined. If this data indicative of a variation is smaller than a predetermined threshold, the corresponding magnetometer data is relatively stable, which indicates that the door or window is at rest, otherwise it indicates that the door or window is not at rest.
[0024] In the case of a separate determination based on angular velocity data, the angular velocity offset data is subtracted from the angular velocity data, taking into account that there is an offset in the angular velocity data, and the resulting data is then used to determine whether the door or window is at rest. The angular velocity offset data is initially determined based on an average of the measured angular velocity data when the door or window is at rest for a predetermined time period, e.g. 1 second. Subsequently, the angular velocity offset data can be updated based on the angular velocity data within a predetermined time period when it is determined that the door or window is at rest for that predetermined time period.
[0025] In particular, when the door is at rest, ideally the angular velocity data around any axis should be zero. It can be determined whether the door or window is at rest by determining a deviation of the current angular velocity data from zero. If this deviation is too large, it indicates that the door or window is not at rest, if it meets a predetermined requirement, it indicates that the door or window is at rest.
[0026] For example, a data indicative of a deviation of the current angular velocity data from zero can be determined by squaring the angular velocity data of each axis at the current time, and then taking the square root of the sum of the squares. This data indicative of a deviation is compared with a predetermined threshold, and if it is smaller, it is determined that the door or window is at rest, otherwise it indicates that the door or window is not at rest. The predetermined threshold is preferably set taking into account the offset of the angular velocity data.
[0027] In another example, a data D indicative of a deviation of the current angular velocity data from zero can be determined taking into account the angular velocity offset data, using the following formula:
[0028]
[0029] where Gx, Gy, Gz are the angular velocity data around the x, y and z axes, respectively, and Ox, Oy, Oz are the angular velocity offset data around the x, y and z axes, respectively. The x, y and z axes are three mutually perpendicular coordinate axes defined with respect to the door. This data D is compared with a predetermined threshold to determine whether the door or window is at rest. In this example, the predetermined threshold can be set to a relatively small value, and does not need to take into account the offset of the angular velocity data.
[0030] In the case of a separate determination based on acceleration data, the variation of the acceleration data should ideally be zero when the door or window is at rest. By comparing the variation data of the acceleration data, such as the range of variation and / or the standard deviation, with a predetermined threshold, it can be determined whether the door or window is at rest.
[0031] To improve the accuracy of the determination, it can be determined whether the consecutive angular velocity data or acceleration data satisfy the above requirement. For example, when it is determined that the deviation of the plurality of angular velocity data or acceleration data from zero within a predetermined time period (e.g. 1 second) satisfies the requirement, it is determined that the door or window is stationary.
[0032] If it is determined in step 1200 that the door or window is stationary (i.e. "Y" in the figure), the method proceeds to step 1300. In step 1300, stability data of the magnetometer data within a predetermined time period during which the door or window is stationary is determined based on the magnetometer data, and it is then determined whether there is a magnetic field distortion based on the determined stability data. For example, the standard deviation of the collected magnetometer data is determined, and the standard deviation is compared with a predetermined threshold value. If the standard deviation is relatively large, it indicates that there is a magnetic field distortion, and vice versa.
[0033] If it is determined in step 1200 whether the door or window is stationary based on the magnetometer data alone, it is possible to combine step 1200 and step 1300. However, considering that there can be a magnetic field distortion, it is determined in step 1200 whether the door or window is stationary based on the angular velocity data and / or the acceleration data.
[0034] If it is determined in step 1300 that there is no magnetic field distortion (i.e. "N" in the figure), the method proceeds to step 1700, and the state detection of the door or window based on the magnetometer data is initiated, i.e. the state of the door or window is determined based on the magnetometer data. Specifically, the state of the door or window is determined based on the magnetometer data and a predetermined correspondence between the magnetometer data and the opening angle of the door or window. This will be described in detail below with reference to Figure 3 If it is determined in step 1300 that there is a magnetic field distortion (i.e. "Y" in the figure), the method proceeds to step 1800, and the state detection of the door or window based on the angular velocity data and / or the acceleration data is initiated. In one embodiment, the state detection of the door or window based on the angular velocity data is initiated. When the state detection of the door or window is performed based on the angular velocity data, the angular velocity offset data is considered, and in particular, the current opening angle of the door or window is calculated based on the measured / received angular velocity data, the angular velocity offset data and the initial opening angle of the door or window, and the state of the door or window is determined. When the current opening angle of the door or window is calculated, it is usually calculated by integrating the angular velocity data on the basis of the initial opening angle of the door or window, wherein the angular velocity data can be the angular velocity data after the angular velocity offset data is subtracted. The initial opening angle can be initially set to zero in an initialization process as described below, and it can also be updated to the angle at which the door is stationary or closed each time, and thus the integration basis for calculating the opening angle of the door or window next time is updated, resulting in a more accurate state detection result of the door or window.
[0035] If it is determined in step 1200 that the door or window is not stationary (i.e., "N" in the drawing), the method proceeds to step 1400. In step 1400, one or more opening angles of the door or window are determined based on the angular velocity data and / or the acceleration data. When the one or more opening angles of the door or window are determined based on the angular velocity data, the angular velocity offset data can be first subtracted from the angular velocity data, and then the current one or more opening angles are determined based on the resulting angular velocity data and the initial opening angle of the door or window. Next, in step 1500, the magnetometer data corresponding to each opening angle is determined. Thus, in steps 1400 and 1500, a correspondence between the opening angles of the door or window and the magnetometer data for the current sensor data is obtained.
[0036] Then, in step 1600, the correspondence obtained in steps 1400 and 1500 and the predetermined correspondence are compared, and it is determined whether the magnetic field distortion exists based on the one or more opening angles determined in steps 1400 and 1500 and the corresponding magnetometer data determined for the one or more opening angles, and the predetermined correspondence, which refers to the predetermined correspondence between each opening angle and the corresponding magnetometer data determined for the door or window in the absence of the magnetic field distortion. The predetermined correspondence can be stored in the form of a table, which is initially set when the device for detecting the state of the door or window is installed, and can be updated.
[0037] Figure 2 A method 2000 of setting the predetermined correspondence according to one embodiment is shown. According to the method 2000, at step 2100, the angular velocity data and the magnetometer data measured for a predetermined period (e.g., 5 seconds) while the door or window is kept stationary are obtained. In step 2200, the stability of the magnetometer data for the predetermined period while the door or window is kept stationary is determined, for example, whether the standard deviation data between the magnetometer data is too large. If it is determined in step 2200 that the magnetometer data for the predetermined period is unstable, it indicates that the magnetic field distortion exists (i.e., "Y" in the drawing), in which case an alarm can be output to prompt the user that the magnetic field distortion currently exists, and then the method can return to step 2100 to obtain new angular velocity data and magnetometer data for a new predetermined period while the door or window is kept stationary.
[0038] If it is determined in step 2200 that the magnetometer data within the predetermined time period is stable, i.e., there is no magnetic field distortion (i.e., "N" in the attached figure), then proceed to step 2300. In this step, based on the angular velocity data within the predetermined time period, for example by calculating the average of the angular velocity data within the predetermined time period, the initial angular velocity offset data of the door or window is determined. This angular velocity offset data can be updated subsequently when the predetermined time period in which the door or window remains stationary is determined.
[0039] Then, in step 2400, based on the magnetometer data within the predetermined time period, for example by calculating the average value of the magnetometer data within the predetermined time period, the magnetometer data when the opening angle of the door or window is zero is determined.
[0040] In step 2500, the opening angle of the door or window is recorded as zero and the corresponding magnetometer data is recorded.
[0041] Furthermore, in step 2600, the user is prompted to repeatedly open and close the door several times at a normal speed, while simultaneously obtaining the measured angular velocity data and the corresponding magnetometer data.
[0042] In step 2700, the opening angle of the door or window during the opening and closing process is determined based on the angular velocity data measured in step 2600, the initial angular velocity offset data determined in step 2300, and the initial opening angle of the door or window (which can be zero).
[0043] In step 2800, the determined opening angle of the door or window during the opening and closing process and the corresponding magnetometer data are stored in, for example, a predetermined table, thereby obtaining the predetermined correspondence between each opening angle and the corresponding magnetometer data. It can be understood that by repeatedly opening and closing the door several times, a predetermined correspondence for each opening and closing can be obtained, and a more accurate result can be obtained by averaging the corresponding data in these predetermined correspondences.
[0044] The above is for reference only. Figure 2 The process of setting up the predefined correspondence is described. It is understood that the process can be repeated under predefined conditions (e.g., periodically) to update the predefined correspondence.
[0045] Return to Figure 1, specifically in step 1600, the magnetometer data determined in step 1500 for the one or more opening angles determined in step 1400 is compared with the magnetometer data corresponding to the one or more opening angles in the predetermined correspondence, and if a first difference data between the magnetometer data determined for the one or more opening angles and the magnetometer data corresponding to the one or more opening angles in the predetermined correspondence is too large, e.g. larger than a predetermined threshold, it is indicated that there is a magnetic field distortion, and vice versa, if the first difference data meets a predetermined requirement, e.g. is smaller than or equal to the predetermined threshold, it is indicated that there is no magnetic field distortion.
[0046] In another embodiment, in step 1600, the one or more opening angles determined in step 1400 are compared with the corresponding opening angles in the predetermined correspondence corresponding to the magnetometer data determined in step 1500 for the one or more opening angles, and if a second difference data between the one or more opening angles and the corresponding opening angles in the predetermined correspondence corresponding to the magnetometer data determined for the one or more opening angles is too large, e.g. larger than a predetermined threshold, it is indicated that there is a magnetic field distortion, and vice versa, if the second difference data meets a predetermined requirement, e.g. is smaller than or equal to the predetermined threshold, it is indicated that there is no magnetic field distortion.
[0047] If it is determined in step 1600 that there is no magnetic field distortion (i.e. "N" in the figure), the method proceeds to step 1700, in which a state detection of the door or window based on the magnetometer data is initiated, i.e. the state of the door or window is determined based on the magnetometer data. If it is determined in step 1600 that there is a magnetic field distortion (i.e. "Y" in the figure), the method proceeds to step 1800, in which a state detection of the door or window based on the angular velocity data and / or the acceleration data is initiated. Preferably, when the state detection of the door or window is performed based on the angular velocity data, the angular velocity offset data is taken into account, and in particular the current one or more opening angles of the door or window are calculated based on the measured / received angular velocity data, the angular velocity offset data (which can be the initial angular velocity offset data or the updated angular velocity offset data) and the initial opening angle of the door or window, and based on which the state of the door or window is determined.
[0048] Figure 3 A method of the state detection of the door or window based on the magnetometer data in step 1700 according to an embodiment is shown. According to the method, at step 1710, the current magnetometer data is compared with the magnetometer data corresponding to the zero door opening angle in the predetermined correspondence, and it is determined whether the difference between the two meets a requirement, e.g. is smaller than a predetermined threshold, and if it is not smaller than the predetermined threshold (i.e. "N" in the figure), the method proceeds to step 1740, in which it is determined that the current state of the door is open. On the contrary, the method proceeds to step 1720, at which it is determined that the current state of the door is closed.
[0049] In the preferred embodiment, after the current state of the door is determined to be closed in step 1720, the process can proceed to step 1730. In step 1730, the initial opening angle of the door or window is set to zero. In this way, the next time the current opening angle of the door or window is calculated based on the measured / received angular velocity data, angular velocity offset data, and the initial opening angle of the door or window, an updated initial opening angle can be used. Given that the offset of the angular velocity sensor data can increase over time, by resetting the initial opening angle closer in time, a more accurate opening angle of the door or window can be obtained the next time the opening angle of the door or window is calculated based on the angular velocity data.
[0050] The above describes updating the initial opening angle of the door or window to zero when the door or window is determined to be closed for calculating the opening angle of the door or window based on the angular velocity data, which is not limiting, and it is also contemplated that the initial opening angle can be updated when the door or window is determined to be in a stationary state (especially at a current opening angle greater than zero) and without magnetic field distortion. Preferably, the initial opening angle is updated when the door or window is determined to be in a stationary state and without magnetic field distortion for a predetermined period of time (e.g., 3 seconds). The updating process is based on the current opening angle calculated from the current angular velocity data, angular velocity offset data, and the initial opening angle, the current magnetometer data, and the predetermined correspondence.
[0051] For example, with reference to Figure 1 After the door or window is determined to be stationary in step 1200 and without magnetic field distortion in step 1300, not only does the process proceed to step 1700, but the initial opening angle updating process (not shown) can also be performed in parallel. Alternatively, the initial opening angle updating process can be performed first before step 1710 shown, and then the process proceeds to step 1710 to compare the current magnetometer data with the magnetometer data corresponding to a zero opening angle in the predetermined correspondence. Alternatively, the initial opening angle updating process can be performed in parallel with steps 1710-1740. Figure 3
[0052] Specifically, according to the initial opening angle updating process, when the door or window is determined to be stationary and without magnetic field distortion, the magnetometer data is relatively more reliable at this time, while the angular velocity data can have errors due to the offset. In this state, if there is no offset of the angular velocity data, ideally, the current magnetometer data corresponding to an opening angle or the current opening angle corresponding to a magnetometer data should be the same as the magnetometer data corresponding to the same opening angle or the opening angle corresponding to the same magnetometer data in the predetermined correspondence.
[0053] Therefore, in one embodiment, first, a current opening angle of the door or window is calculated based on the angular velocity data, the angular velocity offset data and the initial opening angle of the door or window, which can include errors due to the offset. Then, a corresponding opening angle for the current magnetometer data is determined based on the predetermined correspondence; the calculated current opening angle is compared with the determined corresponding opening angle; if the difference between them exceeds a predetermined angle, it means that the errors in the angular velocity data due to the offset are too large, therefore, the initial opening angle of the door or window is set to be equal to the corresponding opening angle determined according to the predetermined correspondence. In this way, the initial opening angle is updated, reducing the errors due to the offset of the angular velocity data.
[0054] In another embodiment, after the current opening angle is determined, a corresponding magnetometer data for the current opening angle is determined based on the predetermined correspondence, the corresponding magnetometer data is compared with the current magnetometer data, if the difference between them exceeds a predetermined threshold, it means that the errors in the angular velocity data due to the offset are too large, therefore, a corresponding opening angle for the current magnetometer data is further determined based on the predetermined correspondence, and the initial opening angle of the door or window is set to be equal to the corresponding opening angle.
[0055] As mentioned above, the initial opening angle is updated when the door or window is determined to be closed or in any stationary state without magnetic field distortion, which can be used as the basis for the integration of the angular velocity data when the opening angle of the door or window is calculated subsequently, thereby reducing the errors due to the offset. Especially when the opening angle needs to be calculated based on the angular velocity data subsequently, including when the status detection of the door or window based on the angular velocity data is initiated, a more accurate detection result is obtained.
[0056] Figure 4 A method of status detection of a door or window based on angular velocity data in step 1800 according to one embodiment is shown. According to the method, in step 1810, first, one or more current opening angles of the door or window are calculated based on the angular velocity offset data, the initial opening angle of the door or window and the angular velocity data from the angular velocity sensor in a predetermined time period (e.g. 1 second). If the opening angle of the door or window has been calculated in a previous step (e.g. step 1400), this step can be omitted. In step 1820, the difference between the calculated opening angle and zero in the predetermined time period is determined, if the difference is too large, e.g. larger than a predetermined angle (e.g. 1 degree), in step 1830, it is determined that the door or window is open, otherwise, in step 1840, it is determined that the door or window is closed. After step 1840, the initial opening angle of the door or window for subsequent opening angle calculation can be further updated to be zero in step 1850 as mentioned above.
[0057] The above describes how to update the initial opening angle when a door or window is determined to be stationary, with reference to different scenarios. It is also expected that the angular velocity offset data will be updated after a predetermined time period (e.g., 1 second) when the door or window is determined to be stationary (at any angle). For example, the angular velocity offset data can be updated based on the angular velocity data measured within the predetermined time period when the door or window is stationary, such as using its average value to replace the original angular velocity offset data. This results in more accurate calculations of the opening angle of the door or window in subsequent calculations.
[0058] By updating the initial opening angle and angular velocity offset data, the drift / offset of angular velocity data can be overcome, thereby improving the accuracy of door or window opening angle calculations based on angular velocity data.
[0059] The above is for reference only. Figures 1-4 Methods for determining the state of a door or window according to various embodiments of the present invention are described. As long as they do not depart from the spirit of the technical solution of the present invention, the various steps can be combined / disassembled / reorganized / modified to obtain the corresponding effects.
[0060] For example, although the above references Figure 1 Steps 1200-1600 describe methods for first determining whether a door or window is stationary and then using different methods to determine whether magnetic field distortion exists, depending on whether the door or window is stationary or not. However, this is not restrictive, and it is also possible to determine whether magnetic field distortion exists without distinguishing between the stationary and non-stationary states of the door or window.
[0061] Figure 5 A device 100 for determining the state of a door or window is shown according to one embodiment. The device 100 includes a receiving unit 110, a first determining unit 120, a second determining unit 130, a state determining unit 140, a first updating unit 150, and a second updating unit 160. The first determining unit 120 and the second determining unit 130 together constitute a determining unit.
[0062] The receiving unit 110 receives sensor data of a door or window, the sensor data including magnetometer data, angular velocity data and acceleration data. The first judging unit 120 judges whether the door or window is stationary based on the sensor data. When the first judging unit 120 judges that the door or window is stationary, the second judging unit 130 judges whether there is a magnetic field distortion based on the magnetometer data. When the first judging unit 120 judges that the door or window is not stationary, the second judging unit 130 determines one or more opening angles of the door or window based on the angular velocity data or the acceleration data, determines magnetometer data for the one or more opening angles, judges whether there is the magnetic field distortion based on the one or more opening angles and the corresponding magnetometer data and a predetermined correspondence between each opening angle of the door or window and the corresponding magnetometer data, the predetermined correspondence being determined in the absence of the magnetic field distortion. Preferably, the one or more opening angles are determined based on the angular velocity data, angular velocity offset data and an initial opening angle of the door or window.
[0063] When the second judging unit 130 judges that there is no magnetic field distortion, the state determining unit 140 determines a state of the door or window based on the magnetometer data and the predetermined correspondence. In one embodiment, when the second judging unit 130 judges that there is the magnetic field distortion, the state determining unit 140 determines the state of the door or window based on the angular velocity data, angular velocity offset data and an initial opening angle of the door or window. It is also possible that the state determining unit 140 determines the state of the door or window based on acceleration data when it is judged that there is the magnetic field distortion.
[0064] In a preferred embodiment, when the first judging unit 120 judges that the door or window is stationary at a current opening angle greater than zero and the second judging unit 130 judges that there is no magnetic field distortion, the initial opening angle of the door or window is updated. The update is based on the current opening angle, the corresponding magnetometer data and the predetermined correspondence. The current opening angle can be calculated from the current angular velocity data, angular velocity offset data and the initial opening angle.
[0065] In a further embodiment, when performing state detection based on magnetometer data, the state determining unit 140 determines a difference between the magnetometer data and magnetometer data corresponding to an opening angle of zero in the predetermined correspondence; and determines whether the door or window is closed based on the difference.
[0066] In contrast, when performing state detection based on angular velocity data, the state determination unit 140 determines one or more opening angles of the door or window based on the angular velocity data, the angular velocity offset data and the initial opening angle of the door or window; and determines whether the door or window is closed based on the one or more opening angles, in particular a comparison thereof to zero.
[0067] Further, when the first judging unit judges that the door or window is stationary for a predetermined time period, the first updating unit 150 updates the angular velocity offset data based on the angular velocity data within the predetermined time period. When the state determination unit 140 determines that the door or window is closed, the second updating unit 160 sets the initial opening angle of the door or window to zero. The updated angular velocity offset data can be used by the first judging unit 120, the second judging unit 130 and the state determination unit 140. The updated initial opening angle can be used by the second judging unit 130 and the state determination unit 140.
[0068] The predetermined time period, the predetermined angle and the predetermined threshold are described above with reference to different applications and scenarios, it can be understood that their values can be different in different scenarios, and it can also be assumed that their values are the same in different scenarios. They can be set by the user as needed.
[0069] The above describes Figures 1-5 Various embodiments of the method and device for detecting the state of the door or window can be combined with each other to obtain different effects without being limited by the subject type. Furthermore, the various units / steps / processes mentioned above are not restrictive, and the functions of the above various units / steps / processes can be combined / combined / changed / modified to obtain corresponding effects. The functions of these units can be realized by software or corresponding hardware, or the functions of the above various units can be realized by means of a processor, for example, the processor can read computer programs in the memory, and run these computer programs to realize the functions of the above various units.
[0070] In particular, the functions of the above device for detecting the state of the door or window can be realized in the microcontroller of the smart lock for the door and window, or can be realized at a remote location relative to the door or window. The inertial sensors, in particular the acceleration sensor, the angular velocity sensor and the magnetometer are installed in the lock of the door or window for detection. In the case of remote processing, the sensor data can be sent to the corresponding remote location. The various sensors installed on the door or window and the device for detecting the state of the door or window as shown in Figure 5 The device for detecting the state of the door or window as shown in
[0071] It will be appreciated that the methods and devices for detecting the state of a door or window according to various embodiments of the present disclosure can be implemented by computer programs / software. These software programs can be loaded into the working memory of the data processor when such software programs are executed, for performing the methods according to various embodiments of the present disclosure.
[0072] Exemplary embodiments of the present disclosure cover both the creation / use of computer programs / software according to the present disclosure from the outset, and the conversion of existing programs / software into computer programs / software according to the present disclosure by means of an update.
[0073] According to further embodiments of the present disclosure, a machine (such as a computer) readable medium, for example a CD-ROM, is provided, wherein the readable medium has stored thereon computer program code which, when executed by a computer or processor, causes the computer or processor to carry out methods according to embodiments of the present disclosure. The machine readable medium is for example an optical storage medium or a solid state medium supplied with or as part of other hardware.
[0074] The computer program for performing the methods according to the embodiments of the present disclosure can also be presented over a network like the Internet or World Wide Web or an electronic bulletin board, as an electronic file for downloading.
[0075] The computer program can also be presented over a network like the Internet or World Wide Web or an electronic bulletin board, as an electronic file for downloading.
[0076] It has to be noted that embodiments of the present disclosure are described with reference to different subject matters. In particular, some embodiments are described with reference to a method type claim whereas others are described with reference to a device type claim. However, a person skilled in the art will gather from the above and the following description that, unless otherwise indicated, in addition to any combination of features according to a method type claim, a device type claim or a combination of both, any feature according to an embodiment of the present disclosure can be expressed with reference to any subject matter type.
[0077] The above described embodiments of the present disclosure have been described. Other embodiments are within the scope of the following claims. In some cases, an act or step can be performed in a different order from the described implementation or implementation can be performed concurrently or in a different order. In addition, the processes depicted in the exemplary implementations need not be performed in the precise order described and other steps can be performed or described to affect the desired end. Furthermore, various activities described with respect to the methods can be implemented by specialized computers or devices created for that purpose or by a general computer or device programmed to perform the method activities.
[0078] The above describes the present disclosure with reference to specific embodiments, and those skilled in the art should understand that the technical solutions of the present disclosure can be implemented in various ways without departing from the spirit and essential characteristics of the present disclosure. The specific embodiments are merely illustrative and not limiting. In addition, the embodiments can be combined in any way to achieve the purpose of the present disclosure. The scope of protection of the present disclosure is defined by the appended claims.
[0079] The word "comprise" in the specification and claims does not exclude the presence of other elements or steps, the expressions "first", "second", "step" and the like do not limit the order or the number of the steps shown in the figures, and the functions of each element described in the specification or recited in the claims can be implemented by corresponding multiple elements or a single element.
Claims
1. A method for detecting a state of a door or window, comprising receiving sensor data from a sensor disposed on the door or window, the sensor data comprising at least one of angular velocity data and acceleration data and magnetometer data; determining, based on the sensor data, whether a magnetic field distortion is present; wherein the determining, based on the sensor data, whether a magnetic field distortion is present comprises determining, based on the sensor data, whether the door or window is stationary; when the door or window is determined to be stationary, determining, based on the magnetometer data, whether a magnetic field distortion is present; and when the door or window is determined to be non-stationary, determining one or more opening angles of the door or window based on the at least one of the angular velocity data and the acceleration data, determining magnetometer data for the one or more opening angles, determining, based on the one or more opening angles and the magnetometer data determined for the one or more opening angles and a predetermined correspondence between each opening angle of the door or window and corresponding magnetometer data, whether the magnetic field distortion is present, the predetermined correspondence being determined in the absence of the magnetic field distortion; when the magnetic field distortion is determined to be absent, determining, based on the magnetometer data and the predetermined correspondence, a state of the door or window; and when the magnetic field distortion is determined to be present, determining, based on the angular velocity data, angular velocity offset data, and an initial opening angle of the door or window, a state of the door or window.
2. The method of claim 1, wherein, the one or more opening angles are determined based on the angular velocity data, angular velocity offset data, and an initial opening angle of the door or window.
3. The method of claim 2, further comprising when the door or window is determined to be stationary at a current opening angle greater than zero and the magnetic field distortion is determined to be absent, updating the initial opening angle of the door or window.
4. The method of claim 1, wherein, the determining, based on the magnetometer data and the predetermined correspondence, a state of the door or window comprises determining a difference between the magnetometer data and magnetometer data corresponding to an opening angle of zero in the predetermined correspondence; and based on the difference, determining whether the door or window is closed. the determining, based on the angular velocity data, angular velocity offset data, and an initial opening angle of the door or window, a state of the door or window comprises 5. The method of claim 3, wherein, determining, based on the angular velocity data, the angular velocity offset data, and the initial opening angle of the door or window, one or more opening angles of the door or window; and based on the one or more opening angles, determining whether the door or window is closed.
6. The method of claim 4 or 5, further comprising when the door or window is determined to be closed, setting the initial opening angle of the door or window to zero.
7. The method of claim 1, further comprising when the door or window is determined to be stationary for a predetermined period of time, updating the angular velocity offset data based on angular velocity data for the predetermined period of time. the determining, based on the one or more opening angles and the magnetometer data determined for the one or more opening angles and the predetermined correspondence between each opening angle of the door or window and corresponding magnetometer data, whether the magnetic field distortion is present comprises 8. The method of claim 1, wherein, determining first difference data between the magnetometer data determined for the one or more opening angles and the magnetometer data corresponding to the one or more opening angles in the predetermined correspondence, and determining whether a magnetic field distortion exists based on the first difference data; or determining second difference data between the one or more opening angles and respective opening angles corresponding to the magnetometer data determined for the one or more opening angles in the predetermined correspondence; and determining whether a magnetic field distortion exists based on the second difference data.
9. An apparatus for detecting a state of a door or window, comprising a receiving unit configured to receive sensor data from a sensor disposed on the door or window, the sensor data comprising at least one of angular velocity data and acceleration data and magnetometer data; a determining unit configured to determine whether a magnetic field distortion exists based on the sensor data, wherein the determining unit comprises a first determining unit configured to determine whether the door or window is stationary based on the sensor data; and a second determining unit configured to determine whether a magnetic field distortion exists based on the magnetometer data when the first determining unit determines that the door or window is stationary, and to determine one or more opening angles of the door or window based on the at least one of the angular velocity data and the acceleration data, determine magnetometer data for the one or more opening angles, determine whether the magnetic field distortion exists based on the one or more opening angles and the corresponding magnetometer data and a predetermined correspondence between each opening angle of the door or window and respective magnetometer data, when the first determining unit determines that the door or window is not stationary, the predetermined correspondence being determined in the absence of the magnetic field distortion. a state determining unit configured to determine a state of the door or window based on the magnetometer data and the predetermined correspondence when the second determining unit determines that the magnetic field distortion does not exist, and to determine the state of the door or window based on the angular velocity data, angular velocity offset data and an initial opening angle of the door or window when the second determining unit determines that the magnetic field distortion exists.
10. The apparatus of claim 9, wherein, The apparatus further comprises a first updating unit configured to update the initial opening angle of the door or window when the first determining unit determines that the door or window is stationary at a current opening angle greater than zero and the second determining unit determines that the magnetic field distortion does not exist, or to set the initial opening angle of the door or window to zero when the state determining unit determines that the door or window is closed.
11. The apparatus of claim 10, further comprising a second updating unit configured to update the angular velocity offset data based on angular velocity data over a predetermined time period when the first determining unit determines that the door or window is stationary for the predetermined time period.
12. A system for detecting a state of a door or window, comprising an acceleration sensor, an angular velocity sensor and a magnetometer mounted on the door or window; and a processor configured to perform the method of any one of claims 1-8.
13. A machine-readable storage medium storing computer program instructions which, when executed, cause a computer to perform the method according to any one of claims 1-8.
Citation Information
Patent Citations
Door status detection method and device
CN107462148A