Motor control methods, camera modules and electronic devices
By applying electrical signals to the motor in the electronic device to obtain vibration parameters, and calculating and updating the position offset, the problem of low accuracy of motor position offset is solved, and higher precision motion compensation and automated drive are achieved.
Patent Information
- Application Number
- CN202510603141.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-09
- Publication Date
- 2026-11-10
AI Technical Summary
In existing technologies, the accuracy of motor position offset is low, resulting in poor motion compensation and an inability to accurately push the camera module to the target position.
By applying an electrical signal to the motor in the electronic device to make it vibrate freely, the vibration parameters are obtained, the correlation between the vibration parameters and the position offset is established, and the position offset is calculated and updated in real time for motion compensation.
It improves the accuracy of position offset and the precision of motion compensation, reduces costs, increases the degree of automation, and ensures the accuracy of motor drive.
Smart Images

Figure CN123074367A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminal technology, and in particular to a motor control method, a camera module, and an electronic device. Background Technology
[0002] Mobile phones and other electronic devices are equipped with motors, which can drive the camera module and other components inside the electronic device to move, enabling functions such as camera focusing and image stabilization.
[0003] Take a motor-driven camera module as an example. Normally, the motor, driven by a driving voltage, moves the camera module. The driving force on the motor can push the camera module to the target position. However, when the motor moves the camera module, it usually needs to consider the positional offset caused by factors such as gravity and magnetic forces, and use this offset for motion compensation.
[0004] In existing technologies, the motion compensation scheme for a single motor involves assigning the same positional offset to motors in the same batch. This scheme provides low accuracy in the positional offset, resulting in poor motion compensation. For example, the motor may still be unable to accurately push the camera module to the target position. Summary of the Invention
[0005] This application provides a motor control method, a camera module, and an electronic device to solve the technical problem of poor motor motion compensation effect caused by low accuracy of position offset.
[0006] To achieve the above objectives, the embodiments of this application adopt the following technical solutions:
[0007] Firstly, a motor control method is provided. This method includes: at a first moment, an electronic device applies a first electrical signal to the motor. The motor, excited by the first electrical signal, begins to vibrate under the magnetic force of its internal magnetic field. The electronic device can acquire first vibration parameters of the motor during the vibration process. The electronic device then acquires a first position offset of the motor at the first moment based on the first vibration parameters. Both the first vibration parameters and the first position offset are related to the motor's elastic coefficient. The electronic device can establish a correlation between the first vibration parameters and the first position offset based on the elastic coefficient, thereby calculating the first position offset of the motor based on the first vibration parameters and the correlation. After the first moment, the electronic device can perform motion compensation on the motor based on the first position offset. Implementing this embodiment improves the accuracy of the position offset, thereby improving the accuracy of motor motion compensation and the control precision of the motor.
[0008] Furthermore, the motor control method provided in this application embodiment allows the electronic device to independently acquire the first position offset, reducing costs and improving automation. The electronic device can acquire the first position offset at the first moment and use it for motion compensation after the first moment, improving the real-time matching degree between the position offset and the motor's performance parameters.
[0009] In one possible implementation of the first aspect, the electronic device applies a first electrical signal to the motor to obtain a first vibration parameter of the motor, which may specifically include:
[0010] The electronic device applies a first electrical signal to the motor, and the motor is subjected to the magnetic force of the magnetic field inside the motor, and moves back and forth along both sides of the equilibrium position to make the motor vibrate freely.
[0011] The electronic device acquires the waveform of the motor's free vibration, such as the waveform corresponding to the motor's voltage data or the waveform corresponding to the motor's vibration data, and then calculates the motor's first vibration parameter based on the waveform. For example, the first vibration parameter can be the vibration period. The electronic device can analyze the waveform to determine the period of the waveform, which is then used as the motor's vibration period.
[0012] Therefore, the first vibration parameter can be determined by the waveform of the motor's free vibration. Compared with other types of vibration, the waveform of free vibration only reflects the performance parameters of the motor itself and reduces the interference of the external environment. Therefore, the first vibration parameter determined by the waveform under free vibration is more accurate.
[0013] In one possible implementation of the first aspect, the aforementioned electronic device includes a controller, a motor, a driver chip, and a first register. For example, the controller can be a first controller of the electronic device or a second controller of a camera module. The first register can refer to a register in the driver chip, and the first register can be used to store a drive voltage value. The driver chip can use the drive voltage value stored in the first register to apply an electrical signal to the motor corresponding to the drive voltage value.
[0014] The aforementioned electronic device applies a first electrical signal to the motor to cause the motor to vibrate freely, including: the controller sending a first driving voltage value to a first register, the driving chip obtaining the first driving voltage value from the first register, generating a first electrical signal, and driving the motor to vibrate freely.
[0015] For example, the controller can send a first drive voltage value to the drive chip, and the drive chip can write the received first drive voltage value into a first register. Before the drive chip applies a first electrical signal to the motor, the drive chip can obtain the first drive voltage value from the first register. For example, the drive chip can directly read the first drive voltage value from the first register and generate a first electrical signal based on the first drive voltage value. For example, the voltage value corresponding to the first electrical signal can be the first drive voltage value. This first electrical signal is applied to the motor to drive the motor to vibrate freely.
[0016] Therefore, by storing the first driving voltage value in the first register, data transmission between the controller and the driver chip is achieved, which not only improves communication efficiency but also makes the process more flexible.
[0017] In one possible implementation of the first aspect, the aforementioned electronic device further includes a second register and a third register, which can refer to registers in the driver chip, and the different registers store different data types. Specifically, the second register can be used to store the waveform of the motor's free vibration, and the third register can be used to store the motor's position offset.
[0018] The driver chip can acquire the waveform of the motor's free vibration and send it to the second register. For example, the driver chip may include a sampling circuit, which can collect data from the motor during free vibration to obtain the waveform of the motor's free vibration. The driver chip also has the ability to write data to the second register, meaning it can directly write the waveform to the second register.
[0019] The controller then retrieves the waveform from the second register and calculates the first vibration parameter of the motor based on the waveform. For example, the controller can map the second register to a specified physical memory address space, and the controller can read the waveform from the physical memory address space of the second register through memory read and write instructions.
[0020] After the aforementioned electronic device obtains the first position offset of the motor at a first moment based on the first vibration parameter, the method further includes: the controller sending the first position offset to a third register. For example, the controller can obtain the address of the driver chip and the address of the third register, and then transmit the first position offset to the third register on the bus according to the address of the driver chip and the address of the third register. This first position offset is used for motion compensation of the motor. After the first moment, the driver chip can obtain the first position offset from the third register to achieve real-time motion compensation.
[0021] Therefore, data transmission between the controller and the driver chip can also be achieved by storing the waveform in the second register. Furthermore, storing different data in different registers improves data accuracy. Storing the first position offset in the third register increases the speed at which the driver chip acquires the first position offset, enabling rapid generation of the first electrical signal and precise, rapid motor movement.
[0022] In one possible implementation of the first aspect, after obtaining the first position offset of the motor at a first moment, the method further includes: at a second moment, the electronic device applies a second electrical signal to the motor, obtains a second vibration parameter of the motor, and obtains a second position offset of the motor at the second moment based on the second vibration parameter. The first moment and the second moment are different; for example, the first moment is a certain moment on January 1st, and the second moment is a certain moment on January 11th. That is, the electronic device can redetermine the position offset of the motor after a certain period of time, so that after the second moment, the electronic device can perform motion compensation on the motor according to the second position offset. The second position offset is different from the first position offset; for example, the position offset changes after the motor components age.
[0023] During use, the electronic device continuously updates the motor's current position offset to improve the accuracy of the updated position offset.
[0024] In one possible implementation of the first aspect, the aforementioned electronic device includes a camera module, a motor for driving the camera module to move, thereby performing image stabilization or focusing, etc., and a first position offset for motion compensation during the movement of the camera module driven by the motor. The position offset of the motor causes the camera module to also shift position; the electronic device performs motion compensation on the motor according to the first position offset, which is equivalent to performing motion compensation on the movement of the camera module.
[0025] The aforementioned first moment satisfies at least one of the following: the first moment is during an idle period; the idle period is predetermined or pre-configured; and the camera module is not started. For example, the idle period can be the early morning period, from 1 a.m. to 3 a.m., thereby avoiding interference with the normal operation of the camera module by the motor control method during the operation of the camera module.
[0026] In one possible implementation of the first aspect, the first vibration parameter includes the natural frequency of the motor at a first moment, which is a frequency determined by the motor's inherent properties and is independent of external disturbances. The formula for calculating the first position offset includes:
[0027]
[0028] Where L is the first position offset of the motor, g is the acceleration due to gravity, and fn This is the natural frequency. Electronic devices can obtain the motor's first position offset by substituting the motor's natural frequency into this calculation formula.
[0029] Therefore, this calculation formula allows the first position offset of the motor to be calculated directly from the motor's natural frequency, improving the calculation efficiency and accuracy of the first position offset.
[0030] In one possible implementation of the first aspect, the first electrical signal is a step signal. The step voltage can be the voltage that jumps from an initial voltage value to a first driving voltage value at a certain moment.
[0031] Therefore, by exciting the motor to vibrate freely using a step voltage, the motor can be quickly excited to achieve instantaneous impact, thereby accurately triggering the motor to vibrate freely.
[0032] Secondly, this application provides a camera module, which includes a motor, a motor drive chip, and a first controller. The first controller is electrically connected to the drive chip, and the drive chip is used to apply electrical signals to the motor. The first controller has the function of implementing the motor control method described in the first aspect. This function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-described function.
[0033] Thirdly, this application provides an electronic device including a motor, a memory, and a second controller, both of which are coupled to the second controller. The second controller has the function of implementing the motor control method described in the first aspect. This function can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the aforementioned function.
[0034] Fourthly, a computer-readable storage medium is provided that stores instructions which, when executed on a computer, enable the computer to perform any of the motor control methods described in the first aspect above.
[0035] Fifthly, a computer program product containing instructions is provided, which, when run on a computer, enables the computer to execute any of the motor control methods described in the first aspect above.
[0036] The technical effects of any of the design methods in aspects two through five can be found in the technical effects of different design methods in aspect one, and will not be repeated here. Attached Figure Description
[0037] Figure 1A schematic diagram illustrating a motor position offset involved in the motor control method provided in the embodiments of this application;
[0038] Figure 2 This is a schematic diagram of the structure of a camera module provided in an embodiment of this application;
[0039] Figure 3 A schematic flowchart of a motor control method provided in an embodiment of this application;
[0040] Figure 4 A schematic diagram illustrating a coil voltage change involved in the motor control method provided in the embodiments of this application;
[0041] Figure 5 A schematic diagram illustrating a coil voltage change involved in the motor control method provided in the embodiments of this application;
[0042] Figure 6 A hardware and software architecture diagram of the electronic device provided in the embodiments of this application;
[0043] Figure 7 A flowchart relating to the motor control method provided in the embodiments of this application;
[0044] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0045] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of this application, including various details to aid understanding. These embodiments should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of this application. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0046] To facilitate understanding, some technical common sense involved in the embodiments of this application will be introduced first.
[0047] A motor is a device that converts electrical potential energy into mechanical energy. Motors are installed in the device modules of electronic devices, driving the module to move. For example, a motor can be a component in the camera module of an electronic device, driving the camera module to move. The following discussion will use a camera module as an example of a motor-driven device module.
[0048] There are various types of motors, but the most commonly used motor in electronic devices is the voice coil motor (VCM). A voice coil motor is used for linear motion. It consists of a coil that can be physically connected to the camera module, driving or pushing it. Typically, a driver chip is built into or externally connected to the voice coil. When the driver chip applies a driving voltage to the coil, the coil experiences magnetic force and moves, thereby driving or pushing the camera module connected to the coil to follow the movement. For example, the coil can be directly glued to or wound around the lens mount of the camera module.
[0049] Before the voice coil motor moves, it should be in a first initial position. The driving voltage applied to the coil by the driver chip is the initial voltage, and this first initial position can be a preset position. For example, for a camera module, this first initial position can be the farthest end or the center point of the camera module's movement range. The initial voltage can also be a preset voltage, such as 0.42V. It should be understood that this initial voltage ensures that the camera module is in this first initial position upon startup. This application embodiment does not limit the first initial position and initial voltage.
[0050] When it is necessary to move the voice coil motor, the driver chip can drive the voice coil motor to move linearly according to the target drive voltage, and the voice coil motor can move from a first initial position to a target position. The electronic device can be pre-configured with a mapping relationship between motor position and drive voltage, which indicates the drive voltage required by the driver chip to move the voice coil motor to different positions. Optionally, the driver chip or other microprocessor can determine the drive voltage based on the position; this application embodiment does not limit this, but for ease of explanation, the following description uses the driver chip determining the drive voltage based on the position as an example.
[0051] During the aforementioned process, the motor is subjected to its own gravity, the gravity of the camera module connected to the motor, magnetic forces, etc., which cause the motor's position to shift. For example, before the motor moves, its actual initial position is not the first initial position, but rather it shifts from the first initial position. For ease of description, the initial position after the motor's shift is denoted as the second initial position. In the embodiments of this application, the amount of shift from the first initial position to the second initial position can be referred to as the position offset. It should be understood that the position offset caused by these forces is continuous; whether the motor moves before or after it has moved to the target position, the motor's position will always shift.
[0052] For ease of explanation, the following content of the embodiments of this application will mainly use gravity as the force that causes the motor to deviate, and will not explain magnetic force or other factors that cause the motor to deviate. However, the provided motor control schemes can compensate for the positional deviation caused by gravity, magnetic force or other factors.
[0053] In electronic devices, to ensure the motor moves accurately to the target position, motion compensation is needed to correct any positional deviation. Motor driver chips can perform both motion control and compensation for the motor.
[0054] Specifically, the process of motion compensation for the motor by the driver chip includes: the driver chip obtains the target drive voltage required for the motor to move to the target position, adjusts the target drive voltage according to the position offset, and then applies the adjusted target drive voltage to the motor to perform motion compensation. For example, the driver chip can adjust the target drive voltage according to the offset direction corresponding to the position offset, thereby performing motion compensation for the motor in the opposite direction to the offset direction, so that the motor actually moves to the target position.
[0055] In one example, see Figure 1 This is a schematic diagram illustrating a motor position offset involved in the motor control method provided in this application embodiment. Figure 1 In this model, the motor's initial position can be 0 on the coordinate axis, and the target position can be 4 on the coordinate axis. The motor's direction of movement is the positive direction of the coordinate axis. Assuming the position offset is 1 and the offset direction is opposite to the positive direction of the coordinate axis, then the motor's second initial position after the offset is -1 on the coordinate axis.
[0056] The target drive voltage should have moved the motor from 0 on the coordinate axis to 4 on the coordinate axis, meaning the target drive voltage supports moving the motor 4 units. However, if there is a positional offset and the target drive voltage is not adjusted, it will instead move the motor from -1 to 3.
[0057] The motion process involves the driver chip adjusting the target drive voltage to allow the motor to move further along the positive direction of the coordinate axis, compensating for the position offset. Specifically, the adjusted target drive voltage needs to support a motor movement of 4 units plus an offset of 1 unit, resulting in a movement of 5 units. Driving the motor with the adjusted target drive voltage allows it to move from -1 to position 4 on the coordinate axis, meaning the motor actually moves to the target position.
[0058] Of the multiple parameters used in the motion compensation process described above, the target position is calculated in real time by the electronic device based on the actual movement requirements of the components, the mapping relationship is pre-configured, and the target driving voltage is the driving voltage corresponding to the target position in the mapping relationship. Therefore, the position offset will affect the effect of motion compensation.
[0059] In related technologies, the position offset of a motor is preset. In some cases, multiple motors processed or shipped from the same batch may use the same position offset for motion compensation. This same position offset can be obtained by measuring the actual position offset of each motor in a subset of the batch, calculating the average of these averages, and using this average as the position offset for the entire batch. The measurement method for the actual position offset of each motor can be the gravity method, i.e., measuring the weight of the motor to determine its actual position offset. This will not be elaborated upon further, but it should be understood that these measurement methods require specialized measuring equipment and cannot typically be performed solely by the electronic equipment containing the motor. In other words, existing electronic equipment itself cannot directly measure the position offset of the motors within the equipment.
[0060] However, even motors manufactured or shipped from the same batch may have differences in the quality and elasticity of their components, resulting in variations in positional offset. In other words, the predetermined positional offset for the motor may differ from its actual offset, leading to poor motor motion compensation.
[0061] Based on this, embodiments of this application provide a motor control method applied to an electronic device. The electronic device applies a first electrical signal to the motor to obtain a first vibration parameter of the motor. The electronic device then obtains a first position offset of the motor based on the first vibration parameter, which is associated with the motor's position offset under gravity. During the movement of the device module driven by the motor, the electronic device can perform motion compensation on the motor based on the first position offset.
[0062] The motor control method provided in this application can be applied in scenarios where the controller of an electronic device performs motion compensation on the motor to enable the motor to drive the device module to move accurately. The device module can be a camera module, a telescopic camera, a disk module, or other modules with specific functions; the following examples primarily use a camera module as the device module.
[0063] The motor control method provided in this application can be applied to electronic devices including mobile phones, which contain motors. In practice, the motor control method can also be applied to tablets, laptops, wearable electronic devices (such as smartwatches), augmented reality (AR) / virtual reality (VR) devices, and other electronic devices with motors, especially electronic devices that use motors to drive camera modules. The following embodiments do not impose any special limitations on the specific form of the electronic device.
[0064] The motor control method provided in this embodiment can be executed by a first controller and / or a second controller. The first controller can be a controller included in a camera module, and the second controller can be a controller included in an electronic device for controlling the camera module.
[0065] In this embodiment, the camera module includes a motor, a motor drive chip, and a first controller. The first controller is electrically connected to the drive chip, which applies an electrical signal to the motor to cause it to move. The camera module also includes a lens and a lens mount. The motor coil is connected to the lens mount to drive the camera module to move.
[0066] As an example, see Figure 2 This is a schematic diagram of a camera module provided in an embodiment of this application. The camera module includes a lens 11, a lens bracket 12, a motor coil 13, and a module housing 14. The motor coil 13 is connected to the lens bracket 12, meaning that the coil 13 is wound around the lens bracket 12.
[0067] In this embodiment, the electronic device includes a second controller and a camera module. The second controller may be a central processing unit (CPU) within the electronic device, or it may be a subprocessor or microprocessor used to control the operation of the camera module, and there is no limitation thereto.
[0068] In this embodiment, the motor of the electronic device can be a voice coil motor or a spring-loaded motor. The motor mainly includes a driver chip, a permanent magnet, an elastic element, and a coil. The permanent magnet ( Figure 2(Not shown in the diagram) can be located on the module housing 14. A permanent magnet is used to provide a permanent magnetic field inside the motor. When the position of the permanent magnet remains unchanged, the permanent magnetic field inside the motor also typically remains unchanged; this will be referred to as the internal magnetic field of the motor in the following description. When the coil is located in the internal magnetic field of the motor and is energized, the coil will experience a magnetic force (also known as the Lorentz force) provided by the internal magnetic field of the motor. The driver chip can energize the coil, changing the magnetic force acting on the coil by altering the voltage value of the driving voltage connected to the coil, thereby controlling the coil to move to different positions under the influence of different magnetic forces.
[0069] like Figure 2 As shown, the motor may include multiple elastic elements 15. The elastic element 15 can be a spring or a sheet spring. In a sheet spring motor, the sheet spring provides elastic force, which can be used to restore the motor to a preset first initial position when not disturbed by other forces. Figure 2 In this configuration, the elastic element 15 can be connected to the coil 13. The elastic element 15 is used to apply a spring force to the coil 13 when the coil 13 moves, in order to balance the magnetic force on the coil 13. Figure 2 As shown, when the motor is in the first initial position, the elastic element 15 is not stretched, meaning the elastic force on the coil 13 is 0. After the driving chip applies a driving voltage to the coil 13, the coil 13 is subjected to the magnetic force of the internal magnetic field of the motor, moving from the first initial position to the target position. Figure 2 The middle coil 13 moves downward. The elastic element 15 then stretches, applying a spring force to the coil 13. Because this spring force balances the magnetic force acting on the coil 13, its first direction is opposite to the second direction of the coil 13's movement. Figure 2 As shown, the second direction of movement of coil 13 is downward, while the first direction of the elastic force can be upward. The driving chip can drive the motor to move by controlling the voltage value of the driving voltage, thereby moving the camera module to the target position.
[0070] During the above process, the electronic device acquires the motor's position offset, which is used for motion compensation. The implementation scheme for the electronic device to acquire the motor's position offset will be explained below.
[0071] See Figure 3 This is a schematic flowchart of a motor control method provided in an embodiment of this application. The electronic device mainly performs the following steps:
[0072] S301: At the first moment, the electronic device applies a first electrical signal to the motor to obtain the first vibration parameters of the motor.
[0073] In this embodiment, the electronic device applies an electrical signal to the motor, triggering the motor to begin vibration, such as free vibration. For ease of description, the currently applied electrical signal used to drive the motor to begin vibration is described as the first electrical signal, and the moment the first electrical signal is applied is described as the first moment. It should be understood that the first electrical signal applied to the motor is actually the first electrical signal applied to the motor's coil. Subsequent descriptions involving the coil will be referred to as the motor.
[0074] There can be many types of first electrical signals, and there can also be many ways for electronic devices to apply first electrical signals to motors.
[0075] In one example, the first electrical signal is a driving voltage, such as a step voltage or an impulse voltage. The electronic device can directly output the driving voltage to the motor, or it can output the driving voltage to the motor through a driving chip to trigger the motor to start vibrating.
[0076] In another example, the first electrical signal is a drive current, such as a step current or an impulse current. The power supply circuit of the electronic device and / or the motor may also include a current drive circuit located between the motor's control circuit and the motor's main circuit. This current drive circuit amplifies the current signal sent from the control circuit to the main circuit, thereby applying the amplified current signal to the motor's coils and triggering the motor to begin vibrating.
[0077] In some embodiments, the electronic device may apply a first electrical signal to the motor to cause the motor to vibrate freely. The electronic device then acquires the waveform of the motor's free vibration and calculates a first vibration parameter of the motor based on the waveform.
[0078] Free vibration of a motor refers to the vibrational motion of a motor caused by initial conditions without continuous external excitation. Specifically, free vibration can mean that the motor is in an equilibrium position when it is not subjected to elastic force, deviates from the equilibrium position due to external force, and then cyclically moves back and forth between the equilibrium position without further external force or without change in the external force.
[0079] When a motor is in free vibration, the vibration parameters such as the period and natural frequency of the free vibration can be extracted from the waveform of the free vibration, and these vibration parameters are related to the motor's offset. For ease of description, the vibration parameters of the motor vibrating under the first electrical signal excitation are denoted as the first vibration parameters.
[0080] The waveform of a motor undergoing free vibration can be varied. Correspondingly, electronic devices can also acquire the waveform of a motor's free vibration in various ways.
[0081] The first type is the waveform of the motor in a free vibration state, which can be the waveform corresponding to the voltage data.
[0082] As an example, after the electronic device applies the first electrical signal to the motor, the driver chip can collect the voltage data of the motor's coils in real time.
[0083] Specifically, the driver chip may include or be connected to an external voltage sampling circuit and an analog-to-digital converter (ADC). The voltage sampling circuit can acquire the analog voltage signal across the coil at a preset sampling frequency. The ADC can convert the acquired analog voltage signal into a digital signal to obtain voltage data, and transmit the voltage data to the controller of the electronic device. The voltage data may include multiple voltage values.
[0084] In some embodiments, the electronic device can extract the first vibration parameter of the motor based on the received voltage data. During the motor's free vibration state, the coils within the motor continuously cut the magnetic field lines in the motor's internal magnetic field, causing the magnetic flux of the coils to change continuously, and consequently, the back electromotive force (EMF) of the coils to change continuously as well. Therefore, the voltage data received by the controller can characterize the trend of this back EMF change, which is correlated with the vibration parameters of the motor during its free vibration state. The controller of the electronic device can analyze the received voltage data using methods such as Fourier transform or wavelet transform to obtain the first vibration parameter of the motor. This first vibration parameter can be frequency, amplitude, etc.
[0085] The second type is the waveform of the motor in a free vibration state, which can be the waveform corresponding to the vibration data.
[0086] As an example, after an electronic device applies an initial electrical signal to a motor, it can collect the motor's vibration data in real time using sensors. This vibration data can refer to the motor's displacement data during vibration. The sensors collecting this vibration data can be velocity sensors, acceleration sensors, position sensors, etc. The sensors transmit the collected vibration data to a controller, which processes the data to obtain the motor's initial vibration parameters.
[0087] Take a voice coil motor with a spring-loaded spring as an example. The spring force of the motor is directly proportional to its displacement. The waveform corresponding to the displacement data of the motor's free vibration over a period of time can be a sine wave. In the sine wave, the amplitude represents the maximum distance the motor deviates from its equilibrium position, and the frequency represents the number of vibrations per unit time.
[0088] After applying the first electrical signal to the motor, the electronic device can also obtain the first vibration parameters through other means, without limitation.
[0089] S302: The electronic device obtains the first position offset of the motor at the first moment based on the first vibration parameter; the first position offset is used for motion compensation of the motor after the first moment.
[0090] In this embodiment, the electronic device can obtain the motor's position offset based on the first vibration parameter. For ease of description, the currently obtained motor position offset is described as the first position offset. Furthermore, since the first electrical signal is applied to the motor at the first moment, the currently obtained motor position offset can also be described as the motor's first position offset at the first moment. The first position offset can be used for motion compensation of the motor after the first moment.
[0091] In this embodiment, the electronic device analyzes the influence of gravity on the motor position based on the first vibration parameter, thereby determining the first position offset of the motor at the first moment.
[0092] Specifically, the electronic device uses a first vibration parameter, combined with the motor's physical characteristic parameters (such as elastic coefficient and mass), and employs a preset mathematical model or algorithm to calculate the displacement of the motor due to gravity, i.e., the first position offset. Furthermore, after the first moment, the electronic device can perform motion compensation on the motor according to the first position offset, i.e., adjust the electrical signal used to drive the motor. By adjusting the subsequently applied electrical signal, the influence of gravity on the motor's position is reduced, improving the accuracy of motor movement.
[0093] After the initial moment, the electronic device can perform motion compensation for each target position of the motor according to the initial position offset. Taking a camera module as an example, in response to a user-applied or automatically triggered focus operation, the electronic device can determine the focus position and, based on the focus position, determine the first target position of the motor. The electronic device can then perform motion compensation for the first target position of the motor during this focusing process. Again, taking a camera module as an example, the electronic device can detect camera module shake data and, based on the shake data, determine the second target position of the motor. The electronic device can then perform motion compensation for the second target position of the motor during this image stabilization process.
[0094] It should be noted that this first position offset is an offset in a specific direction within the camera coordinate system, such as the x-axis. Furthermore, this first position offset is the position offset generated by the motor when the direction of gravity is the same as or opposite to this specific direction. The electronic device can directly use this first position offset to compensate for the motor's motion in that specific direction only when the direction of gravity is the same as or opposite to this specific direction.
[0095] However, in actual compensation, the motor may not move in that specific direction. For example, the camera coordinate system may include three axes. In daily use, the motor can move along any coordinate axis to drive the camera module to achieve focusing or image stabilization in that direction.
[0096] In this scenario, there can be multiple first position offsets, each corresponding to a different specific direction. As an example, there are two first position offsets, corresponding to the x-axis and y-axis on a plane perpendicular to the optical axis in the camera coordinate system. The electronic device uses the first position offset corresponding to the x-axis for motion compensation along the x-axis and the first position offset corresponding to the y-axis for motion compensation along the y-axis, thereby achieving multi-directional motion compensation for the motor and precise image stabilization of the camera module.
[0097] When there are multiple first position offsets, the electronic device can use each first position offset individually to perform motion compensation in a specific direction corresponding to each first position offset. Specifically, the electronic device can decompose gravity to determine the first gravity component of the motor's gravity on the x-axis and the second gravity component on the y-axis. The electronic device can also determine the target position of the motor as a first position on the x-axis and a second position on the y-axis. On the x-axis, the electronic device then performs motion compensation for the first position based on the first position offset and the first gravity component corresponding to the x-axis. On the y-axis, the electronic device then performs motion compensation for the second position based on the first position offset and the second gravity component corresponding to the y-axis.
[0098] Optionally, the electronic device may implement the motor control method provided in this application embodiment twice to obtain the first position offset of the motor on the x-axis and the first position offset of the motor on the y-axis, thereby improving the accuracy of the first position offset. The first position offset on the x-axis and the first position offset on the y-axis may be the same or different, depending on the structure of the motor, and are not limited thereto.
[0099] Furthermore, the electronic device may also include a first position offset on the z-axis to compensate for the motion of the motor in the optical axis direction, thereby achieving precise focusing of the camera module. Therefore, the electronic device can decompose gravity in three directions and determine the target position in those three directions, thus compensating for the motion of the motor in each of the three directions. The specific process is detailed above and will not be repeated here.
[0100] In summary, the motor control method provided in this application involves an electronic device applying a first electrical signal to the motor at a first moment to obtain the motor's first vibration parameters. The electronic device then obtains the motor's first position offset at that first moment based on the first vibration parameters. Since the first vibration parameters are determined in real-time after the motor receives the first electrical signal, the obtained first position offset matches the motor's performance parameters at that moment. Compared to the position offset determined at the factory, the real-time determined first position offset has higher accuracy, thereby improving the motor's positioning accuracy.
[0101] Moreover, this motor control method can be executed independently by electronic devices without the need for other equipment or human assistance. Compared with methods that require the use of professional measuring equipment to measure the actual position offset of the motor, the motor control method provided in this application embodiment is lower in cost and has a higher degree of automation.
[0102] Furthermore, in the camera module, the first position offset is used for motion compensation during the movement of the camera module driven by the motor, thereby improving the focusing or image stabilization effect of the camera module.
[0103] Furthermore, since the movement of an open-loop motor depends entirely on the electrical signal of the drive motor, real-time motion compensation is not possible. Therefore, the motor control method provided in this application embodiment can further improve the motion compensation effect of the motor when the motor is an open-loop motor.
[0104] The first moment in the embodiments of this application can be any moment. In some cases, in order not to affect the normal use of electronic devices, the first moment can be a specific moment that meets certain conditions.
[0105] In some embodiments, taking the movement of a camera module driven by a motor as an example, at least one of the following conditions can be met at the first moment:
[0106] The first moment is during the idle period;
[0107] The camera module is not started.
[0108] The idle time period can be predetermined or pre-configured. For example, the idle time period can be nighttime, or it can be the time when the electronic device is powered on, during screen lock / sleep, or when the camera application is not open. By implementing this embodiment, controlling the motor during the idle time period can avoid the motor control method interfering with the normal operation of the camera module.
[0109] In some embodiments, the idle time period may be pre-configured before the electronic device leaves the factory, or it may be configured after the camera application or the electronic device's backend server leaves the factory. Furthermore, the idle time period may also be set by the electronic device in response to user operation. This application does not limit the configuration method of the idle time period.
[0110] The phrase "camera module not started" can refer to the electronic device not having its camera application open, or having its camera application open but not having functions that require motor movement, such as taking pictures, focusing, or image stabilization, or other related states of the camera module not being invoked, without any limitation.
[0111] In some embodiments, in S301 above, the first electrical signal is a driving voltage. The electronic device can control the driving chip to generate the driving voltage and apply it to the motor to make the motor vibrate freely. The controller of the electronic device can send a first instruction to the driving chip, which instructs the driving chip to output the driving voltage to the motor. Specifically, the first instruction may include or carry the signal waveform, voltage value, etc., of the driving voltage.
[0112] In this embodiment, the first electrical signal is a step signal or a step voltage. A step voltage refers to a signal that jumps from one voltage value to another at a certain moment. The first instruction may include a first driving voltage value, which refers to the voltage value after the step voltage jumps.
[0113] When the driver chip applies a step voltage to the motor, the voltage across the coil in the motor can be divided into several stages of change. For example... Figure 4 The diagram shown illustrates a coil voltage change involved in the motor control method provided in this application embodiment. The various stages of these changes will be explained below.
[0114] 1. Initial Stage. When the driver chip applies a step voltage to the motor, the coil is stationary before the voltage jump, and the back electromotive force is zero. After the voltage jump, the coil voltage becomes the first driving voltage value, the coil current begins to rise rapidly, the magnetic force on the coil also increases, and the coil begins to accelerate under the drive of the magnetic force.
[0115] like Figure 4 As shown in (1), t0 is the transition time point of the step voltage. Before the step voltage transitions to the first driving voltage value u2, the coil voltage value is u1, which is the initial voltage value before the step voltage can transition. This initial voltage value is close to 0 or is 0, and the coil does not move at this time. After the step voltage transitions to the first driving voltage value, the coil voltage value is u2. The initial stage can refer to the stage before the step voltage transition (including the transition time point), that is, the stage before t0.
[0116] 2. Free Vibration Stage. As the coil's speed increases, the coil's back electromotive force (EMF) gradually increases. Since the direction of the back EMF is opposite to the direction of the step voltage, the coil's voltage gradually decreases due to the continuous increase in back EMF. When the coil reaches the equilibrium position where the elastic force and magnetic force are equal, the coil's acceleration is 0. However, the coil's speed is still greater than 0. As the coil moves, the elastic force becomes greater than the magnetic force, and the coil's speed gradually decreases. At this time, the back EMF also decreases, and the coil's voltage gradually increases due to the continuous decrease in back EMF until the coil's speed is 0. At this point, the coil's voltage is the first driving voltage value, u2. Then, the coil begins to accelerate in the opposite direction and repeats this process, starting to cyclically move around the equilibrium position. During this stage, the coil's speed exhibits periodic changes. Figure 4 As shown in (2), the back electromotive force also exhibits a periodic change with the velocity of the coil. It should be understood that the voltage data of the coil may include the voltage value of the coil during the free vibration phase.
[0117] 3. Steady-state stage. Due to damping (such as air damping) experienced by the coil and motor during motion, the amplitude of the coil's oscillations on both sides of the equilibrium position gradually decreases, eventually stabilizing at the equilibrium position. The coil's velocity also decreases to 0, meaning the back electromotive force also decreases to 0. Figure 4 As shown in (1), the voltage value of the coil will also stabilize at the first driving voltage value.
[0118] When a motor vibrates freely, the movement of the coil in the magnetic field cuts magnetic field lines. According to Faraday's law of electromagnetic induction, a back electromotive force (EMF) proportional to the coil's velocity will be generated across the coil. The voltage frequency of this back EMF directly reflects the motor's free vibration frequency; in other words, the voltage frequency of the voltage data directly reflects the motor's free vibration frequency. It should be understood that during free vibration, the vibration frequency with less damping is approximately equal to the natural frequency without damping. Therefore, the voltage frequency of the coil's voltage data can be considered the motor's natural frequency.
[0119] In some embodiments, in S302 above, the first vibration parameter includes the natural frequency of the motor at a first moment. The natural frequency of the motor refers to the inherent vibration frequency of the motor itself, determined by the inherent properties of the motor, such as the weight of the motor, the elastic coefficient of the elastic elements in the motor, etc. The electronic device can determine the voltage frequency of the coil voltage data as the natural frequency of the motor at the first moment.
[0120] Voltage frequency refers to the number of periodic changes in the voltage data of a coil per unit time as the back electromotive force changes; essentially, it corresponds to the vibration frequency of a motor during free vibration. For example, electronic devices can determine the voltage frequency in the following ways.
[0121] The first method uses the peak value method for calculation.
[0122] In some embodiments, the electronic device can obtain the peak time point of the coil voltage value from the voltage data. Then, the electronic device sequentially calculates the first time difference between each peak time point and the next adjacent peak time point to determine the change period corresponding to the voltage data, thereby obtaining the voltage frequency of the voltage data based on the change period.
[0123] refer to Figure 5 This is a schematic diagram illustrating a coil voltage change involved in the motor control method provided in this application embodiment. Figure 5 In (1), the peak time points obtained by the electronic device, from smallest to largest, are: time point t1, time point t2, time point t3, and time point t4. The first time differences obtained include: T1 = (time point t2 - time point t1), T2 = (time point t3 - time point t2), and T3 = (time point t4 - time point t3). The electronic device can directly use any one of the first time differences as the change period corresponding to the voltage data, or the electronic device can use the average value of multiple first time differences as the change period corresponding to the voltage data.
[0124] The second method uses the zero-crossing method for calculation.
[0125] In some embodiments, the electronic device can obtain the zero-crossing time point where the back electromotive force of the coil is 0 from the voltage data. At this time, the voltage value across the coil is equal to the first driving voltage value. The electronic device sequentially calculates the second time difference between each zero-crossing time point and the next adjacent zero-crossing time point to determine the change period corresponding to the voltage data, thereby obtaining the voltage frequency of the voltage data based on the change period.
[0126] exist Figure 5 In (2), the zero-crossing time points obtained by the electronic device, from smallest to largest, are: time point t5, time point t6, time point t7, and time point t8 (not all zero-crossing time points in the voltage data are shown). The obtained second time differences include: T4 = (time point t6 - time point t5), T5 = (time point t7 - time point t6), and T6 = (time point t8 - time point t7). The electronic device can directly multiply any one of the first time differences by 2 to obtain the corresponding change period of the voltage data, or the electronic device can multiply the average of multiple second time differences by 2 to obtain the corresponding change period of the voltage data.
[0127] In some embodiments, the electronic device can determine the first position offset of the motor based on the motor's natural frequency at a first moment and the motor's gravitational acceleration. In this embodiment, the first position offset is related to the elastic coefficient of the elastic element in the motor. For example, the first position offset is inversely proportional to the elastic coefficient of the elastic element. The motor's natural frequency is also related to the elastic coefficient of the elastic element; specifically, the motor's natural frequency is directly proportional to the elastic coefficient of the elastic element. Using the elastic coefficient of the elastic element as a correlation parameter, a calculation formula can be established, and the electronic device can calculate the first position offset according to the calculation formula.
[0128] Specifically, the natural frequency of the motor can be calculated according to the first calculation formula, which is:
[0129]
[0130] Where k is the elastic coefficient of the elastic element, and m is the weight of the motor or the camera module.
[0131] Specifically, the first position offset can also be calculated using the second calculation formula, which is as follows:
[0132]
[0133] Where k is the elastic coefficient of the elastic element, m is the weight of the motor or the camera module, and g is the gravitational acceleration.
[0134] It's important to understand that k and m in the first calculation formula are the same as those in the second calculation formula. If m in the first formula represents the weight of the motor, then m in the second formula also represents the weight of the motor. Similarly, if m in the first formula represents the weight of the camera module, then m in the second formula also represents the weight of the camera module. By eliminating the identical k and m in both the second and third calculation formulas, we can arrive at the third calculation formula. Given the known gravitational acceleration, after obtaining the motor's natural frequency, the electronic device can calculate the motor's first position offset using the third calculation formula based on the motor's natural frequency.
[0135] The third calculation formula can be:
[0136]
[0137] Where L is the first position offset of the motor, f n This is the natural frequency of the motor, also known as the vibration frequency of the motor during free vibration, or the voltage frequency of the coil voltage data.
[0138] The solution provided in this application ensures that even if the elastic coefficient of the elastic element of the spring motor or the gravity acting on the motor changes during later use, the accuracy of the calculated first position offset will not be affected.
[0139] The following is combined with Figure 6 and Figure 7 This paper describes how the various hardware and / or software modules inside the electronic device execute the motor control method provided in the embodiments of this application.
[0140] Figure 6 This document provides a hardware and software architecture diagram of an electronic device as illustrated in an embodiment of this application. The software system of the electronic device can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This embodiment uses a layered architecture as an example to exemplify the hardware and software structure of the electronic device. It should be noted that this embodiment uses a layered system as an example; the solution of this application can also be implemented in other operating systems as long as the functions implemented by each functional module are similar to those in the embodiments of this application.
[0141] Specifically, the internal architecture of an electronic device can be divided into four layers, from top to bottom: the application layer (APP), the framework layer (FWK), the hardware abstraction layer (HAL), and the hardware layer. It should be noted that in addition to these main functional layers, other functional modules may also be included, without limitation.
[0142] The application layer may include a series of application packages. These application packages may include a camera application, and may also include applications such as gallery, calendar, call, map, navigation, WLAN, settings, music, lock screen, and messaging. Of course, the application layer may also include other application packages, such as third-party applications like payment applications, shopping applications, banking applications, chat applications, or financial management applications; this application does not limit the scope of these applications.
[0143] The framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The framework layer includes some predefined functions. For example, it may include a motor control module, as well as an activity manager, window manager, content provider, view system, resource manager, notification manager, etc., without any limitations in this embodiment. The motor control module is used to receive image stabilization or focus requests from the application layer and send relevant instructions to the corresponding HAL in the hardware abstraction layer.
[0144] The hardware abstraction layer encapsulates the driver, providing an interface to the upper layers and shielding the implementation details of the underlying hardware.
[0145] The hardware abstraction layer may include a motor HAL. After receiving a motor control command, the motor HAL determines the target position of the motor and sends that position to the driver chip. It should be understood that the operations related to the motor HAL driving the motor to control the movement of the camera module can also be performed by the camera HAL in the hardware abstraction layer, without limitation.
[0146] The hardware layer includes a driver chip and a motor. The first, second, and third registers can be registers within the driver chip. It should be understood that each register stores data with a specific function. For example, the first register can store the first drive voltage value, the second register can store the waveform of the motor's free vibration, and the third register can store the first position offset.
[0147] In other words, when an electronic device recognizes a business scenario requiring motor movement (e.g., a camera application installed in the electronic device triggers a video recording function), the motor control module in the framework layer can call the motor HAL in the hardware abstraction layer. This motor HAL instructs the driver chip to obtain the first position offset determined in this embodiment, perform motion compensation on the motor, generate a drive voltage, and apply the drive voltage to the motor, thereby causing the motor to move to the target position. It should be understood that the various calls and instructions mentioned above can be accomplished by sending commands. For example, a stabilization or focus request initiated by a camera application can be considered a command sent by the camera application to the motor control module.
[0148] For ease of description, the following section will use the controller as the execution subject to describe the interaction process between the motor control module, the motor HAL, and the driver chip in the hardware layer.
[0149] refer to Figure 7 This is a schematic flowchart illustrating a motor control method provided in an embodiment of this application. (Reference) Figure 6 and Figure 7 As shown, the motor control method mainly includes the following steps:
[0150] S701: At the first moment, the controller sends the first drive voltage value to the first register.
[0151] In this embodiment, the controller has the ability to write data to the first register. For example, the controller can map the first register to a first memory address (virtual address). In this case, the controller can directly write the first drive voltage value to the first register through the Inter-Integrated Circuit (I2C) bus based on the pointer corresponding to the first memory address.
[0152] In some embodiments, the controller may send a first driving voltage value to the driver chip. The driver chip receives the first driving voltage value and writes it into a first register. It should be understood that upon receiving the first driving voltage value, the driver chip does not immediately generate the first electrical signal corresponding to the first driving voltage value; instead, it waits for the driver chip to have available time resources. That is, after receiving the clock signal for generating the first electrical signal, the driver chip generates the first electrical signal corresponding to the first driving voltage value. Therefore, the driver chip first writes the first driving voltage value into the first register and then reads the first driving voltage value from the first register.
[0153] S702: The driver chip obtains the first drive voltage value from the first register.
[0154] In this embodiment, the first register is a register in the driver chip, and the driver chip has the ability to read data from the first register. For example, the driver chip can determine the first physical address (real address) corresponding to the first register. At this time, the driver chip can directly read the first driving voltage value from the first register based on the first physical address through memory read / write instructions.
[0155] S703: The driver chip generates the first electrical signal to drive the motor to vibrate freely.
[0156] Since the first register stores the first driving voltage value, the driver chip can generate a first electrical signal based on the acquired first driving voltage value. In other words, the driver chip can generate a step voltage corresponding to the first driving voltage value. The driver chip then applies this first electrical signal to the motor, causing the motor to start moving, that is, to vibrate freely.
[0157] It should be understood that after the electronic device is started, the motor can perform initialization operations such as power-on, which will not be elaborated on.
[0158] S704: The driver chip acquires the waveform of the motor's free vibration.
[0159] The driver chip can acquire the coil voltage data through a voltage sampling circuit and an analog-to-digital converter, which serves as the waveform for the motor's free vibration. For details on the implementation, please refer to section S301; further explanation is omitted here.
[0160] S705: The driver chip sends a waveform to the second register.
[0161] In this embodiment, since the second register is a register of the driver chip, the driver chip has the ability to write data to the second register. For example, the driver chip can determine the second physical address corresponding to the second register. At this time, the driver chip can directly write waveforms to the second register based on the second physical address using memory read / write instructions.
[0162] S706: The controller obtains the waveform from the second register.
[0163] In this embodiment, the controller has the ability to read data from the second register. For example, the controller can map the second register to a second memory address (virtual address). In this case, the controller can directly read the waveform from the second register through the integrated circuit bus based on the pointer corresponding to the second memory address.
[0164] In some embodiments, the controller may send a second request to the driver chip to request waveform acquisition. Upon receiving the second request, the driver chip may read the waveform from the second register and send the waveform to the controller via the integrated circuit bus.
[0165] S707: The controller calculates the first vibration parameter of the motor based on the waveform.
[0166] The controller can analyze the free vibration of the motor based on the waveform to obtain the motor's first vibration parameters. For details on the implementation, please refer to section S301, which will not be elaborated further.
[0167] S708: The controller obtains the first position offset of the motor at the first moment based on the first vibration parameter.
[0168] The controller can analyze the influence of gravity on the motor's position based on the first vibration parameter, thereby obtaining the motor's first position offset at the first moment. For details on the implementation, please refer to section S302, which will not be elaborated upon here.
[0169] S709: The controller sends the first position offset to the third register.
[0170] The controller can also send the first position offset to the third register via the integrated circuit bus. For details on the sending method, please refer to the S701 documentation; further details will not be provided here.
[0171] After the controller sends the first position offset to the third register, the driver chip can read the first position offset from the third register and adjust the electrical signal used to drive the motor according to the first position offset to perform motion compensation for the motor.
[0172] It should be understood that the data interaction between the controller, the driver chip, and the various registers can all be performed via the integrated circuit bus. For example, the controller sends a voltage value to the driver chip, and the controller writes a position offset to the register. If the electronic device is connected to an oscilloscope, the oscilloscope can monitor the data transmitted on the integrated circuit bus and analyze whether the controller of the electronic device is performing the aforementioned related operations involved in the motor control method provided in the embodiments of this application.
[0173] In some embodiments, the electronic device can also determine the position offset multiple times for the same motor. It should be noted that the natural frequency of a motor changes with usage time. As usage time increases, internal components of the motor (such as elastic elements) may experience aging, deformation, or other problems, leading to changes in the motor's natural frequency. The natural frequency of the motor acquired by the electronic device at different times may be different, and therefore the position offset calculated based on the natural frequency may also be different.
[0174] Following S302 in the above embodiment, continue as follows: Figure 3 As shown, the motor control method provided in this application embodiment may further include the following steps:
[0175] S303: At the second moment, the electronic device applies a second electrical signal to the motor to obtain the second vibration parameters of the motor.
[0176] S304: The electronic device obtains the second position offset of the motor at the second moment based on the second vibration parameter; the second position offset is used for motion compensation of the motor after the second moment.
[0177] The second moment differs from the first moment, and the second position offset differs from the first position offset. For example, the second moment can be a moment after the first moment. During the period from the first moment to the second moment, the internal components of the motor may age, causing changes in the natural frequency, which in turn causes the first position offset to differ from the second position offset.
[0178] The electronic device can perform motion compensation on the motor according to the first position offset after the first moment and before the second moment. After the second moment, the electronic device can perform motion compensation on the motor according to the second position offset. By updating the position offset, the accuracy of the position offset can be further improved, and the motion compensation effect can be better.
[0179] For details on the implementation of S303 and S304, please refer to the contents of S301 and S302, which will not be elaborated here.
[0180] Furthermore, embodiments of this application also provide an electronic device, including a motor, a memory, and a controller;
[0181] The memory stores the instructions that the computer executes;
[0182] The controller executes computer-executed instructions stored in the memory, causing the electronic device to perform the motor control method provided in the above embodiments. In addition to these main components, the electronic device also includes components for implementing basic functions, which will be discussed below. Figure 8 Please provide a detailed explanation.
[0183] Figure 8This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 800 may include a processor 810, an external memory interface 820, an internal memory 821, a Universal Serial Bus (USB) interface 830, a charging management module 840, a power management module 841, a battery chip 842, antenna 1, antenna 2, a mobile communication module 850, a wireless communication module 860, an audio module 870, a speaker 870A, a receiver 870B, a microphone 870C, a headphone jack 870D, a sensor module 880, buttons 890, a motor 891, an indicator 892, a camera 893, a display screen 894, and a SIM card module 895, etc. The sensor module 880 may include a pressure sensor 880A, a gyroscope sensor 880B, a barometric pressure sensor 880C, a magnetic sensor 880D, etc.
[0184] The illustrated structure of this embodiment does not constitute a limitation on the electronic device 800. It may include more or fewer components than illustrated, or combine or separate certain components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of both.
[0185] Processor 810 may include one or more processing units. For example, processor 810 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors.
[0186] The aforementioned controller can be the decision-maker that directs the various components of the electronic device 800 to work in a coordinated manner according to instructions. It is the nerve center and command center of the electronic device 800. Based on the instruction opcode and timing signals, the controller generates operation control signals to complete the control of instruction fetching and execution. For example, the controller can perform the following steps in this embodiment:
[0187] At the first moment, a first electrical signal is applied to the motor. Excited by the signal, the motor begins to vibrate under the influence of the magnetic force of its internal magnetic field. The first vibration parameters of the motor during this vibration process are then acquired. Based on these parameters, the first position offset of the motor at the first moment is determined.
[0188] The processor 810 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 810 is a cache memory, which can store instructions or data that the processor 810 has just used or that are used repeatedly. If the processor 810 needs to use the instruction or data again, it can directly retrieve it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 810, and thus improves the efficiency of the system.
[0189] In some embodiments, the processor 810 may include interfaces. These interfaces may include an I2C interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a SIM interface, and / or a USB interface, etc.
[0190] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDL) and a serial clock line (SCL). In some embodiments, the processor 810 may include multiple I2C buses. The processor 810 can couple to the touch sensor 880K, charger, flash, camera 893, etc., through different I2C bus interfaces. For example, the processor 810 can couple to the touch sensor 880K through the I2C interface, enabling the processor 810 and the touch sensor 880K to communicate through the I2C bus interface, thereby realizing the touch function of the electronic device 800.
[0191] The interface connection relationships between the modules illustrated in the embodiments of the present invention are merely illustrative and do not constitute a structural limitation on the electronic device 800. The electronic device 800 may employ different interface connection methods or combinations of multiple interface connection methods as described in the embodiments of the present invention.
[0192] Motor 891 can generate vibration alerts. Motor 891 can be used for camera image stabilization or focusing. For example, when stabilizing the camera, motor 891 can move the camera module in a plane perpendicular to the optical axis; when focusing the camera, motor 891 can move the camera module along the optical axis.
[0193] The motor control methods described in the foregoing embodiments can all be implemented in the electronic device 800 having the aforementioned hardware structure.
[0194] Based on the above embodiments, this application also provides a motor control device, which includes a processor for executing the motor control method provided in the above embodiments.
[0195] This application also provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to execute the motor control method provided in the above embodiments.
[0196] This application also provides a computer program product containing instructions that, when run on a computer, enable the computer to execute the motor control method provided in the above embodiments.
[0197] The specific implementation methods and technical effects of the electronic devices, motor control devices, computer-readable storage media, and computer program products containing instructions provided in this application can be found in the specific implementation process and technical effects of the motor control method provided in the foregoing embodiments, which will not be repeated here.
[0198] In some embodiments, as described above, those skilled in the art will clearly understand that, for the sake of convenience and brevity, the division of the functional modules described above is merely an example. In practical applications, the functions described above can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0199] In the embodiments of this application, the functional units can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0200] If the integrated unit is implemented as 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, the technical solutions of the embodiments of this application, essentially, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as flash memory, portable hard disk, read-only memory, random access memory, magnetic disk, or optical disk.
[0201] The above description is merely a specific implementation of the embodiments of this application, but the protection scope of the embodiments of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the embodiments of this application should be covered within the protection scope of the embodiments of this application. Therefore, the protection scope of the embodiments of this application should be determined by the protection scope of the claims.
Claims
1. A motor control method, characterized in that, include: At the first moment, the electronic device applies a first electrical signal to the motor to obtain the first vibration parameters of the motor; The electronic device obtains the first position offset of the motor at the first moment based on the first vibration parameter; the first position offset is used for motion compensation of the motor after the first moment.
2. The motor control method according to claim 1, characterized in that, The electronic device applies a first electrical signal to the motor and acquires the first vibration parameters of the motor, including: An electronic device applies the first electrical signal to the motor to cause the motor to vibrate freely. The electronic device acquires the waveform of the motor performing the free vibration, and calculates the first vibration parameter based on the waveform.
3. The motor control method according to claim 2, characterized in that, The electronic device includes a controller, a driver chip, a first register, and the motor; The electronic device applies the first electrical signal to the motor to cause the motor to vibrate freely, including: The controller sends a first drive voltage value to the first register; The driver chip obtains the first driving voltage value from the first register, generates the first electrical signal, and drives the motor to perform the free vibration.
4. The motor control method according to claim 3, characterized in that, The electronic device also includes a second register and a third register; The electronic device acquires the waveform of the motor performing the free vibration, and calculates the first vibration parameter based on the waveform, including: The drive chip acquires the waveform of the motor performing the free vibration and sends the waveform to the second register; The controller obtains the waveform from the second register and calculates the first vibration parameter based on the waveform; After the electronic device obtains the first position offset of the motor at the first moment based on the first vibration parameter, the method further includes: The controller sends the first position offset to the third register.
5. The motor control method according to any one of claims 1-4, characterized in that, After obtaining the first position offset of the motor at the first moment, the method further includes: At the second moment, the electronic device applies a second electrical signal to the motor, acquires the second vibration parameter of the motor, and acquires the second position offset of the motor at the second moment based on the second vibration parameter; the second position offset is used for motion compensation of the motor after the second moment. The second time point is different from the first time point, and the second position offset is different from the first position offset.
6. The motor control method according to any one of claims 1-5, characterized in that, The electronic device includes a camera module, and the motor is used to drive the camera module to move. The first position offset is used for motion compensation during the process of the motor driving the camera module to move. At the first moment, at least one of the following conditions must be met: The first moment occurs during an idle period; the idle period is predetermined or pre-configured. The camera module was not started.
7. The motor control method according to any one of claims 1-6, characterized in that, The motor is a sheet spring motor, and / or the motor is an open-loop motor.
8. The motor control method according to any one of claims 1-7, characterized in that, The first vibration parameter includes the natural frequency of the motor at the first moment; The formula for calculating the first position offset includes: Wherein, L is the first position offset, g is the gravitational acceleration, and f n The inherent frequency is denoted as .
9. The motor control method according to any one of claims 1-8, characterized in that, The first electrical signal is a step signal.
10. A camera module, characterized in that, The camera module includes a motor, a driver chip for the motor, and a first controller. The first controller is electrically connected to the driver chip, and the driver chip is used to apply an electrical signal to the motor. The first controller is used to execute the motor control method according to any one of claims 1-9.
11. An electronic device, characterized in that, The electronic device includes a motor, a memory, and a second controller, wherein the motor and the memory are both coupled to the second controller. The memory stores computer-executed instructions; The second controller executes computer execution instructions stored in the memory, causing the electronic device to perform the motor control method as described in any one of claims 1-9.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when run on a computer, causes the computer to perform the motor control method as described in any one of claims 1-9.
13. A computer program product, characterized in that, It includes a computer program, which, when executed by the controller, implements the motor control method as described in any one of claims 1-9.
