Position detection assembly and method, electronic equipment, detection device and storage medium
By using a three-axis Hall sensor to measure the intensity and direction of the magnetic field in electronic devices, the problem of Hall devices being susceptible to external magnetic field interference is solved, and the accurate detection of the position of the magnetic body is achieved and the anti-interference ability is improved.
Patent Information
- Application Number
- CN202311820069.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-26
- Publication Date
- 2025-06-27
AI Technical Summary
Hall devices used in existing electronic devices are susceptible to external magnetic fields, resulting in inaccurate device position detection.
A three-axis Hall sensor is used to measure the intensity and direction of the magnetic field in the perpendicular direction of three pairs, and the interference of the external magnetic field to determine the position of the magnetic body by obtaining the corresponding measurement signals, thereby accurately detecting the position of the magnetic body.
It effectively avoids erroneous determination of the position of the magnetic body, improves the anti-interference ability of the position detection component, and ensures that the three-axis Hall sensor and circuit board can accurately detect the position of the magnetic parts.
Smart Images

Figure CN120212835A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of electronic devices, and particularly to a position detection component and method, an electronic device, a detection device, and a storage medium. Background Art
[0002] Many mechanisms of electronic devices for detecting the position of components (such as the position of a sliding key body) are realized by the cooperation of Hall devices and magnetic bodies. However, since Hall devices are easily affected by external magnetic fields, the detection of the position of components by electronic devices is prone to inaccurate recognition. Summary of the Invention
[0003] To solve the above problems existing in the prior art, in a first aspect, the present application provides a position detection component, which includes a magnetic body, a triaxial Hall sensor, and a circuit board. The triaxial Hall sensor and the circuit board can cooperate to detect the position of the magnetic body;
[0004] Among them, the triaxial Hall sensor is used to measure the magnetic field intensity and direction in a first direction, a second direction, and a third direction. The second direction and the third direction are perpendicular to each other and are both perpendicular to the first direction;
[0005] The magnetic body is located on one side of the triaxial Hall sensor and is configured to be movable relative to the triaxial Hall sensor along the first direction;
[0006] The circuit board is communicatively connected to the triaxial Hall sensor, and can obtain a first measurement signal corresponding to the magnetic field intensity and direction in the first direction, a second measurement signal corresponding to the magnetic field intensity and direction in the second direction, and a third measurement signal corresponding to the magnetic field intensity and direction in the third direction, and determine the magnetic field interference of the external magnetic field on the position determination of the magnetic body relative to the triaxial Hall sensor based on the first measurement signal, the second measurement signal, and the third measurement signal.
[0007] In a second aspect, the present application provides a position detection method, which is applied to a position detection component. The position detection component includes a magnetic body and a triaxial Hall sensor. The magnetic body is located on one side of the triaxial Hall sensor and is configured to be movable relative to the triaxial Hall sensor along the first direction. The position detection method includes:
[0008] Obtain the values of the first measurement signal, the second measurement signal, and the third measurement signal output by the triaxial Hall sensor, and judge the external magnetic field interference situation based on the values of the first measurement signal, the second measurement signal, and the third measurement signal. Among them, the first measurement signal corresponds to the magnetic field intensity and direction in the first direction, the second measurement signal corresponds to the magnetic field intensity and direction in the second direction, the third measurement signal corresponds to the magnetic field intensity and direction in the third direction, the second direction and the third direction are perpendicular to each other, and are both perpendicular to the first direction;
[0009] If it is determined that there is no external magnetic field interference, the position where the magnetic body is located is determined based on the value of the first measurement signal;
[0010] If it is determined that there is stable external magnetic field interference, the position where the magnetic body is located is determined based on the values of the first measurement signal, the second measurement signal, and the third measurement signal;
[0011] If it is determined that there is unstable external magnetic field interference, the position where the magnetic body is located is not determined.
[0012] In a third aspect, the present application provides an electronic device, which includes a housing and the above-mentioned position detection component, and the position detection component is arranged in the housing.
[0013] In a fourth aspect, the present application provides a detection device for an electronic device, which includes a processor and a memory. A computer program is stored in the memory, and the processor is used to execute the computer program to implement the above-mentioned position detection method.
[0014] In a fifth aspect, the present application provides a storage medium, which stores a computer program, and when the computer program is executed, the above-mentioned position detection method is implemented.
[0015] Different from the prior art, the beneficial effect of the position detection component provided by the present application is:
[0016] The present application uses a three-axis Hall sensor to measure the magnetic field intensity and direction in three mutually perpendicular directions, and uses three measurement signals corresponding to the magnetic field intensity and direction in the three directions respectively to determine the magnetic field interference of the external magnetic field on the position determination of the magnetic body relative to the three-axis Hall sensor, so as to effectively avoid making a wrong determination of the position of the magnetic body, enabling the three-axis Hall sensor and the circuit board to accurately detect the position of the magnetic component, and improving the anti-interference ability of the position detection component.
[0017] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and do not limit the present application. Description of the Drawings
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required to be used in the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0019] Figure 1 It is a schematic structural diagram of an electronic device provided by some embodiments of the present application;
[0020] Figure 2It is a schematic structural diagram of a position detection component provided by some embodiments of the present application;
[0021] Figure 3 It is a schematic structural diagram of a position detection component provided by some embodiments of the present application;
[0022] Figure 4 It is Figure 3 a schematic exploded view of the position detection component in the embodiment;
[0023] Figure 5 It is a schematic diagram of the detection principle of a position detection component provided by some embodiments of the present application;
[0024] Figure 6 It is a schematic structural diagram of a position detection component provided by some embodiments of the present application in the first state;
[0025] Figure 7 It is Figure 6 a schematic structural diagram of the position detection component in the second state in the embodiment;
[0026] Figure 8 It is Figure 6 a schematic structural diagram of the position detection component in the third state in the embodiment;
[0027] Figure 9 It is a schematic flowchart of the steps of a position detection method provided by some embodiments of the present application;
[0028] Figure 10 It is a partial flowchart of the position detection method provided by some embodiments of the present application;
[0029] Figure 11 It is a schematic flowchart of the steps for determining whether there is external magnetic field interference provided by some embodiments of the present application;
[0030] Figure 12 It is a schematic flowchart of the steps for determining whether the external magnetic field interference is stable provided by some embodiments of the present application;
[0031] Figure 13 It is a schematic flowchart of the steps for determining the position of a magnetic body in the presence of stable external magnetic field interference provided by some embodiments of the present application;
[0032] Figure 14 It is a schematic structural diagram of a detection device of an electronic device provided by some embodiments of the present application;
[0033] Figure 15 It is a schematic structural diagram of a storage medium provided by some embodiments of the present application;
[0034] Figure 16It is a schematic diagram of the structural composition of an electronic device provided by some embodiments of the present application. Detailed implementation manners
[0035] Next, the technical solutions in the embodiments of the present application will be clearly and completely described with reference to the accompanying drawings in the embodiments of the present application. It can be understood that the specific embodiments described herein are only used to explain the present application, rather than limiting the present application. In addition, it should be noted that for the sake of description, only parts related to the present application rather than all structures are shown in the accompanying drawings. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0036] The mention of "embodiments" in the application means that the specific features, structures, or characteristics described in connection with the embodiments can be included in at least one embodiment of the present application. The phrase appears in various places in the specification and does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art will explicitly and implicitly understand that the embodiments described herein can be combined with other embodiments.
[0037] Embodiments of the present application provide an electronic device with anti-interference ability and its position detection component. As used herein, an "electronic device" (or simply referred to as a "terminal") includes, but is not limited to, devices configured to receive / transmit communication signals via wired connections (such as via a public switched telephone network (PSTN), digital subscriber line (DSL), digital cable, direct cable connection, and / or another data connection / network) and / or via wireless interfaces (such as for cellular networks, wireless local area networks (WLANs), digital television networks such as DVB-H networks, satellite networks, AM-FM broadcast transmitters, and / or another communication terminal). A communication terminal configured to communicate via a wireless interface may be referred to as a "wireless communication terminal", a "wireless terminal", or a "mobile terminal". Examples of mobile terminals include, but are not limited to, satellite or cellular telephones; personal communication system (PCS) terminals that can combine cellular radiotelephone with data processing, facsimile, and data communication capabilities; PDAs that may include radiotelephones, pagers, Internet / intranet access, web browsers, notebooks, calendars, and / or global positioning system (GPS) receivers; and conventional laptop and / or palm receivers or other electronic devices including radiotelephone transceivers. A mobile phone is an electronic device configured with a cellular communication module.
[0038] Please refer to Figure 1 and Figure 2 , Figure 1 It is a schematic diagram of the structure of an electronic device provided by some embodiments of the present application, Figure 2It is a schematic structural diagram of a position detection component provided by some embodiments of the present application.
[0039] In some embodiments, the electronic device 10 includes a housing 11 and a position detection component 12. The position detection component 12 can be disposed in the housing 11. The position detection component 12 may include a moving body 100, and the moving body 100 can be configured to be movable relative to the housing 11. The moving body 100 can be, but is not limited to, a moving key, a button, etc. The moving body 100 can serve as a function switch of the electronic device 10 and achieve function control by moving.
[0040] The position detection component 12 includes a three-axis Hall sensor 200, which can be used to measure the magnetic field strength and direction in three directions. The three-axis Hall sensor 200 is a solid-state electronic device that utilizes the Hall effect and can be composed of three Hall elements (not shown in the figure). The three Hall elements respectively measure the magnetic fields in three directions.
[0041] The moving body 100 can be disposed on one side of the three-axis Hall sensor 200 and configured to be movable relative to the three-axis Hall sensor 200. For example, the three-axis Hall sensor 200 can be disposed inside the housing 11 of the electronic device 10, and the moving body 100 can be disposed on one side of the housing 11. A strip-shaped groove for accommodating at least a part of the moving body 100 can be formed on this side of the housing 11, so that the moving body 100 can slide on one side of the housing 11, and thus the moving body 100 can move relative to the three-axis Hall sensor 200. Of course, the moving design of the moving body 100 is not limited to this.
[0042] The position detection component 12 may further include a circuit board 300, and the circuit board 300 can be a main board disposed inside the housing 11. The circuit board 300 is communicatively connected to the three-axis Hall sensor 200, can obtain the measurement signals of the magnetic field strength and direction in three directions from the three-axis Hall sensor 200, and determine the external magnetic field interference situation and the position of the moving body 100 based on these measurement signals.
[0043] It should be noted that the technical features not detailed about the electronic device 10 in the above embodiments are within the scope easily obtained by those skilled in the art, so they will not be elaborated here.
[0044] Please refer to Figure 3 and Figure 4 , Figure 3 is a schematic structural diagram of a position detection component provided by some embodiments of the present application, Figure 4 is Figure 3 an exploded structural diagram of the position detection component in the embodiment.
[0045] In some embodiments, the position detection component 12 includes a magnetic body 400, which is located on one side of the three-axis Hall sensor 200 and is configured to be movable relative to the three-axis Hall sensor 200. The three-axis Hall sensor 200 and the circuit board 300 can cooperate to detect the position of the magnetic body 400. When the position of the magnetic body 400 changes, the magnetic induction intensity and direction detected by the three-axis Hall sensor 200 also change. In other words, when the magnetic body 400 is in different positions, the magnetic induction intensity and direction detected by the three-axis Hall sensor 200 may also be different. Thus, according to the value of the measurement signal measured by the three-axis Hall sensor 200, the current position of the magnetic body 400 can be determined.
[0046] Among them, the three-axis Hall sensor 200 can be used to measure the magnetic field intensity and direction in the first direction Y, the second direction X, and the third direction Z. The second direction X and the third direction Z are perpendicular to each other and are both perpendicular to the first direction Y. In other words, the first direction Y, the second direction X, and the third direction Z are three mutually perpendicular directions. The magnetic body 400 can be configured to be movable relative to the three-axis Hall sensor 200 along the first direction Y. The magnetic body 400 can be directly opposite to the three-axis Hall sensor 200 in the second direction X.
[0047] It should be noted that the terms "first", "second", etc. in this application are used to distinguish different objects, rather than to describe a specific order. In addition, the meaning of "a plurality" in this article is at least two, such as two, three, etc., unless there is a specific restrictive description.
[0048] Among them, the three-axis Hall sensor 200 can be disposed on the circuit board 300. The circuit board 300 is communicatively connected to the three-axis Hall sensor 200, and can obtain a first measurement signal corresponding to the magnetic field intensity and direction in the first direction Y, a second measurement signal corresponding to the magnetic field intensity and direction in the second direction X, and a third measurement signal corresponding to the magnetic field intensity and direction in the third direction Z, and determine the magnetic field interference of the external magnetic field on the position determination of the magnetic body 400 relative to the three-axis Hall sensor 200 based on the first measurement signal, the second measurement signal, and the third measurement signal. The magnetic body 400 can be spaced apart from the circuit board 300 in the second direction X.
[0049] The position detection component 12 may further include a protective cover 500 disposed on the circuit board 300. The protective cover 500 can cover the three-axis Hall sensor 200 on the circuit board 300 to play a protective role. In other embodiments, the three-axis Hall sensor 200 may also be located outside the circuit board 300 and communicatively connected to the circuit board 300 through a wire.
[0050] Optionally, the position detection component 12 includes a moving body 100 and a magnetic body 400. The magnetic body 400 is fixed to the moving body 100, so that the movement of the moving body 100 can be regarded as equivalent to the movement of the magnetic body 400. The moving body 100 can be configured to be movable relative to the three-axis Hall sensor 200 in the first direction Y. Therefore, the measurement signal measured by the three-axis Hall sensor 200 can also be used to determine the position of the moving body 100. Wherein, a receiving groove 101 may be provided on the side of the moving body 100 facing the three-axis Hall sensor 200, and the magnetic body 400 is accommodated in the receiving groove 101 to prevent the movement amount of the magnetic body 400 from being different from the movement amount of the moving body 100. In other embodiments, the moving body 100 and the magnetic body 400 may also be integrally formed, that is, the magnetic body 400 is used as the moving body 100, such as a magnetic moving key.
[0051] It should be noted that the terms "comprising" and "having" and any variations thereof in this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products or devices.
[0052] Please refer to Figure 5 , Figure 5 which is a schematic diagram of the detection principle of the position detection component provided in some embodiments of this application.
[0053] The magnetic body 400 of the position detection component 12 has an N pole and an S pole. (Virtual) magnetic induction lines can emit from the N pole and pass through the three-axis Hall sensor 200 and return to the S pole, so that the three-axis Hall sensor 200 can sense the magnetic field strength and direction around the magnetic body 400. When the magnetic body 400 moves relative to the three-axis Hall sensor 200, the magnetic flux passing through the three-axis Hall sensor 200 changes, so the magnetic strength and direction measured by the three-axis Hall sensor 200 change. The magnetic body 400 can move relative to the three-axis Hall sensor 200 in the first direction Y, so that during the movement of the magnetic body 400, the magnetic strength and direction measured by the three-axis Hall sensor 200 change, and the first measurement signal, the second measurement signal, and the third measurement signal change accordingly.
[0054] Wherein, the magnetic body 400 can be arranged at intervals from the circuit board 300 in the second direction X. When the magnetic body 400 moves to at least partially coincide with the three-axis Hall sensor 200 in the second direction X, the N pole of the magnetic body 400 can face the three-axis Hall sensor 200 in the second direction X. Wherein, the N pole of the magnetic body 400 can face the circuit board 300.
[0055] It should be noted that the placement form of the magnetic body 400 is not limited to the form as shown in Figure 5 . In other embodiments, the magnetic body 400 can be arranged in other forms. For example, the orientation of its N pole can be the first direction Y, or an acute angle with the first direction Y and an acute angle with the second direction X, etc., as long as the orientations of the N pole and the S pole are not the third direction Z. In addition, the shape of the magnetic body 400 is not limited to one type, and can specifically be a square, a circle, a long strip, a U shape, etc.
[0056] Please refer to Figures 6 to 8 , Figure 6 which is a schematic structural diagram of the position detection component in the first state provided by some embodiments of the present application, Figure 7 and Figure 6 is a schematic structural diagram of the position detection component in the second state in an Figure 8 embodiment, Figure 6 and
[0057] is a schematic structural diagram of the position detection component in the third state in an
[0058] embodiment. The first state, the second state, and the third state are the states where the magnetic body 400 is in three different positions. The switching between the states can be realized by the user toggling the switch. These three states can correspond to three different function modes of the electronic device 10, for example, corresponding to the ringing mode, the vibration mode, and the silent mode respectively.
[0059] During the movement of the magnetic member, as the movement direction and the movement distance change, the magnetic field generated by the magnetic member at the Hall position will change. Based on the change in the signal amounts in the first direction Y, the second direction X, and the third direction Z, the position detection component 12 can calculate the relative position of the magnetic member, and then determine the key value of the switch (such as the moving body 100), and then the electronic device 10 can set different functions and scenario modes according to different key value positions.
[0060]
[0061] Among them, state ①, state ②, and state ③ represent the first state, the second state, and the third state in sequence, and Bx, By, and Bz represent the signal values of the magnetic field strength and direction measured by the three-axis Hall sensor 200 in the second direction X, the first direction Y, and the third direction Z respectively.
[0062] Based on the differences in the Hall signal values measured in the first state, second state, and third state, the position detection component 12 can calculate the current position of the magnetic body 400, and can further calculate the current position of the moving body 100. As can be seen from the tabular data, in the above three different states, the values of Bx and By are quite different. Therefore, the position detection component 12 can determine the current position of the magnetic body 400 through the values of Bx and By (or the value of By alone), and then determine the functional state or scenario mode of the electronic device 10. The position detection component 12 can also determine whether there is external magnetic field interference based on Bx, By, and Bz, and further make corresponding judgments to exclude the influence of external magnetic field interference on position determination. This part of the content will be specifically elaborated below.
[0063] It should be noted that the above three-stage function control is only an exemplary effect. Based on the above design, the electronic device 10 and its position detection component 12 provided in the embodiments of the present application can also implement two-stage or more than three-stage control functions, and realize the recognition of two or more than three key values to enrich the interaction content. The embodiments of the present application can achieve multi-stage function control through a single Hall device (triaxial Hall sensor 200) in cooperation with the magnetic body 400, which is beneficial to saving the installation space of the circuit board and saving material costs.
[0064] The embodiments of the present application further provide a position detection method, which can be applied to the above-mentioned electronic device 10 and position detection component 12.
[0065] Please refer to Figure 9 , Figure 9 which is a schematic flowchart of the steps of the position detection method provided in some embodiments of the present application.
[0066] In some embodiments, the position detection method includes:
[0067] S11. Obtain three measurement signals output by the triaxial Hall sensor.
[0068] Among them, the three measurement signals refer to the above-mentioned first measurement signal, second measurement signal, and third measurement signal, which respectively represent the magnetic field intensity and direction in the first direction, the magnetic field intensity and direction in the second direction, and the magnetic field intensity and direction in the third direction.
[0069] S12. Judge the external magnetic field interference situation based on the three measurement signals.
[0070] Ideally, all the magnetic fields detected by the triaxial Hall sensor are generated by the magnetic body of the position detection component, so that the position of the magnetic body can be accurately determined. However, in many application scenarios, the measurement of the triaxial Hall sensor may be interfered by external magnetic fields. In the embodiments of the present application, the triaxial Hall sensor is used to measure the magnetic field intensities and signals in three directions, and based on this, the external magnetic field interference situation is judged to achieve anti-interference position detection.
[0071] The external magnetic field interference situations identified by this method include three types. In the following steps, this method performs corresponding processing steps for the three situations respectively to achieve position detection.
[0072] S131. There is no external magnetic field interference.
[0073] The first possible external magnetic field interference situation is that there is no external magnetic field interference. The corresponding scenarios include that there are no other magnetic field sources near the position detection component, or the magnetic fields generated by the magnetic field sources nearby will not interfere with the position detection component. In this case, step S141 can be implemented.
[0074] S141. Determine the position of the magnetic body based on the value of the first measurement signal.
[0075] In the case of no external magnetic field interference, the position detection component can determine the position of the magnetic body only by using the first measurement signal. Referring to the above table, among the value of the first measurement signal By, the value of the second measurement signal Bx, and the value of the third measurement signal Bz measured by the triaxial Hall sensor, By will change with the position of the magnetic body, and during the movement of the magnetic body along the first direction, the change of By shows a progressive trend. Therefore, the position detection component can determine the position of the magnetic body only by using the value of one measurement signal, that is, the value of the first measurement signal By.
[0076] The position detection component can also use the values of multiple measurement signals to determine the position of the magnetic body. For example, the value of the first measurement signal By and the value of the second measurement signal Bx are used for position determination to improve the accuracy of position determination.
[0077] S132. There is a stable external magnetic field interference.
[0078] The second possible external magnetic field interference situation is: there is a stable external magnetic field interference. The corresponding scenarios include that there is one or more magnetic field sources near the position detection component, and the magnetic field generated by them will interfere with the detection of the position detection component, and the interference amount of the magnetic field generated by the magnetic field source on the position detection component is basically unchanged. For example, when the electronic device is equipped with a magnetic shell, or the electronic device is installed on a magnetic bracket, etc., the relative positions of the magnetic field source and the three-axis Hall sensor are basically unchanged. In this case, step S142 can be implemented.
[0079] S142. Determine the position where the magnetic body is located based on the values of the three measurement signals.
[0080] In the case where there is a stable external magnetic field interference, its interference amount can be determined by calculation. The position detection component can exclude this interference amount to determine the position where the magnetic body is located. Since the interference direction and intensity of the external magnetic field on the position detection component are not single, the position detection component can use the values of the three measurement signals for position determination to exclude various possible stable external magnetic field interference factors.
[0081] S133. There is an unstable external magnetic field interference.
[0082] The third possible external magnetic field interference situation is: there is an unstable external magnetic field interference. The corresponding scenarios include that one or more unstable magnetic field sources appear near the position detection component, and the magnetic field generated by them will interfere with the detection of the position detection component, and the interference amount of the magnetic field generated by the magnetic field source on the position detection component will change. For example, a magnet passes near the electronic device, or the electronic device is in an environment where the magnetic field will change, etc. In this case, step S143 can be implemented.
[0083] S143. Do not determine the position where the magnetic body is located.
[0084] In daily life scenarios, unstable external magnetic field interference is very likely to be generated by accidental factors, such as when an object held or worn by a user has magnetism and generates it when passing by the electronic device, which is not an operation made by the user under the subjective intention of holding and adjusting the functions of the electronic device. In this case, this method adopts the method of not determining the position where the magnetic body is located to avoid the position detection component being accidentally triggered, and can effectively avoid unstable external magnetic field interference.
[0085] Through the above method, the embodiments of the present application detect external magnetic field interference and divide it into three different situations, and correspondingly implement corresponding processing steps using the three measurement signals measured by the three-axis Hall sensor, effectively improving the accuracy of position detection and the anti-interference ability of the position detection component.
[0086] Under the above method framework, the position detection method provided by the embodiments of the present application can be designed into multiple processing modes, and some of them are listed below.
[0087] Please refer to Figure 10 , Figure 10 which is a partial flowchart of the position detection method provided by some embodiments of the present application.
[0088] In some embodiments, the position detection method includes:
[0089] S21. Detect three measurement signals output by the triaxial Hall sensor.
[0090] This step can be located after the above step S11, that is, after obtaining the three measurement signals, they are detected.
[0091] S22. Determine whether the three measurement signals change.
[0092] In this method, the detection of the first measurement signal, the second measurement signal, and the third measurement signal can be real-time detection. When any one of the three measurement signals is detected to change, the next step is implemented. When none of the three measurement signals change, it is in the real-time detection stage.
[0093] This method can also adopt non-real-time detection, such as trigger detection, design trigger conditions corresponding to specific states, and perform detection when the trigger conditions are met to save computational effort.
[0094] S23. Determine whether there is external magnetic field interference.
[0095] When it is detected that the measurement signal changes, first determine whether there is external magnetic field interference. If it is determined that there is external magnetic field interference, further implement step S24 to determine whether the external magnetic field interference is stable. If it is determined that there is no external magnetic field interference, then implement step S25 to determine the position of the magnetic body based on the value of the first measurement signal, without further determining whether the external magnetic field is stable.
[0096] After step S24, if the determination result is that the external magnetic field interference is stable, then implement step S26 to determine the position of the magnetic body based on the values of the three measurement signals; if the determination result is that the external magnetic field interference is unstable, then implement step S27 without determining the position of the magnetic body.
[0097] It should be noted that this embodiment only shows an exemplary mode of the position detection method provided by the present application. In other embodiments, the position detection method can also judge the three situations of no external magnetic field, presence of a stable external magnetic field, and presence of an unstable external magnetic field in the same step, rather than being limited to this embodiment.
[0098] By detecting three measurement signals, this method can determine what kind of change has occurred when the magnetic field near the three-axis Hall sensor changes. Among them, the situations of no external magnetic field and the existence of a stable external magnetic field can be regarded as changes caused by user operations. Through corresponding calculation methods, the position of the magnetic body can be determined, and then the corresponding function control of the electronic device can be realized; among them, the situation of the existence of an unstable external magnetic field can be regarded as a change caused by non-user operations. Therefore, the position of the magnetic body is not determined, and the state of the electronic device remains unchanged, which can avoid phenomena such as mis-triggering.
[0099] Please refer to Figure 11 , Figure 11 which is a schematic diagram of the step flow for determining whether there is external magnetic field interference provided by some embodiments of this application.
[0100] In some embodiments, when it is necessary to determine whether there is external magnetic field interference, for example, in the above steps S12 and S23, the step flow as Figure 12 shown can be implemented, including:
[0101] S31. Detect whether both the first determination value and the second determination value are within a preset range.
[0102] Among them, the first determination value is the sum of the absolute value of the first measurement signal and the absolute value of the second measurement signal, and the second determination value is the value of the third measurement signal. Referring to the data in the above table, the first determination value is |Bx| + |By| (that is, the sum of the absolute value of Bx and the absolute value of By), and the second determination value is Bz.
[0103] Based on the above design of the position detection component, in the absence of external magnetic field interference, both the first determination value and the second determination value remain relatively fixed values during the movement of the magnetic body of the position detection component and do not exceed the preset range.
[0104] When both the first determination value and the second determination value do not exceed the preset range, step S32 is implemented to determine that there is no external magnetic field interference. For example, the preset range of the first determination value is 24 to 27, and the preset range of the second determination value is -4 to -1; in the first state, |Bx| + |By| is equal to 26, and Bz is equal to -2; in the second state, |Bx| + |By| is equal to 25, and Bz is equal to -3; in the third state, |Bx| + |By| is equal to 26, and Bz is equal to -2, all of which do not exceed the above preset range. In this case, it can be determined that there is no external magnetic field interference. On the contrary, when either or both of the first determination value and the second determination value exceed the preset range, step S33 is implemented to determine that there is external magnetic field interference.
[0105] It should be noted that the judgment on whether both the first judgment value and the second judgment value are within the preset range in step S31 can be node-based, for example, detecting and making judgments at three nodes: the first state, the second state, and the third state; or it can be line-based, for example, detecting in real time during the detection process whether at least one of the first judgment value and the second judgment value exceeds the preset range. This detection process can be a process in which the value of at least one of the first measurement signal, the second measurement signal, and the third measurement signal changes, that is, the entire process from the change of at least one of them to determining the position of the magnetic body.
[0106] Please refer to Figure 12 , Figure 12 which is a schematic flowchart of the steps for judging whether the external magnetic field interference is stable provided by some embodiments of the present application.
[0107] In some embodiments, when it is necessary to judge whether the external magnetic field interference is stable, for example, in the above steps S12 and S24, the following steps can be implemented Figure 12 as shown, including:
[0108] S41. Obtain a first deviation value, a second deviation value, and a third deviation value.
[0109] These three deviation values can be used to characterize the interference amount of the external magnetic field on the position detection. Among them, the first deviation value is the difference between the value of the first measurement signal and the first preset value, the second deviation value is the difference between the value of the second measurement signal and the second preset value, and the third deviation value is the difference between the value of the third measurement signal and the third preset value.
[0110] The first preset value can be the value of the first measurement signal that the triaxial Hall sensor should measure in the first direction in the absence of external magnetic field interference, that is, the theoretical value. Similarly, the second preset value and the third preset value can be the values of the second measurement signal and the third measurement signal that the triaxial Hall sensor should measure in the second direction and the third direction in the absence of external magnetic field interference. Thus, the first deviation value, the second deviation value, and the third deviation value obtained by the above subtraction method can successively characterize the interference amounts of the external magnetic field on the magnetic fields in the first direction, the second direction, and the third direction.
[0111] Further, after obtaining the three deviation values, step S42 is implemented to detect whether the change amounts of the three deviation values are all within the preset range. Each of the above preset values can be obtained by looking up a table, and each preset range can be a range close to 0, such as -1 to 1.
[0112] Among them, the change amount of the deviation value characterizes the stability of the interference amount of the external magnetic field. The judgment of the change amounts of the three deviation values needs to be carried out in a certain process. For example, the three deviation values are detected in real time during the detection process; or, multiple nodes are selected during the detection process to detect the three deviation values. By comparing a certain deviation value before and after, the change amount of this deviation value can be obtained.
[0113] If the change amounts of the three deviation values are all within the preset range, for example, the change amounts of all three are 0, then step S43 is executed to determine that the external magnetic field interference is stable. If the change amount of one or more of the three deviation values exceeds the preset range, then step S44 is executed to determine that the external magnetic field interference is unstable.
[0114] Please refer to Figure 13 , Figure 13 which is a schematic flowchart of the steps for determining the position of the magnetic body in the presence of stable external magnetic field interference provided by some embodiments of the present application.
[0115] In some embodiments, when it is determined that there is stable external magnetic field interference and the position of the magnetic body needs to be determined, for example, in the above steps S142 and S26, the following steps can be implemented Figure 13 as shown in the following steps, including:
[0116] S51. Obtain the first travel difference, the second travel difference, and the third travel difference.
[0117] Among them, the first travel difference is the difference between the measured value of the first measurement signal and the initial value of the first measurement signal, the second travel difference is the difference between the measured value of the second measurement signal and the initial value of the second measurement signal, and the third travel difference is the difference between the measured value of the third measurement signal and the initial value of the third measurement signal.
[0118] The initial values of the first measurement signal, the second measurement signal, and the third measurement signal are the values of the three measured when they change. The measured values of the first measurement signal, the second measurement signal, and the third measurement signal are the values measured at present.
[0119] For example, during the process of the position detection component switching from the first state to the second state, the values of the respective measurement signals measured by the triaxial Hall sensor in the first state are the initial values, and the values of the respective measurement signals measured in the second state are the measured values.
[0120] Or, during the process of the position detection component starting to switch from the first state to any other state, the values of the respective measurement signals measured by the triaxial Hall sensor in the first state are the initial values, and the values of the respective measurement signals measured in real time by the triaxial Hall sensor during the movement of the magnetic body are the measured values.
[0121] Since the external magnetic field interference is stable, when the interference amount of the external magnetic field is characterized as a numerical value, its magnitude is the same or similar. Therefore, the travel difference obtained by subtracting the measured value from the initial value is the signal value after removing the interference amount.
[0122] Further, after obtaining the first travel difference, the second travel difference, and the third travel difference, step S52 is implemented to detect whether all three travel differences meet the preset conditions. If the preset conditions are met, step S53 is implemented to determine that the magnetic body is at the position corresponding to the preset conditions.
[0123] Among them, there can be one or more preset conditions for the three travel differences, and the preset condition can be the theoretical value of the travel difference corresponding to a certain specific state of the position detection component.
[0124] For example, in the first state, the value of the first measurement signal By is -10, the value of the second measurement signal Bx is 16, and the value of the third measurement signal Bz is -2. In the second state, the value of the first measurement signal By is 0, the value of the second measurement signal Bx is 25, and the value of the third measurement signal Bz is -3. Then, during the process of the position detection component switching from the first state to the second state, there can be a preset condition: the first travel difference is equal to 10, the second travel difference is equal to 9, and the third travel difference is equal to -1. Thus, when the magnetic body moves to the position corresponding to the second state, the three travel differences can meet this preset condition, and further determine that the magnetic body is at the position corresponding to the second state.
[0125] Similarly, any specific state of the position detection component can have corresponding preset conditions, so that when the magnetic body moves to the position corresponding to any specific state, its position can be determined.
[0126] It should be noted that the start and end points of the detection process in this method are not limited to one type. For example, the detection process can be from the first state to the second state, or from the first state to the third state, or from the third state to the first state, etc. The values of the start and end points corresponding to different processes also change accordingly. Whenever a process ends, the position detection component can report the end values of the corresponding signals as the start values of the next process.
[0127] Regarding other steps of the position detection method, they can be obtained from the above description of the position detection component, so they will not be elaborated here.
[0128] Please refer to Figure 14 , Figure 14It is a schematic structural diagram of a detection device for an electronic device provided by some embodiments of the present application. The detection device 20 may include a processor 21 and a memory 22. A computer program 23 is stored in the memory 22, and the processor 21 is configured to execute the computer program 23 to implement the above-mentioned position detection method.
[0129] Please refer to Figure 15 , Figure 15 It is a schematic structural diagram of a storage medium provided by some embodiments of the present application. The storage medium 30 may store a computer program 31, and when the computer program 31 is executed, the above-mentioned position detection method is implemented.
[0130] Please refer to Figure 16 , Figure 16 It is a schematic structural composition diagram of an electronic device provided by some embodiments of the present application. The structure of the electronic device 10 may include an RF circuit 910, a memory 920, an input unit 930, a display unit 940, a sensor 950, an audio circuit 960, a WiFi module 970, a processor 980, and a power supply 990, etc. Among them, the RF circuit 910, the memory 920, the input unit 930, the display unit 940, the sensor 950, the audio circuit 960, and the WiFi module 970 are respectively connected to the processor 980; the power supply 990 is used to supply electrical energy to the entire electronic device 10.
[0131] Specifically, the RF circuit 910 is used for receiving and transmitting signals; the memory 920 is used for storing data instruction information; the input unit 930 is used for inputting information, which may specifically include a touch panel 931 and other input devices 932 such as operation buttons; the display unit 940 may include a display panel 941, etc.; the sensor 950 includes an infrared sensor, a laser sensor, etc., and is used for detecting user proximity signals, distance signals, etc.; the speaker 961 and the microphone 962 are connected to the processor 980 through the audio circuit 960 and are used for receiving and transmitting sound signals; the WiFi module 970 is used for receiving and transmitting WiFi signals, and the processor 980 is used for processing the data information of the electronic device 10. Regarding the specific structural features of the electronic device 10, reference may be made to the relevant descriptions of the above embodiments, and details will not be described herein again.
[0132] In several embodiments provided by the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the above-mentioned unit division is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0133] In the description of the present application, it should be noted that the orientation or positional relationship indicated by terms such as "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings, or the orientation or positional relationship in which the products of the present application are usually placed during use. It is only for the convenience of describing the embodiments of the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation to the present application.
[0134] In the description of the present application, it should also be noted that unless otherwise clearly specified and defined, the terms "set", "installed", "connected", and "connected" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the communication inside two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to specific situations.
[0135] The above is only the implementation mode of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made according to the content of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, shall be equally included in the patent protection scope of the present application.
Claims
1. A position detection component, characterized in that, The position detection component includes a magnetic body, a three-axis Hall sensor, and a circuit board. The three-axis Hall sensor and the circuit board can cooperate to detect the position of the magnetic body; Among them, the three-axis Hall sensor is used to measure the magnetic field intensity and direction in the first direction, the second direction, and the third direction. The second direction and the third direction are perpendicular to each other and are both perpendicular to the first direction; The magnetic body is located on one side of the three-axis Hall sensor and is configured to be movable relative to the three-axis Hall sensor along the first direction; The circuit board is communicatively connected to the three-axis Hall sensor, and can obtain a first measurement signal corresponding to the magnetic field intensity and direction in the first direction, a second measurement signal corresponding to the magnetic field intensity and direction in the second direction, and a third measurement signal corresponding to the magnetic field intensity and direction in the third direction, and determine the magnetic field interference of the external magnetic field on the position determination of the magnetic body relative to the three-axis Hall sensor based on the first measurement signal, the second measurement signal, and the third measurement signal.
2. The position detection component according to claim 1, wherein The position detection component further includes a moving body, the magnetic body is fixed to the moving body, and the moving body is configured to be movable relative to the three-axis Hall sensor along the first direction.
3. A position detection method, applied to a position detection component, characterized in that, The position detection component includes a magnetic body and a three-axis Hall sensor. The magnetic body is located on one side of the three-axis Hall sensor and is configured to be movable relative to the three-axis Hall sensor along the first direction; the position detection method includes: Obtain the values of the first measurement signal, the second measurement signal, and the third measurement signal output by the three-axis Hall sensor, and judge the external magnetic field interference situation based on the values of the first measurement signal, the second measurement signal, and the third measurement signal; among them, the first measurement signal corresponds to the magnetic field intensity and direction in the first direction, the second measurement signal corresponds to the magnetic field intensity and direction in the second direction, the third measurement signal corresponds to the magnetic field intensity and direction in the third direction, the second direction and the third direction are perpendicular to each other and are both perpendicular to the first direction; If it is determined that there is no external magnetic field interference, the position where the magnetic body is located is determined based on the value of the first measurement signal; If it is determined that there is a stable external magnetic field interference, the position where the magnetic body is located is determined based on the values of the first measurement signal, the second measurement signal, and the third measurement signal; If it is determined that there is an unstable external magnetic field interference, the position where the magnetic body is located is not determined.
4. The position detection method according to claim 3, wherein The step of judging the external magnetic field interference situation based on the values of the first measurement signal, the second measurement signal, and the third measurement signal includes: Detect whether the values of the first measurement signal, the second measurement signal, and the third measurement signal change; When the value of at least one of them changes, judge whether there is an external magnetic field interference; If it is determined that there is an external magnetic field interference, further judge whether the external magnetic field interference is stable.
5. The position detection method according to claim 4, wherein The step of judging whether there is an external magnetic field interference includes: Detect whether the sum of the absolute value of the first measurement signal and the absolute value of the second measurement signal, and the value of the third measurement signal are all within a preset range; If at least one of them exceeds a preset range, it is determined that there is external magnetic field interference; If both of them are within the preset range, it is determined that there is no external magnetic field interference.
6. The position detection method according to claim 4, wherein The step of further determining whether the external magnetic field interference is stable includes: Obtaining a first deviation value, a second deviation value, and a third deviation value, where the first deviation value is the difference between the value of the first measurement signal and a first preset value, the second deviation value is the difference between the value of the second measurement signal and a second preset value, and the third deviation value is the difference between the value of the third measurement signal and a third preset value; Detecting whether the change amounts of the first deviation value, the second deviation value, and the third deviation value are all within a preset range; If the change amounts of all three of them do not exceed the preset range, it is determined that the external magnetic field interference is stable; If the change amount of at least one of them exceeds the preset range within a preset time, it is determined that the external magnetic field interference is unstable.
7. The position detection method according to claim 6, wherein The step of, if it is determined that there is stable external magnetic field interference, determining the position of the magnetic body based on the values of the first measurement signal, the second measurement signal, and the third measurement signal includes: Obtaining a first travel difference, a second travel difference, and a third travel difference, where the first travel difference is the difference between the measured value of the first measurement signal and the initial value of the first measurement signal, the second travel difference is the difference between the measured value of the second measurement signal and the initial value of the second measurement signal, and the third travel difference is the difference between the measured value of the third measurement signal and the initial value of the third measurement signal; wherein, the initial values of the first measurement signal, the second measurement signal, and the third measurement signal are the values of the three measured when the three change; When the first travel difference, the second travel difference, and the third travel difference all meet the preset conditions, it is determined that the magnetic body is in the position corresponding to the preset conditions.
8. An electronic device, characterized in that, The electronic device includes a housing and a position detection component as described in any one of claims 3-7, and the position detection component is provided in the housing.
9. A detection device for an electronic device, characterized in that, The detection device includes a processor and a memory, and a computer program is stored in the memory. The processor is configured to execute the computer program to implement the position detection method as described in any one of claims 3-7.
10. A storage medium, characterized in that, The storage medium stores a computer program, and when the computer program is executed, it implements the position detection method as described in any one of claims 3-7.