Angle control method and device of stepping motor, stepping motor and storage medium

By installing a magnetic sensor on the stepper motor and using the analog-to-digital conversion value to detect the out-of-step phenomenon and perform angle correction, the problem of low accuracy of the stepper motor is solved and higher rotation accuracy is achieved.

CN118539795APending Publication Date: 2024-08-23GUANGZHOU SHIYUAN ELECTRONICS CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310151056.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-21
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

There is a problem of low accuracy when the stepper motor rotates to the target position. This is mainly due to the lack of feedback signal in the closed-loop control, which makes the out-of-step phenomenon difficult to detect and correct.

Method used

Install a magnetic sensor on the stepper motor, obtain the analog-to-digital conversion value through the magnetic sensor, determine the difference between the actual angle and the target angle, and perform angle control based on this to ensure that the motor reaches the target position accurately.

Benefits of technology

Through the use of magnetic sensors, the out-of-step phenomenon of the stepper motor can be effectively detected and precise angle control can be performed, significantly improving the accuracy of the stepper motor rotating to the target position.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118539795A
    Figure CN118539795A
Patent Text Reader

Abstract

The invention provides an angle control method and device of a stepping motor, the stepping motor and a storage medium. The stepping motor is provided with the magnetic sensor, when the stepping motor works, relative displacement occurs between the first magnetic ring in the magnetic sensor and the first magnetic encoder, and therefore the analog-to-digital conversion value of the first magnetic encoder can be obtained. The magnetic sensor has the characteristic that when the analog-to-digital conversion value meets the target condition, the stepping motor has the out-of-step phenomenon. Therefore, the actual rotation angle of the first shaft can be obtained when the stepping motor is out of step under the condition that the analog-to-digital conversion value meets the target condition. Namely, whether the stepping motor is out of step or not is determined according to the analog-to-digital conversion value and the measurement precision value of the magnetic sensor, and when the stepping motor is out of step, the actual rotation angle of the first shaft is determined. And when the target angle is given, whether the first shaft rotates to the target angle or not is determined, and when the first shaft does not rotate to the target angle, angle control is performed on the stepping motor, so that the precision of rotating the stepping motor to the target position 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 motor technology, and more specifically, to an angle control method and device for a stepper motor, a stepper motor and a storage medium in the field of motor technology. Background Art

[0002] The stepper motor is one of the most common motors in the field of CNC machine tools. It rotates according to a series of step angles to enable the stepper motor to reach the target position.

[0003] In the related art, the control of the stepper motor is often a closed-loop control: the information of the target position is directly input into the stepper motor to control the stepper motor to rotate. There is no feedback signal during the rotation of the stepper motor.

[0004] The above closed-loop control enables the stepper motor to rotate to the target position, but there may be a problem that the precision of the stepper motor rotating to the target position is not high. Summary of the invention

[0005] The present application provides a stepper motor angle control method, device, stepper motor and storage medium, which can improve the accuracy of the stepper motor rotating to a target position.

[0006] In a first aspect, a method for controlling the angle of a stepper motor is provided. A magnetic sensor is installed on the stepper motor. The magnetic sensor includes a first magnetic ring and a first magnetic encoder. The first magnetic ring and the first magnetic encoder are arranged opposite to each other. The first magnetic ring is connected to a first axis of the stepper motor, or the first magnetic encoder is connected to the first axis. The method includes: obtaining an analog-to-digital conversion value of the first magnetic encoder at a current moment through the magnetic sensor; determining an actual rotation angle of the first axis based on the analog-to-digital conversion value at the current moment and a measurement accuracy value of the magnetic sensor when the analog-to-digital conversion value at the current moment meets a target condition; and performing angle control on the stepper motor based on the target angle of rotation of the first axis and the actual angle of rotation of the first axis.

[0007] In the above technical solution, since a magnetic sensor is installed on the stepper motor, during the operation of the stepper motor, a relative displacement change will occur between the first magnetic ring in the magnetic sensor and the first magnetic encoder, so the analog-to-digital conversion value of the first magnetic encoder can be obtained through the magnetic sensor. Since the magnetic sensor has the characteristic of being able to indicate that the stepper motor has lost step when the analog-to-digital conversion value meets the target condition. Therefore, the actual angle of rotation of the first axis when the stepper motor loses step can be obtained when the analog-to-digital conversion value meets the target condition. In other words, whether the stepper motor has lost step is determined by the analog-to-digital conversion value and the measurement accuracy value of the magnetic sensor, and in the case of losing step, the actual angle of rotation of the first axis is determined. Under the condition of a given target angle, it is determined whether the first axis rotates to the target angle. When it does not rotate to the target angle, the stepper motor can be angle-controlled so that the first axis rotates to the target angle, thereby improving the accuracy of the stepper motor rotating to the target position.

[0008] In combination with the first aspect, in some possible implementations, the method also includes: determining whether there is a linear relationship between the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at multiple historical moments; if there is no linear relationship between the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at the multiple historical moments, determining that the analog-to-digital conversion value at the current moment meets the target condition.

[0009] The above technical solution describes the process of whether the analog-to-digital conversion value at the current moment meets the target condition. That is, when there is no linear relationship between the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at multiple historical moments, it indicates that the analog-to-digital conversion value at the current moment meets the target condition and the stepping motor loses steps.

[0010] In combination with the first aspect and the above-mentioned implementation manner, in some possible implementation manners, the process of determining that there is no linear relationship between the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at multiple historical moments includes any one of the following: using target relationship data to determine a test analog-to-digital conversion value at the current moment, and when the difference between the test analog-to-digital conversion value and the analog-to-digital conversion value at the current moment is greater than a first threshold, determining that there is no linear relationship between the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at multiple historical moments, the target relationship data being obtained based on the analog-to-digital conversion values ​​at multiple historical moments; or, at a first ratio When the difference between the first ratio and the second ratio is greater than the second threshold, it is determined that there is no linear relationship between the analog-to-digital conversion value of the current moment and the analog-to-digital conversion values ​​of multiple historical moments, the first ratio is the ratio between the first difference and the second difference, the first difference is the difference between any two historical moments, the second difference is the difference between the analog-to-digital conversion values ​​of the two historical moments, the second ratio is the ratio between the third difference and the fourth difference, the third difference is the difference between the current moment and any historical moment, and the fourth difference is the difference between the analog-to-digital conversion value of the current moment and the analog-to-digital conversion value of the historical moment.

[0011] In the above technical scheme, the process of the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at multiple historical moments not having a linear relationship is described, and two different determination processes are specifically given. The first is to use the target relationship data to determine the test analog-to-digital conversion value at the current moment, and when the difference between the test analog-to-digital conversion value and the analog-to-digital conversion value at the current moment is greater than the first threshold, determine that the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at multiple historical moments do not have a linear relationship. Equivalent to the process of determining whether the first coordinate point (current moment, analog-to-digital conversion value at the current moment) falls on a straight line formed by multiple target data; the second is to determine that the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at multiple historical moments do not have a linear relationship when the difference between the first ratio and the second ratio is greater than the second threshold, which is equivalent to determining whether the slope determined by the second coordinate point (current moment, test analog-to-digital conversion value at the current moment) and the third coordinate point (any historical moment, analog-to-digital conversion value at any historical moment) is the same as the slope determined by the two coordinate points corresponding to the analog-to-digital conversion values ​​of any two historical moments. Optionally, the fourth coordinate point of the two coordinate points may be (any historical moment, the analog-to-digital conversion value of any historical moment); the fifth coordinate point of the two coordinate points may be (another historical moment, the analog-to-digital conversion value of another historical moment).

[0012] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the stepper motor is angle-controlled based on the target angle of rotation of the first axis and the actual angle of rotation of the first axis, including: determining the angle difference between the target angle and the actual angle; and based on the actual angle, controlling the first axis to continue rotating by the angle difference.

[0013] The above technical solution is a process of controlling the first axis of the stepper motor to rotate from the actual angle to the target angle. It should be understood that the angle difference here can be positive or negative. In other words, the actual angle of rotation of the first axis may exceed the target angle or may not exceed the target angle. In this regard, based on the angle difference, the first axis can be controlled to continue rotating by the angle difference on the basis of the actual angle. The first axis is rotated to the target angle, and the accuracy of the first axis rotating to the target angle is improved.

[0014] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the method also includes: determining the total rotation angle of the stepper motor and the maximum analog-to-digital conversion value of the first magnetic encoder when the first axis rotates from the minimum limit point of the stepper motor to the maximum limit point of the stepper motor, the minimum limit point and the maximum limit point being used to limit the motion range of the stepper motor; based on the total angle, controlling the stepper motor to rotate toward the center position of the motion range; based on the maximum analog-to-digital conversion value and the actual analog-to-digital conversion value obtained during the rotation of the stepper motor toward the center position, verifying whether the stepper motor has rotated to the center position.

[0015] In the above technical scheme, the minimum limit point and the maximum limit point of the first axis are calibrated, and the stepper motor is reset to the center position. When the first axis of the stepper motor is at the minimum limit point, the rotation angle of the stepper motor is 0, and the analog-to-digital conversion value is 0. When the first axis of the stepper motor is at the maximum limit point, the rotation angle of the stepper motor is the largest, and the analog-to-digital conversion value is the largest. When the first axis rotates from the minimum limit point to the maximum limit point, the rotation angle will continue to increase, and the analog-to-digital conversion value will continue to increase. When the first axis reaches the maximum limit point, the total angle of rotation of the first axis and the maximum analog-to-digital conversion value can be obtained. Therefore, in the process of resetting the stepper motor to the center position of the motion range, the first axis can be rotated based on the total angle, and based on the maximum analog-to-digital conversion value and the actual analog-to-digital conversion value, it can be verified whether the stepper motor has rotated to the center position. This can improve the accuracy of the stepper motor rotating to the center position.

[0016] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the stepper motor is also equipped with a camera, and the camera can be driven to rotate when the first axis rotates. Before obtaining the analog-to-digital conversion value of the first magnetic encoder at the current moment through the magnetic sensor, the method also includes: obtaining the environmental image captured by the camera; determining the relative position between the target object in the environmental image and the center of the environmental image; based on the relative position, the conversion relationship between the motor coordinate system and the camera coordinate system, determining the target angle that the first axis needs to rotate to when the image of the target object falls at the center, and controlling the rotation of the first axis based on the target angle.

[0017] In the above technical solution, placing the target object in the central area of ​​the environment image is a concept of central composition, which can form a visual focus, highlight the content of the target object, and intuitively display the main content (target object).

[0018] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the stepper motor is a dual-axis stepper motor, the dual-axis stepper motor also includes a second axis, the magnetic sensor also includes a second magnetic ring and a second magnetic encoder, the second magnetic ring and the second magnetic encoder are arranged opposite to each other, the second magnetic ring is connected to the second axis of the dual-axis stepper motor, or the second magnetic encoder is connected to the second axis.

[0019] In the above technical solution, when the stepper motor is a dual-axis stepper motor, the stepper motor also includes a second axis. The second axis and the first axis are only placed differently during installation. The second axis, like the first axis, will also have a second magnetic ring and a second magnetic encoder connected to it. The second magnetic ring or the second magnetic encoder will rotate around the second axis. Therefore, during the operation of the dual-axis stepper motor, the second axis can also improve the accuracy of the stepper motor rotating to the target position based on the characteristics of the magnetic sensor, just like the first axis.

[0020] In a second aspect, a stepper motor angle control device is provided, wherein a magnetic sensor is installed on the stepper motor, the magnetic sensor includes a first magnetic ring and a first magnetic encoder, the first magnetic ring and the first magnetic encoder are arranged opposite to each other, the first magnetic ring is connected to the first axis of the stepper motor, or the first magnetic encoder is connected to the first axis, the device includes: an acquisition module, used to acquire the analog-to-digital conversion value of the first magnetic encoder at a current moment through the magnetic sensor; a determination module, used to determine the actual rotation angle of the first axis based on the analog-to-digital conversion value at the current moment and the measurement accuracy value of the magnetic sensor when the analog-to-digital conversion value meets the target condition; and a control module, used to perform angle control on the stepper motor based on the target angle of rotation of the first axis and the actual angle of rotation of the first axis.

[0021] In combination with the second aspect, in some possible implementations, the determination module is also used to: determine whether there is a linear relationship between the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at multiple historical moments; if there is no linear relationship between the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at the multiple historical moments, determine that the analog-to-digital conversion value at the current moment meets the target condition.

[0022] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, the determination module is specifically used for any one of the following: using the target relationship data to determine the test analog-to-digital conversion value of the current moment, and when the difference between the test analog-to-digital conversion value and the analog-to-digital conversion value of the current moment is greater than a first threshold, determining that there is no linear relationship between the analog-to-digital conversion value of the current moment and the analog-to-digital conversion values ​​of multiple historical moments, and the target relationship data is obtained based on the analog-to-digital conversion values ​​of multiple historical moments; or, when the difference between the first ratio and the second ratio is greater than the second threshold, determining that there is no linear relationship between the analog-to-digital conversion value of the current moment and the analog-to-digital conversion values ​​of multiple historical moments, the first ratio is the ratio between the first difference and the second difference, the first difference is the difference between any two historical moments, the second difference is the difference between the analog-to-digital conversion values ​​of the two historical moments, the second ratio is the ratio between the third difference and the fourth difference, the third difference is the difference between the current moment and any historical moment, and the fourth difference is the difference between the analog-to-digital conversion value of the current moment and the analog-to-digital conversion value of the historical moment.

[0023] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, the control module is specifically used to: determine the angle difference between the target angle and the actual angle; and based on the actual angle, control the first axis to continue rotating by the angle difference.

[0024] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, the determination module is also used to determine the total rotation angle of the stepper motor and the maximum analog-to-digital conversion value of the first magnetic encoder when the first axis rotates from the minimum limit point of the stepper motor to the maximum limit point of the stepper motor, and the minimum limit point and the maximum limit point are used to limit the motion range of the stepper motor; the control module is also used to control the stepper motor to rotate toward the center position of the motion range of the stepper motor based on the total angle; the device also includes: a verification module, which is used to verify whether the stepper motor rotates to the center position based on the maximum analog-to-digital conversion value and the actual analog-to-digital conversion value obtained during the rotation of the stepper motor to the center position.

[0025] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, a camera is also installed on the stepper motor, and the camera can be driven to rotate when the first axis rotates. The acquisition module is also used to acquire the environmental image captured by the camera; the determination module is also used to: determine the relative position between the target object in the environmental image and the center of the environmental image; determine the target angle that the first axis needs to rotate to when the image of the target object falls on the center based on the relative position, the conversion relationship between the motor coordinate system and the camera coordinate system; the control module is also used to control the rotation of the first axis based on the target angle.

[0026] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, the stepper motor is a dual-axis stepper motor, the dual-axis stepper motor also includes a second axis, the magnetic sensor also includes a second magnetic ring and a second magnetic encoder, the second magnetic ring and the second magnetic encoder are arranged opposite to each other, the second magnetic ring is connected to the second axis of the dual-axis stepper motor, or the second magnetic encoder is connected to the second axis.

[0027] According to a third aspect, a stepper motor is provided, on which a magnetic sensor is installed. The magnetic sensor includes a first magnetic ring and a first magnetic encoder. The first magnetic ring and the first magnetic encoder are arranged opposite to each other. The first magnetic ring is connected to the first shaft of the stepper motor, or the first magnetic encoder is connected to the first shaft.

[0028] In a fourth aspect, a controller for a stepper motor is provided, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein when the processor executes the computer program, the controller executes the method in the above-mentioned first aspect or any possible implementation of the first aspect.

[0029] In a fifth aspect, a computer-readable storage medium is provided, which stores instructions. When the instructions are executed on a computer or a processor, the computer or the processor executes the method in the first aspect or any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 is a schematic diagram of the relative position relationship between a stepper motor and a magnetic sensor provided in an embodiment of the present application;

[0031] Figure 2 is a schematic diagram of the relative position relationship between a dual-axis stepping motor and a magnetic sensor provided in an embodiment of the present application;

[0032] Figure 3 is a schematic flow chart of a stepper motor angle control method provided in an embodiment of the present application;

[0033] Figure 4 is a schematic diagram of analog-to-digital conversion values ​​at multiple moments provided by an embodiment of the present application;

[0034] Figure 5 It is a schematic diagram of an analog-to-digital conversion value at the current moment provided by an embodiment of the present application not satisfying a target condition;

[0035] Figure 6 This is a schematic diagram provided by the present application for placing a target object in the central area of ​​an environment image;

[0036] Figure 7 is a structural schematic diagram of an angle control device for a stepping motor provided in an embodiment of the present application;

[0037] Figure 8 It is a structural schematic diagram of a controller of a stepper motor provided in an embodiment of the present application. DETAILED DESCRIPTION

[0038] The technical solutions in the present application will be described clearly and in detail below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, "multiple" means two or more than two. The terms "first" and "second" are used for descriptive purposes only and should not be understood as implying or suggesting relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features.

[0039] It should be understood that a stepper motor is an actuator that converts a pulse signal into an angular displacement. Each time a stepper motor receives a pulse signal, it rotates a fixed angle in the set direction, which is called the "step angle". The number of steps of a stepper motor can be understood as the number of step angles that the stepper motor rotates.

[0040] Figure 1 It is a schematic diagram of the relative position relationship between a stepper motor and a magnetic sensor provided in an embodiment of the present application.

[0041] Exemplarily, a magnetic sensor is installed on the stepper motor, and the magnetic sensor includes a first magnetic ring and a first magnetic encoder. The first magnetic ring and the first magnetic encoder are arranged opposite to each other, and the first magnetic ring is connected to the first shaft of the stepper motor, or the first magnetic encoder is connected to the first shaft.

[0042] Among them, "the first magnetic ring and the first magnetic encoder are arranged facing each other" can be understood as the first magnetic ring and the first magnetic encoder are in a face-to-face position relationship while maintaining a certain distance. "The first magnetic ring is connected to the first axis of the stepper motor, or the first magnetic encoder is connected to the first axis" can be understood as the first magnetic ring and the first magnetic encoder both surround the first axis. When the first magnetic ring and the first magnetic encoder are in a face-to-face position relationship, when the stepper motor is working, the first magnetic encoder or the first magnetic ring surrounds the first axis and rotates with the first axis. When the first magnetic encoder surrounds the first axis and rotates with the first axis, the first magnetic ring does not move, and the first magnetic encoder will cut the magnetic field around the first magnetic ring, thereby changing the magnetic field strength. When the first magnetic ring surrounds the first axis and rotates with the first axis, the first magnetic encoder does not move, and the rotation of the first magnetic ring will change the magnetic field strength.

[0043] like Figure 1 As shown, a magnetic sensor B and a camera C are installed on the stepper motor A, wherein the magnetic sensor B is installed at the position indicated by the dotted box, and the magnetic sensor B includes a first magnetic encoder B1 and a first magnetic ring B2. A certain gap is maintained between the first magnetic encoder B1 and the first magnetic ring B2. Figure 1 The figures are all around the first axis O1 of the stepper motor A. During the operation of the stepper motor A, the first magnetic encoder B1 or the first magnetic ring B2 rotates around the first axis O1 in the direction indicated by o along with the first axis O1, and at the same time drives the camera C to rotate in the direction indicated by o, so that the camera C can collect the environment image around the stepper motor A during the rotation.

[0044] It should be understood that when the first magnetic encoder B1 rotates around the first axis O1, the first magnetic ring B2 remains stationary; when the first magnetic ring B2 rotates around the first axis O1, the first magnetic encoder B1 remains stationary.

[0045] It should also be understood that the above Figure 1 The stepper motor A shown includes an axis, namely the first axis O1 (horizontally placed axis), that is, the stepper motor A rotates only in one direction, namely the direction indicated by o. It should also be understood that the stepper motor A may include an axis that is placed vertically, so that the stepper motor A rotates in other directions.

[0046] Optionally, the first magnetic encoder is a Hall magnetic encoder.

[0047] Figure 2 It is a schematic diagram of the relative position relationship between a dual-axis stepper motor and a magnetic sensor provided in an embodiment of the present application.

[0048] For example, Figure 2As shown, the stepper motor A is a dual-axis stepper motor, which also includes a second axis. The magnetic sensor also includes a second magnetic ring and a second magnetic encoder. The second magnetic ring and the second magnetic encoder are arranged opposite to each other, and the second magnetic ring is connected to the second axis of the dual-axis stepper motor, or the second magnetic encoder is connected to the second axis.

[0049] like Figure 2 As shown in FIG. 1 , the dual-axis stepper motor D is based on the stepper motor A and adds a second axis O2, a second magnetic encoder B3 and a second magnetic ring B4. The second magnetic encoder B3 and the second magnetic ring B4 are installed in Figure 2 At the position indicated by the left dotted line box in the figure, a certain gap is maintained between the second magnetic encoder B3 and the second magnetic ring B4. Figure 2 The figures are all around the second axis O2 of the dual-axis stepper motor D. During the operation of the dual-axis stepper motor D, the second magnetic encoder B3 or the second magnetic ring B4 revolves around the second axis O2 and rotates in the direction indicated by p along with the second axis O2; the first magnetic encoder B1 or the first magnetic ring B2 revolves around the first axis O1 and rotates in the direction indicated by o along with the first axis O1. In this way, the rotation of the first axis O1 will drive the camera C to rotate in the direction indicated by o, and the rotation of the second axis O2 will drive the camera C to rotate in the direction indicated by p, so that the camera C rotates in the angle direction indicated by p (0°~e°) and the angle direction indicated by o, and collects the environmental image around the dual-axis stepper motor D.

[0050] Optionally, e is 90, and the angle range in the angle direction indicated by o is 0° to 40°.

[0051] Optionally, the above Figure 2 The first axis O1 is a horizontal axis, and the second axis O2 is a vertical axis.

[0052] Optionally, the above Figure 2 The first magnetic encoder B1 is a vertical magnetic encoder, the first magnetic ring B2 is a vertical magnetic ring, the second magnetic encoder B3 is a horizontal magnetic encoder, and the second magnetic ring B4 is a horizontal magnetic ring.

[0053] Optionally, the above Figure 2 The first magnetic encoder B1 is a vertical Hall magnetic encoder, and the second magnetic encoder B3 is a horizontal Hall magnetic encoder.

[0054] It should be understood that when the stepper motor mentioned above is a dual-axis stepper motor, the stepper motor also includes a second axis. The second axis and the first axis are only placed differently during installation. The second axis, like the first axis, will also have a second magnetic ring and a second magnetic encoder connected to it. The second magnetic ring or the second magnetic encoder will rotate around the second axis. Therefore, during the operation of the dual-axis stepper motor, the second axis can also improve the accuracy of the stepper motor rotating to the target position in the p direction based on the characteristics of the magnetic sensor, just like the first axis.

[0055] Figure 3 It is a schematic flow chart of an angle control method of a stepper motor provided in an embodiment of the present application.

[0056] It should be understood that the angle control method of a stepper motor provided in the embodiment of the present application can be applied to the stepper motor. Specifically, the angle control method is applied to the controller of the stepper motor.

[0057] For example, Figure 3 As shown, the method 300 includes:

[0058] 301. The controller of the stepper motor obtains the analog-to-digital conversion value of the first magnetic encoder at the current moment through the magnetic sensor.

[0059] It should be understood that the magnetic sensor in the above step 301 is a magnetic rotation sensor. The magnetic rotation sensor adopts a magneto-electric design, and generates or provides the rotation position of the actuator (stepping motor) by the magnetic field change of the magnetic induction device (first magnetic ring).

[0060] It should also be understood that the magnetic sensor includes a first magnetic ring and a first magnetic encoder. During the operation of the stepper motor, the first magnetic ring or the first magnetic encoder will Figure 1 As shown, the first magnetic ring revolves around the first axis and rotates with the first axis. At this time, a relative displacement will occur between the first magnetic ring and the first magnetic encoder, and a change in magnetic field strength will occur between the first magnetic ring and the first magnetic encoder, so that the detected change in magnetic field strength can be quantified to obtain an analog-to-digital conversion value.

[0061] 302, when the analog-to-digital conversion value at the current moment meets the target condition, the controller of the stepper motor determines the actual rotation angle of the first axis based on the analog-to-digital conversion value at the current moment and the measurement accuracy value of the magnetic sensor.

[0062] It should be understood that the "target condition" can be understood as a condition under which the stepping motor loses step. The loss of step can be manifested as the absence of a linear relationship between the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at multiple historical moments.

[0063] It should also be understood that the measurement accuracy values ​​of different magnetic sensors may be different, and the measurement accuracy value of the magnetic sensor is determined by the resolution of the magnetic sensor. In the embodiment of the present application, the resolution of the magnetic sensor is 18, and the measurement accuracy value of the magnetic sensor is 2 18 .

[0064] In a possible implementation, step 302 includes: the controller of the stepper motor determines the ratio between the first angle and the measurement accuracy value as a third ratio; the controller of the stepper motor multiplies the third ratio by the analog-to-digital conversion value at the current moment to determine the actual angle.

[0065] Optionally, the first angle is 360°.

[0066] The process of "the analog-to-digital conversion value at the current moment satisfies the target condition" is discussed as follows.

[0067] In one possible implementation, the method also includes: the controller of the stepper motor determines whether there is a linear relationship between the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at multiple historical moments; when there is no linear relationship between the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at the multiple historical moments, the controller of the stepper motor determines that the analog-to-digital conversion value at the current moment meets the target condition.

[0068] The above technical solution describes the process of whether the analog-to-digital conversion value at the current moment meets the target condition. That is, when there is no linear relationship between the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at multiple historical moments, it indicates that the analog-to-digital conversion value at the current moment meets the target condition and the stepping motor loses steps.

[0069] In a possible implementation, the process of determining that there is no linear relationship between the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at multiple historical moments includes any of the following: determining a test analog-to-digital conversion value at the current moment using target relationship data, and determining that there is no linear relationship between the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at multiple historical moments when the difference between the test analog-to-digital conversion value and the analog-to-digital conversion value at the current moment is greater than a first threshold, the target relationship data being obtained based on the analog-to-digital conversion values ​​at multiple historical moments; determining that there is no linear relationship between the analog-to-digital conversion value at the current moment and ... When the value is greater than the second threshold, it is determined that there is no linear relationship between the analog-to-digital conversion value of the current moment and the analog-to-digital conversion values ​​of multiple historical moments, the first ratio is the ratio between the first difference and the second difference, the first difference is the difference between any two historical moments, the second difference is the difference between the analog-to-digital conversion values ​​of the two historical moments, the second ratio is the ratio between the third difference and the fourth difference, the third difference is the difference between the current moment and any historical moment, and the fourth difference is the difference between the analog-to-digital conversion value of the current moment and the analog-to-digital conversion value of the historical moment.

[0070] In the above technical scheme, the process of the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at multiple historical moments not having a linear relationship is described, and two different determination processes are specifically given. The first is to use the target relationship data to determine the test analog-to-digital conversion value at the current moment, and when the difference between the test analog-to-digital conversion value and the analog-to-digital conversion value at the current moment is greater than the first threshold, determine that the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at multiple historical moments do not have a linear relationship. Equivalent to the process of determining whether the first coordinate point (current moment, analog-to-digital conversion value at the current moment) falls on a straight line formed by multiple target data; the second is to determine that the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at multiple historical moments do not have a linear relationship when the difference between the first ratio and the second ratio is greater than the second threshold, which is equivalent to determining whether the slope determined by the second coordinate point (current moment, test analog-to-digital conversion value at the current moment) and the third coordinate point (any historical moment, analog-to-digital conversion value at any historical moment) is the same as the slope determined by the two coordinate points corresponding to the analog-to-digital conversion values ​​of any two historical moments. Optionally, the fourth coordinate point of the two coordinate points may be (any historical moment, the analog-to-digital conversion value of any historical moment); the fifth coordinate point of the two coordinate points may be (another historical moment, the analog-to-digital conversion value of another historical moment).

[0071] Figure 4 It is a schematic diagram of analog-to-digital conversion values ​​at multiple moments provided in an embodiment of the present application.

[0072] Exemplarily, the analog-to-digital conversion values ​​at multiple moments are given in the form of a digital axis. Figure 4 As shown, at 9s, the analog-to-digital conversion value is 2; at 10s, the analog-to-digital conversion value is 4; at 11s, the analog-to-digital conversion value is 6; at 12s, the analog-to-digital conversion value is 8; at 13s, the analog-to-digital conversion value is 10; at 14s, the analog-to-digital conversion value is 12.

[0073] Figure 5 It is a schematic diagram of the analog-to-digital conversion value at the current moment provided by the embodiment of the present application not meeting the target condition. It should be understood that not meeting the target condition means that the analog-to-digital conversion value at the current moment has a linear relationship with the analog-to-digital conversion values ​​at multiple historical moments.

[0074] For example, Figure 5 As shown in (a), it corresponds to the first situation in the above scheme.

[0075] based on Figure 4The analog-to-digital conversion values ​​of multiple moments are given in , and the current moment is 14s, the analog-to-digital conversion value of the current moment is 12, the other multiple moments are historical moments, the other multiple analog-to-digital conversion values ​​are analog-to-digital conversion values ​​of historical moments, and the first threshold is 0.5 as an example, and the analog-to-digital conversion value of the current moment does not meet the target condition. Based on multiple historical moments (9s, 10s, 11s, 12s and 13s), and multiple analog-to-digital conversion values ​​(2, 4, 6, 8 and 10) corresponding to multiple historical moments, it can be determined as follows Figure 5 The target relationship data shown in (a) is: y=2t-16, where t is the time and y is the analog-to-digital conversion value. Substituting the current time 14s into the target relationship data, the test analog-to-digital conversion value at the current time is 12; the difference between the test analog-to-digital conversion value 12 and the analog-to-digital conversion value 12 at the current time is 0, which is less than the first threshold value 0.5. Figure 5 As shown in (a), that is, the first coordinate point (14, 12) falls on the straight line formed by multiple target data: y=2t-16, and the analog-to-digital conversion value at the current moment has a linear relationship with the analog-to-digital conversion values ​​at multiple historical moments, that is, the analog-to-digital conversion value at the current moment does not meet the target condition.

[0076] For example, Figure 5 As shown in (b), it corresponds to the second situation in the above scheme.

[0077] based on Figure 4 The analog-to-digital conversion values ​​of multiple moments are given in , and the current moment is 14s, and the analog-to-digital conversion value of the current moment is 12; any two historical moments are 10s and 12s, respectively, and the analog-to-digital conversion values ​​corresponding to the two historical moments are 4 and 8 respectively; any historical moment is 13s, and the analog-to-digital conversion value at 13s is 10, and the second threshold is 0.5. For example, the analog-to-digital conversion value of the current moment does not meet the target condition. Based on any two historical moments (10s and 12s) in the above, the first difference is 2s; based on the analog-to-digital conversion values ​​(4 and 8) corresponding to the two historical moments, the second difference is 4, then the first ratio is 0.5; based on the current moment (14s) and any of the above historical moments (13s), the third difference is 1; based on the analog-to-digital conversion value (12) of the current moment and the analog-to-digital conversion value (10) of any of the historical moments (13s), the fourth difference is 2, then the second ratio is 0.5. The difference between the first ratio and the second ratio is 0, which is less than the second threshold 0.5. Figure 5As shown in (b), that is, the slope determined by the second coordinate point (14, 12) and the third coordinate point (13, 10) is the same as the slope determined by the two coordinate points (12, 8) and (10, 4) corresponding to the analog-to-digital conversion values ​​of any two historical moments; the analog-to-digital conversion value at the current moment has a linear relationship with the analog-to-digital conversion values ​​of multiple historical moments, that is, the analog-to-digital conversion value at the current moment does not meet the target condition.

[0078] 303 , the controller of the stepper motor performs angle control on the stepper motor based on the target angle of rotation of the first shaft and the actual angle of rotation of the first shaft.

[0079] In a possible implementation, step 303 includes: the controller of the stepper motor determines the angle difference between the target angle and the actual angle; based on the actual angle, the controller of the stepper motor controls the first axis to continue rotating by the angle difference.

[0080] It should be understood that the angle difference between the target angle and the actual angle can be positive or negative. That is, during the process of the stepper motor rotating toward the target angle, the target angle may be exceeded or may not be exceeded. When the angle difference is a positive number, it indicates that the stepper motor does not exceed the target angle during the process of rotating toward the target angle; when the angle difference is a negative number, it indicates that the stepper motor exceeds the target angle during the process of rotating toward the target angle.

[0081] The above technical solution is a process of controlling the first axis of the stepper motor to rotate to a target angle. Based on the angle difference, on the basis of the actual angle, the first axis is controlled to continue to rotate by the angle difference so that the first axis rotates to the target angle, thereby improving the accuracy of the first axis rotating to the target angle.

[0082] The process of "controlling the first axis to continue rotating by the angle difference based on the actual angle" is discussed in two cases as follows.

[0083] Case 1: The angle difference is a positive number, and the stepper motor does not exceed the target angle during its rotation toward the target angle.

[0084] In one possible implementation, the angle difference is a positive number, and based on the actual angle, the controller of the stepper motor controls the first axis to continue rotating by the angle difference, including: based on the actual angle, the controller of the stepper motor controls the first axis to continue rotating by the angle difference in the original rotation direction of the first axis.

[0085] Case 2: The angle difference is a negative number, and the stepper motor exceeds the target angle during its rotation toward the target angle.

[0086] In another possible implementation, the angle difference is a negative number, and based on the actual angle, the controller of the stepper motor controls the first axis to continue rotating by the angle difference, including: based on the actual angle, the controller of the stepper motor controls the first axis to continue rotating by the angle difference in the opposite direction of the original rotation direction of the first axis.

[0087] It should be understood that the above gives the process of angle control of the stepper motor in two cases. When the actual angle has not rotated to the target angle, the first axis continues to rotate by the angle difference in the direction in which the first axis originally rotated; when the actual angle exceeds the target angle, the first axis rotates back by the angle difference (the first axis continues to rotate by the angle difference in the opposite direction of the original rotation direction of the first axis). Both cases can make the first axis rotate to the target angle, and improve the accuracy of the first axis rotating to the target angle.

[0088] In the process of using a stepper motor, there is a need to reset the stepper motor to the center position of the stepper motor's motion range. Figure 1 As shown, in order to make the image captured by the camera B on the stepper motor A be in the positive horizontal center position of the motion coordinate system of the stepper motor, a solution for rotating the stepper motor to the center position is given as follows.

[0089] In one possible implementation, the method also includes: the controller of the stepper motor determines the total rotation angle of the stepper motor and the maximum analog-to-digital conversion value of the first magnetic encoder when the first axis rotates from the minimum limit point of the stepper motor to the maximum limit point of the stepper motor, and the minimum limit point and the maximum limit point are used to limit the motion range of the stepper motor; the controller of the stepper motor controls the stepper motor to rotate toward the center position of the motion range based on the total angle; the controller of the stepper motor verifies whether the stepper motor rotates to the center position based on the maximum analog-to-digital conversion value and the actual analog-to-digital conversion value obtained during the rotation of the stepper motor toward the center position.

[0090] It should be understood that when the first axis of the stepper motor is at the minimum limit point, the initial rotation angle of the stepper motor is 0, and at this time the analog-to-digital conversion value of the first magnetic encoder is the minimum, which is 0.

[0091] It should also be understood that the stepper motor determines whether it rotates to the minimum limit point and the maximum limit point through the limiter installed thereon.

[0092] In the above technical scheme, the minimum limit point and the maximum limit point of the first axis are calibrated, and the stepper motor is reset to the center position. When the first axis of the stepper motor is at the minimum limit point, the rotation angle of the stepper motor is 0, and the analog-to-digital conversion value is 0. When the first axis of the stepper motor is at the maximum limit point, the rotation angle of the stepper motor is the largest, and the analog-to-digital conversion value is the largest. When the first axis rotates from the minimum limit point to the maximum limit point, the rotation angle will continue to increase, and the analog-to-digital conversion value will continue to increase. When the first axis reaches the maximum limit point, the total angle of rotation of the first axis and the maximum analog-to-digital conversion value can be obtained. Therefore, in the process of resetting the stepper motor to the center position of the motion range, the first axis can be rotated based on the total angle, and based on the maximum analog-to-digital conversion value and the actual analog-to-digital conversion value, it can be verified whether the stepper motor has rotated to the center position. This can improve the accuracy of the stepper motor rotating to the center position.

[0093] In one possible implementation, the controller of the stepper motor controls the stepper motor to rotate toward the center position of the motion range based on the total angle, including: the controller of the stepper motor controls the stepper motor to rotate toward the center position of the motion range based on 1 / 2 of the total angle; and the controller of the stepper motor verifies whether the stepper motor rotates to the center position based on the maximum analog-to-digital conversion value and the actual analog-to-digital conversion value obtained during the rotation of the stepper motor toward the center position, including: the controller of the stepper motor determines whether the actual analog-to-digital conversion value is equal to 1 / 2 of the maximum analog-to-digital conversion value; if they are equal, the controller of the stepper motor determines that the stepper motor rotates to the center position; if they are not equal, the controller of the stepper motor determines that the stepper motor does not rotate to the center position.

[0094] It should be understood that the stepper motor is controlled to rotate toward the center position of the motion range based on 1 / 2 of the total angle. However, abnormal conditions are inevitable during the rotation of the stepper motor, such as the stepping motor losing steps. Therefore, the actual analog-to-digital conversion value can be used to provide real-time feedback on the rotation process of the stepper motor toward the center position, and the maximum analog-to-digital conversion value of 1 / 2 and the actual analog-to-digital conversion value can be used to verify whether the stepper motor accurately rotates to the center position.

[0095] The camera installed on the stepper motor can collect the environment image around the stepper motor during the operation of the stepper motor. When the image of the target object in the environment image needs to fall in the central area of ​​the environment image, the technical solution given below can be referred to.

[0096] In one possible implementation, before the controller of the stepper motor obtains the analog-to-digital conversion value of the first magnetic encoder through the magnetic sensor, the method also includes: the controller of the stepper motor obtains the environmental image captured by the camera; the controller of the stepper motor determines the relative position between the target object in the environmental image and the center of the environmental image; the controller of the stepper motor determines the target angle of rotation of the first axis when the image of the target object falls at the center based on the relative position and the conversion relationship between the motor coordinate system and the camera coordinate system, and controls the rotation of the first axis based on the target angle.

[0097] It should be understood that after determining the target angle that the first shaft of the stepper motor needs to rotate, the controller of the stepper motor can control the first shaft of the stepper motor to rotate based on the determined target angle, so that the first shaft of the stepper motor rotates to a first position, so that in the first position, the target object in the environment image captured by the camera is in the center area of ​​the environment image.

[0098] It should also be understood that when the first shaft of the stepper motor rotates toward the first position, the analog-to-digital conversion value of the first magnetic encoder can be obtained in real time; the stepper motor is angle-controlled based on the actual rotation angle of the first shaft and the target angle (the target angle required for the first shaft to rotate) determined by the analog-to-digital conversion value of the first magnetic encoder. For the specific implementation process, please refer to steps 301 to 303, which will not be described in detail here.

[0099] In the above technical solution, placing the target object in the central area of ​​the environment image is a concept of central composition, which can form a visual focus, highlight the content of the target object, and intuitively display the main content (target object).

[0100] In one possible implementation, the controller of the stepper motor determines the relative position between the target object in the environmental image and the center of the environmental image, including: the controller of the stepper motor establishes a coordinate system with the center position of the environmental image as the origin; the controller of the stepper motor determines the relative position based on the coordinates of the target object and the origin.

[0101] Figure 6 This is a schematic diagram provided by the present application for placing a target object in the central area of ​​an environment image.

[0102] For example, the target angle is w. The stepper motor A is Figure 6 At the position shown in (a), the environment image containing the target object M captured by the camera C is as follows: Figure 6 As shown in (b), it can be concluded from this figure that the target object M falls in the upper middle area of ​​the environment image. After the first axis of the stepper motor A is rotated by w in the direction of o', the stepper motor A is in the following Figure 6At the position shown in (c), the environment image containing the target object M captured by camera C is as follows: Figure 6 As shown in (d), it can be concluded from the figure that the target object M falls in the central area of ​​the environment image.

[0103] Figure 7 It is a structural schematic diagram of an angle control device of a stepper motor provided in an embodiment of the present application.

[0104] Exemplarily, a magnetic sensor is installed on the stepper motor, and the magnetic sensor includes a first magnetic ring and a first magnetic encoder. The first magnetic ring and the first magnetic encoder are arranged opposite to each other, and the first magnetic ring is connected to the first shaft of the stepper motor, or the first magnetic encoder is connected to the first shaft. Figure 7 As shown, the device 700 includes:

[0105] An acquisition module 701 is used to acquire the analog-to-digital conversion value of the first magnetic encoder at the current moment through a magnetic sensor;

[0106] A determination module 702 is used to determine the actual angle of rotation of the first axis based on the analog-to-digital conversion value at the current moment and the measurement accuracy value of the magnetic sensor when the analog-to-digital conversion value meets the target condition;

[0107] The control module 703 is used to perform angle control on the stepper motor based on the target angle of rotation of the first shaft and the actual angle of rotation of the first shaft.

[0108] Optionally, the determination module 702 is also used to: determine whether there is a linear relationship between the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at multiple historical moments; if there is no linear relationship between the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at the multiple historical moments, determine that the analog-to-digital conversion value at the current moment meets the target condition.

[0109] Optionally, the determination module 702 is specifically used for any one of the following: using the target relationship data to determine the test analog-to-digital conversion value of the current moment, and when the difference between the test analog-to-digital conversion value and the analog-to-digital conversion value of the current moment is greater than a first threshold, determining that there is no linear relationship between the analog-to-digital conversion value of the current moment and the analog-to-digital conversion values ​​of multiple historical moments, and the target relationship data is obtained based on the analog-to-digital conversion values ​​of multiple historical moments; when the difference between the first ratio and the second ratio is greater than a second threshold, determining that there is no linear relationship between the analog-to-digital conversion value of the current moment and the analog-to-digital conversion values ​​of multiple historical moments, the first ratio is the ratio between the first difference and the second difference, the first difference is the difference between any two historical moments, the second difference is the difference between the analog-to-digital conversion values ​​of the two historical moments, the second ratio is the ratio between the third difference and the fourth difference, the third difference is the difference between the current moment and any historical moment, and the fourth difference is the difference between the analog-to-digital conversion value of the current moment and the analog-to-digital conversion value of the historical moment.

[0110] Optionally, the control module 703 is specifically used to: determine an angle difference between the target angle and the actual angle; and based on the actual angle, control the first axis to continue rotating by the angle difference.

[0111] Optionally, the determination module 702 is also used to determine the total rotation angle of the stepper motor and the maximum analog-to-digital conversion value of the first magnetic encoder when the first axis rotates from the minimum limit point of the stepper motor to the maximum limit point of the stepper motor, and the minimum limit point and the maximum limit point are used to limit the motion range of the stepper motor; the control module 703 is also used to control the stepper motor to rotate toward the center position of the motion range of the stepper motor based on the total angle; the device also includes: a verification module, which is used to verify whether the stepper motor has rotated to the center position based on the maximum analog-to-digital conversion value and the actual analog-to-digital conversion value obtained during the rotation of the stepper motor to the center position.

[0112] Optionally, a camera is also installed on the stepper motor, and the camera can be driven to rotate when the first axis rotates. The acquisition module 701 is also used to acquire the environmental image captured by the camera; the determination module 702 is also used to: determine the relative position between the target object in the environmental image and the center of the environmental image; determine the target angle that the first axis needs to rotate to when the image of the target object falls at the center based on the relative position, the conversion relationship between the motor coordinate system and the camera coordinate system; the control module 703 is also used to control the rotation of the first axis based on the target angle.

[0113] Optionally, the stepper motor is a dual-axis stepper motor, which also includes a second axis. The magnetic sensor also includes a second magnetic ring and a second magnetic encoder. The second magnetic ring and the second magnetic encoder are arranged opposite to each other. The second magnetic ring is either connected to the second axis of the dual-axis stepper motor, or the second magnetic encoder is connected to the second axis.

[0114] The present embodiment provides a stepper motor, on which a magnetic sensor is installed. The magnetic sensor includes a first magnetic ring and a first magnetic encoder. The first magnetic ring and the first magnetic encoder are arranged opposite to each other. The first magnetic ring is connected to the first shaft of the stepper motor, or the first magnetic encoder is connected to the first shaft.

[0115] Figure 8 It is a structural schematic diagram of a controller of a stepper motor provided in an embodiment of the present application.

[0116] For example, Figure 8 As shown, the controller 800 includes: a memory 801, a processor 802, and a computer program 803 stored in the memory 801 and running on the processor 802, wherein when the processor 802 executes the computer program 803, the controller can execute any one of the stepper motor angle control methods introduced above.

[0117] In this embodiment, the controller can be divided into functional modules according to the above method example. For example, each functional module can be corresponded, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0118] In the case of dividing each functional module according to each function, the controller may include: an acquisition module, a determination module, a control module, a verification module, etc. It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, which will not be repeated here.

[0119] The controller provided in this embodiment is used to execute the above-mentioned angle control method of a stepper motor, and thus can achieve the same effect as the above-mentioned implementation method.

[0120] In the case of an integrated unit, the controller may include a processing module and a storage module. The processing module may be used to control and manage the actions of the controller. The storage module may be used to support the controller in executing mutual program codes and data.

[0121] The processing module may be a processor or a controller, which may implement or execute various exemplary logic blocks, modules and circuits disclosed in the present application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module may be a memory.

[0122] The controller provided in the embodiments of the present application may specifically be a chip, a component or a module, and the controller may include a connected processor and a memory; wherein the memory is used to store instructions, and when the controller is running, the processor may call and execute instructions so that the chip executes any one of the stepper motor angle control methods described above.

[0123] This embodiment provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a computer or a processor, the computer or the processor executes any one of the above-mentioned stepper motor angle control methods.

[0124] This embodiment also provides a computer program product including instructions. When the computer program product is run on a computer or a processor, the computer or the processor executes the above-mentioned related steps to implement any one of the above-mentioned stepper motor angle control methods.

[0125] Among them, the controller, computer-readable storage medium, computer program product or chip containing instructions provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.

[0126] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions 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.

[0127] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0128] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for controlling the angle of a stepping motor, characterized in that: The stepper motor is equipped with a magnetic sensor, the magnetic sensor including a first magnetic ring and a first magnetic encoder, the first magnetic ring and the first magnetic encoder are arranged opposite to each other, the first magnetic ring is connected to the first shaft of the stepper motor, or the first magnetic encoder is connected to the first shaft, and the method includes: Acquire the analog-to-digital conversion value of the first magnetic encoder at the current moment through the magnetic sensor; When the analog-to-digital conversion value at the current moment meets a target condition, determining an actual rotation angle of the first shaft based on the analog-to-digital conversion value at the current moment and a measurement accuracy value of the magnetic sensor; The stepping motor is angle-controlled based on a target angle of rotation of the first shaft and an actual angle of rotation of the first shaft.

2. The method according to claim 1, characterized in that The method further comprises: Determining whether there is a linear relationship between the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at multiple historical moments; In a case where there is no linear relationship between the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at the multiple historical moments, it is determined that the analog-to-digital conversion value at the current moment meets the target condition.

3. The method according to claim 2, characterized in that The process of determining that the analog-to-digital conversion value at the current moment does not have a linear relationship with the analog-to-digital conversion values ​​at multiple historical moments includes any one of the following: determining a test analog-to-digital conversion value at the current moment using the target relationship data, and determining that no linear relationship exists between the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​at multiple historical moments if a difference between the test analog-to-digital conversion value and the analog-to-digital conversion value at the current moment is greater than a first threshold, the target relationship data being obtained based on the analog-to-digital conversion values ​​at the multiple historical moments; or, When the difference between the first ratio and the second ratio is greater than the second threshold, it is determined that there is no linear relationship between the analog-to-digital conversion value at the current moment and the analog-to-digital conversion values ​​of multiple historical moments, the first ratio is the ratio between the first difference and the second difference, the first difference is the difference between any two historical moments, the second difference is the difference between the analog-to-digital conversion values ​​of the two historical moments, the second ratio is the ratio between the third difference and the fourth difference, the third difference is the difference between the current moment and any historical moment, and the fourth difference is the difference between the analog-to-digital conversion value at the current moment and the analog-to-digital conversion value at the historical moment.

4. The method according to any one of claims 1 to 3, characterized in that The stepping motor is controlled at an angle based on a target rotation angle of the first shaft and an actual rotation angle of the first shaft, comprising: determining an angle difference between the target angle and the actual angle; Based on the actual angle, the first shaft is controlled to continue rotating by the angle difference.

5. The method according to any one of claims 1 to 3, characterized in that The method further comprises: determining a total angle of rotation of the stepper motor and a maximum analog-to-digital conversion value of the first magnetic encoder when the first shaft rotates from a minimum limit point of the stepper motor to a maximum limit point of the stepper motor, the minimum limit point and the maximum limit point being used to limit a range of motion of the stepper motor; Based on the total angle, controlling the stepper motor to rotate toward the center position of the motion range; Based on the maximum analog-to-digital conversion value and an actual analog-to-digital conversion value obtained during the stepping motor's rotation toward the center position, it is verified whether the stepping motor has rotated to the center position.

6. The method according to claim 1, characterized in that The stepper motor is further equipped with a camera, and the camera can be driven to rotate when the first shaft rotates. Before obtaining the analog-to-digital conversion value of the first magnetic encoder at the current moment through the magnetic sensor, the method further includes: Acquire an environmental image captured by the camera; determining a relative position between a target object in the environment image and a center of the environment image; Based on the relative position, the conversion relationship between the motor coordinate system and the camera coordinate system, the target angle that the first axis needs to rotate to when the image of the target object falls on the center is determined, and the rotation of the first axis is controlled based on the target angle.

7. The method according to claim 1, characterized in that The stepper motor is a dual-axis stepper motor, which also includes a second axis. The magnetic sensor also includes a second magnetic ring and a second magnetic encoder. The second magnetic ring and the second magnetic encoder are arranged opposite to each other, and the second magnetic ring is connected to the second axis of the dual-axis stepper motor, or the second magnetic encoder is connected to the second axis.

8. An angle control device for a stepping motor, characterized in that: The stepper motor is equipped with a magnetic sensor, which includes a first magnetic ring and a first magnetic encoder. The first magnetic ring and the first magnetic encoder are arranged opposite to each other. The first magnetic ring is connected to the first shaft of the stepper motor or the first magnetic encoder is connected to the first shaft. The device includes: An acquisition module, configured to acquire the analog-to-digital conversion value of the first magnetic encoder at a current moment through a magnetic sensor; a determination module, configured to determine, if the analog-to-digital conversion value does not meet a target condition, an actual rotation angle of the first shaft based on the analog-to-digital conversion value at the current moment and a measurement accuracy value of the magnetic sensor; A control module is configured to perform angle control on the stepper motor based on a target angle of rotation of the first shaft and an actual angle of rotation of the first shaft.

9. A stepping motor, characterized in that: A magnetic sensor is installed on the stepper motor. The magnetic sensor includes a first magnetic ring and a first magnetic encoder. The first magnetic ring and the first magnetic encoder are arranged opposite to each other. The first magnetic ring is connected to the first shaft of the stepper motor, or the first magnetic encoder is connected to the first shaft.

10. A controller for a stepping motor, characterized in that: The invention comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the controller executes the angle control method of the stepping motor according to any one of claims 1 to 7.

11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed on a computer or a processor, the computer or the processor executes the angle control method of the stepping motor according to any one of claims 1 to 7.