Electronic compass calibration method, device, electronic equipment and storage medium
The Hall sensor obtains the target button position information and calibrates the magnetic field parameters of the electronic compass, which solves the deviation problem caused by the interference of the magnetic field in electronic devices, and improves the detection accuracy and difficulty of stacking the entire machine.
Patent Information
- Application Number
- CN202210220956.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-08
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2042-03-08
AI Technical Summary
In electronic equipment, the electronic compass is affected by the interference magnetic field, which leads to a deviation in the direction of the detected geomagnetic field, and has poor accuracy.
The position information of the target button is obtained through the Hall sensor, the calibration parameters are determined based on this information, and the magnetic field parameters of the electronic compass are calibrated to avoid the influence of interference with the magnetic field.
It improves the accuracy of the electronic compass, reduces the magnetic field interference of the target buttons, and reduces the difficulty of stacking the entire electronic device.
Smart Images

Figure CN114777755B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of communication technology, and specifically relates to an electronic compass calibration method, device, electronic equipment and storage medium. Background Art
[0002] Usually, an electronic compass is provided in an electronic device, so that when a user wants to know the direction of the geomagnetic field, the user can trigger the electronic device to detect the geomagnetic field through the electronic compass and display the detected geomagnetic field direction, so that the user can view the geomagnetic field direction.
[0003] However, since there may be interfering magnetic fields in electronic devices, for example, the magnetic field formed by the mute button and the Hall sensor in the electronic device, the interfering magnetic field may interfere with the electronic compass's detection of the geomagnetic field, thereby causing the geomagnetic field direction detected by the electronic compass to deviate.
[0004] This results in poor accuracy of the electronic compass. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide an electronic compass calibration method, device, electronic device and storage medium, which can solve the problem of poor accuracy of the electronic compass.
[0006] In a first aspect, an embodiment of the present application provides an electronic compass calibration method, which includes: obtaining target position information of a target button of an electronic device through at least one Hall sensor, wherein the target position information is used to indicate the button position of the target button on the electronic device; determining target calibration parameters through an electronic compass based on the target position information; and calibrating the magnetic field parameters output by the electronic compass using the target calibration parameters.
[0007] In a second aspect, an embodiment of the present application provides an electronic compass calibration device, which includes: a target button, at least one Hall sensor and an electronic compass, and the electronic compass calibration device also includes: an acquisition module, a determination module and a calibration module. The acquisition module is used to acquire target position information of a target button of the electronic compass calibration device through at least one Hall sensor, and the target position information is used to indicate the button position of the target button on the electronic compass calibration device. The determination module is used to determine target calibration parameters through the electronic compass according to the target position information acquired by the acquisition module. The calibration module is used to calibrate the magnetic field parameters output by the electronic compass using the target calibration parameters determined by the determination module.
[0008] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a target button is arranged on a printed circuit board PCB of the electronic device; at least one Hall sensor is arranged opposite to the target button, and the at least one Hall sensor is used to obtain target position information of the target button, and the target position information is used to indicate the button position of the target button on the electronic device; an electronic compass is arranged at one end of the PCB away from the target button; wherein the electronic compass is used to determine target calibration parameters according to the target position information, so that the electronic device can use the target calibration parameters to calibrate the magnetic field parameters output by the electronic compass.
[0009] In a fourth aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.
[0010] In a fifth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0011] In a sixth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0012] In a seventh aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.
[0013] In an embodiment of the present application, the electronic device can obtain the target position information of the target button through at least one Hall sensor (the target position information is used to indicate the button position of the target button on the electronic compass calibration device), and determine the target calibration parameters through the electronic compass based on the target position information, so that the electronic device can calibrate the magnetic field parameters output by the electronic compass based on the target calibration parameters. In this solution, since the electronic device can obtain the target position information of the target button that may interfere with the electronic compass detecting the geomagnetic field, and calibrate the magnetic field parameters output by the electronic compass based on the target calibration parameters determined by the target position information, that is, the target calibration parameters are related to the target position information, it is possible to avoid the situation where the magnetic field of the target button interferes with the electronic compass detecting the geomagnetic field, thereby avoiding the deviation of the geomagnetic field direction detected by the electronic compass, so that the accuracy of the electronic compass can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 This is one of the flow charts of an electronic compass calibration method provided in an embodiment of the present application;
[0015] Figure 2 This is the second flowchart of an electronic compass calibration method provided in an embodiment of the present application;
[0016] Figure 3 This is the third flow chart of an electronic compass calibration method provided in an embodiment of the present application;
[0017] Figure 4 This is one of the structural schematic diagrams of an electronic compass calibration device provided in an embodiment of the present application;
[0018] Figure 5 This is a fourth flow chart of an electronic compass calibration method provided in an embodiment of the present application;
[0019] Figure 6 This is the second structural schematic diagram of an electronic compass calibration device provided in an embodiment of the present application;
[0020] Figure 7 This is a third structural diagram of an electronic compass calibration device provided in an embodiment of the present application;
[0021] Figure 8 This is a fourth structural diagram of an electronic compass calibration device provided in an embodiment of the present application;
[0022] Fig. 9 This is a fifth structural diagram of an electronic compass calibration device provided in an embodiment of the present application;
[0023] Fig.10 This is the sixth structural diagram of an electronic compass calibration device provided in an embodiment of the present application;
[0024] Fig.11 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application;
[0025] Fig.12 It is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0027] The terms "first", "second", etc. in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first Hall sensor can be one or more. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0028] The electronic compass calibration method provided in the embodiment of the present application is described in detail below through specific embodiments and application scenarios in conjunction with the accompanying drawings.
[0029] With the development of communication technology, the functions attached to electronic devices are becoming more and more abundant, so the components integrated in electronic devices are gradually increasing. For example, an electronic compass can be added to the electronic device, and in the overall stacking of current electronic devices, the electronic compass is usually arranged together with the mute key Hall. In this way, when the user needs to know the geomagnetic direction (that is, the current position), the electronic device can detect the current geomagnetic field environment through the electronic compass and display the detected geomagnetic field direction, so that the user can view the current position and direction.
[0030] However, both the electronic compass and the mute key Hall sensor are magnetic sensors. Since the mute key Hall function judgment requires an external magnet to provide a certain magnetic field, the position of the mute key can be determined by detecting the size of the magnetic field. When the external magnetic field set by the mute key changes, the magnetic field detected by the electronic compass may be misjudged. In related technologies, the electronic compass and the mute key magnets can be arranged at a distance greater than a preset distance (for example, 15MM) to reduce the interference of the mute key magnet on the electronic compass. However, if the distance between the electronic compass and the mute key is too large, the stacking layout of the electronic equipment will become more difficult.
[0031] In an embodiment of the present application, the electronic device provided by the present application includes: a target button, at least one Hall sensor, and an electronic compass, so that the electronic device can obtain the current position information of the mute button (i.e., the target button) through at least one Hall sensor (the current position information is used to indicate the current button position of the mute button on the electronic device), and determine the calibration parameters through the electronic compass according to the current position information, so that the electronic device can calibrate the magnetic field parameters output by the electronic compass according to the determined calibration parameters. In this scheme, since the electronic device can obtain the current position information of the mute button that may interfere with the electronic compass detecting the geomagnetic field, and calibrate the magnetic field parameters output by the electronic compass according to the calibration parameters determined by the current position information, that is, the determined calibration parameters are related to the current position information, it is possible to avoid the situation where the magnetic field of the mute button interferes with the electronic compass detecting the geomagnetic field, thereby avoiding the deviation of the geomagnetic field direction detected by the electronic compass, so that the accuracy of the electronic compass can be improved.
[0032] The present application embodiment provides an electronic compass calibration method. Figure 1 FIG. 1 is a flow chart of an electronic compass calibration method provided by an embodiment of the present application. Figure 1 As shown, the electronic compass calibration method provided in the embodiment of the present application may include the following steps 201 to 203.
[0033] Step 201: The electronic device obtains target position information of a target key through at least one Hall sensor.
[0034] In the embodiment of the present application, the above-mentioned target position information is used to indicate the key position of the target key on the electronic device.
[0035] Optionally, in the embodiment of the present application, a magnetic member may be provided in the target button.
[0036] The target button may be any of the following: a mute button, a volume button, a button corresponding to a preset position in an electronic device, or any button that is less than a preset distance (e.g., 2 cm) from an electronic compass. The magnetic member may include at least one of the following: a magnet, an electromagnet, and the like.
[0037] Optionally, in an embodiment of the present application, the above-mentioned target position information may specifically be coordinate information of the target button in a preset coordinate system in the electronic device.
[0038] Optionally, in an embodiment of the present application, when the electronic device is in a powered-on state, the electronic device may obtain target position information of the target key. The powered-on state may include any of the following: a powered-on startup state, a standby state (e.g., a screen-off standby state), and a working state (e.g., a screen-on state).
[0039] In one example, when an electronic device runs a navigation application, the electronic device can obtain target position information of a target button in real time.
[0040] In another example, when the electronic device receives a first input from a user to a target key, the electronic device can obtain target position information of the target key in real time, wherein the first input is used to move the target key so that the key position of the target key on the electronic device changes.
[0041] It can be understood that if the key position of the target key on the electronic device changes, it can be considered that the magnetic field near the target key may change, so the electronic device can obtain the target position information in real time.
[0042] Further optionally, in the embodiment of the present application, the first input may be any of the following: a press input (eg, a click input), a toggle input, a slide input, or a preset track input, etc. The specific input may be determined according to actual use requirements, and the embodiment of the present application does not limit the input.
[0043] Optionally, in an embodiment of the present application, at least one Hall sensor may also be provided in the electronic device, and the at least one Hall sensor is arranged at a position within a preset range of the target key, so that the at least one Hall sensor can respectively output corresponding Hall parameters to output at least one Hall parameter, and then the electronic device can determine the target position information of the target key based on the at least one Hall parameter.
[0044] Step 202: The electronic device determines target calibration parameters using an electronic compass according to the target position information.
[0045] In the embodiment of the present application, the above-mentioned target calibration parameters are used to calibrate the magnetic field parameters output by the electronic compass of the electronic device.
[0046] Optionally, in an embodiment of the present application, the above-mentioned target calibration parameter may include at least one of the following: an angle relationship parameter, a magnetic field distribution parameter, a magnetic field direction parameter or an acceleration parameter.
[0047] Optionally, in an embodiment of the present application, multiple preset calibration parameters (for example, at least two preset calibration parameters in the following embodiments) are pre-stored in the electronic device, and the multiple preset calibration parameters correspond one-to-one to multiple location information, so that the electronic device can determine the target calibration parameters corresponding to the target location information.
[0048] Further optionally, in an embodiment of the present application, the electronic device may determine a piece of location information that matches the target location information from multiple pieces of location information, and determine a preset calibration parameter corresponding to the piece of location information as the target calibration parameter.
[0049] It should be noted that the above “matching the target location information” can be understood as: being the same as the target location information; or, the difference between the target location information and the target location information is less than or equal to a preset threshold.
[0050] Step 203: The electronic device uses the target calibration parameters to calibrate the magnetic field parameters output by the electronic compass.
[0051] Optionally, in an embodiment of the present application, the above-mentioned magnetic field parameters may include magnetic field direction parameters.
[0052] Optionally, in the embodiment of the present application, the electronic device may use a preset calibration algorithm to calculate according to the target calibration parameters and the magnetic field parameters output by the electronic compass to obtain calibrated magnetic field parameters. It is understood that the calibrated magnetic field parameters are accurate magnetic field parameters.
[0053] In an example, when the electronic device has not calibrated the magnetic field parameters output by the electronic compass of the electronic device, the electronic device may directly use the target calibration parameters to calibrate the magnetic field parameters output by the electronic compass of the electronic device.
[0054] In another example, when the electronic device uses other calibration parameters (such as the initial calibration parameters in the following embodiment) to calibrate the magnetic field parameters output by the electronic compass of the electronic device, the electronic device can first update the other calibration parameters to target calibration parameters, and then use the target calibration parameters to calibrate the magnetic field parameters output by the electronic compass of the electronic device.
[0055] It is understandable that after the electronic device determines the target calibration parameters, the electronic device may use other calibration parameters to calibrate the magnetic field parameters output by the electronic compass. The other calibration parameters are not related to the target position information. In this way, the magnetic field of the target button may interfere with the electronic compass's detection of the geomagnetic field. Therefore, the electronic device can update the other calibration parameters to the target calibration parameters.
[0056] Optionally, in the embodiment of the present application, combined with Figure 1 ,like Figure 2 As shown, before the above step 203, the electronic compass calibration method provided in the embodiment of the present application further includes the following step 301.
[0057] Step 301: When initial calibration parameters are used to calibrate magnetic field parameters, the electronic device updates the initial calibration parameters to target calibration parameters.
[0058] Further optionally, in the embodiment of the present application, the electronic compass performs magnetic field calibration processing in real time. When the position of the target button changes, the electronic device can update the initial calibration parameters to the target calibration parameters, thereby recalibrating the magnetic field parameters output by the electronic compass through the updated target calibration parameters to obtain the magnetic field parameters output based on the target calibration parameters. The specific process of obtaining the target calibration parameters can be referred to the above embodiment and will not be repeated here.
[0059] Further optionally, in an embodiment of the present application, the electronic device can receive a second input from the user to the target button to trigger a change in the position information of the target button (for example, the second position described below), so that the electronic device can obtain the target calibration parameters corresponding to the second position information, so as to calibrate the magnetic field parameters output by the electronic compass through the target calibration parameters corresponding to the second position information.
[0060] Further optionally, in the embodiment of the present application, the second input may be any one of the following: click input, toggle input, slide input or preset track input. The specific input may be determined according to actual use requirements and is not limited in the embodiment of the present invention.
[0061] In an embodiment of the present application, the electronic device can update the stored initial calibration parameters to target calibration parameters related to the target position information, thereby calibrating the magnetic field parameters output by the electronic compass through the target calibration parameters, thereby improving the accuracy of the electronic compass.
[0062] Optionally, in the embodiment of the present application, after calibrating the magnetic field parameters output by the electronic compass, the electronic device may perform the above steps 201 to 203 again to calibrate the magnetic field parameters output by the electronic compass again.
[0063] In one example, the electronic device may perform the above steps 201 to 203 again after a preset time after calibrating the magnetic field parameters output by the electronic compass. It is understandable that the electronic device may calibrate the magnetic field parameters output by the electronic compass again at regular intervals.
[0064] In another example, the electronic device may perform the above steps 201 to 203 again according to the user's input to the electronic device. It is understandable that the electronic device may also calibrate the magnetic field parameters output by the electronic compass again according to the user's needs.
[0065] In an embodiment of the present application, a magnet is provided in the target button, so that when the button position of the target button on the electronic device changes, the magnetic field near the target button may change, causing the magnetic field parameters output by the electronic compass to be inaccurate. Therefore, the electronic device can obtain the target position information of the target button, and determine the target calibration parameters based on the target position information, so as to use the target calibration parameters to calibrate the magnetic field parameters output by the electronic compass of the electronic device to obtain accurate magnetic field parameters.
[0066] The embodiment of the present application provides an electronic compass calibration method, where the electronic device can obtain the target position information of a target button (the target position information is used to indicate the button position of the target button on the electronic device), and determine the target calibration parameters according to the target position information, so that the electronic device can calibrate the magnetic field parameters output by the electronic compass according to the target calibration parameters. In this solution, since the electronic device can obtain the target position information of the target button that may interfere with the electronic compass detecting the geomagnetic field, and calibrate the magnetic field parameters output by the electronic compass according to the target calibration parameters determined by the target position information, that is, the target calibration parameters are related to the target position information, it is possible to avoid the situation where the magnetic field of the target button interferes with the electronic compass detecting the geomagnetic field, thereby avoiding the deviation of the geomagnetic field direction detected by the electronic compass, and thus, the accuracy of the electronic compass can be improved.
[0067] Furthermore, since the electronic device can calibrate the magnetic field parameters output by the electronic compass according to the target calibration parameters determined by the target position information, the electronic compass and the target button can be arranged in adjacent areas, thus reducing the difficulty of stacking the entire electronic device.
[0068] The following will take an electronic device provided with two Hall sensors as an example to illustrate how the electronic device obtains target position information.
[0069] Optionally, in the embodiment of the present application, combined with Figure 1 ,like Figure 3 As shown, the electronic device further includes a first Hall sensor and a second Hall sensor. The step 201 can be implemented by the following steps 201a and 201b.
[0070] Step 201a: The electronic device obtains a first Hall parameter detected by the first Hall sensor and a second Hall parameter detected by the second Hall sensor.
[0071] Optionally, in the embodiment of the present application, the first Hall sensor and the second Hall sensor may be linear Hall sensors (eg, open-loop Hall sensors or closed-loop Hall sensors), or switch-type Hall sensors.
[0072] It should be noted that the first Hall sensor and the second Hall sensor have opposite polarities, and both the first Hall sensor and the second Hall sensor are perpendicular to the key magnet.
[0073] Optionally, in the embodiment of the present application, the first Hall parameter and the second Hall parameter may both be Hall voltage values.
[0074] There is a Hall voltage in both the first Hall sensor and the second Hall sensor. The stronger the magnetic field, the higher the voltage. Conversely, the weaker the magnetic field, the lower the voltage. Therefore, the first Hall sensor can obtain a Hall voltage value (i.e., the first Hall parameter) according to the magnetic field size of the magnet of the detected target key, and the second Hall sensor can obtain another Hall voltage value (i.e., the second Hall parameter) according to the magnetic field size of the magnet of the detected target key, so that the electronic device can determine the target position information of the acquired target key based on the first Hall parameter and the second Hall parameter.
[0075] It can be understood that when the magnet in the target key moves (for example, up and down, or left and right), the moving position of the magnet is fixed by the structural limit of the target key. When the key magnet moves up and down, the magnetic field generated by the magnet also changes up and down. In this way, when the size, shape, and brand of the magnet are determined, the surface magnetism and magnetic field range of the magnet can also be determined accordingly. Therefore, the electronic device can determine the target position information of the target key through the first Hall parameter and the second Hall parameter. The same is true for left and right movement, which will not be repeated here.
[0076] Step 201b: The electronic device determines target position information according to the first Hall parameter and the second Hall parameter.
[0077] Optionally, in an embodiment of the present application, the electronic device can determine the target position information based on whether the first Hall parameter is greater than (or less than) a first preset voltage value and whether the second Hall parameter is less than (or greater than) a second preset voltage value.
[0078] Exemplarily, assuming that the magnet in the target key is close to the first Hall sensor (i.e., the target key is in the first position, which is the upper half of the target key), the magnetic field of the magnet detected by the first Hall sensor is larger, and the magnetic field of the magnet detected by the second Hall sensor is smaller, so that the Hall voltage value (i.e., the first Hall parameter) obtained by the first Hall sensor is larger, and the Hall voltage value (i.e., the second Hall parameter) obtained by the second Hall sensor is smaller. Therefore, when the first Hall parameter is greater than the first preset voltage value, and the second Hall parameter is less than the second preset voltage value, the electronic device can determine the first position information as the target position information. The first position information is used to indicate that the key position of the target key on the electronic device is the first position.
[0079] For example, Figure 4 As shown, the magnet in the target button is close to the first Hall sensor 13, the magnetic field of the magnet detected by the first Hall sensor 14 is larger, and the magnetic field of the magnet detected by the second Hall sensor 13 is smaller. At this time, when the first Hall parameter is greater than the first preset voltage value and the second Hall parameter is less than the second preset voltage value, the electronic device can determine the first position information as the target position information.
[0080] As another example, assuming that the magnet in the target key is close to the second Hall sensor (i.e., the target key is in the second position, which is the lower half of the target key), the magnetic field of the magnet detected by the first Hall sensor is relatively small, and the magnetic field of the magnet detected by the second Hall sensor is relatively large, so that the Hall voltage value (i.e., the first Hall parameter) obtained by the first Hall sensor is relatively small, and the Hall voltage value (i.e., the second Hall parameter) obtained by the second Hall sensor is relatively large. Therefore, when the first Hall parameter is less than the first preset voltage value, and the second Hall parameter is greater than the second preset voltage value, the electronic device can determine the second position information as the target position information. The second position information is used to indicate that the key position of the target key on the electronic device is the second position.
[0081] In the embodiment of the present application, since two Hall sensors can be provided in the electronic device, the electronic device can directly determine the target position information based on the two Hall parameters detected by the two Hall sensors, thereby improving the accuracy of the electronic device in determining the target position information.
[0082] Of course, in order to further reduce the interference of the magnetic field of the magnet in the target button on the detection of the earth's magnetic field by the electronic compass, a magnetic isolation component can be provided on the target button.
[0083] The following is an example of how the electronic device determines the target calibration parameters.
[0084] Optionally, in the embodiment of the present application, combined with Figure 1 ,like Figure 5 As shown, the above step 202 can be specifically implemented through the following step 202a.
[0085] Step 202a: The electronic device determines a target calibration parameter corresponding to the target position information from at least two preset calibration parameters pre-stored in the electronic compass.
[0086] In the embodiment of the present application, the at least two preset calibration parameters correspond one-to-one to at least two pieces of position information, and the at least two pieces of position information include target position information.
[0087] Further optionally, in the embodiment of the present application, for each of the at least two preset calibration parameters, the target key can be first moved to a key position, and the deviation value between the magnetic field parameter output by the electronic compass and the accurate magnetic field parameter can be obtained, and then a preset calibration parameter can be determined according to the deviation value to obtain a preset calibration parameter, so as to obtain at least two preset calibration parameters. Among them, the above-mentioned accurate magnetic field parameter can be a magnetic field parameter detected by other equipment (such as a compass).
[0088] It can be understood that in the whole machine, the magnetic field environment of the electronic compass is complex. In order to measure the geomagnetic field more accurately, at least two preset calibration parameters can be pre-determined according to the different key positions of the target key, so that the electronic device can determine the corresponding preset calibration parameters according to the key position of the target key.
[0089] Further optionally, in an embodiment of the present application, at least two hard magnetic databases are pre-set in the electronic compass, and each hard magnetic database stores a preset calibration parameter, so that the electronic device can determine a hard magnetic database corresponding to the target position information according to at least two corresponding relationships, and determine the preset calibration parameter in the hard magnetic database as the target calibration parameter. Each of the at least two corresponding relationships is a corresponding relationship between a position information and a hard magnetic database.
[0090] Specifically, the electronic device can determine a piece of position information matching the target position information from at least two pieces of position information in at least two corresponding relationships, and then determine a preset calibration parameter in the hard magnetic library corresponding to the piece of position information as the target calibration parameter.
[0091] In the embodiment of the present application, the electronic device can adjust the magnetic field parameters output by the electronic compass through the target calibration parameters corresponding to the target button position, thereby avoiding the situation where the target button may interfere with the electronic compass's detection of geomagnetism when the target button is close to the electronic compass, thereby causing the direction of the geomagnetic field detected by the electronic compass to deviate, thereby improving the accuracy of the electronic compass.
[0092] An embodiment of the present application provides an electronic device, Figure 6 A possible structural diagram of an electronic device provided in an embodiment of the present application is shown. Figure 6 As shown, the electronic device 10 may include: a PCB 11 , a target button 12 , at least one Hall sensor and an electronic compass 15 , wherein the at least one Hall sensor includes a first Hall sensor 13 and a second Hall sensor 14 .
[0093] The PCB is provided with: a first Hall sensor 13 and a second Hall sensor 14 , which are arranged opposite to the target button 12 ; and an electronic compass 15 , which is arranged at one end of the PCB 11 away from the target button 12 .
[0094] In an embodiment of the present application, the at least one Hall sensor is used to obtain target position information of a target key, and the target position information is used to indicate the key position of the target key on the electronic device; the electronic compass is used to determine target calibration parameters based on the target position information, so that the electronic device can use the target calibration parameters to calibrate the magnetic field parameters output by the electronic compass.
[0095] An embodiment of the present application provides an electronic device, which can obtain target position information of a target button (the target position information is used to indicate the button position of the target button on the electronic device) through at least one Hall sensor, and determine target calibration parameters through an electronic compass based on the target position information, so that the electronic device can calibrate the magnetic field parameters output by the electronic compass based on the target calibration parameters. In this solution, since the electronic device can obtain the target position information of the target button that may interfere with the electronic compass detecting the geomagnetic field, and calibrate the magnetic field parameters output by the electronic compass based on the target calibration parameters determined by the target position information, that is, the target calibration parameters are related to the target position information, it is possible to avoid the situation where the magnetic field of the target button interferes with the electronic compass detecting the geomagnetic field, thereby avoiding the deviation of the geomagnetic field direction detected by the electronic compass, and thus, the accuracy of the electronic compass can be improved.
[0096] Optionally, in the embodiment of the present application, combined with Figure 6 ,like Figure 7 As shown, the key positions of the target key 12 include: a first key position 121 and a second key position 122 ; and the at least one Hall sensor 13 includes: a first Hall sensor 13 and a second Hall sensor 14 .
[0097] The first button position 121 faces the first Hall sensor 13 , and the second button position 122 faces the second Hall sensor 14 .
[0098] Specifically, the first Hall sensor 13 and the second Hall sensor 14 are both located on the same plane and are both perpendicular to the target button 12 . The electronic compass 15 is located above the first Hall sensor 131 and the distance between the electronic compass 15 and the first Hall sensor 13 is less than 15 MM.
[0099] In an embodiment of the present application, two Hall sensors may be provided in the electronic device, so that the electronic device can directly determine the key position of the target key based on the two Hall sensors, thereby improving the accuracy of the electronic device in determining the key position of the target key.
[0100] Optionally, in the embodiment of the present application, combined with Figure 6 ,like Figure 8 As shown, the electronic device further includes a magnetic isolation component 15 .
[0101] Optionally, in the embodiment of the present application, the magnetic isolation component 16 can be disposed on the PCB 11, and the magnetic isolation component 16 can be any one of the following: a magnetic isolation sheet, a silicon steel sheet, or any component with magnetic isolation capability.
[0102] It can be understood that the magnetic isolation sheet is a soft magnetic material sintered at a constant high temperature, with high magnetic permeability and low magnetic loss factor. It utilizes the electron scattering caused by the thermal motion of the lattice electric field of the functional component and the interaction between electrons to absorb the electromagnetic wave energy and convert it into heat energy, thereby achieving the purpose of attenuating the electromagnetic wave.
[0103] In the embodiment of the present application, the target button, the first Hall sensor and the second Hall sensor are all disposed in the space formed by the magnetic isolation component 16 .
[0104] It should be noted that the above Figure 8 A top view of an electronic device.
[0105] Further optionally, in the embodiment of the present application, the space formed by the magnetic isolation component 16 may specifically be: a space enclosed by the magnetic isolation component 16 and the PCB 11 , or a space enclosed by the magnetic isolation component 16 .
[0106] Specifically, a groove can be provided on the magnetic isolation component 16, and the notch of the groove is connected to the PCB (for example, fixedly connected), so that the target button, the first Hall sensor and the second Hall sensor are all arranged at the position of the PCB in the groove, so as to be arranged in the space formed by the magnetic isolation component 16.
[0107] For example, Fig. 9 As shown, a groove may be provided on the magnetic isolation component 16, and the notch of the groove is fixedly connected to the PCB 11, so that the target button 12, the first Hall sensor 13 and the second Hall sensor 14 are all arranged at the position where the PCB 11 is located in the groove.
[0108] It can be understood that when the electronic devices are stacked, a magnetic isolation sheet space is reserved above the target button, the first Hall sensor and the second Hall sensor, so that the magnetic field generated by the magnet in the target button will be determined in the magnetic isolation sheet space and will not radiate to the outside. Therefore, the electronic compass will no longer be affected by the magnetic field of the target button when detecting the geomagnetism.
[0109] In the embodiment of the present application, a magnetic isolation component is provided on the target button, the first Hall sensor and the second Hall sensor so that the magnetic isolation component guides the magnetic field generated by the magnet of the target button and does not radiate outward. Therefore, it is possible to avoid the magnetic field of the target button interfering with the electronic compass detecting the geomagnetic field, thereby avoiding the deviation of the geomagnetic field direction detected by the electronic compass. In this way, the accuracy of the electronic compass can be improved.
[0110] It should be noted that the electronic compass calibration method provided in the embodiment of the present application can be executed by an electronic device. In the embodiment of the present application, an electronic device executing the electronic compass calibration method is taken as an example to illustrate the electronic device provided in the embodiment of the present application.
[0111] Fig.10 FIG. 2 shows a possible structural diagram of an electronic compass calibration device involved in an embodiment of the present application. Fig. 9 As shown, the electronic compass calibration device includes: a target button, at least one Hall sensor and an electronic compass. The electronic compass calibration device 70 may include: an acquisition module 71, a determination module 72 and a calibration module 73.
[0112] The acquisition module 71 is used to acquire the target position information of the target button of the electronic compass calibration device through at least one Hall sensor, and the target position information is used to indicate the button position of the target button on the electronic compass calibration device 70. The determination module 72 is used to determine the target calibration parameters through the electronic compass according to the target position information acquired by the acquisition module 71. The calibration module 73 is used to calibrate the magnetic field parameters output by the electronic compass using the target calibration parameters determined by the determination module 72.
[0113] In one possible implementation, the above-mentioned determination module 72 is specifically used to determine the target calibration parameters corresponding to the target position information from at least two preset calibration parameters pre-stored in the electronic compass; wherein the at least two preset calibration parameters correspond one-to-one to at least two position information, and the at least two position information include the target position information.
[0114] In a possible implementation, the electronic compass calibration device provided in the embodiment of the present application further includes an update module. The update module is used to update the initial calibration parameters to the target calibration parameters before the calibration module 73 uses the target calibration parameters to calibrate the magnetic field parameters output by the electronic compass, when the calibration module 73 uses the initial calibration parameters to calibrate the magnetic field parameters.
[0115] In a possible implementation, the electronic compass calibration device further includes a first Hall sensor and a second Hall sensor. The acquisition module 71 is specifically used to acquire a first Hall parameter detected by the first Hall sensor and a second Hall parameter detected by the second Hall sensor; and determine the target position information according to the first Hall parameter and the second Hall parameter.
[0116] An embodiment of the present application provides an electronic compass calibration device. Since the electronic compass calibration device can obtain the target position information of a target button that may interfere with the electronic compass's detection of the geomagnetic field, and calibrate the magnetic field parameters output by the electronic compass based on the target calibration parameters determined by the target position information, that is, the target calibration parameters are related to the target position information, it is possible to avoid the magnetic field of the target button interfering with the electronic compass's detection of the geomagnetic field, thereby avoiding deviations in the geomagnetic field direction detected by the electronic compass. In this way, the accuracy of the electronic compass can be improved.
[0117] The electronic compass calibration device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in an electronic device. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a car-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0118] The electronic compass calibration device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0119] The electronic compass calibration device provided in the embodiment of the present application can achieve Figures 1 to 8 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0120] Alternatively, if Fig.11 As shown, an embodiment of the present application further provides an electronic device 90, including a processor 91 and a memory 92, wherein the memory 92 stores programs or instructions that can be executed on the processor 91, and when the program or instructions are executed by the processor 91, the various steps of the above-mentioned electronic compass calibration method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not described here.
[0121] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0122] Fig.12 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0123] The electronic device 100 includes but is not limited to components such as a radio frequency unit 101, a network module 102, an audio output unit 103, an input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, a memory 109, and a processor 110.
[0124] Those skilled in the art will appreciate that the electronic device 100 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 110 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Fig.12 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0125] Among them, the processor 110 is used to obtain the target position information of the target key of the electronic device through at least one Hall sensor, and the target position information is used to indicate the key position of the target key on the electronic device; and determine the target calibration parameters through the electronic compass according to the target position information; and use the target calibration parameters to calibrate the magnetic field parameters output by the electronic compass.
[0126] An embodiment of the present application provides an electronic device. Since the electronic device can obtain target position information of a target button that may interfere with the electronic compass's detection of the geomagnetic field, and calibrate the magnetic field parameters output by the electronic compass based on target calibration parameters determined according to the target position information, that is, the target calibration parameters are related to the target position information, it is possible to avoid the magnetic field of the target button interfering with the electronic compass's detection of the geomagnetic field, thereby avoiding deviations in the geomagnetic field direction detected by the electronic compass. In this way, the accuracy of the electronic compass can be improved.
[0127] Optionally, in an embodiment of the present application, the processor 110 is specifically used to determine a target calibration parameter corresponding to the target position information from at least two preset calibration parameters pre-stored in the electronic compass; wherein the at least two preset calibration parameters correspond one-to-one to at least two pieces of position information, and the at least two pieces of position information include the target position information.
[0128] In the embodiment of the present application, the electronic device can adjust the magnetic field parameters output by the electronic compass through the target calibration parameters corresponding to the target button position, thereby avoiding the situation where the target button may interfere with the electronic compass's detection of geomagnetism when the target button is close to the electronic compass, thereby causing the direction of the geomagnetic field detected by the electronic compass to deviate, thereby improving the accuracy of the electronic compass.
[0129] Optionally, in an embodiment of the present application, the processor 110 is further configured to update the initial calibration parameters to the target calibration parameters when the magnetic field parameters are calibrated using the initial calibration parameters before the target calibration parameters are used to calibrate the magnetic field parameters output by the electronic compass.
[0130] In an embodiment of the present application, the electronic device can update the stored initial calibration parameters to target calibration parameters related to the target position information, thereby calibrating the magnetic field parameters output by the electronic compass through the target calibration parameters, thereby improving the accuracy of the electronic compass.
[0131] Optionally, in the embodiment of the present application, the electronic device further includes a first Hall sensor and a second Hall sensor. The processor 110 is specifically configured to obtain a first Hall parameter detected by the first Hall sensor and a second Hall parameter detected by the second Hall sensor; and determine target position information according to the first Hall parameter and the second Hall parameter.
[0132] In the embodiment of the present application, since two Hall sensors can be provided in the electronic device, the electronic device can directly determine the target position information based on the two Hall parameters detected by the two Hall sensors, thereby improving the accuracy of the electronic device in determining the target position information.
[0133] The electronic device provided in the embodiment of the present application can implement each process implemented in the above method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described here.
[0134] The beneficial effects of various implementations in this embodiment can be specifically referred to the beneficial effects of the corresponding implementations in the above method embodiment. To avoid repetition, they will not be described again here.
[0135] It should be understood that in the embodiment of the present application, the input unit 104 may include a graphics processor (Graphics Processing Unit, GPU) 1041 and a microphone 1042, and the graphics processor 1041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 106 may include a display panel 1061, and the display panel 1061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 107 includes a touch panel 1071 and at least one of other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include two parts: a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0136] The memory 109 can be used to store software programs and various data. The memory 109 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 109 may include a volatile memory or a non-volatile memory, or the memory 109 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 109 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0137] The processor 110 may include one or more processing units; optionally, the processor 110 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 110.
[0138] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0139] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0140] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0141] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0142] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned electronic compass calibration method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0143] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises one..." does not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be noted that the scope of the method and device in the embodiment of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0144] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0145] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. An electronic compass calibration method, applied to electronic equipment, characterized in that: The electronic device comprises a target button, at least one Hall sensor and an electronic compass, wherein the electronic compass is provided with at least two hard magnetic databases, each of which stores a preset calibration parameter. The method comprises: Based on at least one Hall parameter detected by the at least one Hall sensor, acquiring target position information of the target key, wherein the at least one Hall sensor corresponds to the at least one Hall parameter in a one-to-one manner, and the target position information is used to indicate the key position of the target key on the electronic device; Based on at least two corresponding relationships, determining a preset calibration parameter corresponding to the target position information from at least two preset calibration parameters as a target calibration parameter; Using the target calibration parameters, calibrating the magnetic field parameters output by the electronic compass; In which, a magnetic part is arranged in the target button, the at least one Hall sensor is arranged within a preset range of the target button, the at least two preset calibration parameters correspond one-to-one to at least two position information, the at least two position information include the target position information, and each of the at least two corresponding relationships is used to indicate the corresponding relationship between a position information and a hard magnetic database.
2. The method according to claim 1, characterized in that Before calibrating the magnetic field parameters output by the electronic compass using the target calibration parameters, the method further includes: When the magnetic field parameters are calibrated using initial calibration parameters, the initial calibration parameters are updated to the target calibration parameters.
3. The method according to claim 1, characterized in that The at least one Hall sensor comprises a first Hall sensor and a second Hall sensor; The acquiring the target position information of the target key based on the at least one Hall parameter detected by the at least one Hall sensor includes: Acquire a first Hall parameter detected by the first Hall sensor and a second Hall parameter detected by the second Hall sensor; The target position information is determined according to the first Hall parameter and the second Hall parameter.
4. An electronic compass calibration device, characterized in that: The electronic compass calibration device comprises: a target button, at least one Hall sensor and an electronic compass, wherein the electronic compass is provided with at least two hard magnetic databases, each of which stores a preset calibration parameter, and the electronic compass calibration device further comprises: an acquisition module, a determination module and a calibration module; The acquisition module is used to acquire the target position information of the target key based on at least one Hall parameter detected by the at least one Hall sensor, the at least one Hall sensor corresponds to the at least one Hall parameter in a one-to-one manner, and the target position information is used to indicate the key position of the target key on the electronic compass calibration device; The determination module is configured to determine, based on at least two corresponding relationships, a preset calibration parameter corresponding to the target position information from at least two preset calibration parameters as a target calibration parameter; The calibration module is used to calibrate the magnetic field parameters output by the electronic compass using the target calibration parameters determined by the determination module; In which, a magnetic part is arranged in the target button, the at least one Hall sensor is arranged within a preset range of the target button, the at least two preset calibration parameters correspond one-to-one to at least two position information, the at least two position information include the target position information, and each of the at least two corresponding relationships is used to indicate the corresponding relationship between a position information and a hard magnetic database.
5. An electronic device, characterized in that: The printed circuit board PCB of the electronic device is provided with: Target button; at least one Hall sensor, the at least one Hall sensor being arranged opposite to the target key, the at least one Hall sensor being used to obtain target position information of the target key, the target position information being used to indicate a key position of the target key on the electronic device; An electronic compass, the electronic compass being disposed at an end of the PCB away from the target button, the electronic compass being provided with at least two hard magnetic databases, each of which storing a preset calibration parameter; The electronic compass is used to determine the target calibration parameters according to the target position information, from at least two preset calibration parameters in at least two hard magnetic databases set in the electronic compass, and the preset calibration parameters corresponding to the target position information are used so that the electronic device can use the target calibration parameters to calibrate the magnetic field parameters output by the electronic compass, and each hard magnetic database stores a preset calibration parameter.
6. The electronic device according to claim 5, characterized in that: The key position of the target key includes: a first key position and a second key position; the at least one Hall sensor includes: a first Hall sensor and a second Hall sensor; The first button position is directly opposite to the first Hall sensor, and the second button position is directly opposite to the second Hall sensor.
7. The electronic device according to claim 5, characterized in that: The PCB of the electronic device is also provided with: A magnetic isolation component, wherein the magnetic isolation component and the PCB form a magnetic isolation space; Wherein, the target button and the at least one Hall sensor are both arranged in the magnetic isolation space.
8. An electronic device, characterized in that: The invention comprises a processor, a memory and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the electronic compass calibration method as claimed in any one of claims 1 to 3.
9. A readable storage medium, characterized in that: The readable storage medium stores a program or an instruction, and when the program or the instruction is executed by the processor, the steps of the electronic compass calibration method according to any one of claims 1 to 3 are implemented.
