Compass calibration method and electronic device

By setting up the second compass wrapped in magnetic materials on the printing circuit board of the electronic equipment, and combining the readings of the first compass, the soft magnetic field interference is removed, which solves the problem of interference by hard magnetic field and soft magnetic field. accuracy.

CN118463954BActive Publication Date: 2025-01-28HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311344451.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-16
Publication Date
2025-01-28
Estimated Expiration
2043-10-16

AI Technical Summary

Technical Problem

The compass function in existing electronic devices is disturbed by hard and soft magnetic fields, resulting in a decrease in accuracy.

Method used

Set the first compass and the second compass on the printing circuit board of the electronic equipment. The second -compass needle is wrapped with magnetic materials to isolate the hard magnetic field interference. Magnetic field interference and target magnetic parameters.

Benefits of technology

By reducing the interference of the hard magnetic field and soft magnetic field, the accuracy of the compass is improved, and the electronic equipment can obtain more accurate orientation information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118463954B_ABST
    Figure CN118463954B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a compass calibration method and an electronic device, which relates to the field of terminal technology. The electronic device includes a printed circuit board PCB, on which a first compass, a second compass and a control unit are arranged, and the outer portion of the second compass that is not attached to the PCB is wrapped with a magnetic isolation material; the control unit is used to obtain a first reading of the first compass and a second reading of the second compass, and remove the magnetic data generated by the soft magnetic field in the second reading to obtain the target magnetic parameters for calculating the orientation of the electronic device. The electronic device can isolate the interference of the hard magnetic field on the second compass by arranging the magnetic isolation material on the outer side of the second compass, and remove the interference of the soft magnetic field in the second reading to obtain the target magnetic parameters that are not affected by the external environment, so that the electronic device can obtain a more accurate orientation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal technology, and in particular to a compass calibration method and electronic equipment. Background Art

[0002] With the popularization and development of electronic devices, people's functional requirements for electronic devices are becoming more and more diverse. For example, in order to meet users' needs for positioning functions, many electronic devices can be equipped with compass devices, which can provide positioning services for navigation software and positioning software.

[0003] Generally, the realization of the compass function is mainly to detect the magnetic field where the electronic device is located, and determine the direction based on the detected magnetic data. However, in this process, the compass may be affected by the environment where the electronic device is located, resulting in a decrease in the accuracy of the compass. Summary of the invention

[0004] The embodiments of the present application provide a compass calibration method and an electronic device, which are used to reduce the interference of hard magnetic fields and soft magnetic fields in the electronic device on the compass and improve the accuracy of the compass.

[0005] In a first aspect, an embodiment of the present application provides an electronic device, comprising a printed circuit board PCB, on which a first compass, a second compass and a control unit are arranged, and a portion of the outer side of the second compass that is not attached to the PCB is wrapped with a magnetic isolation material; the control unit is used to obtain a first reading of the first compass and a second reading of the second compass, remove magnetic data generated by a soft magnetic field from the second reading, and obtain target magnetic parameters for calculating the orientation of the electronic device; wherein the soft magnetic field includes a magnetic field generated by a circuit in the PCB, and the magnetic data generated by the soft magnetic field is obtained based on the first reading and the reading of the first compass in the absence of interference from the soft magnetic field.

[0006] In this way, the electronic device can isolate the interference of the hard magnetic field on the second compass by setting magnetic isolation material on the outside of the second compass, and obtain the interference of the soft magnetic field by numerical calculation between the first reading and the reading of the first compass without the interference of the soft magnetic field, and remove the soft magnetic field interference in the second reading to obtain the target magnetic parameters that are not affected by the external environment, so that the electronic device can obtain a more accurate direction.

[0007] Among them, the scenario without soft magnetic field interference may be when the electronic device is turned on, restarted, or the flight mode is turned off.

[0008] The target magnetic parameters may be the geomagnetic field parameters described in the embodiments of the present application.

[0009] In a possible implementation, the first compass and the second compass are located on two sides of the PCB.

[0010] When two compasses are arranged on one PCB, the design in other PCB boards can be kept unchanged to the greatest extent, resulting in minimal hardware changes.

[0011] In a possible implementation, the PCB includes a first PCB and a second PCB, the first PCB and the second PCB are connected via a frame board, the second compass is arranged in the first PCB, and the first compass is arranged in the second PCB.

[0012] Since multiple PCBs can usually be set in an electronic device, there is also a structure in which the two compasses are set on different PCBs respectively, so that the electronic device can realize flexible arrangement of the two compasses and allocate appropriate positions according to the actual device occupancy of the PCB.

[0013] In a possible implementation manner, the projection of the first compass in the vertical direction overlaps with the projection of the second compass in the vertical direction.

[0014] The overlapping projections can make the soft magnetic interference received by the first compass and the second compass almost the same.

[0015] In a second aspect, an embodiment of the present application provides a compass calibration method, which is applied to the electronic device described in the first aspect, and the method includes: the electronic device receives a first instruction for using the compass; in response to the first instruction, the electronic device obtains a first reading of a first compass and a second reading of a second compass, removes magnetic data generated by a soft magnetic field from the second reading, and obtains target magnetic parameters for calculating the orientation of the electronic device; wherein the soft magnetic field includes a magnetic field generated by a circuit in a PCB, and the magnetic data generated by the soft magnetic field is obtained based on the first reading and the reading of the first compass in the absence of interference from the soft magnetic field.

[0016] In this way, the electronic device can isolate the interference of the hard magnetic field on the second compass by setting magnetic isolation material on the outside of the second compass, and obtain the interference of the soft magnetic field by numerical calculation between the first reading and the reading of the first compass without the interference of the soft magnetic field, and remove the soft magnetic field interference in the second reading to obtain the target magnetic parameters that are not affected by the external environment, so that the electronic device can obtain a more accurate direction.

[0017] In one possible implementation, the first reading includes magnetic data generated by a hard magnetic field, and the second reading does not include magnetic data generated by a hard magnetic field. The hard magnetic field is a magnetic field generated by magnetized materials in the PCB and / or a magnetic field generated by magnetic materials in the PCB.

[0018] The electronic device can isolate the interference of the hard magnetic field on the second compass by setting up magnetic isolation materials. Since no magnetic isolation materials are set up on the outside of the first compass, the reading of the first compass can include magnetic data generated by the hard magnetic field.

[0019] In one possible implementation, before the electronic device obtains the first reading of the first compass and the second reading of the second compass, the method also includes: the electronic device receives a second instruction, where the second instruction is an instruction generated when any one of a power-on operation, a restart operation, or an airplane mode shut-down operation is detected; in response to the second instruction, the electronic device obtains a third reading of the first compass, where the reading of the first compass in the absence of soft magnetic field interference is obtained by subtracting the first reading from the third reading by the electronic device.

[0020] Since the electronic device is in an initialization state and cannot perform services such as calls and / or communications in the scenario of powering on, restarting, or turning off the airplane mode, it can be assumed that the electronic device does not have interference from a soft magnetic field in this scenario. The electronic device can then determine the soft magnetic interference parameter by the difference between the readings obtained by the first compass under the two instructions.

[0021] In one possible implementation, before removing the magnetic data generated by the soft magnetic field in the second reading, the method also includes: the electronic device performs scene recognition; when it is determined that the electronic device is in a target scene, the electronic device determines the magnetic data generated by the soft magnetic field corresponding to the target scene from the first corresponding relationship, and the target scene is at least one of the charging scene and / or the communication scene.

[0022] The electronic device can perform scene recognition. When it is determined that the current scene is in the target scene, it obtains magnetic data generated by the soft magnetic field from a preset first corresponding relationship. The soft magnetic interference parameters can be obtained by the electronic device through multiple tests. The electronic device can directly use the magnetic data generated by the soft magnetic field without the need for real-time calculation and acquisition.

[0023] In one possible implementation, the charging scenario includes: a charging scenario when the charging current satisfies a first numerical range, and / or a charging scenario when the battery voltage satisfies a second numerical range, and the communication scenario includes one or more of the following: a call scenario, a scenario when using mobile data, or a scenario when using WIFI.

[0024] In this way, the electronic device can determine the soft magnetic interference parameters corresponding to the target scene through the first corresponding relationship, and reduce the interference caused by the soft magnetic environment in the charging scene or the communication scene in the subsequent calculation process. When the target scene includes multiple scenes, multiple soft magnetic interference parameters can be obtained, and the final soft magnetic interference parameters can be obtained by accumulating the multiple soft magnetic interference parameters.

[0025] In a possible implementation, the soft magnetic field includes a magnetic field generated by a circuit in the PCB, including: the soft magnetic field includes a magnetic field generated by a circuit in the PCB whose current intensity is greater than a first threshold.

[0026] It can be understood that the soft magnetic field can generally be the magnetic field generated when the current intensity is large, and the magnetic field generated when the current intensity is large will have a greater impact on the compass.

[0027] In a possible implementation, an electronic device includes: a smart sensor hub, a target application, a sensor framework sensor FWK, and a sensor hardware abstraction module sensor HAL. The electronic device receives a first instruction for using a compass, including: the sensor hub receives the first instruction transmitted via the target application, the sensor FWK, and the sensor HAL; the electronic device obtains a first reading of a first compass and a second reading of a second compass, including: the sensor hub reads the first reading from a first compass driver, and the sensor hub reads the second reading from a second compass driver; the magnetic data generated by a soft magnetic field is removed from the second reading to obtain target magnetic parameters for calculating the orientation of the electronic device, including: the sensor hub removes the magnetic data generated by the soft magnetic field from the second reading to obtain the target magnetic parameters.

[0028] The electronic device can obtain the first reading and the second reading and calculate the target magnetic parameters by setting a sensor hub and utilizing the computing capability of the sensor hub and the capability of acquiring sensor parameters.

[0029] In a third aspect, an embodiment of the present application provides a compass calibration device, which includes a display unit and a processing unit. The display unit is used to process the steps of displaying data in the compass calibration device, and the processing unit is used to process the steps of processing data in the compass calibration device.

[0030] In a possible implementation, the compass calibration device may further include a storage unit. The storage unit may include one or more memories. The memory may be a device in one or more devices or circuits for storing programs or data.

[0031] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, the memory being used to store code instructions; the processor being used to run the code instructions so that the electronic device executes the method described in the second aspect or any one of the implementations of the second aspect.

[0032] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores instructions. When the instructions are executed, the computer executes the method described in the second aspect or any one of the implementations of the second aspect.

[0033] In a sixth aspect, a computer program product comprises a computer program, and when the computer program is executed, the computer executes the method as described in the second aspect or any one of the implementations of the second aspect.

[0034] It should be understood that the third to sixth aspects of the present application correspond to the technical solutions of the first and second aspects of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 A schematic diagram of a scenario provided for an embodiment of the present application;

[0036] Figure 2 A schematic diagram of the structure of a printed circuit board provided in an embodiment of the present application;

[0037] Figure 3 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0038] Figure 4 A schematic diagram of the software structure of an electronic device provided in an embodiment of the present application;

[0039] Figure 5 A schematic diagram of the configuration of a compass provided in an embodiment of the present application;

[0040] Figure 6 A schematic diagram of another compass configuration provided in an embodiment of the present application;

[0041] Figure 7 A schematic diagram of another compass configuration provided in an embodiment of the present application;

[0042] Figure 8 A schematic diagram of module interaction of a compass calibration method provided in an embodiment of the present application;

[0043] Fig. 9 A schematic diagram of the relationship between battery voltage and charging current in a charging scenario provided in an embodiment of the present application;

[0044] Fig.10 A circuit diagram provided for an embodiment of the present application;

[0045] Fig.11 A schematic diagram of the structure of a compass calibration device provided in an embodiment of the present application;

[0046] Fig.12 A schematic diagram of the hardware structure of another electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0047] In order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish between identical or similar items with substantially the same functions and effects. For example, the first value and the second value are only used to distinguish different values, and their order is not limited. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.

[0048] It should be noted that, in this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0049] In the present application, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, a and b, a and c, b and c, or a, b and c, where a, b, c can be single or multiple.

[0050] For example, Figure 1 A schematic diagram of a scenario provided in an embodiment of the present application. Figure 1 In the corresponding embodiments, an example is given in which the electronic device is a mobile phone and the application using the compass is a compass application. This example does not constitute a limitation on the embodiments of the present application.

[0051] When the electronic device detects that the user has opened the compass application, it can detect the orientation of the electronic device through the compass and the position of the electronic device through the global positioning system (GPS) technology, and then display the following information: Figure 1 The interface shown.

[0052] like Figure 1 As shown, the interface may be a compass interface, which may display the orientation of the electronic device, for example, the electronic device is at 0° north, and the position of the electronic device, for example, the electronic device is at 30°X′X″ north latitude, 108°X′X″ east longitude. A compass icon may also be displayed in the interface, and the compass icon indicates that the electronic device is at 0° north.

[0053] Generally, when the compass is affected by the environment in which the electronic device is located, the compass direction may deviate. Figure 1 The interface shown shows that the compass is at 21° north. After being affected by the environment, the compass has an error. At this time, the electronic device is Figure 1 The interface shown shows a direction of 0° North.

[0054] Among them, the environmental influences on the compass may include hard magnetic interference and soft magnetic interference.

[0055] Hard magnetic interference mainly includes the magnetic field generated by easily magnetized materials in electronic equipment and the magnetic field generated by magnetic materials. Among them, easily magnetized materials can include: steel sheets in printed circuit boards (PCBs), and magnetic materials can include: magnets in PCBs.

[0056] Soft magnetic interference mainly includes magnetic field interference generated by large currents in PCB, such as ground return and other circuit currents in PCB when electronic equipment is performing certain tasks (such as charging or communication). Among them, large current can be circuit current with current intensity greater than a certain threshold.

[0057] For example, Figure 2 A schematic diagram of the structure of a printed circuit board provided in an embodiment of the present application. Figure 2 As shown, a printed circuit board (PCB) may be provided in the electronic device, and various devices required for the electronic device may be provided in the PCB. For example, a battery 200, a compass 201, a reflow point 202, a reflow point 203, a reflow point 204, and other devices in the PCB may be provided in the PCB.

[0058] During the use of the electronic device, the battery 200, any device in the PCB and any return point can form a path. For example, the current can flow from the battery 200 to other devices and further flow to any return point to form a current path. The current path constitutes a ground return in the PCB.

[0059] Understandably, Figure 2The PCB structure provided is only an example and does not constitute a limitation on the embodiments of the present application.

[0060] In view of this, an embodiment of the present application provides a compass calibration method, by setting a first compass and a second compass in a PCB, and wrapping the second compass with magnetic isolation material. The electronic device can reduce the interference of the hard magnetic field in the electronic device on the second compass through the design of the magnetic isolation material, obtain the reading of the first compass and the reading of the second compass, remove the magnetic data generated by the soft magnetic field from the second compass, calculate more accurate target magnetic parameters, and derive the orientation of the electronic device.

[0061] Among them, the target magnetic parameters can be the geomagnetic field parameters described in the embodiments of the present application.

[0062] It is understandable that the above electronic devices may also be referred to as terminals, user equipment (UE), mobile stations (MS), mobile terminals (MT), etc. The electronic devices may be mobile phones with touch screens, smart TVs, wearable devices, tablet computers (Pad), computers with wireless transceiver functions, virtual reality (VR) electronic devices, augmented reality (AR) electronic devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, etc. The embodiments of the present application do not limit the specific technologies and specific device forms used by the electronic devices.

[0063] Therefore, in order to better understand the embodiments of the present application, the structure of the electronic device of the embodiments of the present application is introduced below. Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0064] The electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, an indicator 192, a camera 193, and a display screen 194, etc.

[0065] The sensor module 180 may include a first compass and a second compass. A compass is a device for measuring the orientation of an electronic device. In the embodiment of the present application, the electronic device may measure the direction and strength of the earth's magnetic field (or geomagnetic field for short) through the readings of the first compass and the second compass, thereby determining the orientation of the electronic device.

[0066] The first compass or the second compass described in the embodiments of the present application are both electronic compasses. The electronic compass may also be called a magnetometer or a magnetic sensor, which is not limited in the embodiments of the present application.

[0067] In a possible implementation, the sensor module 180 may also include one or more of the following: a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, or a bone conduction sensor, etc., which is not specifically limited in the embodiments of the present application ( Figure 3 not shown).

[0068] It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0069] The processor 110 may include one or more processing units. Different processing units may be independent devices or integrated into one or more processors. A memory may also be provided in the processor 110 for storing instructions and data. The processor 110 may include a control unit described in the embodiment of the present application. The processor 110 may realize the acquisition of the compass reading and the calculation of the position of the electronic device.

[0070] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge an electronic device, and can also be used to transfer data between an electronic device and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.

[0071] The charging management module 140 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. The power management module 141 is used to power the control unit, the first compass, and the second compass provided in the embodiment of the present application.

[0072] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor.

[0073] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Antennas in electronic devices can be used to cover single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas.

[0074] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to electronic devices. The mobile communication module 150 can receive electromagnetic waves through the antenna 1 .

[0075] The wireless communication module 160 can provide wireless communication solutions for electronic devices, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), etc.

[0076] The electronic device realizes the display function through a GPU, a display screen 194, and an application processor.

[0077] The display screen 194 is used to display images, videos, etc. For example, the display screen 194 can be used to display Figure 1 The interface shown or the interface in the display navigation application.

[0078] The electronic device can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0079] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The internal memory 121 can be used to store computer executable program codes, which include instructions.

[0080] The electronic device can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0081] The buttons 190 include a power button, a volume button, etc. The electronic device can receive the button input and generate a key signal input related to the user settings and function control of the electronic device. For example, the electronic device can read the compass reading, such as reading the third reading of the first compass, when detecting that the user triggers the power button.

[0082] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0083] The software system of the electronic device can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a microservice architecture, or a cloud architecture, etc., which will not be elaborated here.

[0084] For example, Figure 4 A schematic diagram of the software structure of an electronic device provided in an embodiment of the present application.

[0085] like Figure 4 As shown, the layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into multiple layers, from top to bottom, including the application (APP) layer, the application framework (FWK) layer, the hardware abstraction layer (HAL), and the driver layer, etc., which are not limited in the embodiments of the present application.

[0086] The application layer may include a series of application packages. The application layer may include one or more of the following applications, such as a compass application, a navigation application, or a Bluetooth application, which is not limited in the embodiments of the present application.

[0087] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined interfaces. The application framework layer may include one or more of the following: scene recognition module, sensor FWK, or display synthesizer (surface flinger, SF), etc.

[0088] The scene recognition module is used to recognize the charging scene or communication scene of the electronic device.

[0089] Sensor FWK is a module that processes sensor data at the application framework layer. Sensor FWK can convert the geomagnetic field parameters reported by sensor HAL into the orientation of the electronic device.

[0090] The main function of the display compositor is to receive graphics data buffers from multiple sources, composite them into layers, and then send them to other modules that process the layers.

[0091] In a possible implementation, the application framework layer may further include one or more of the following: a window manager, a content provider, a resource manager, a view system, or a notification manager, etc.

[0092] The purpose of the hardware abstraction layer is to abstract the hardware, and can provide a unified interface for querying hardware devices for upper-layer applications, or can also provide data storage services for upper-layer applications. The hardware abstraction layer can include: sensorHAL, and hardware composer (HWC).

[0093] Sensor HAL is a module that processes sensor data at the HAL layer. Sensor HAL can transmit the geomagnetic field parameters driven by the smart sensor hub to the sensor FWK.

[0094] The hardware editor mainly provides hardware support for the display synthesizer, such as supporting layer processing and other functions.

[0095] The driver layer is the layer between hardware and software. The driver layer is used to drive the hardware to make it work. The driver layer may include one or more of the following: sensor hub driver, display driver, or sensor driver.

[0096] The sensor hub driver may include: a first compass driver and a second compass driver. The first compass driver is used to transmit the reading of the first compass to the sensor hub driver, and the second compass driver is used to transmit the reading of the second compass to the sensor hub driver.

[0097] In a possible implementation, the first compass driver and the second compass driver may also be independently provided in the driver layer or in other modules of the driver layer, which is not limited in the embodiments of the present application.

[0098] The sensor hub driver is a module that processes sensor data at the driver layer. The sensor hub can determine the geomagnetic field parameters using the readings of the first compass and the second compass, and can also determine the soft magnetic interference parameters based on the scene information identified by the scene recognition module.

[0099] In a possible implementation, the electronic device may also include a hardware layer ( Figure 4 The hardware layer may include one or more of the following: a first compass, a second compass, a camera, a liquid crystal display (LCD), and other hardware.

[0100] In the embodiments of the present application, no specific limitation is imposed on the software layers involved in the software architecture, the modules contained in the layers, and the functions of the modules.

[0101] The following specific embodiments are used to describe in detail the technical solution of the present application and how the technical solution of the present application solves the above technical problems. The following specific embodiments can be implemented independently or in combination with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0102] A compass calibration method provided in an embodiment of the present application can be applied to an electronic device including two compasses, and the two compasses can be arranged on a PCB of the electronic device.

[0103] When two compasses are set on one PCB in an electronic device, the setting method of the two compasses can be referred to Figure 5 In the corresponding embodiment, when the electronic device includes two PCBs, the arrangement of the two compasses can refer to Figure 6 as well as Figure 7 The corresponding embodiments.

[0104] The first compass or the second compass can be set in the PCB by surface mounting technology (SMT) or pasting, etc., which is not limited in the embodiments of the present application.

[0105] In one implementation, Figure 5 A schematic diagram of the setting of a compass provided in an embodiment of the present application.

[0106] like Figure 5 As shown, a PCB, or referred to as a first PCB, may be provided in the electronic device, and a first compass and a second compass may be provided in the first PCB.

[0107] The first compass is set at the top of the first PCB, and the second compass is set at the bottom of the first PCB. The orientation of the first compass and the orientation of the second compass can be opposite, for example, the first compass can be set at the top of the first PCB facing upward, and the second compass can be set at the bottom of the first PCB facing downward.

[0108] The outer side of the second compass that is not attached to the first PCB is wrapped with magnetic isolation material. For example, the magnetic isolation material can be arranged on three surfaces of the second compass.

[0109] The projection of the first compass in the direction perpendicular to the first PCB overlaps with the projection of the second compass in the direction perpendicular to the first PCB. In this way, the overlapping projections can make the soft magnetic interference received by the first compass and the second compass almost the same, the geomagnetic field parameters in the reading of the first compass are opposite to the geomagnetic field parameters in the reading of the second compass in the Z-axis direction, and the two geomagnetic field parameters have the same values ​​in the X-axis and Y-axis directions, and then the geomagnetic field parameters can be offset by the two compass readings to obtain the hard magnetic interference parameters.

[0110] Since the first compass and the second compass are respectively arranged on two sides of the first PCB, the orientation of the first compass in the vertical direction (or Z-axis direction) is opposite to the orientation of the second compass in the vertical direction.

[0111] In this scenario, taking the plane where the first PCB is located as a plane formed by the X-axis and the Y-axis as an example, when the reading of the first compass can be (MagX1, MagY1, MagZ1), the reading of the geomagnetic field parameter in the first compass can be (MagX11, MagY11, MagZ11), the reading of the second compass can be (MagX2, MagY2, -MagZ2), and the reading of the geomagnetic field parameter in the second compass can be (MagX11, MagY11, -MagZ11). Wherein, MagZ11 and MagZ2 can both be positive numbers greater than 0.

[0112] The magnetic isolation material is used to isolate the magnetic field in a hard magnetic environment (such as a strong magnetic field environment such as a steel sheet or magnet in an electronic device) from interfering with the second compass. The magnetic isolation material can be 444 stainless steel or 316 stainless steel.

[0113] Among them, the principle of magnetic isolation materials isolating magnetic fields can be: magnetic isolation materials can achieve the isolation and conduction of magnetic fields. The magnetic field is generated by the current inside the object or naturally generated by the object, and has a certain influence on the surrounding objects. Magnetic isolation materials can usually be made of materials that are not easily magnetized, such as iron, cobalt, and nickel. These materials have high magnetic permeability and can absorb and conduct energy in the magnetic field, thereby weakening the strength of the magnetic field. When the magnetic field encounters magnetic isolation materials, the magnetic lines of force therein will be conducted through the magnetic isolation materials. Due to the magnetic permeability of the magnetic isolation materials, the strength of the magnetic field will be weakened. In this way, the magnetic isolation material plays a role in isolating the magnetic field, so that the magnetic field will not continue to propagate outward.

[0114] Combination Figure 5 In the corresponding embodiment, the readings of the first compass and the second compass are respectively:

[0115] The reading of the first compass = geomagnetic field parameter + hard magnetic interference parameter + soft magnetic interference parameter

[0116] Second compass reading = geomagnetic field parameters + soft magnetic interference parameters

[0117] The reading of the first compass is (MagX1, MagY1, MagZ1), the reading of the second compass is (MagX2, MagY2, -MagZ2), and the hard magnetic interference parameters can be (MagX1-MagX2, MagY1-MagY2, MagZ1-(-(-MagZ2))).

[0118] The soft magnetic interference parameter may be obtained by the electronic device based on the reading of the first compass and the reading of the first compass without soft magnetic interference (for example, the reading obtained when the device is turned on, restarted, or the flight mode is turned off), or the soft magnetic interference parameter may be obtained by the electronic device in a preset first corresponding relationship, for details, see Figure 8 The corresponding embodiments.

[0119] Based on this, the electronic device can obtain the geomagnetic field parameters by removing the soft magnetic interference parameters and the hard magnetic interference parameters from the reading of the first compass, or obtain the geomagnetic field parameters by removing the soft magnetic interference parameters from the reading of the second compass. This is not limited in the embodiments of the present application.

[0120] In this way, electronic equipment can isolate the interference of hard magnetic field on electronic equipment by utilizing the magnetic isolation material on the outside of the second compass, and remove the interference of soft magnetic field on electronic equipment by calculating soft magnetic interference parameters, thereby obtaining geomagnetic field parameters that are closer to the real geomagnetic field.

[0121] In another implementation, Figure 6 A schematic diagram of another compass setting provided in an embodiment of the present application.

[0122] like Figure 6 As shown, two PCBs may be provided in the electronic device, for example, a first PCB and a second PCB. The first PCB and the second PCB may be connected via a frame board. The first PCB, the second PCB and the frame board may constitute a multi-layer PCB (or sandwich board) structure.

[0123] The second compass may be provided in the first PCB, and the first compass may be provided in the second PCB.

[0124] The second compass is set at the top of the first PCB, and the first compass is set at the top of the second PCB. The orientation of the first compass and the orientation of the second compass can be the same, for example, the first compass can be set on the top of the second PCB facing up, and the second compass can be set on the top of the first PCB facing up.

[0125] The second compass is not attached to the outer side of the first PCB and is wrapped with magnetic isolation material.

[0126] The first PCB and the second PCB can be parallel, and the projection of the first compass in a direction perpendicular to the first PCB overlaps with the projection of the second compass in a direction perpendicular to the first PCB. In this way, the overlapping projections can make the soft magnetic interference received by the first compass and the second compass almost the same, and the geomagnetic field parameters in the reading of the first compass are the same as the geomagnetic field parameters in the reading of the second compass, and then the geomagnetic field parameters can be offset by the two compass readings to obtain the hard magnetic interference parameters.

[0127] In this scenario, taking the plane where the first PCB is located as a plane composed of the X-axis and the Y-axis as an example, when the reading of the first compass can be (MagX3, MagY3, MagZ3), the reading of the geomagnetic field parameter in the first compass can be (MagX31, MagY31, MagZ31), the reading of the second compass can be (MagX4, MagY4, MagZ4), and the reading of the geomagnetic field parameter in the second compass can be (MagX31, MagY31, MagZ31). Among them, MagZ4 can be a positive number greater than 0.

[0128] Combination Figure 6 In the corresponding embodiment, the readings of the first compass and the second compass are respectively:

[0129] The reading of the first compass = geomagnetic field parameter + hard magnetic interference parameter + soft magnetic interference parameter

[0130] Second compass reading = geomagnetic field parameters + soft magnetic interference parameters

[0131] The reading of the first compass is (MagX3, MagY3, MagZ3), the reading of the second compass is (MagX4, MagY4, MagZ4), and the hard magnetic interference parameters can be (MagX3-MagX4, MagY3-MagY4, MagZ3-MagZ4).

[0132] The calculation methods of soft magnetic interference parameters and geomagnetic field parameters can be found in Figure 5 The description in the corresponding embodiments will not be repeated here.

[0133] In another implementation, Figure 7 A schematic diagram of the setting of another compass provided in an embodiment of the present application.

[0134] like Figure 7 As shown, the electronic device may include two PCBs, for example, a first PCB and a second PCB, and the first PCB and the second PCB may be connected via a frame board.

[0135] The first PCB may be provided with a second compass, the second PCB may be provided with the first compass, and magnetic isolation material may be provided around the second compass.

[0136] The second compass is set at the top of the first PCB, and the first compass is set at the bottom of the second PCB. The orientation of the first compass and the orientation of the second compass can be opposite, for example, the first compass can be set at the bottom of the second PCB facing downward, and the second compass can be set at the top of the first PCB facing upward.

[0137] The second compass is not attached to the outer side of the first PCB and is wrapped with magnetic isolation material.

[0138] The first PCB and the second PCB can be parallel, and the projection of the first compass in a direction perpendicular to the first PCB overlaps with the projection of the second compass in a direction perpendicular to the first PCB. In this way, the overlapping projections can make the soft magnetic interference received by the first compass and the second compass almost the same, and the geomagnetic field parameters in the reading of the first compass are opposite to the geomagnetic field parameters in the reading of the second compass in the Z-axis direction, and the two geomagnetic field parameters have the same values ​​in the X-axis and Y-axis directions, and then the geomagnetic field parameters can be offset by the two compass readings to obtain the hard magnetic interference parameters.

[0139] In this scenario, taking the plane where the first PCB is located as a plane composed of the X-axis and the Y-axis as an example, when the reading of the first compass can be (MagX5, MagY5, -MagZ5), the reading of the geomagnetic field parameter in the first compass can be (MagX51, MagY51, -MagZ51), the reading of the second compass can be (MagX6, MagY6, MagZ6), and the reading of the geomagnetic field parameter in the second compass can be (MagX51, MagY51, MagZ51). Among them, MagZ5 can be a positive number greater than 0.

[0140] It can be understood that the compass calibration method provided in the embodiment of the present application may not be limited to one or two PCBs in the electronic device. When the electronic device includes multiple PCBs, the setting of two compasses in the multiple PCBs can be implemented in more ways, which is not limited in the embodiment of the present application.

[0141] Combination Figure 6 In the corresponding embodiment, the readings of the first compass and the second compass are respectively:

[0142] The reading of the first compass = geomagnetic field parameter + hard magnetic interference parameter + soft magnetic interference parameter

[0143] Second compass reading = geomagnetic field parameters + soft magnetic interference parameters

[0144] The reading of the first compass is (MagX5, MagY5, -MagZ5), the reading of the second compass is (MagX6, MagY6, MagZ6), and the hard magnetic interference parameters can be (MagX5-MagX6, MagY5-MagY6, -MagZ3-(-MagZ6)).

[0145] The calculation methods of soft magnetic interference parameters and geomagnetic field parameters can be found in Figure 5 The description in the corresponding embodiments will not be repeated here.

[0146] It is understandable that, combined with Figure 6 The corresponding embodiments and Figure 7 In the corresponding embodiment, when the second PCB is set on the first PCB, the advantage of setting the second compass on the first PCB and the first compass on the second PCB is: since magnetic isolation material is set on the outside of the second compass, the second compass can be set on the first PCB, and the structure of the two PCBs and the setting of the frame board will not affect the reading of the second compass; if the first compass is set in the first PCB and the second compass is set in the second PCB, the reading of the first compass may be affected by the positions of the two PCB boards, resulting in inaccurate reading of the first compass.

[0147] exist Figure 5 (or Figure 6 Or 7) on the basis of the corresponding embodiment, the electronic device can construct a second compass without hard magnetic field interference by setting up the first compass, the second compass, and the magnetic isolation material outside the second compass.

[0148] The electronic device can determine the hard magnetic interference parameter based on the difference between the reading of the first compass and the reading of the second compass. The electronic device can pre-set the first corresponding relationship, and when the scene information of the electronic device is determined by scene recognition, the soft magnetic interference parameter matching the scene information is obtained from the first corresponding relationship, or the electronic device can also determine the soft magnetic interference parameter based on the difference between the reading of the first compass and the reading of the first compass without soft magnetic interference. Then, when the soft magnetic interference parameter and the hard magnetic interference parameter are obtained, the electronic device can calculate the geomagnetic field parameter.

[0149] For example, Figure 8 A schematic diagram of module interaction of a compass calibration method provided in an embodiment of the present application. Figure 8 In a corresponding embodiment, the electronic device may be provided with: a target application, a sensor FWK, a scene recognition module, a sensor HAL, and a sensor hub driver, and the sensor hub driver may include: a first compass driver and a second compass driver.

[0150] like Figure 8 As shown, the compass calibration method may include the following steps:

[0151] S801. In response to a first instruction, the target application sends a message to the sensor FWK for instructing to use a compass.

[0152] The target application may be an application that uses a compass, such as a compass application, a navigation application, or a social application with a positioning function, etc., which is not limited in the embodiments of the present application.

[0153] The first instruction may include one or more of the following, for example: the first instruction may be an instruction generated when the user opens a compass application or a navigation application, or the first instruction may be an instruction generated when the user opens a location positioning function or a navigation function in other applications such as social applications, or the first instruction may be an instruction periodically generated by a target application. The electronic device may initiate the first instruction and execute the steps shown in S802-S817 to calibrate the compass, so that the compass can more accurately detect the geomagnetic field parameters when used, thereby improving the accuracy of positioning.

[0154] S802: The sensor FWK sends a message to the sensor HAL for instructing the use of the compass.

[0155] S803: The sensor HAL sends a message to the sensor hub driver to instruct the use of the compass.

[0156] S804: The sensor hub driver sends a message for instructing the first compass driver to use the compass.

[0157] Exemplarily, the sensor hub driver may execute the steps shown in S804 and S806 simultaneously, or may execute the steps shown in S804 and S806 sequentially, which is not limited in the embodiments of the present application.

[0158] S805: The first compass driver returns the reading of the first compass to the sensor hub driver.

[0159] The first compass reading (or referred to as the first reading) may include: geomagnetic field parameters, hard magnetic interference parameters, and soft magnetic interference parameters.

[0160] S806: The sensor hub driver sends a message for instructing the second compass driver to use the compass.

[0161] S807: The second compass driver sends the reading of the second compass to the sensor hub driver.

[0162] The second compass reading (or referred to as the second reading) may include: geomagnetic field parameters and soft magnetic interference parameters.

[0163] After obtaining the reading of the first compass and the reading of the second compass, the sensor hub may determine the hard magnetic interference parameter through S808 and / or determine the soft magnetic interference parameter through S809-S813.

[0164] S808. The sensor hub driver uses the readings of the first compass and the second compass to determine hard magnetic interference parameters.

[0165] Exemplarily, when the sensor hub driver obtains the reading of the first compass and the reading of the second compass, the sensor hub driver may simultaneously execute steps S808 and S809, or may first execute S808 and then execute step S809, which is not limited in the embodiments of the present application.

[0166] The sensor hub driver uses the readings of the first compass and the second compass to determine the hard magnetic interference parameters. Figure 5-Figure 7 The description in the corresponding embodiments will not be repeated here.

[0167] In a possible implementation, in order to make the hard magnetic interference parameters more accurate, the sensor hub driver can also calculate the hard magnetic interference parameters in the absence of soft magnetic interference. For example, the hard magnetic interference parameters are calculated in scenarios where the user is not using a phone and / or mobile data (and / or WIFI). In this scenario, the reading of the first compass may include: geomagnetic field parameters and hard magnetic interference parameters, and the reading of the second compass may include geomagnetic field parameters.

[0168] In one implementation, the electronic device can determine the hard magnetic interference parameter by the difference between the reading of the first compass and the reading of the second compass during the booting process (or restarting, or turning off the airplane mode). Since the electronic device does not use the phone function, mobile data, or WIFI during the booting process (or restarting, or turning off the airplane mode), it can be assumed that the electronic device does not have soft magnetic interference for a period of time during the booting process.

[0169] In another implementation, the electronic device may also initiate a prompt message in the interface for using the compass to prompt the user not to use the phone function, mobile data, or WIFI temporarily. After the user confirms the prompt message, the electronic device may determine that there is no soft magnetic interference parameter at present, and calculate the hard magnetic interference parameter based on the reading of the first compass and the reading of the second compass.

[0170] S809: The sensor hub driver sends a message for obtaining scene information to the sensor HAL.

[0171] S810. The sensor HAL sends a message for acquiring scene information to the scene recognition module.

[0172] S811. The scene recognition module sends scene information to the sensor HAL.

[0173] The scene information may include an identifier for uniquely identifying the scene in which the electronic device is located, and the identifier may be any character.

[0174] In response to a message for acquiring scene information, the scene recognition module can identify the scene in which the electronic device is currently located. For example, when the electronic device detects that it is charging, it can be determined that the electronic device is in a charging scene; or, when the electronic device detects that it is in a call state (such as a 2G call, a 4G call, or a 5G call), using mobile data (4G mobile data, 5G mobile data), or using WIFI, etc., it can be determined that the electronic device is in a communication scene (or it can also be called a high-power RF scene), and then the scene recognition module can return the identified scene information to the sensor hub driver through the steps shown in S809-S810.

[0175] S812, sensor HAL sends scene information to the sensor hub driver.

[0176] S813: When there is a target scene in the scene information, the sensor hub drives and determines soft magnetic interference parameters corresponding to the target scene.

[0177] The target scenario may include: a charging scenario and / or a communication scenario. For example, the charging scenario includes: a charging scenario when the charging current meets the first value range, and / or a charging scenario when the battery voltage meets the second value range, and the communication scenario includes one or more of the following: a call scenario, a scenario when using mobile data, or a scenario when using WIFI.

[0178] In a possible implementation, when the target scene does not exist in the scene information, the electronic device can determine that there is no soft magnetic field at present. The electronic device can directly obtain the geomagnetic field parameters by using the reading of the second compass, or by subtracting the hard magnetic interference parameters from the reading of the first compass, and then execute the steps shown in S815-S818.

[0179] The sensor hub driver can obtain a first corresponding relationship, which may include a corresponding relationship between a target scene and a soft magnetic interference parameter. The soft magnetic interference parameter corresponding to any scene can be obtained by performing multiple tests on the electronic device in the scene.

[0180] The first correspondence relationship can be pre-stored in the electronic device. For example, the first correspondence relationship can be stored in the memory and called from the memory when the sensor hub driver determines to use it; or the first correspondence relationship can also be pre-configured in the sensor hub driver to facilitate the sensor hub driver to use it at any time, which is not limited in the embodiments of the present application.

[0181] Since different battery voltages can correspond to different charging currents in the charging scenario, and different charging currents (or battery voltages) can correspond to different soft magnetic interferences, the electronic device can configure different soft magnetic interference parameters for different battery voltages (or charging currents), or configure different soft magnetic interference parameters for battery voltages (or charging currents) in different parameter ranges (see the corresponding embodiment of Table 1).

[0182] For example, Fig. 9 A schematic diagram of the relationship between battery voltage and charging current in a charging scenario provided by an embodiment of the present application. Fig. 9 As shown, the battery voltage can vary from 0 to V4, and the charging current can vary from 0 to A5. As the battery voltage increases, the charging current gradually decreases, that is, charging current = a × battery voltage2 , a is a constant.

[0183] Table 1 Schematic table of the first corresponding relationship

[0184] Target scenario Soft magnetic interference parameters Communication Scenario A0 Communication scenario 1 (the scenario of a 2G call) A1 Communication scenario 2 (the scenario of a 4G call) A2 Communication scenario 3 (the scenario of a 5G call) A3 Communication scenario 4 (scenario when using 4G mobile data) A4 Communication scenario 5 (scenario when using 5G mobile data) A5 Communication scenario 6 (scenario when using WIFI) A6 Charging scenario 1 (battery voltage is 0-V1, and / or charging current is A4-A5) B1 Charging scenario 2 (battery voltage is V1-V2, and / or charging current is A3-A4) B2 Charging scenario 3 (battery voltage is V2-V3, and / or charging current is A2-A3) B3 Charging scenario 4 (battery voltage is V3-V4, and / or charging current is A1-A2) B4 Charging scenario 5 (battery voltage is greater than V4, and / or charging current is less than A1) B5

[0185] As shown in Table 1, the electronic device may match a soft magnetic interference parameter A0 when the electronic device is in a communication scenario, or may match different soft magnetic interference parameters A1-A6 when the electronic device is in more subdivided scenarios in the communication scenario.

[0186] In the charging scenario, B1 is greater than B2, B2 is greater than B3, B3 is greater than B4, and B5 is greater than B4. That is, the greater the charging current, the greater the soft magnetic interference generated by the electronic device.

[0187] Based on this, the electronic device can determine the soft magnetic interference parameters corresponding to the target scene through the first corresponding relationship, and reduce the interference caused by the soft magnetic environment in the charging scene or the communication scene in the subsequent calculation process. When the target scene includes multiple scenes, multiple soft magnetic interference parameters can be obtained, and the final soft magnetic interference parameters can be obtained by accumulating the multiple soft magnetic interference parameters.

[0188] It is understandable that the embodiments of the present application do not specifically limit the soft magnetic interference parameters in different scenarios in Table 1 and the value range of the battery voltage (or charging current) in the charging scenario.

[0189] In a possible implementation, when the sensor hub driver can determine the soft magnetic interference parameters through the first correspondence based on the steps shown in S809-S813, or when the sensor hub driver obtains the reading of the first compass, the reading of the second compass and the hard magnetic interference parameters, S813 can also be replaced by the sensor hub driver calculating the soft magnetic interference parameters in real time.

[0190] Exemplarily, the electronic device can calculate the soft magnetic interference parameter by readings of the first compass at two moments when determining the hard magnetic interference parameter.

[0191] For example, before S801, the compass application can obtain the first compass reading when it detects that the electronic device is turned on. The first compass reading can be called the compass reading at the first moment (or the third reading). As described in S809, it can be assumed that there is no soft magnetic interference in the electronic device during a period of power-on, so the compass reading at the first moment can include hard magnetic interference parameters and geomagnetic field parameters. The first compass reading obtained when the compass application is opened (such as the first compass reading described in S805) can be called the compass reading at the second moment. The electronic device can use the compass reading at the second moment to subtract the compass reading at the first moment to obtain the soft magnetic interference parameters in the current scene.

[0192] It is understandable that since no magnetic isolation material is required around the first compass, the first compass is almost completely exposed to the outside, and the first compass receives more magnetic field interference. The hard magnetic interference parameters and geomagnetic field parameters contained in the compass reading at the first moment obtained in the absence of soft magnetic interference are more accurate. Therefore, the soft magnetic interference parameters calculated using the two first compass readings at two moments are also more accurate.

[0193] S814. The sensor hub driver calculates geomagnetic field parameters using the reading of the first compass, the reading of the second compass, the soft magnetic interference parameters, and the hard magnetic interference parameters.

[0194] Geomagnetic field parameters = first compass reading - hard magnetic interference parameters - soft magnetic interference parameters

[0195] Or, geomagnetic field parameter = second compass reading - soft magnetic interference parameter

[0196] In the scenario where the geomagnetic field parameters are determined by reading the second compass and the soft magnetic interference parameters, the electronic device may not execute the step shown in S808.

[0197] S815, sensor hub driver sends geomagnetic field parameters to sensor HAL.

[0198] S816. Sensor HAL sends geomagnetic field parameters to sensor FWK.

[0199] S817, sensor FWK converts the geomagnetic field parameters into the position of the electronic device.

[0200] For example, the electronic device can calculate the location of the electronic device to be 21° north by converting the geomagnetic field parameters.

[0201] S818. The sensor FWK sends the location of the electronic device to the target application.

[0202] After the target application receives the location of the electronic device, the electronic device can directly display the location of the electronic device in the interface (for example, display Figure 1 Alternatively, the target application may also display a direction indicator in the interface according to the orientation of the electronic device (eg, an arrow indicating the orientation of the electronic device).

[0203] Based on this, an embodiment of the present application provides a compass calibration method. By setting a first compass and a second compass in a PCB, and wrapping the second compass with magnetic isolation material, the electronic device can reduce the interference of hard magnetic fields in the electronic device on the second compass through the design of magnetic isolation material, obtain the reading of the first compass and the reading of the second compass, remove the magnetic data generated by the soft magnetic field from the second compass, calculate more accurate target magnetic parameters, and derive the orientation of the electronic device.

[0204] exist Figure 5-Figure 9 Based on the corresponding embodiments, Fig.10 A circuit diagram provided in an embodiment of the present application. Fig.10 As shown, the electronic device may include: a power supply unit, a control unit, a first compass, and a second compass. The control unit and the first compass, as well as the control unit and the second compass can be connected via I2C (interintegrated circuit), and the power supply unit supplies power to the control unit, the first compass, and the second compass.

[0205] The power supply unit may be a power management unit (PMU), and the power supply unit may provide 1.8V power supply for the circuit.

[0206] The control unit may be a system on chip (SOC) control unit for determining the geomagnetic field parameters according to the readings of the first compass and the second compass, and further calculating the position of the electronic device.

[0207] The first compass and the second compass are used to provide compass readings.

[0208] Combined with the above Figure 4-Figure 10 , the method provided in the embodiment of the present application is described, and the device for executing the above method provided in the embodiment of the present application is described below. Fig.11 As shown, Fig.11 A schematic diagram of the structure of a compass calibration device provided in an embodiment of the present application. The compass calibration device may be the electronic device in the embodiment of the present application, or may be a chip or chip system in the electronic device.

[0209] like Fig.11 As shown, the compass calibration device 1100 can be used in a communication device, a circuit, a hardware component or a chip, and the compass calibration device 1100 includes: a display unit 1101 and a processing unit 1102. The display unit 1101 is used to support the display step performed by the compass calibration method; the processing unit 1102 is used to support the compass calibration device 1100 to perform the information processing step.

[0210] In a possible implementation, the compass calibration device 1100 may further include a communication unit 1103, and the communication unit 1103 is used to support the compass calibration device 1100 to perform steps such as receiving or sending a message.

[0211] The compass calibration devices described in the embodiments of the present application may include Fig.11 The units described in the corresponding embodiments.

[0212] Specifically, the processing unit 1102 and the display unit 1101 may be integrated together, and the processing unit 1102 and the display unit 1101 may communicate with each other.

[0213] In a possible implementation, the compass calibration device 1100 may further include: a storage unit 1104. The storage unit 1104 may include one or more memories, and the memory may be a device in one or more devices or circuits for storing programs or data.

[0214] The storage unit 1104 may exist independently and be connected to the processing unit 1102 via a communication bus. The storage unit 1104 may also be integrated with the processing unit 1102.

[0215] Taking the compass calibration device 1100 as an example, which can be a chip or chip system of the electronic device in the embodiment of the present application, the storage unit 1104 can store computer execution instructions of the method of the electronic device, so that the processing unit 1102 executes the method of the electronic device in the above embodiment. The storage unit 1104 can be a register, a cache or a random access memory (RAM), etc. The storage unit 1104 can be integrated with the processing unit 1102. The storage unit 1104 can be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, and the storage unit 1104 can be independent of the processing unit 1102.

[0216] In a possible implementation, the compass calibration device 1100 may further include: a communication unit 1103. The communication unit 1103 is used to support the compass calibration device 1100 to interact with other devices. Exemplarily, when the compass calibration device 1100 is an electronic device, the communication unit 1103 may be a communication interface or an interface circuit. When the compass calibration device 1100 is a chip or a chip system in an electronic device, the communication unit 1103 may be a communication interface. For example, the communication interface may be an input / output interface, a pin or a circuit, etc.

[0217] The device of this embodiment can be used to execute the steps executed in the above method embodiment. Its implementation principle and technical effects are similar and will not be described in detail here.

[0218] Fig.12 A schematic diagram of the hardware structure of another electronic device provided in an embodiment of the present application.

[0219] The electronic device includes a processor 1201, a communication circuit 1204 and at least one communication interface ( Fig.12 The communication interface 1203 is used as an example for explanation).

[0220] The processor 1201 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.

[0221] Communications link 1204 may include circuitry to transmit information between the above-described components.

[0222] The communication interface 1203 uses any transceiver or other device for communicating with other devices or communication networks, such as Ethernet, wireless local area networks (WLAN), etc.

[0223] Possibly, the electronic device may further include a memory 1202 .

[0224] The memory 1202 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processor via a communication line 1204. The memory may also be integrated with the processor.

[0225] The memory 1202 is used to store computer-executable instructions for executing the solution of the present application, and the execution is controlled by the processor 1201. The processor 1201 is used to execute the computer-executable instructions stored in the memory 1202, thereby implementing the method provided by the embodiment of the present application.

[0226] Possibly, the computer-executable instructions in the embodiments of the present application may also be referred to as application code, and the embodiments of the present application do not specifically limit this.

[0227] In a specific implementation, as an embodiment, the processor 1201 may include one or more CPUs, such as Fig.12 CPU0 and CPU1 in.

[0228] In a specific implementation, as an embodiment, the electronic device may include multiple processors, such as Fig.12 1 and 1205. Each of these processors may be a single-CPU processor or a multi-CPU processor. A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0229] In the above embodiments, the instructions stored in the memory for execution by the processor may be implemented in the form of a computer program product, wherein the computer program product may be pre-written in the memory, or may be downloaded and installed in the memory in the form of software.

[0230] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a server or data center that includes one or more available media integrated. For example, the available medium can include a magnetic medium (e.g., a floppy disk, a hard disk or a tape), an optical medium (e.g., a digital versatile disc (digital versatiledisc, DVD)), or a semiconductor medium (e.g., a solid state drive (solid state disk, SSD)), etc.

[0231] The embodiments of the present application also provide a computer-readable storage medium. The methods described in the above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. Computer-readable media may include computer storage media and communication media, and may also include any medium that can transfer a computer program from one place to another. The storage medium may be any target medium that can be accessed by a computer.

[0232] As a possible design, the computer readable medium may include a compact disc read-only memory (CD-ROM), RAM, ROM, EEPROM or other optical disc storage; the computer readable medium may include a magnetic disk storage or other magnetic disk storage device. Moreover, any connection line may also be appropriately referred to as a computer readable medium. For example, if the software is transmitted from a website, server or other remote source using a coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology (such as infrared, radio and microwave), the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology such as infrared, radio and microwave are included in the definition of medium. Disk and disc as used herein include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and Blu-ray disc, where disks usually reproduce data magnetically, while optical discs reproduce data optically using lasers.

[0233] The above combinations should also be included in the scope of computer-readable media. The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

[0234] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.

Claims

1. An electronic device, characterized in that: The electronic device comprises a printed circuit board PCB, on which a first compass, a second compass and a control unit are arranged, and a portion of the outer side of the second compass not attached to the PCB is wrapped with a magnetic isolation material; The control unit is used to obtain a first reading of the first compass and a second reading of the second compass, remove the magnetic data generated by the soft magnetic field from the second reading, and obtain target magnetic parameters for calculating the orientation of the electronic device; wherein the soft magnetic field includes the magnetic field generated by the circuit in the PCB, and the magnetic data generated by the soft magnetic field is obtained based on the first reading and the reading of the first compass without the interference of the soft magnetic field.

2. The electronic device according to claim 1, characterized in that: The first compass and the second compass are located on two sides of the PCB.

3. The electronic device according to claim 1, characterized in that: The PCB includes a first PCB and a second PCB, the first PCB and the second PCB are connected via a frame plate, a second compass is arranged in the first PCB, and a first compass is arranged in the second PCB.

4. The electronic device according to claim 2 or 3, characterized in that: The projection of the first compass in the vertical direction overlaps with the projection of the second compass in the vertical direction.

5. A compass calibration method, characterized in that: Applied to the electronic device according to any one of claims 1 to 4, the method comprises: The electronic device receives a first instruction for using a compass; In response to the first instruction, the electronic device obtains a first reading of the first compass and a second reading of the second compass, removes the magnetic data generated by the soft magnetic field from the second reading, and obtains target magnetic parameters for calculating the orientation of the electronic device; wherein the soft magnetic field includes the magnetic field generated by the circuit in the PCB, and the magnetic data generated by the soft magnetic field is obtained based on the first reading and the reading of the first compass without interference from the soft magnetic field.

6. The method according to claim 5, characterized in that The first reading includes magnetic data generated by a hard magnetic field, while the second reading does not include the magnetic data generated by the hard magnetic field. The hard magnetic field is a magnetic field generated by magnetized materials in the PCB and / or a magnetic field generated by magnetic materials in the PCB.

7. The method according to claim 5, characterized in that Before the electronic device obtains a first reading of the first compass and a second reading of the second compass, the method further includes: The electronic device receives a second instruction, where the second instruction is an instruction generated when any one of a power-on operation, a restart operation, or a flight mode closing operation is detected; In response to the second instruction, the electronic device obtains a third reading of the first compass, where the reading of the first compass without soft magnetic field interference is obtained by subtracting the first reading from the third reading by the electronic device.

8. The method according to claim 5, characterized in that Before removing the magnetic data generated by the soft magnetic field in the second reading, the method further includes: The electronic device performs scene recognition; When it is determined that the electronic device is in a target scene, the electronic device determines the magnetic data generated by the soft magnetic field corresponding to the target scene from a first correspondence relationship, the target scene is at least one of the charging scene and / or the communication scene, and the first correspondence relationship includes a correspondence between the target scene and the soft magnetic interference parameters.

9. The method according to claim 8, characterized in that The charging scenario includes: a charging scenario when the charging current meets a first numerical range, and / or a charging scenario when the battery voltage meets a second numerical range, and the communication scenario includes one or more of the following: a call scenario, a scenario when using mobile data, or a scenario when using WIFI.

10. The method according to any one of claims 5 to 9, characterized in that: The soft magnetic field includes a magnetic field generated by a circuit in the PCB, including: the soft magnetic field includes a magnetic field generated by a circuit in the PCB whose current intensity is greater than a first threshold.

11. The method according to any one of claims 5 to 9, characterized in that: The electronic device includes: an intelligent sensor hub, a target application, a sensor framework sensor FWK, and a sensor hardware abstraction module sensorHAL. The electronic device receives a first instruction for using a compass, comprising: the sensor hub receives the first instruction transmitted via the target application, the sensor FWK, and the sensor HAL; The electronic device obtains a first reading of the first compass and a second reading of the second compass, including: the sensor hub reads the first reading from the first compass driver, and the sensor hub reads the second reading from the second compass driver; Removing magnetic data generated by the soft magnetic field in the second reading to obtain target magnetic parameters for calculating the orientation of the electronic device includes: the sensor hub removing magnetic data generated by the soft magnetic field in the second reading to obtain the target magnetic parameters.

12. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the electronic device executes the method according to any one of claims 5 to 11.

13. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the computer executes the method according to any one of claims 5 to 11.

Citation Information

Patent Citations

  • Method and device for eliminating interference on electronic compass

    CN105091872A

  • Self-correcting electronic compass and method for correcting same

    CN108088431A