Auto-focusing method, auto-focusing device, camera module, device and medium

By increasing the number of magnetic gate segments detected by magnetic sensors in the automatic focus device, the problem of excessively long flow time of the camera module in the prior art is solved, and the effect of faster camera start-up and reduced power consumption is achieved.

CN117651218BActive Publication Date: 2025-07-11HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311720375.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-13
Publication Date
2025-07-11
Estimated Expiration
2043-12-13

AI Technical Summary

Technical Problem

In the prior art, the position detection scheme based on magnetic gate and tunnel magnetoresistive effect sensors results in a long flow time of the camera module, which affects the user's shooting experience.

Method used

在自动对焦装置中增加一个或多个磁性传感器,用于检测自动对焦马达当前所在的磁栅段数,避免每次开启摄像头时需要移动至机械顶端或底端。

Benefits of technology

It shortens the starting time of the camera module, improves the user's shooting experience, and reduces the device's power consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117651218B_ABST
    Figure CN117651218B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose an autofocus method, an autofocus device, a camera module, a device, and a medium. The autofocus device includes a magnetic component, a driving component, a magnetic grating, a magnetic grating sensor, and a magnetic sensor. The driving component drives the lens to move along the optical axis direction under the magnetic field action of the magnetic component, and drives the magnetic component or the magnetic sensor to move, and drives the magnetic grating or the magnetic grating sensor to move. The magnetic grating sensor outputs a first electrical signal by sensing the periodically changing magnetic field of the magnetic grating. The magnetic sensor outputs a second electrical signal for indicating the current magnetic grating segment number where the autofocus device is located by sensing the magnetic field of the magnetic component. In this way, by additionally adding a magnetic sensor in the autofocus device to detect the magnetic grating segment number where the autofocus device is located, the startup time of the camera module is shortened, and the user shooting experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of shooting technologies, and in particular, to an autofocus method, an autofocus device, a camera module, an electronic device, and a computer-readable storage medium. Background Art

[0002] With the continuous popularization of electronic devices such as mobile phones and the increasingly powerful shooting functions, it has gradually become a trend to use electronic devices such as mobile phones for image and video shooting.

[0003] During the shooting process of an electronic device such as a mobile phone, the automatic focus motor can be controlled to move, so as to drive the optical lens (lens) to move along the optical axis direction, and then adjust the distance between the lens and the image sensor, thereby realizing autofocus (AF), so that objects at different distances are clearly imaged on the image sensor.

[0004] Currently, some electronic devices adopt a position detection scheme based on a magnetic grating and a tunnel magnetoresistance effect (TMR) sensor to detect the position of the lens during the autofocus process. However, in this position detection scheme, each time the camera is turned on, the automatic focus motor needs to be moved to the mechanical top or bottom, which results in a relatively long start-up time of the camera module and affects the user's shooting experience. Summary of the Invention

[0005] Embodiments of the present application provide an autofocus method, an autofocus device, a camera module, an electronic device, and a computer-readable storage medium, which can solve the problem of relatively long start-up time of the camera module.

[0006] In a first aspect, an embodiment of the present application provides an autofocus device, including a magnetic component, a driving component, a magnetic grating, a magnetic grating sensor, and a magnetic sensor; the magnetic component is used to generate a magnetic field; the magnetic grating is used to generate a periodically changing magnetic field; the driving component is used to drive the lens to move along the optical axis direction under the action of the magnetic field generated by the magnetic component, and drive one of the magnetic component and the magnetic sensor to move relative to the other, and drive one of the magnetic grating and the magnetic grating sensor to move relative to the other; the magnetic grating sensor is used to output a first electrical signal by sensing the periodically changing magnetic field when the magnetic grating and the magnetic grating sensor move relative to each other; the magnetic sensor is used to output a second electrical signal by sensing the magnetic field generated by the magnetic component when the magnetic component and the magnetic sensor move relative to each other, and the second electrical signal is used to indicate the current magnetic grating segment number of the autofocus device (such as an automatic focus motor).

[0007] As can be seen from the above, the embodiment of the present application is directed to an autofocus device that uses a magnetic grating and a magnetic grating sensor to detect the position of the lens. One or more magnetic sensors are additionally added to the autofocus device to detect the number of magnetic grating segments where the autofocus motor is currently located. In this way, when the camera is turned on, there is no need to move the autofocus motor to the top or bottom of the machine, thereby shortening the camera module startup time and improving the user's shooting experience.

[0008] In some possible implementations of the first aspect, the magnetic grating sensor is a giant magnetoresistance sensor or a tunnel magnetoresistance effect sensor.

[0009] In some possible implementations of the first aspect, the magnetic sensor is a Hall sensor, an anisotropic magnetoresistance effect sensor, a giant magnetoresistance sensor, or a tunnel magnetoresistance effect sensor.

[0010] In some possible implementations of the first aspect, the one or more magnetic sensors are disposed on the left side, the right side, the top side, or the bottom side of the magnetic component.

[0011] In some possible implementations of the first aspect, the magnetic assembly includes one or more magnetic members, and the driving assembly includes a coil; when the coil drives the lens to move along the optical axis, it drives the magnetic member and the magnetic grid to move.

[0012] In a second aspect, the embodiment of the present application provides a camera module, including a lens, a driving chip, a magnetic component, a driving component, a magnetic grid, a magnetic grid sensor and a magnetic sensor. The magnetic component is used to generate a magnetic field; the magnetic grid is used to generate a periodically changing magnetic field.

[0013] The driving component is used to drive the lens to move along the optical axis under the action of the magnetic field generated by the magnetic component, and drive one of the magnetic component and the magnetic sensor to move relative to the other, and drive one of the magnetic grid and the magnetic grid sensor to move relative to the other. The magnetic grid sensor is used to output a first electrical signal by sensing a periodically changing magnetic field when the magnetic grid and the magnetic grid sensor produce relative displacement. The magnetic sensor is used to output a second electrical signal by sensing the magnetic field generated by the magnetic component when the magnetic component and the magnetic sensor move relative to each other. The driving chip is used to receive the first electrical signal and the second electrical signal, determine the number of magnetic grid segments where the autofocus device is currently located according to the second electrical signal; and determine the position of the lens according to the number of magnetic grid segments and the first electrical signal.

[0014] The embodiments of the present application are directed to a camera module that uses a magnetic grid and a magnetic grid sensor to determine the lens position. One or more additional magnetic sensors are added to the camera module to detect the number of magnetic grid segments the magnetic grid sensor is currently located in. This eliminates the need to move the autofocus motor to the top or bottom of the mechanism when the camera is turned on, thereby shortening the camera module startup time and improving the user's shooting experience.

[0015] In some possible implementation manners of the second aspect, the magnetic grating sensor is a giant magnetoresistive sensor or a tunneling magnetoresistance effect sensor.

[0016] In some possible implementation manners of the second aspect, the magnetic sensor is a Hall sensor, an anisotropic magnetoresistive effect sensor, a giant magnetoresistive sensor or a tunneling magnetoresistance effect sensor.

[0017] In some possible implementation manners of the second aspect, the magnetic component includes one or more magnetic members, and the driving component includes a coil; when the coil drives the lens to move along the optical axis direction, the magnetic member and the magnetic grating are driven to move.

[0018] In some possible implementation manners of the second aspect, the second electrical signal is a voltage signal. The driving chip is specifically configured to: determine the number of magnetic grating segments corresponding to the second electrical signal according to the correspondence between the motor displacement and the voltage signal, and the number of magnetic grating segments is the number of magnetic grating segments where the autofocus device is currently located.

[0019] In some possible implementation manners of the second aspect, the driving component includes a coil, and the driving chip is further configured to: adjust the current signal output to the coil according to the number of magnetic grating segments and the first electrical signal, so as to closed-loop control the autofocus motor to move to the corresponding position, and then drive the lens to move to the desired focusing position to complete autofocus.

[0020] In some possible implementation manners of the second aspect, due to the influence of the detection accuracy of the magnetic sensor, when the autofocus device is at the junction of two magnetic grating segments, only determining the number of magnetic grating segments where the autofocus device is located according to the second electrical signal output by the magnetic sensor may result in an incorrect judgment of the number of magnetic grating segments. To further improve the detection accuracy of the number of magnetic grating segments, the driving chip can first determine which two magnetic grating segments the current is at the junction according to the second electrical signal, and then further accurately determine which magnetic grating segment among the two magnetic grating segments the autofocus device is currently in according to the first electrical signal.

[0021] That is, the driving chip is specifically configured to: if it is determined according to the second electrical signal that the autofocus device is currently within a preset range, determine that the autofocus device is currently at the junction of the nth magnetic grating segment and the (n + 1)th magnetic grating segment according to the second electrical signal, and then determine the final number of magnetic grating segments where the autofocus device is currently located according to the voltage amplitude of the first electrical signal, and the final number of magnetic grating segments is the nth or the (n + 1)th; where the preset range is a ± b microns, a is the position of the demarcation point between the nth magnetic grating segment and the (n + 1)th magnetic grating segment, and the detection accuracy of the magnetic sensor is ± b microns. In this way, aiming at the problem that the limited detection accuracy of the magnetic sensor leads to inaccurate judgment of the number of magnetic grating segments at the magnetic grating demarcation, further combining the voltage signal output by the magnetic grating sensor, the number of magnetic grating segments to which it belongs is accurately judged, and high-precision detection of the number of magnetic grating segments is achieved.

[0022] If it is determined according to the second electrical signal that the autofocus device is not currently in the preset range, that is, not at the junction of two magnetic grids, the number of magnetic grid segments corresponding to the second electrical signal is determined according to the corresponding relationship between the motor displacement and the voltage signal.

[0023] In some possible implementations of the second aspect, in addition to accurately determining the number of magnetic grating segments where the autofocus device is located based on the first electrical signal and the second electrical signal at the junction of two magnetic gratings, the number of magnetic grating segments where the autofocus device is located can also be determined based on the first electrical signal and the second electrical signal at any position to improve the magnetic grating detection accuracy. In this case, the driver chip is specifically used to determine the number of magnetic grating segments where the autofocus device is currently located based on the second electrical signal and the first electrical signal.

[0024] In a third aspect, an embodiment of the present application provides an autofocus method, the method comprising: obtaining a focus instruction, the focus instruction being used to indicate a desired focus position; obtaining a first electrical signal output by a magnetic grating sensor, and a second electrical signal output by a magnetic sensor; determining the number of magnetic grating segments where the autofocus device is currently located based on the second electrical signal; and controlling the movement of the autofocus device in a closed loop based on the number of magnetic grating segments and the first electrical signal to drive the lens to move to the desired focus position.

[0025] Among them, the autofocus device includes a magnetic component, a driving component, a magnetic grid, a magnetic grid sensor and a magnetic sensor; the magnetic component is used to generate a magnetic field; the magnetic grid is used to generate a periodically changing magnetic field; the driving component is used to drive the lens to move along the optical axis under the action of the magnetic field generated by the magnetic component, and drive one of the magnetic component and the magnetic sensor to move relative to the other, and drive one of the magnetic grid and the magnetic grid sensor to move relative to the other; the magnetic grid sensor is used to output a first electrical signal by sensing a periodically changing magnetic field when the magnetic grid and the magnetic grid sensor move relative to each other; the magnetic sensor is used to output a second electrical signal by sensing the magnetic field generated by the magnetic component when the magnetic component and the magnetic sensor move relative to each other.

[0026] In some possible implementations of the third aspect, the second electrical signal is a voltage signal; and determining the number of magnetic grid segments where the autofocus device is currently located according to the second electrical signal includes:

[0027] According to the corresponding relationship between the motor displacement and the voltage signal, the number of magnetic grid segments corresponding to the second electrical signal is determined, and the number of magnetic grid segments is the number of magnetic grid segments where the autofocus device is currently located.

[0028] In some possible implementations of the third aspect, determining the number of magnetic grid segments where the autofocus device is currently located according to the second electrical signal includes:

[0029] If it is determined, based on the second electrical signal, that the autofocus device is currently within a preset range, then it is determined, based on the second electrical signal, that the autofocus device is currently at the junction of the nth grating and the (n + 1)th grating, and based on the voltage amplitude of the first electrical signal, the final grating segment number where the autofocus device is currently located is determined, and the final grating segment number is the nth grating or the (n + 1)th grating; wherein, the preset range is a ± b microns, a is the position of the demarcation point between the nth grating segment and the (n + 1)th grating segment, and the detection accuracy of the magnetic sensor is ± b microns;

[0030] If it is determined, based on the second electrical signal, that the autofocus device is not currently within the preset range, then based on the correspondence between the motor displacement and the voltage signal, the grating segment number corresponding to the second electrical signal is determined, and the grating segment number is the grating segment number where the autofocus device is currently located. In some possible implementation manners of the third aspect, the grating sensor is a giant magnetoresistive sensor or a tunneling magnetoresistive effect sensor; the magnetic sensor is a Hall sensor, an anisotropic magnetoresistive effect sensor, a giant magnetoresistive sensor or a tunneling magnetoresistive effect sensor.

[0031] In some possible implementation manners of the third aspect, after determining the grating segment number where the grating sensor is currently located based on the second electrical signal, the method further includes: controlling the magnetic sensor to enter the sleep mode. In this way, the power consumption can be reduced.

[0032] In a fourth aspect, an embodiment of the present application provides an electronic device, including the autofocus device according to any one of the above first aspects or the imaging module according to any one of the above second aspects.

[0033] In a fifth aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the method according to any one of the above third aspects is implemented.

[0034] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of the above third aspects is implemented.

[0035] In a seventh aspect, an embodiment of the present application provides a chip system, and the chip system includes a processor, the processor is coupled to a memory, and the processor executes a computer program stored in the memory to implement the method according to any one of the above third aspects. The chip system can be a single chip or a chip module composed of multiple chips.

[0036] In an eighth aspect, an embodiment of the present application provides a computer program product, and when the computer program product runs on an electronic device, the electronic device is caused to execute the method described in the above third aspect.

[0037] It can be understood that for the beneficial effects of the above second aspect to eighth aspect, reference can be made to the relevant descriptions in the above first aspect, which will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 Schematic diagram of the autofocus closed-loop control system provided by an embodiment of the present application;

[0039] Figure 2 Schematic diagram of position detection based on TMR sensor and magnetic grating provided by an embodiment of the present application;

[0040] Figure 3A Schematic diagram of a sensor setting position provided by an embodiment of the present application;

[0041] Figure 3B Schematic cross-sectional view of the autofocus device 300 provided by an embodiment of the present application;

[0042] Figure 3C Schematic side view of the autofocus device 300 provided by an embodiment of the present application;

[0043] Figure 4 Schematic block diagram of an autofocus closed-loop control system provided by an embodiment of the present application;

[0044] Figure 5A Schematic diagram of the correspondence between magnetic field and motor displacement provided by an embodiment of the present application;

[0045] Figure 5B Schematic diagram of the correspondence between voltage and magnetic field provided by an embodiment of the present application;

[0046] Figure 5C Schematic diagram of the correspondence between voltage and magnetic field provided by an embodiment of the present application;

[0047] Figure 5D Schematic diagram of the correspondence between the displacement after calculation and the motor displacement provided by an embodiment of the present application;

[0048] Figure 6A Schematic diagram of the determination process of the number of magnetic grating segments at the magnetic grating junction provided by an embodiment of the present application;

[0049] Figure 6B Schematic diagram of the determination process of the number of magnetic grating segments at the magnetic grating junction provided by an embodiment of the present application;

[0050] Figure 7 Schematic block diagram of a process of an autofocus method provided by an embodiment of the present application;

[0051] Figure 8 Schematic block diagram of an autofocus process provided by an embodiment of the present application. Specific Embodiments

[0052] In the following description, for the purpose of illustration rather than limitation, specific details such as specific system architectures, technologies, etc. are presented to provide a thorough understanding of the embodiments of the present application.

[0053] The following introduces the relevant content that the embodiments of the present application may involve.

[0054] (1) Automatic Focus Closed-Loop Control Process.

[0055] Exemplarily, referring to Figure 1 the schematic diagram of the automatic focus closed-loop control system provided by the embodiments of the present application shown, the automatic focus closed-loop control system may include but is not limited to: image sensor (sensor) 10, lens 11, autofocus motor 12, drive chip 13, control chip 14, and position sensor 15.

[0056] The autofocus motor 12 is used to drive the lens 11 to move along the optical axis direction when moving within the motor stroke range, so as to increase or decrease the distance between the lens 11 and the image sensor 10, so that objects to be photographed at different distances can be clearly imaged on the image sensor 10.

[0057] The autofocus motor 12 can be a voice coil motor (VCM), can be a piezoelectric motor, or can be other types of motors. Usually, the autofocus motor 12 includes a stator part and a rotor part, and the rotor part can be connected to the lens 11. When the rotor part moves within the motor stroke range, the lens 11 also moves accordingly.

[0058] The control chip 14 can be, for example, a system-on-chip (SOC) of an electronic device such as a mobile phone, and is used to send a focusing instruction to the drive chip 13. This focusing instruction is used to indicate the target position of the autofocus motor.

[0059] The drive chip 13 is used to receive the focusing instruction sent by the control chip 14, and obtain the target position of the autofocus motor according to the focusing instruction; based on this target position, output a control signal to the autofocus motor 12 to control the autofocus motor to move to the target position.

[0060] The position sensor 15 is used to detect the position of the lens 11, and feedback the detected position of the lens 11 to the drive chip 13, so that the drive chip 13 performs closed-loop control according to the feedback position.

[0061] The position sensor 15 can be a magnetic sensor (such as a Hall sensor), or a magnetoresistive sensor, for example, an anisotropic magnetoresistive (AMR) sensor, a giant magnetoresistance (GMR) sensor, and a TMR sensor.

[0062] Exemplarily, taking the VCM motor as an example, the autofocus closed-loop control process can be as follows:

[0063] The control chip 14 issues a focusing instruction to the drive chip 13; the drive chip 13 obtains the target position according to the focusing instruction, and according to the target position, outputs a current signal with a corresponding magnitude and a corresponding direction to the coil of the autofocus motor 12; after the coil of the autofocus motor 12 is powered on, it interacts with the magnet to generate a Lorentz force, which pushes the moving part of the autofocus motor 12 to move, so as to drive the lens 11 to move along the optical axis direction.

[0064] After the drive chip 13 outputs a current signal to the coil, the position sensor 15 detects the position of the lens 11 and feeds back the detected position to the drive chip 13. The drive chip 13 performs closed-loop control according to the feedback position signal to continuously adjust the position of the autofocus motor 12 so that the position of the lens 11 is consistent with the desired focusing position. For example, if the drive chip 13 determines according to the feedback position of the lens 11 that the current position of the lens 11 is not the final desired focusing position, then according to the difference between the current position of the lens 11 and the desired focusing position, the moving distance and moving direction of the lens are obtained; according to the moving distance and moving direction of the lens, the magnitude and direction of the output current are determined; according to the determined magnitude and direction of the current, a corresponding current signal is output to the coil of the autofocus motor 12 to control the moving part of the autofocus motor 12 to move a corresponding distance in a corresponding direction, so as to drive the lens 11 to reach the desired focusing position.

[0065] Generally, using a position sensor such as a Hall sensor, an AMR sensor, or a GMR sensor can meet the requirements of autofocus closed-loop control (such as control accuracy, etc.). However, in some cases, for example, when the image sensor target surface of the camera is relatively large (such as 1 inch), or the camera is a periscope camera, and the autofocus travel is greater than 1 millimeter (mm), in order to meet the requirements of autofocus distance from infinity to close focus, a position detection scheme based on a TMR sensor and a magnetic grating is usually used to detect and feedback the lens position.

[0066] (2) Position detection scheme based on TMR sensor and magnetic grating.

[0067] During the autofocus process, the TMR sensor or the magnetic grating can move along with the movement of the lens, resulting in relative movement between the TMR sensor and the magnetic grating. For example, the TMR sensor is fixedly arranged, the magnetic grating and the lens carrier are fixedly arranged, and the moving part of the autofocus motor drives the lens carrier to move, so as to drive the lens to move along the optical axis direction. During the movement of the lens carrier, the magnetic grating also moves accordingly.

[0068] When the TMR sensor and the magnetic grating move relatively, the TMR sensor outputs a sine voltage signal and a cosine voltage signal by sensing the periodically changing magnetic field signal generated by the magnetic grating; according to the sine voltage signal and the cosine voltage signal, the position of the autofocus motor can be determined to determine the position of the lens, so as to realize the detection of the lens position during the autofocus process.

[0069] Exemplarily, refer to Figure 2 FIG. shows a schematic diagram of position detection based on a TMR sensor and a magnetic grating provided by an embodiment of the present application. The magnetic grating 20 includes a plurality of S-pole magnets and a plurality of N-pole magnets, and the S-pole magnets and the N-pole magnets are arranged alternately. Figure 2 Exemplarily, it is shown that the magnetic grating 20 is a strip-shaped magnetic grating and is composed of S-pole magnets, N-pole magnets, S-pole magnets, N-pole magnets, S-pole magnets, and N-pole magnets arranged in sequence along the first direction.

[0070] Based on the alternately arranged S-pole magnets and N-pole magnets, the magnetic grating 20 can generate a periodically changing magnetic field according to a fixed length period. The length period can be, for example, 800 micrometers (um). One length period can be regarded as a magnetic grating segment. The magnetic grating 20 can include a plurality of length periods, and thus can include a plurality of magnetic grating segments.

[0071] The TMR sensor 21 generally includes a Wheatstone full-bridge circuit. The Wheatstone full-bridge circuit is composed of a plurality of magnetosensitive elements, and the magnetosensitive elements can be equivalent to resistors with equal resistance values.

[0072] The TMR sensor 21 and the magnetic grating 20 can be arranged adjacent to each other so that the TMR sensor 21 can sense the magnetic field generated by the magnetic grating 20. Generally, the TMR sensor 21 can be arranged opposite to the magnetic grating 20.

[0073] When the magnetic grating 20 and the TMR sensor 21 move relatively, the TMR sensor 21 can sense the periodically changing magnetic field of the magnetic grating 20 through the magnetosensitive elements, and output corresponding electrical signals according to the sensed periodically changing magnetic field signals. The electrical signals can be current signals or voltage signals. Exemplarily, Figure 2 the original signals output by the TMR include sine and cosine voltage signals V1 and V2. As Figure 2As shown, the horizontal axis of the sine voltage signal V1 and the cosine voltage signal V2 is the motor displacement, and the vertical axis is the voltage. That is, as the autofocus motor moves, a periodically changing voltage signal is obtained.

[0074] It can be understood that the relative movement between the magnetic grating 20 and the TMR sensor 21 can mean that the magnetic grating 20 is fixed and the TMR sensor 21 moves; it can also mean that the magnetic grating 20 moves and the TMR sensor 21 is fixed.

[0075] During the autofocus closed-loop control process, when the autofocus motor moves within the motor stroke range, in addition to driving the lens to move along the optical axis direction, it can also drive the magnetic grating 20 or the TMR sensor 21 to move together. Exemplarily, the autofocus motor includes a stator part and a rotor part. The TMR sensor 21 is connected to the stator part, and the magnetic grating 20 is connected to the rotor part; when the rotor part of the autofocus motor moves to drive the lens to move along the optical axis direction, the magnetic grating 20 connected to the rotor part moves with the rotor part, while the stator part does not move, and the TMR sensor 21 connected to the stator part does not move. That is to say, the TMR sensor 21 remains stationary, and the magnetic grating 20 moves back and forth along the first direction and the second direction relative to the TMR sensor 21. As the magnetic grating 20 moves back and forth, the stationary TMR sensor 21 outputs positive and cosine voltage signals V1 and V2 as shown in Figure 2 shown.

[0076] According to the electrical signal output by the TMR sensor 21, the relative movement displacement between the magnetic grating 20 and the TMR sensor 21 can be calculated to achieve linear displacement detection. Since the magnetic grating 20 or the TMR sensor 21 moves with the movement of the autofocus motor, the relative movement displacement between the magnetic grating 20 and the TMR sensor 21 can be equivalent to the displacement of the autofocus motor.

[0077] As Figure 2 shown, based on the positive and cosine voltage signals V1 and V2 output by the TMR sensor, an arctangent operation is performed to obtain a relationship diagram between the motor stroke and the motor displacement. The horizontal axis of this relationship diagram is the motor displacement (actual motor displacement), and the vertical axis is the motor displacement of each cycle after calculation. Based on this relationship diagram, the number of magnetic grating segments passed by the motor can be determined, as well as the displacement of the motor in each length cycle or each magnetic grating segment. Finally, according to the length of each magnetic grating segment (for example, 800um) and the number of magnetic grating segments passed by the motor, the total displacement of the motor movement can be obtained.

[0078] Exemplarily, Figure 2The number of magnetic grating segments ranges from 1 to 6, represented by the numbers 1 to 6 respectively. In the first magnetic grating segment, based on the sine voltage signal and cosine voltage signal output by the TMR sensor, the displacement of the autofocus motor within the first magnetic grating segment (or the first length cycle) is calculated; in the second magnetic grating segment, based on the sine voltage signal and cosine voltage signal output by the TMR sensor, the displacement of the autofocus motor in the second magnetic grating segment is calculated. Similarly, the displacements of the autofocus motor in the third, fourth, fifth, and sixth magnetic grating segments are calculated. Finally, by adding the displacements of the autofocus motor in the first to sixth magnetic grating segments, the total displacement of the motor can be obtained.

[0079] It can be understood that when the autofocus motor moves, it drives the lens to move along the optical axis direction. Therefore, based on the displacement of the autofocus motor, the displacement of the lens can be obtained. Based on the displacement of the lens, the position of the lens can be determined, thereby realizing the lens position detection of the TMR sensor. In the position detection scheme of the grating, since the magnetic field provided by the magnetic grating changes periodically, only the displacement of the TMR sensor within the current magnetic field cycle (or length cycle) can be determined based on the voltage signal output by the TMR sensor, and the magnetic field cycle in which the TMR sensor is located cannot be determined. That is, based on the voltage signal output by the TMR sensor, the number of the magnetic grating segment where the autofocus motor is currently located cannot be known. If the number of the magnetic grating segment where the autofocus motor is currently located cannot be known, the total displacement of the autofocus motor cannot be calculated, and thus the lens position detection cannot be realized, and the autofocus closed-loop control cannot be realized.

[0080] Therefore, in the related art, each time the camera is turned on, the autofocus motor is driven to move to the mechanical top or bottom (or the stroke zero point), and the initial magnetic grating segment where the autofocus motor is located is default set to the first magnetic grating segment or the last magnetic grating segment to obtain the number of the initial magnetic grating segment where the autofocus motor is located. In this way, during the autofocus process, based on the electrical signal output by the TMR sensor and the number of the initial magnetic grating segment, the displacement of the autofocus motor within the current magnetic field cycle and the number of the magnetic grating segment where it is currently located can be determined.

[0081] For example, when the camera is turned on, the driving autofocus motor moves to the starting point of the initial number of magnetic grating segments, that is, the initial number of magnetic grating segments is the first magnetic grating segment. During the autofocus process, the autofocus motor starts to move from the starting point of the first magnetic grating segment, and during the movement of the autofocus motor, the electrical signals continuously output by the TMR sensor are acquired; according to this electrical signal, it can be calculated that the autofocus motor has passed through three magnetic field cycles, that is, three magnetic grating segments (the first magnetic grating segment, the second magnetic grating segment, and the third magnetic grating segment) have passed, and it stops at a certain position point of the fourth magnetic grating segment. At this time, since the initial number of magnetic grating segments is the first segment, and the autofocus motor has passed through three magnetic grating segments, it can be determined that the magnetic grating segment number where the autofocus motor is currently located is the fourth segment. After determining the magnetic grating segment number where the autofocus motor is currently located, the displacement amount between the starting point of the fourth magnetic grating segment and a certain position point and the total displacement amount of the first three magnetic grating segments are added together to obtain the total displacement amount of the autofocus motor.

[0082] However, the inventors found during long-term research that if the autofocus motor needs to be moved to the mechanical top or bottom each time the camera is turned on to know the initial magnetic grating segment number where the autofocus motor is located, it will cause a relatively long startup time of the camera module, affecting the user experience.

[0083] Specifically, driving the autofocus motor to move to the mechanical top or bottom will consume a certain amount of time, for example, about 300 milliseconds (ms). During the process of driving the autofocus motor to move to the mechanical top or bottom, the camera module does not output a video stream, and electronic devices such as mobile phones will be in a black screen state and do not display an image screen. After the autofocus motor reaches the mechanical top or bottom and the camera module is ready, it will output a video stream. In this way, the interval time between turning on the camera and the startup of the camera is relatively long, resulting in a relatively long startup time of the camera module, seriously affecting the user experience.

[0084] In addition, the inventors also found during long-term research that if electronic devices such as mobile phones include multiple cameras, and the camera using the TMR sensor and the magnetic grating for lens detection is not the main camera, but other cameras (such as periscope cameras). At this time, in order to reduce the edge hitting time and improve the user experience, when the main camera is turned on, the camera using this position detection scheme also needs to be turned on simultaneously, thereby increasing the device power consumption.

[0085] Specifically, electronic devices such as mobile phones may include multiple cameras (for example, including main cameras, periscope cameras, wide-angle cameras, telephoto cameras, etc.). During the process of starting the camera application for shooting, camera switching may be involved. For example, switching from the main camera to the wide-angle camera. When switching from the current camera to the next camera, it is necessary to refocus on the next camera. When refocusing on the next camera, if the next camera is a camera that detects the lens based on a magnetic grating and a TMR sensor, the initial position of the autofocus motor needs to be obtained.

[0086] In the related art, when switching to the next camera, the autofocus motor can also be moved to the mechanical top or bottom to obtain the initial position of the autofocus motor, so as to complete the autofocus of the camera. However, this will result in a longer startup time for the camera, affecting the user experience. Therefore, in order to reduce the edge time and thus reduce the startup time of the camera, the related art usually starts this camera while starting other cameras and continuously powers on the autofocus motor to monitor and obtain the position of the TMR sensor. Although this can reduce the edge time and the startup time of the camera, it increases the device power consumption.

[0087] For example, taking the periscope camera as an example, the autofocus motor of the periscope camera includes a magnetic grating and a TMR sensor, and the lens position is detected based on the TMR sensor. In the related art, in order to reduce the edge time of the periscope camera, the periscope camera is started while starting the main camera, and the autofocus motor of the periscope camera is continuously powered on to monitor the position of the TMR sensor. During the continuous power-on process of the autofocus motor, the MCU, TMR sensor, etc. in the drive chip of the periscope camera need to continuously perform signal processing and other processes, resulting in an increase in device power consumption. The increased power consumption is about 40 milliamperes (mA) for example.

[0088] To address the related problems mentioned above, embodiments of the present application add one or more magnetic sensors in the autofocus device to detect the number of magnetic grating segments where the autofocus motor is currently located. In this way, according to the magnetic sensors, the initial number of magnetic grating segments of the autofocus motor can be detected, and there is no need to move the autofocus motor to the mechanical top or bottom to obtain the initial number of magnetic grating segments when opening the camera, shortening the time from opening the camera to the camera starting to work (for example, reducing the duration by about 300 ms).

[0089] In addition, if an autofocus device with one or more magnetic sensors is applied to a camera such as a periscope camera, when turning on other cameras (such as the main camera), there is no need to turn on the camera that uses a magnetic grating sensor to detect the lens position at the same time to reduce the startup time of this camera. Instead, this camera can be turned on only when switching to this camera (such as a periscope camera), and the initial magnetic grating segment number of the autofocus motor is obtained through the magnetic sensor to reduce the startup time of the camera, thereby reducing the device power consumption (for example, reducing the power consumption by about 40 mA).

[0090] For example, a mobile phone includes a main camera and a periscope camera. The main camera is turned on by default, and the periscope camera uses a TMR sensor to detect the lens position during autofocus. At this time, when the user opens the camera application, the main camera is turned on by default for shooting; during the shooting process, when the mobile phone needs to switch from the current main camera to the periscope camera, the periscope camera is turned on, and the autofocus motor of the periscope camera is powered on. The initial magnetic grating segment number where the autofocus motor is currently located is detected through the magnetic sensor of the autofocus motor, and then the initial position of the autofocus motor is obtained. Based on the initial position of the autofocus motor and the TMR sensor, the autofocus closed-loop process of the periscope camera is completed. In this way, when the main camera is turned on, there is no need to turn on the periscope camera at the same time to reduce the startup time of the periscope camera. Instead, the periscope camera is turned on only when it is needed, and the initial position of the autofocus motor is detected through the magnetic sensor in the periscope camera to reduce the startup time of the periscope camera, thereby reducing the device power consumption.

[0091] The autofocus device may include a magnetic component, a driving component, a magnetic grating, a magnetic grating sensor, and a magnetic sensor.

[0092] The magnetic component interacts with the driving component to drive the lens to move along the optical axis direction. Exemplarily, the magnetic component includes one or more magnets, and the driving component includes one or more coils. The coil and the magnet are arranged opposite to each other. After the coil is energized, it interacts with the magnet to generate a driving force for driving the lens to be arranged along the optical axis direction.

[0093] In some embodiments, the magnetic component may be a movable part, and the driving component is fixedly arranged. For example, the autofocus device may be an autofocus motor. The autofocus motor includes a housing and a lens carrier. The housing is fixedly arranged, and the lens carrier can move along the optical axis direction. The lens carrier is used to carry the optical lens. When the lens carrier moves, the lens is driven to move. The magnetic component is fixedly connected to the lens carrier, that is, there is no relative displacement between the magnetic component and the lens carrier; the driving component is fixedly connected to the housing, that is, there is no relative displacement between the housing and the driving component. The magnetic component can move along the optical axis direction under the driving force of the driving component, thereby driving the lens carrier to move along the optical axis direction.

[0094] Of course, in some other embodiments, the magnetic component may be fixedly arranged, while the driving component is a movable part. At this time, the driving force generated by the interaction between the driving component and the magnetic component can push the driving component to move along the optical axis direction.

[0095] The magnetic grating and the magnetic grating sensor are arranged opposite to each other. The magnetic grating can be a movable part, and the magnetic grating sensor is fixedly arranged. At this time, when the lens moves along the optical axis direction, the magnetic grating can move along with the movement of the lens, so that a relative movement is generated between the magnetic grating and the magnetic grating sensor. Of course, the magnetic grating can also be fixedly arranged, while the magnetic grating sensor is a movable part. At this time, when the lens moves along the optical axis direction, the magnetic grating sensor can move along with the movement of the lens, so that a relative movement is generated between the magnetic grating and the magnetic grating sensor.

[0096] The magnetic grating can generate a periodically changing magnetic field. When a relative movement is generated between the magnetic grating and the magnetic grating sensor, the magnetic grating sensor can output a first electrical signal (such as voltage signals of sine and cosine) by sensing the periodically changing magnetic field.

[0097] The magnetic grating sensor can be a GMR sensor, a TMR sensor, or other similar magnetoresistive sensors.

[0098] The magnetic sensor and the magnetic component are arranged opposite to each other. When the magnetic component is a movable part, the magnetic sensor is fixedly arranged. At this time, when the magnetic component moves along with the movement of the lens, a relative movement is generated between the magnetic component and the magnetic sensor; when the magnetic component is fixedly arranged, the magnetic sensor is a movable part. At this time, the magnetic sensor can move along with the movement of the lens, so that a relative movement is generated between the magnetic component and the magnetic sensor.

[0099] When the magnetic component and the magnetic sensor move relatively, the magnetic sensor can sense the linear magnetic field of the magnetic component to output a second electrical signal (such as a linear voltage signal).

[0100] The magnetic sensor can be an AMR sensor, a GMR sensor, a TMR sensor, or a Hall sensor. Further, the Hall sensor can be a gallium arsenide Hall sensor, or a Hall sensor including a Hall analog signal, an Application Specific Integrated Circuit (ASIC) signal processing part, and a digital processing output part. Of course, the magnetic sensor can also be other types of magnetic position sensors, which are not limited herein. The magnetic sensor can be a sensor packaged by packaging processes such as DFN, WLCSP, or WLBGA.

[0101] The magnetic component is used to generate a magnetic field, which is usually a linear magnetic field. The magnetic grating is used to generate a periodically changing magnetic field.

[0102] The driving component is used to drive the lens to move along the optical axis under the action of the magnetic field generated by the magnetic component, and drive one of the magnetic component and the magnetic sensor to move relative to the other, that is, drive the magnetic component or the magnetic sensor to move; and drive one of the grating and the grating sensor to move relative to the other, that is, drive the grating or the grating sensor to move.

[0103] The magnetic component may include one or more magnetic members, and the magnetic member may be a magnet. The driving component includes a coil. When the coil drives the lens to move along the optical axis, the magnetic member and the grating are driven to move. Exemplarily, the magnetic component includes one or more magnets, and the driving component includes one or more coils; the coils are fixedly arranged (for example, fixedly arranged with the housing), the magnets are movably arranged, and the magnets can move along with the lens. The grating is movably arranged and can move along with the lens, and the grating sensor is fixedly arranged (for example, can be arranged on the flexible circuit board of the camera module). After the coil is powered on, the driving force generated by the interaction between the magnet and the coil pushes the magnet, the lens and the grating to move, so that a relative movement is generated between the magnet and the magnetic sensor, and a relative movement is generated between the grating and the grating sensor.

[0104] The grating sensor is used to output a first electrical signal by sensing the periodically changing magnetic field when the grating and the grating sensor move relative to each other, and the first electrical signal is used to indicate the position of the lens. For example, the first electrical signal includes a sine voltage signal and a cosine voltage signal. By combining the initial number of grating segments of the autofocus motor and performing calculation processing on the sine voltage signal and the cosine voltage signal, the position of the autofocus motor can be obtained, and then the position of the lens can be obtained.

[0105] It can be understood that when there is no relative movement between the grating and the grating sensor, the grating sensor can also output an electrical signal by sensing the magnetic field generated by the grating. When the grating and the grating sensor move relative to each other, the grating sensor can continuously output an electrical signal.

[0106] The magnetic sensor is used to output a second electrical signal by sensing the magnetic field generated by the magnetic component when the magnetic component and the magnetic sensor move relative to each other. The second electrical signal is used to indicate the number of grating segments where the autofocus device is currently located.

[0107] It can be understood that the magnetic sensor generates a voltage signal by detecting the magnetic field change of the magnetic component. The magnetic field generated by the magnetic component is linear, so there is a linear relationship between the voltage signal output by the magnetic sensor and the magnetic field, and there is also a linear relationship between the magnetic field and the motor displacement. Therefore, there is a linear relationship between the motor displacement and the voltage signal. According to the linear relationship between the motor displacement and the voltage signal, the motor displacement corresponding to each voltage can be determined, that is, the position of the motor can be determined, and then the number of grating segments where the autofocus motor is currently located can be determined.

[0108] In an autofocus device, a magnetic grating sensor can be used as the main position sensor for autofocus to detect the lens position during the autofocus process; the newly added magnetic sensor can be used as an auxiliary position sensor for autofocus to detect the number of magnetic grating segments where the autofocus motor is located. In this way, when the camera is turned on, there is no need to move the autofocus motor to the mechanical top or bottom to obtain the initial position of the autofocus motor. Instead, the initial position of the autofocus motor can be detected by the auxiliary position sensor.

[0109] The detection accuracy of the main position sensor should be higher than that of the auxiliary position sensor. Exemplarily, the detection accuracy of the magnetic grating sensor is 1 micrometer (um), and the detection accuracy of the magnetic sensor can be within 50 micrometers (um). The length of each magnetic grating segment (pitch) can be 800 micrometers (um).

[0110] The number of magnetic sensors can be one or more. Usually, using one magnetic sensor can meet the requirements. However, in some cases (such as when the autofocus travel is long), multiple magnetic sensors can be used.

[0111] The installation position of the magnetic sensor can be related to the installation position of the magnetic component. Usually, the magnetic sensor can be installed on the left side, right side, upper side, or lower side of the magnetic component.

[0112] Exemplarily, refer to Figure 3A As shown in a schematic diagram of the installation position of a sensor, inside the autofocus device 300, there are magnetic sensors 311 - 315, a motor drive magnet 32, a magnetic grating 33, and a magnetic grating sensor 34 (such as a TMR sensor).

[0113] Magnetic sensors 311 - 315 represent magnetic sensors installed at different positions. Among them, magnetic sensor 311 refers to the magnetic sensor installed at the first position, magnetic sensor 312 refers to the magnetic sensor installed at the second position, magnetic sensor 313 refers to the magnetic sensor installed at the third position, magnetic sensor 314 refers to the magnetic sensor installed at the fourth position, and magnetic sensor 315 refers to the magnetic sensor installed at the fifth position.

[0114] As Figure 3A shown, magnetic sensor 311 is installed on the lower side of the motor drive magnet 32, magnetic sensor 312 is installed on the left side of the motor drive magnet 32, magnetic sensors 313 and 314 are installed on the upper side of the motor drive magnet, and magnetic sensor 315 is installed on the right side of the motor drive magnet.

[0115] It can be understood that when there is only one magnetic sensor, the magnetic sensor can be set at any position where the magnetic sensors 311 to 315 are located; when there are at least two magnetic sensors, at least two magnetic sensors can be respectively set at the positions where the magnetic sensors 311 to 315 are located. For example, when there are two magnetic sensors, the two magnetic sensors can be set at the positions where the magnetic sensor 311 and the magnetic sensor 315 are located.

[0116] When the magnetic sensor is set at the first position (i.e., the position where the magnetic sensor 311 is located), the cross-sectional view of the autofocus device can be as Figure 3B shown. When the magnetic sensor is set at the fifth position (i.e., the position where the magnetic sensor 315 is located), the side view of the autofocus device can be as Figure 3C shown.

[0117] As Figure 3B shown, the autofocus device 300 internally includes a motor drive magnet 32, a coil 35, a magnetic sensor 311, a magnetic grating 33, and a magnetic grating sensor 34. After the coil 35 is energized, it can drive the motor drive magnet 32 to move along the optical axis direction to drive the lens to move and drive the magnetic grating 33 to move. The magnetic sensor 311 and the magnetic grating sensor 34 can be fixedly arranged on components such as insert molding traces or flexible circuit boards, and the traces are made of conductive materials. When the motor drive magnet 32 moves, a relative movement is generated between the magnetic sensor 311 and the motor drive magnet 32, and the magnetic sensor 311 outputs a linear voltage signal by sensing the linear magnetic field during the movement of the motor drive magnet 32. When the magnetic grating 33 moves, a relative movement is generated between the magnetic grating 33 and the magnetic grating sensor 34, so that the magnetic grating sensor 34 can sense the periodically changing magnetic field and output a periodic voltage signal.

[0118] As Figure 3C shown, the autofocus device 300 includes a coil 35, a motor drive magnet 32, a magnetic grating sensor 34, and a magnetic sensor 315. The magnetic grating sensor 34 is fixedly arranged on components such as insert molding traces or flexible circuit boards. The motor drive magnet 32 can move under the action of the coil 35 and drive the magnetic grating to move, so that a relative movement is generated between the motor drive magnet 32 and the magnetic sensor 315, and a relative movement is generated between the magnetic grating sensor 34 and the magnetic grating.

[0119] The first electrical signal output by the magnetic grating sensor and the second electrical signal output by the magnetic sensor can be transmitted to a module with processing capabilities such as a microprocessor (MCU) or a SOC chip of a driving chip, so that the MCU or SOC chip can determine the number of magnetic grating segments where the autofocus motor is currently located based on the second electrical signal, and determine the position of the autofocus motor based on the number of magnetic grating segments and the first electrical signal, thereby realizing autofocus closed-loop control.

[0120] It can be seen that the embodiment of the present application adds one or more magnetic sensors in the autofocus device to detect the number of magnetic grating segments where the magnetic grating sensor or the autofocus motor is located. In this way, when the camera is turned on, it is no longer necessary to move the autofocus motor to the top or bottom of the machine to obtain the initial position of the magnetic grating sensor, which shortens the camera module start-up time and improves the user's shooting experience. In addition, it may also reduce the power consumption of the device.

[0121] See also Figure 4 , is a schematic block diagram of an autofocus closed-loop control system provided in an embodiment of the present application, and the autofocus closed-loop control system may include a camera module 400 and a control chip 410. The camera module 400 may include a lens 401, an image sensor 402, a driver chip 403, a magnetic grid 404, a magnetic grid sensor 405, a driver component 406, a magnetic component 407, and a magnetic sensor 408. The autofocus motor may include but is not limited to the magnetic grid 404, the magnetic grid sensor 405, the driver component 406, the magnetic component 407, and the magnetic sensor 408. The driver chip 403 may be disposed in the autofocus motor, or may not be disposed in the autofocus motor.

[0122] The magnetic component 407 is used to generate a magnetic field; the magnetic grid 405 is used to generate a periodically changing magnetic field.

[0123] The driving component 406 is used to drive the lens to move along the optical axis under the action of the magnetic field generated by the magnetic component 407, and drive one of the magnetic component 407 and the magnetic sensor 408 to move relative to the other, and drive one of the magnetic grid 404 and the magnetic grid sensor 405 to move relative to the other. The magnetic grid sensor 405 is used to output a first electrical signal by sensing a periodically changing magnetic field when the magnetic grid 404 and the magnetic grid sensor 405 produce relative displacement. The magnetic sensor 408 is used to output a second electrical signal by sensing the magnetic field generated by the magnetic component 407 when the magnetic component 407 and the magnetic sensor 408 move relative to each other. The driving chip 403 is used to receive the first electrical signal and the second electrical signal, determine the number of magnetic grid segments where the magnetic grid sensor is currently located according to the second electrical signal; and determine the position of the lens according to the number of magnetic grid segments and the first electrical signal.

[0124] It should be noted that the relevant introductions of the lens 401, the image sensor 402, the magnetic grating 404, the magnetic grating sensor 405, the driving component 406, the magnetic component 407, and the magnetic sensor 408 can be referred to the relevant content about the autofocus device above, and will not be elaborated here.

[0125] The second electrical signal can be a voltage signal. At this time, the driving chip 406 can determine the magnetic grating segment number where the autofocus motor is currently located according to the corresponding relationship between the motor displacement and the voltage signal.

[0126] Among them, the corresponding relationship between the motor displacement and the voltage signal is obtained according to the pre-calibrated corresponding relationship. The pre-calibrated corresponding relationship can include the corresponding relationship between the magnetic field and the motor displacement, and the corresponding relationship between the voltage and the magnetic field. Exemplarily, referring to Figure 5A the schematic diagram of the corresponding relationship between the magnetic field and the motor displacement shown. The vertical axis is the magnetic field signal of the magnetic component 407 monitored, and the horizontal axis is the displacement of the autofocus motor, that is, there is a linear relationship between the monitored magnetic field of the magnetic component 407 and the motor displacement. During the specific calibration process, control the autofocus motor to drive the lens to move along the optical axis direction, and record the magnetic field signal generated by the magnetic component 407 at each position point when the autofocus motor is at each position point, so as to generate, according to the magnetic field signals at each motor position point, as Figure 5A the schematic diagram of the corresponding relationship between the magnetic field and the motor displacement shown.

[0127] Referring to Figure 5B the schematic diagram of the corresponding relationship between the voltage and the magnetic field shown. The vertical axis is the voltage signal output by the magnetic sensor 408, and the horizontal axis is the magnetic field signal generated by the magnetic component 407, that is, there is a linear relationship between the magnetic field generated by the magnetic component 407 and the output voltage of the magnetic sensor 408. During the specific calibration process, control the autofocus motor to drive the lens to move along the optical axis direction, and record the magnetic field generated by the magnetic component 407 and the voltage signal output by the magnetic sensor 408 at each motor position point, so as to generate, according to each voltage signal and magnetic field signal, as Figure 5B the schematic diagram of the corresponding relationship between the magnetic field and the voltage shown.

[0128] According to the corresponding relationship between the magnetic field and the motor displacement as Figure 5A shown, and the corresponding relationship between the magnetic field and the voltage as Figure 5B shown, it can be determined that there is a linear corresponding relationship between the motor displacement and the voltage signal output by the magnetic sensor 408. Based on this linear corresponding relationship, the motor displacement (i.e., the motor position) corresponding to the voltage signal can be determined according to the voltage signal output by the magnetic sensor 408. For example, for the voltage signal output by the magnetic sensor 408 at a certain moment, based on Figure 5BThe one-to-one correspondence between the voltage and the magnetic field shown can be used to determine the magnetic field signal corresponding to the voltage signal. Then, based on Figure 5A the one-to-one correspondence between the magnetic field signal shown and the motor displacement, the motor displacement corresponding to the magnetic field signal can be determined. Based on this motor displacement, the position of the autofocus motor at the current moment can be determined. Finally, based on the relationship between each previously obtained motor position point and the number of magnetic grating segments, the number of magnetic grating segments corresponding to the autofocus motor position can be determined, thereby realizing the detection of the number of magnetic grating segments where the autofocus motor is located according to the magnetic sensor 408.

[0129] Refer to Figure 5C the schematic diagram of the correspondence between the voltage and the motor displacement shown. After calculation, the number of magnetic grating segments corresponding to each voltage signal or magnetic field signal can be determined. Exemplarily, Figure 5C in [the figure], the numbers 1 to 6 are respectively used to mark the number of magnetic grating segments to which they belong on the linear segment. The segment where the number 1 is located belongs to the first magnetic grating (i.e., the number of magnetic grating segments is 1), the segment where the number 2 is located belongs to the second magnetic grating, the segment where the number 3 is located belongs to the third magnetic grating, the segment where the number 4 is located belongs to the fourth magnetic grating, the segment where the number 5 is located belongs to the fifth magnetic grating, and the segment where the number 6 is located belongs to the sixth magnetic grating.

[0130] Of course, in some embodiments, the corresponding relationship as shown in Figure 5C can also be obtained through a pre-calibration operation. In this way, in actual applications, after receiving the voltage signal output by the magnetic sensor 408, the drive chip 406 can, according to Figure 5C the corresponding relationship shown, determine the number of magnetic grating segments corresponding to the voltage signal, and then determine the number of magnetic grating segments where the autofocus motor is located.

[0131] After the drive chip 406 determines the number of magnetic grating segments where the magnetic grating sensor is located according to the second electrical signal output by the magnetic sensor 408, it can calculate the displacement of the autofocus motor based on the first electrical signal output by the magnetic grating sensor and the number of magnetic grating segments. Exemplarily, refer to Figure 5D the schematic diagram of the correspondence between the total motor displacement after calculation and the motor displacement shown. The horizontal axis is the motor displacement, and the vertical axis is the total motor displacement after calculation. The total motor displacement after calculation refers to the total motor displacement calculated according to the first electrical signal and the second electrical signal after the drive chip 406 controls the movement of the autofocus motor. Figure 5DThe displacements of the respective grating segments are identified by the numbers 1 to 6. The length of the line segment corresponding to the number 1 represents the motor displacement within the first grating segment, the length of the line segment corresponding to the number 2 represents the motor displacement within the second grating segment, the length of the line segment corresponding to the number 3 represents the motor displacement within the third grating segment, the length of the line segment corresponding to the number 4 represents the motor displacement within the fourth grating segment, the length of the line segment corresponding to the number 5 represents the motor displacement within the fifth grating segment, and the length of the line segment corresponding to the number 6 represents the motor displacement within the sixth grating segment. By adding up the displacements of the motor within the five grating segments, the total displacement of the motor can be calculated.

[0132] After obtaining the calculated total displacement of the motor based on the first electrical signal and the second electrical signal, the driving chip 406 can determine the lens position according to the calculated total displacement of the motor. If the lens position is different from the desired focusing position, then according to the difference between the lens position and the desired focusing position, the current signal output to the coil is adjusted, for example, the magnitude and direction of the current signal are adjusted, so that the coil in the driving assembly can drive the lens to the desired focusing position, realizing automatic focusing closed-loop control.

[0133] It should be noted that the imaging module 400 can be a main camera module, a wide-angle camera module, a telephoto camera module, a periscope camera module, etc. That is to say, an autofocus device with one or more magnetic sensors added can be used for the automatic focusing closed-loop control process of main cameras, wide-angles, telephotos, periscopes, etc.

[0134] When the autofocus device is applied to the default-on camera (such as the main camera) of an electronic device such as a mobile phone, by adding one or more magnetic sensors in the autofocus device to detect the initial number of grating segments of the autofocus motor, the current start-up time of this camera can be shortened.

[0135] When the autofocus device is applied to a switching camera such as a periscope, telephoto or wide-angle of an electronic device such as a mobile phone, by adding one or more magnetic sensors in the autofocus device to detect the initial number of grating segments of the autofocus motor, not only can the current start-up time of this camera be shortened, but also the device power consumption can be reduced.

[0136] The accuracy of the magnetic sensor 408 is relatively low. Therefore, when simply determining the number of grating segments based on the second electrical signal output by the magnetic sensor 408, it may cause an incorrect judgment of the number of grating segments when the autofocus motor is at the grating boundary. For example, when the detection accuracy of the magnetic sensor is 50 micrometers (μm), the voltage signals within 50 μm before and after the grating boundary point may be affected by the detection accuracy, resulting in an incorrect judgment of the number of grating segments within this range. Assuming that the length of each grating segment is 800 micrometers (μm) and the grating boundary point is at 800 μm, then the voltage signals between 750 μm and 850 μm may have an incorrect judgment of the number of grating segments.

[0137] In some embodiments, in order to improve the detection accuracy of the number of magnetic grating segments at the magnetic grating boundary and achieve high-precision detection of the number of magnetic grating segments, the first electrical signal and the second electrical signal can be combined to accurately determine the number of magnetic grating segments.

[0138] It can be understood that during the continuous movement of the autofocus motor, the first electrical signal continuously output by the magnetic grating sensor can include electrical signals belonging to different magnetic grating segments. For example, as Figure 2 shown, the voltage signal output by the TMR sensor can include voltage signals of the first magnetic grating segment to the sixth magnetic grating segment.

[0139] After receiving the first electrical signal and the second electrical signal collected simultaneously, the driving chip 406 determines whether the autofocus motor is within a preset range according to the second electrical signal. The preset range is the junction of two magnetic gratings. For example, the driving chip 406 can determine the motor position corresponding to the current second electrical signal according to Figures 5A to 5C , and if the current motor position is at the magnetic grating boundary, it is determined that the autofocus motor is currently within the preset range. Conversely, if the current motor position is not at the magnetic grating boundary, it is determined that the autofocus motor is not currently within the preset range. The preset range is a ± b microns, where a is the position of the boundary point between the nth magnetic grating segment and the (n + 1)th magnetic grating segment, and the detection accuracy of the magnetic sensor is ± b microns. n is a positive integer greater than or equal to 1.

[0140] For example, assume that the length of each magnetic grating segment is 800 um, b is 50, and a is the magnetic grating position where the magnetic grating boundary point is located (for example, at 800 um, 1600 um, 2400 um). At this time, the preset range can be 750 um to 850 um (i.e., the junction of the first and second magnetic grating segments). If the current motor position is 790 um or 830 um, it is considered that the motor is at the boundary between the first magnetic grating segment and the second magnetic grating segment at this time.

[0141] After the driving chip 406 determines that the current autofocus motor is at the junction of two magnetic grating segments, it can then determine, according to the second electrical signal, that the autofocus motor is at the junction of the nth magnetic grating segment and the (n + 1)th magnetic grating segment, that is, determine at the junction of which two magnetic grating segments. For example, according to Figure 5C the shown relationship diagram, determine at the junction of which two magnetic grating segments according to the second electrical signal.

[0142] After the driving chip 406 determines at the junction of which two magnetic grating segments, it further combines the first electrical signal to accurately determine the number of magnetic grating segments where the autofocus motor is currently located.

[0143] Under normal circumstances, the first electrical signal at a certain moment may include a sine voltage signal and a cosine voltage signal. According to the magnitudes of the sine voltage signal and the cosine voltage signal, it is determined whether the current magnetic grid segment number where the autofocus motor is located is the nth segment or the (n + 1)th segment. Specifically, the sine voltage signal and the cosine voltage signal can be used as the coordinates of a circle (such as a unit circle), and according to the quadrant where the coordinates are located, it is determined whether the current magnetic grid segment number where the autofocus motor is located is the nth segment or the (n + 1)th segment. For example, assuming that according to the second electrical signal, it is determined that the autofocus motor is between the first magnetic grid segment and the second magnetic grid segment. After converting the first electrical signal into the coordinates of a circle, if the coordinates are in the first quadrant, it is determined that the current magnetic grid segment number where the autofocus motor is located is the second magnetic grid segment; if the coordinates are in the second quadrant, it is determined that the current magnetic grid segment number where the autofocus motor is located is the first magnetic grid segment.

[0144] Exemplarily, referring to Figure 6A and Figure 6B the schematic diagram of the magnetic grid segment number determination process at the magnetic grid junction shown in, the drive chip 406 receives the original signal output by the TMR sensor and the electrical signal output by the magnetic sensor, intercepts a small segment of the signal from the original signal output by the TMR sensor, and obtains the signal shown in Figure 600. The horizontal axis in Figure 600 represents the motor displacement, and the vertical axis represents the voltage. The length of the horizontal axis in Figure 600 is approximately 800um, and the sine and cosine voltage signals in Figure 600 are the voltage signals corresponding to one length period or one magnetic grid segment.

[0145] Since the detection accuracy of the magnetic sensor is plus or minus 50 micrometers (um), then a voltage signal with a length of approximately 100um is intercepted from the signal in Figure 600 to obtain the signal shown in Figure 610. The abscissa of Figure 610 is 1 - 99um; through processes such as arctangent on the original signal shown in Figure 600, a line graph shown in Figure 620 can be obtained, which can represent the magnetic grid segment number. The position of the dashed box is the junction between the first magnetic grid and the second magnetic grid. In addition, since the signal in Figure 600 is a sine voltage signal and a cosine voltage signal, the circle in Figure 630 can be represented by the sin function and the cos function, that is, the coordinates of the circle in Figure 630 can be expressed as (cos, sin). Therefore, in Figure 630, the magnitudes of the sine voltage signal and the cosine voltage signal determine the quadrant where the coordinate point is located.

[0146] Intercept the line segment corresponding to the signal of pattern 610 from the circle in pattern 630 to obtain the line segment shown in pattern 640, which is the line segment corresponding to the signal of pattern 610 in the circle of pattern 630. The driving chip 406 also processes the electrical signal output by the magnetic sensor to obtain the corresponding processing result. As shown in pattern 650, it is the displacement detection result corresponding to the signal in pattern 610. At this time, the points on the vertical axis less than 0 in pattern 650 correspond to the points in the second quadrant in pattern 640, and the points on the vertical axis greater than 0 correspond to the points in the first quadrant in pattern 640. At this time, after converting the sine and cosine voltage signals output by the TMR sensor into the coordinates of a circle, if the coordinate falls in the first quadrant, it means that the magnetic grating segment where the current autofocus motor is located is the second magnetic grating segment; if the coordinate falls in the second quadrant, it means that the magnetic grating segment where the current autofocus motor is located is the first magnetic grating segment.

[0147] According to this principle, after determining where the autofocus motor is currently at the junction of two magnetic grating segments based on the second electrical signal, that is, based on the second electrical signal, determining that the autofocus motor is currently at the junction of the nth segment and the n+1th segment, the magnitude of the sine voltage signal and the cosine voltage signal can be used to accurately determine whether the autofocus motor is in the nth segment or the n+1th segment.

[0148] It should be noted that aiming at the problem that the detection accuracy of the magnetic sensor is limited, resulting in inaccurate judgment of the magnetic grating segment number at the magnetic grating boundary, further combining the voltage signal output by the magnetic grating sensor, the magnetic grating segment number is accurately judged, realizing high-precision detection of the magnetic grating segment number.

[0149] As shown above, when determining the magnetic grating segment number where the autofocus motor is located according to the second electrical signal, the magnetic grating segment number can be determined only according to the second electrical signal. For example, according to Figure 5C the corresponding relationship directly determines the magnetic grating segment number corresponding to the voltage signal output by the magnetic sensor; it can determine the magnetic grating segment number only according to the second electrical signal at non-magnetic grating boundaries, and at the magnetic grating boundaries, further accurately detect the magnetic grating segment number according to the first electrical signal. Of course, in some embodiments, it is also possible not to distinguish whether it is at the magnetic grating boundary, but to combine the first electrical signal and the second electrical signal at all positions or any position to accurately judge the magnetic grating segment number, and the specific process can be as Figure 6A and Figure 6B shown in the process.

[0150] In the embodiment of the present application, one or more magnetic sensors are additionally added to the camera module to detect the magnetic grating segment number where the magnetic grating sensor is currently located, so that when the camera is turned on, the autofocus motor does not need to be moved to the mechanical top or bottom, reducing the device power consumption, shortening the current start-up time of the camera module, and improving the user shooting experience.

[0151] Please refer toFigure 7 , which is a schematic flowchart of a method for automatic focusing provided by an embodiment of the present application. The method may include the following steps:

[0152] Step S701, the driving chip obtains a focusing instruction, and the focusing instruction is used to indicate the desired focusing position.

[0153] The driving chip may refer to the driving chip in the autofocus motor, which may include an MCU. In addition to the driving chip being able to execute the automatic focusing closed-loop control, it may also be executed by the application processor of the SOC chip in an electronic device such as a mobile phone, that is Figure 7 the driving chip in can be replaced by an SOC chip or the application processor of an SOC chip.

[0154] The focusing instruction may be an instruction issued by the SOC chip. The desired focusing position may be the target position of the lens determined by the SOC chip according to the autofocus algorithm, or the target position of the autofocus motor, that is, driving the lens to the target position, or controlling the autofocus motor to move to the target position to achieve autofocus.

[0155] Step S702, the driving chip obtains the first electrical signal output by the magnetic grating sensor and the second electrical signal output by the magnetic sensor.

[0156] Step S703, the driving chip determines the number of magnetic grating segments where the autofocus device is currently located according to the second electrical signal.

[0157] In some embodiments, the second electrical signal is a voltage signal, and the driving chip may determine the number of magnetic grating segments corresponding to the second electrical signal according to the correspondence between the motor displacement and the voltage signal. The number of magnetic grating segments is the number of magnetic grating segments of the autofocus device. The autofocus device may be an autofocus motor.

[0158] In some other embodiments, the driving chip may also combine the first electrical signal and the second electrical signal to accurately determine the number of magnetic grating segments of the magnetic grating sensor.

[0159] Exemplarily, if the driving chip determines that the autofocus device is currently within a preset range according to the second electrical signal, it determines that the autofocus device is currently at the junction of the nth magnetic grating segment and the (n + 1)th magnetic grating segment according to the second electrical signal, and determines the final number of magnetic grating segments where the autofocus device is currently located according to the voltage amplitude of the first electrical signal. The final number of magnetic grating segments is the nth magnetic grating segment or the (n + 1)th magnetic grating segment. Among them, the preset range is a ± b microns, a is the position of the demarcation point between the nth magnetic grating segment and the (n + 1)th magnetic grating segment, and the detection accuracy of the magnetic sensor is ± b microns;

[0160] If the driving chip determines that the autofocus device is not currently within the preset range based on the second electrical signal, it determines the number of magnetic grating segments corresponding to the second electrical signal according to the correspondence between the motor displacement and the voltage signal. The number of magnetic grating segments is the number of the magnetic grating segment where the autofocus device is currently located.

[0161] It can be understood that the driving chip can process the acquired first electrical signal and second electrical signal in real time. The first electrical signal and the second electrical signal can be regarded as being collected simultaneously.

[0162] After determining the number of magnetic grating segments, in order to reduce power consumption, the magnetic sensor can be controlled to enter the sleep mode. Of course, the magnetic sensor can also be kept in the working mode continuously.

[0163] Step S704: The driving chip performs closed-loop control on the movement of the autofocus device according to the number of magnetic grating segments and the first electrical signal, so as to drive the lens to move to the desired focusing position.

[0164] It can be understood that usually when the camera starts, the number of the magnetic grating segment where the autofocus motor is currently located is obtained through the second electrical signal output by the magnetic sensor, and then the initial position of the autofocus motor is obtained. After obtaining the initial position of the autofocus motor, the magnetic sensor can be powered off to save power consumption. And, according to the initial position of the autofocus motor and the first electrical signal continuously output by the magnetic grating sensor, the movement of the autofocus motor is closed-loop controlled to achieve the autofocus function.

[0165] Of course, in addition to using the magnetic sensor to detect the initial position of the autofocus motor, the magnetic grating sensor can also be used to detect the position of the autofocus motor at any time.

[0166] To better introduce the technical solution provided by the embodiments of the present application, the following is combined with Figure 8 The schematic block diagram of the shown autofocus process is described. As Figure 8 shown, the magnetic grating sensor is exemplarily a TMR sensor and serves as the main position sensor; the magnetic sensor serves as the auxiliary position sensor. This process may include the following steps:

[0167] Step S801: The SOC chip issues an autofocus instruction.

[0168] Step S802: The MCU in the driving chip acquires the position information output by the auxiliary position sensor.

[0169] Step S803: The MCU acquires the TMR position information output by the main position sensor.

[0170] It can be understood that the MCU can acquire the position information output by the main position sensor and the auxiliary position sensor simultaneously.

[0171] Step S804: The MCU determines the current magnetic grating segment number of the autofocus motor based on the position information output by the auxiliary position sensor, or based on the position information output by the auxiliary position sensor and the TMR position information.

[0172] It can be understood that the MCU can determine the magnetic grating segment number only using the position information output by the auxiliary position sensor, or can use the position information output by the auxiliary position sensor and the TMR position information together to improve the accuracy of judging the magnetic grating segment number at the magnetic grating boundary.

[0173] The position information and the TMR position information can refer to electrical signals. For example, the TMR position information can be a sine-cosine voltage signal, and the position information can be a linear voltage signal.

[0174] Step S805: The MCU controls the auxiliary position sensor to enter the sleep mode or maintain the working state.

[0175] It can be understood that after determining the initial magnetic grating segment number of the autofocus motor through the auxiliary position sensor, the auxiliary position sensor can be powered down or enter the sleep mode to save device power consumption.

[0176] Of course, the auxiliary position sensor can also be kept in the working state all the time. In this way, in some special cases, the auxiliary position sensor can still obtain the magnetic grating segment number of the autofocus motor. For example, when a user uses an electronic device such as a mobile phone to take a photo, assuming that the mobile phone or other electronic device has completed autofocus through the above autofocus process, or is in the process of autofocusing, and at this time the mobile phone or other electronic device is physically slapped by an external force. For example, the user pats the camera with his hand. Due to the external force, the autofocus motor will move instantaneously, resulting in the driving chip being unable to detect whether the movement of the main position sensor (such as the TMR sensor) exceeds a length cycle, and thus unable to know the magnetic grating segment number where the autofocus motor is located, resulting in blurred autofocus. In this case, by keeping the auxiliary position sensor in the working state all the time, the current magnetic grating segment where the autofocus motor is located can be detected, and even if the autofocus motor moves instantaneously due to external force, there will be no blurred autofocus.

[0177] Step S806: The MCU controls the autofocus motor to move to the focus code position according to the magnetic grating segment number and the signal output by the TMR sensor.

[0178] Exemplarily, the MCU determines the current position of the autofocus motor according to the magnetic grating segment number and the signal output by the TMR sensor; according to the difference between the current position of the autofocus motor and the focus code position (i.e., the desired focus position), the magnitude and direction of the current signal input to the coil of the autofocus motor are changed to control the movement of the autofocus motor.

[0179] Step S807: The MCU outputs current to the coil of the autofocus motor to control the position of the autofocus motor in a closed loop.

[0180] Step S808: The MCU reads back the signal output by the TMR sensor to confirm whether the autofocus motor has reached the focus code position. If so, proceed to step S809; if not, return to step S806.

[0181] During the process of controlling the movement of the autofocus motor, the MCU can obtain the current position of the autofocus motor according to the signal output by the TMR sensor. If the current position of the autofocus motor is the focus code position, it is considered that the current focusing is completed; if not, it is necessary to continue to adjust the magnitude and direction of the current in the coil to control the autofocus motor to reach the focus code position, thereby driving the lens to move to the corresponding position.

[0182] Step S809: The current autofocus is completed.

[0183] For the same or similar parts between this embodiment and the above-mentioned embodiments, reference can be made to each other, and details will not be repeated here.

[0184] The embodiment of the present application also provides an electronic device, which may include the autofocus device or the camera module in any of the above embodiments. The autofocus device can also be regarded as an autofocus motor.

[0185] The embodiment of the present application also provides an electronic device, which may include, but is not limited to, Figure 4 the control chip 410 and the camera module 400 as shown. The control chip 410 may be an SOC chip or the like. The electronic device may be a terminal device with a shooting function such as a mobile phone, a tablet computer, or a vehicle-mounted device.

[0186] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the above-mentioned division of each functional unit and module is used as an example. In actual applications, the above functions can be allocated to different functional units and modules according to needs, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of each functional unit and module are only for the convenience of mutual distinction and do not limit the protection scope of the present application. The specific working processes of the units and modules in the above system can refer to the corresponding processes in the foregoing method embodiments, and details will not be repeated here.

[0187] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, to implement all or part of the processes in the above-described embodiment methods of this application, a computer program can be used to instruct relevant hardware to complete. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor (such as the MCU in a driving chip or the application processor of an SOC chip), the steps of the above-described various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can at least include: any entity or device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal, and software distribution medium that can carry the computer program code to electronic devices such as driving chips, SOC chips, or mobile phones. For example, USB flash drives, external hard drives, magnetic disks, or optical discs, etc. In some jurisdictions, according to legislation and patent practice, the computer-readable medium cannot be an electrical carrier signal and a telecommunication signal.

[0188] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0189] In the embodiments provided in this application, it should be understood that the disclosed devices, electronic devices, and methods can be implemented in other ways. For example, the above-described device / electronic device embodiments are merely illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces, and the indirect couplings or communication connections of the devices or units can be in an electrical, mechanical, or other forms.

[0190] The unit described as a separation component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0191] The electronic device provided by the embodiment of the present application may include a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the method of any one of the above-mentioned embodiments of the autofocus method.

[0192] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned various method embodiments can be implemented.

[0193] The embodiment of the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device can implement the steps in the above-mentioned various method embodiments when executed.

[0194] The embodiment of the present application also provides a chip system. The chip system includes a processor. The processor is coupled to a memory. The processor executes a computer program stored in the memory to implement the method described in any of the above-mentioned method embodiments. The chip system can be a single chip or a chip module composed of multiple chips.

[0195] In the above embodiments, the descriptions of the various embodiments have their own emphases. For parts not detailed or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments. It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution. The execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application. In addition, in the description of the specification and the appended claims of the present application, the terms "first", "second", "third", etc. are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance or implicitly indicating the quantity of the indicated technical features. Thus, features defined with "first", "second", "third", "fourth" may explicitly or implicitly include one or more of such features. In addition, it should be understood that at least one involved in the embodiments of the present application includes one or more; among them, multiple means greater than or equal to two. In the embodiments of the present application, "and / or" is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this article generally represents an "or" relationship between the associated objects before and after.

[0196] Reference to "one embodiment" or "some embodiments" etc. described in the specification of this application means that a specific feature, structure or characteristic described in connection with that embodiment is included in one or more embodiments of this application. Thus, statements such as "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments" etc. that appear in different places in this specification do not necessarily all refer to the same embodiment, but mean "one or more but not all of the embodiments", unless otherwise specifically emphasized in other ways.

[0197] Finally, it should be noted that the above are only specific implementation manners of this application, but the protection scope of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be covered within the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claimed rights.

Claims

1. An autofocus device, characterized in that, It includes a magnetic component, a driving component, a magnetic grating, a magnetic grating sensor, and a magnetic sensor; The magnetic component is used to generate a magnetic field; the magnetic grating is used to generate a periodically changing magnetic field; The driving component is used to drive the lens to move along the optical axis under the action of the magnetic field generated by the magnetic component, and drive one of the magnetic component and the magnetic sensor to move relative to the other, and drive one of the magnetic grating and the magnetic grating sensor to move relative to the other; The magnetic grating sensor is used to output a first electrical signal by sensing the periodically changing magnetic field when the magnetic grating and the magnetic grating sensor move relative to each other; The magnetic sensor is used to output a second electrical signal by sensing the magnetic field generated by the magnetic component when the magnetic component and the magnetic sensor move relative to each other, and the second electrical signal is used to indicate the number of magnetic grating segments where the autofocus device is located.

2. The device according to claim 1, characterized in that, The magnetic grating sensor is a giant magnetoresistive sensor or a tunneling magnetoresistance effect sensor.

3. The device according to claim 1, characterized in that The magnetic sensor is a Hall sensor, an anisotropic magnetoresistive effect sensor, a giant magnetoresistive sensor, or a tunneling magnetoresistance effect sensor.

4. The device according to claim 1, characterized in that, One or more of the magnetic sensors are arranged on the left side, right side, upper side, or lower side of the magnetic component.

5. The device according to any one of claims 1 to 4, characterized in that The magnetic component includes one or more magnetic elements, and the driving component includes a coil; when the coil drives the lens to move along the optical axis, the magnetic element and the magnetic grating are driven to move.

6. An imaging module, characterized in that, It includes a lens, a driving chip, a magnetic component, a driving component, a magnetic grating, a magnetic grating sensor, and a magnetic sensor; The magnetic component is used to generate a magnetic field; the magnetic grating is used to generate a periodically changing magnetic field; The driving component is used to drive the lens to move along the optical axis under the action of the magnetic field generated by the magnetic component, and drive one of the magnetic component and the magnetic sensor to move relative to the other, and drive one of the magnetic grating and the magnetic grating sensor to move relative to the other; The magnetic grating sensor is used to output a first electrical signal by sensing the periodically changing magnetic field when there is a relative displacement between the magnetic grating and the magnetic grating sensor; The magnetic sensor is used to output a second electrical signal by sensing the magnetic field generated by the magnetic component when the magnetic component and the magnetic sensor move relative to each other; The driving chip is used to receive the first electrical signal and the second electrical signal, determine the number of magnetic grating segments where the autofocus device is currently located according to the second electrical signal; and determine the position of the lens according to the number of magnetic grating segments and the first electrical signal.

7. The imaging module according to claim 6, wherein The magnetic grating sensor is a giant magnetoresistive sensor or a tunneling magnetoresistance effect sensor.

8. The camera module according to claim 6, characterized in that, The magnetic sensor is a Hall sensor, an anisotropic magnetoresistive effect sensor, a giant magnetoresistive sensor, or a tunneling magnetoresistance effect sensor.

9. The imaging module according to claim 6, wherein The magnetic component includes one or more magnetic elements, and the driving component includes a coil; when the coil drives the lens to move along the optical axis, the magnetic element and the magnetic grating are driven to move.

10. The camera module according to any one of claims 6 to 9, characterized in that, The second electrical signal is a voltage signal; The driving chip is specifically used to determine the number of magnetic grating segments corresponding to the second electrical signal according to the corresponding relationship between the motor displacement and the voltage signal, and the number of magnetic grating segments is the number of magnetic grating segments where the autofocus device is currently located.

11. The camera module according to claim 10, wherein The driving assembly includes a coil; The driving chip is further used to adjust the current signal output to the coil according to the number of magnetic grid segments and the first electrical signal.

12. The camera module according to any one of claims 6 to 9, wherein The driver chip is specifically used for: If it is determined according to the second electrical signal that the autofocus device is currently in a preset range, then it is determined according to the second electrical signal that the autofocus device is currently at the junction of the nth magnetic grid and the n+1th magnetic grid, and according to the voltage amplitude of the first electrical signal, the final magnetic grid segment number where the autofocus device is currently located is determined, and the final magnetic grid segment number is the nth magnetic grid or the n+1th magnetic grid; wherein the preset range is a±b microns, a is the position of the boundary point between the nth magnetic grid segment and the n+1th magnetic grid segment, and the detection accuracy of the magnetic sensor is ±b microns; If it is determined based on the second electrical signal that the autofocus device is not currently in the preset range, the number of magnetic grating segments corresponding to the second electrical signal is determined based on the correspondence between the motor displacement and the voltage signal, and the number of magnetic grating segments is the number of magnetic grating segments where the autofocus device is currently located.

13. An autofocus method, characterized in that, The method comprises: Acquire a focus instruction, where the focus instruction is used to indicate a desired focus position; Acquire a first electrical signal output by the magnetic grating sensor and a second electrical signal output by the magnetic sensor; determining the number of the magnetic grid segment where the autofocus device is currently located according to the second electrical signal; According to the number of magnetic grid segments and the first electrical signal, the automatic focusing device is controlled in a closed loop to move, so as to drive the lens to move to the desired focusing position; Wherein, the autofocus device comprises a magnetic component, a driving component, the magnetic grid, the magnetic grid sensor and the magnetic sensor; The magnetic component is used to generate a magnetic field; the magnetic grid is used to generate a periodically changing magnetic field; The driving assembly is used to drive the lens to move along the optical axis under the action of the magnetic field generated by the magnetic assembly, and drive one of the magnetic assembly and the magnetic sensor to move relative to the other, and drive one of the magnetic grid and the magnetic grid sensor to move relative to the other; The magnetic grating sensor is used to output the first electrical signal by sensing the periodically changing magnetic field when the magnetic grating and the magnetic grating sensor move relative to each other; The magnetic sensor is used for outputting the second electrical signal by sensing the magnetic field generated by the magnetic component when the magnetic component and the magnetic sensor move relative to each other.

14. The method according to claim 13, wherein The second electrical signal is a voltage signal; Determining the number of the magnetic grid segment where the autofocus device is currently located according to the second electrical signal includes: The number of magnetic grating segments corresponding to the second electrical signal is determined according to the corresponding relationship between the motor displacement and the voltage signal, and the number of magnetic grating segments is the number of magnetic grating segments where the autofocus device is currently located.

15. The method according to claim 13, wherein Determining the number of the magnetic grid segment where the autofocus device is currently located according to the second electrical signal includes: If it is determined, based on the second electrical signal, that the autofocus device is currently within a preset range, then it is determined, based on the second electrical signal, that the autofocus device is currently at the junction of the n-th magnetic grating and the (n + 1)-th magnetic grating, and it is determined, based on the voltage amplitude of the first electrical signal, the final magnetic grating segment number where the autofocus device is currently located, the final magnetic grating segment number being the n-th magnetic grating or the (n + 1)-th magnetic grating; wherein, the preset range is a ± b microns, a is the position of the demarcation point between the n-th magnetic grating segment and the (n + 1)-th magnetic grating segment, and the detection accuracy of the magnetic sensor is ± b microns; If it is determined, based on the second electrical signal, that the autofocus device is not currently within the preset range, then it is determined, based on the correspondence between the motor displacement and the voltage signal, the magnetic grating segment number corresponding to the second electrical signal, the magnetic grating segment number being the magnetic grating segment where the autofocus device is currently located.

16. The method according to claim 13, wherein The magnetic grating sensor is a giant magnetoresistive sensor or a tunneling magnetoresistance effect sensor; the magnetic sensor is a Hall sensor, an anisotropic magnetoresistive effect sensor, a giant magnetoresistive sensor or a tunneling magnetoresistance effect sensor.

17. The method according to any one of claims 13 to 16, characterized in that After determining, based on the second electrical signal, the magnetic grating segment number where the magnetic grating sensor is currently located, the method further includes: Controlling the magnetic sensor to enter the sleep mode.

18. An electronic device, characterized in that, Including the autofocus device according to any one of claims 1 to 5 or the imaging module according to any one of claims 6 to 12.

19. An electronic device, characterized in that, Including a memory, a processor, and a computer program stored in the memory and executable on the processor, where when the processor executes the computer program, the method according to any one of claims 13 to 17 is implemented.

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

Citation Information

Patent Citations

  • Magnetic position detecting device

    JP2021071334A

  • Method of Setting the Origin of a Linear Motor

    US20080265826A1