A speed measurement method, device and electronic equipment for encoder

By counting the number of pulses of the encoder within the fixed number of rotations of the motor, and performing pulse width measurements in combination with the number of pulses within the fixed speed measurement period, the average effective counting pulse width value is calculated to obtain the motor speed, which solves the problem of unstable speed measurement of low-precision encoder and improves the speed measurement accuracy.

CN114520609BActive Publication Date: 2025-04-18LOCTEK ERGONOMIC TECH CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210093202.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-26
Publication Date
2025-04-18
Estimated Expiration
2042-01-26

AI Technical Summary

Technical Problem

In the existing motor speed measurement methods, low-precision encoders have pulse width unevenness, resulting in unstable speed measurement results, especially at low speeds, with a large error rate.

Method used

By counting the number of N pulses emitted by the encoder within the fixed number of rotations of the motor as a reference, the pulse width measurement is performed in combination with the number of K pulses emitted within the fixed speed measurement period, and the average effective counting pulse width value is calculated to obtain the rotation speed of the motor.

Benefits of technology

It reduces the pulse width uneven problem caused by uneven distribution of the encoder pole pair, improves the speed measurement accuracy, and ensures real-time and accurate acquisition of the motor speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114520609B_ABST
    Figure CN114520609B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of motor technology, and to a speed measurement method, device and electronic device of an encoder. This solution uses the number of N pulses emitted by the counting encoder within a fixed number of rotations of the motor, and uses the number of N pulses as a reference to subsequently obtain an average effective counting pulse width value, and then obtain the speed of the motor based on the average effective counting pulse width value. Based on the counting pulse width value, the average effective counting pulse width value of multiple counting pulse width values ​​is obtained, which can minimize the problem of uneven pulse width caused by uneven distribution of encoder pole pairs, and the more the number of counting pulse width values ​​obtained, the more accurate the average effective counting pulse width value obtained, further improving the detection accuracy of the encoder.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of motor technology, and in particular to a speed measurement method, device and electronic equipment of an encoder. Background Art

[0002] The commonly used speed measurement algorithms for motors equipped with encoders are the frequency method and the period method. The period method measures the time interval between two encoder pulses to calculate the speed. However, due to differences in manufacturing processes and other factors, the counting pulse width measured by low-precision encoders at the same speed has a very large unevenness, resulting in instability in the speed measurement results.

[0003] In a certain time period Tc, the number of pulses M1 output by the encoder is measured to calculate the speed. The frequency of the encoder output pulses can be obtained by dividing the number of pulses M1 by the time period Tc. For low-precision encoders, when the speed is relatively low, only a small number of count pulses can be obtained when the motor rotates. Due to the unevenness of the count pulse width, the fewer the number of pulses detected per unit time, the greater the error rate.

[0004] Based on this, how to reduce the shortcomings of the above two speed measurement methods is an urgent problem to be solved. Summary of the invention

[0005] The problem solved by the present invention is how to reduce the disadvantages of the above two speed measurement methods.

[0006] In order to solve the above problems, the present invention provides an embodiment for the purpose of providing a speed measurement method of an encoder.

[0007] A second object of the present invention is to provide a speed measuring device for an encoder.

[0008] A third object of the present invention is to provide an electronic device.

[0009] A fourth object of the present invention is to provide a readable storage medium.

[0010] To achieve the first object of the present invention, an embodiment of the present invention provides a speed measurement method of an encoder.

[0011] The method is applicable to a motor, comprising the following steps: counting the number of N pulses emitted by an encoder within a fixed number of rotations of the motor; counting the number of K pulses emitted by the encoder within a fixed speed measurement period, and measuring the pulse width of each pulse in the K pulses to obtain K counted pulse width values; obtaining an average effective counted pulse width value according to the counted pulse width values, and obtaining the motor speed according to the average effective counted pulse width value.

[0012] The speed of the motor; where N is related to the encoder pole pair number and frequency and is an integer, and K is an integer greater than or equal to 1.

[0013] Compared with the existing technology, the technical effect achieved by adopting this solution is: the motor speed is the most important parameter affecting the motor drive system. Too high a motor speed may cause the motor output torque to exceed the stall torque, which may cause the motor to burn out, while too low a motor speed may cause the motor to

[0014] The output efficiency is low and the desired driving effect cannot be achieved.

[0015] Therefore, it is necessary to measure the speed of the motor. The number N is related to the number of encoder pole pairs. However, the existing low-precision encoders cause uneven pulse widths during the detection process due to uneven distribution of encoder pole pairs. This solution uses the N pulses emitted by the counting encoder within a fixed number of motor rotations, where the fixed number of motor rotations is preferably one circle, and N pulses are used.

[0016] The number is used as a benchmark to subsequently obtain the average effective count pulse width value, and then the motor speed is obtained based on the average effective count pulse width value.

[0017] According to the count pulse width value, the average effective count pulse width value of multiple count pulse width values ​​is obtained, which can minimize the problem of uneven pulse width caused by uneven distribution of encoder pole pairs and other reasons. The more count pulse width values ​​are obtained, the more accurate the average effective count pulse width value is.

[0018] Further improve the detection accuracy of the encoder.

[0019] In this embodiment, the step of obtaining an average effective count pulse width value according to the count pulse width value specifically includes: updating the count pulse width value in real time to obtain an effective count pulse width value; averaging at most N effective count pulse width values ​​to obtain an average effective count pulse width value.

[0020] The technical effect after adopting this technical solution is that, due to the fixed speed measurement cycle, the counting

[0021] The encoder will measure more than N count pulse width values, and the calculation method of the effective count pulse width value is only to average at most N effective count pulse width values. Therefore, it is necessary to replace the old count pulse width value with a new count pulse width value so that the count pulse width value data can be kept updated in real time, ensuring that the detected count pulse width value is synchronized with the rotation of the motor, so as to obtain the real-time speed of the motor more accurately.

[0022] In this embodiment, the step of updating the count pulse width value in real time and obtaining the effective count pulse width value specifically includes: comparing the size of K and N; when K>N, replacing the original K-1th effective count pulse width value with the Kth count pulse width value, replacing the original K-2th effective count pulse width value with the K-1th effective count pulse width value, and successively replacing the previous effective count pulse width value with the effective count pulse width value, until the K-N+1th effective count pulse width value replaces the original effective count pulse width value.

[0023] The first KN-th valid counting pulse width value.

[0024] The technical effect of adopting this technical solution is that, because the number of revolutions of the motor varies within a fixed speed measurement period due to the change in the speed, the number of pulses K emitted by the encoder will also be different from N. When the number of pulses K is less than or equal to N, at this time, because the count pulse width value is only K, only the K count pulse width values ​​can be used as the effective count pulse width value. When the number of pulses K is greater than N,

[0025] When the effective count pulse width value cannot exceed N, the new count pulse width value replaces the previous effective count pulse width value, and the Kth count pulse width value replaces the original K-1th effective count pulse width value, and the K-1th effective count pulse width value replaces the original K-2th effective count pulse width value, and the new count pulse width value replaces the previous effective count pulse width value in sequence, until the K-N+1th effective count pulse width value replaces the original KNth effective count pulse width value.

[0026] Count the pulse width value to achieve the purpose of obtaining a new effective counting pulse width value.

[0027] In this embodiment, the step of averaging at most N valid counting pulse width values ​​specifically includes: S1: comparing the sizes of K and N; S2: when K≤N, averaging the K valid counting pulse width values ​​to obtain the average effective counting pulse width value, if not S2 jumps to S3; S3: when K>N, averaging the latest N valid counting pulse width values ​​to obtain the average effective counting pulse width value.

[0028] The technical effect of adopting this technical solution is that, because the number of revolutions of the motor is different due to the change in the speed within a fixed speed measurement period, the number of pulses K emitted by the encoder will also be different from N. When the number of pulses K is less than or equal to N, at this time, because the effective counting pulse width value is only K, the average value of the K effective counting pulse width values ​​can only be calculated to obtain the average effective counting

[0029] Pulse width value. When the number of pulses K is greater than N, because the effective count pulse width value cannot exceed N, the latest N effective count pulse width values ​​are averaged to obtain the average effective count pulse width value, so as to achieve the purpose of obtaining the average effective count pulse width value.

[0030] In this embodiment, the motor speed state is obtained according to the comparison result of K and N;

[0031] When K≤N, the number of motor revolutions is less than or equal to the fixed number of motor revolutions, and the motor is in low speed.

[0032] State; when K>N, the number of motor rotations is greater than the fixed number of motor rotations, and the motor is in a high speed state.

[0033] The technical effect of adopting this technical solution is that, according to the comparison result of K and N, the motor speed state is obtained to identify whether the motor is in a high speed state, a low speed state or a steady speed state equal to the fixed number of rotations of the motor.

[0034] In this embodiment, the average effective count pulse width value is calculated by the following formula:

[0035] , where: represents the average effective counting pulse width value, τ1 represents the latest effective counting pulse width value, τ2 represents the previous effective counting pulse width value, τ3 represents the previous effective counting pulse width value, and the value of i ranges from 1 to N.

[0036] The technical effect of adopting this technical solution is that, by using the above formula, at most N

[0037] The effective count pulse width value is calculated to obtain an average effective count pulse width value.

[0038] In this embodiment, the speed of the motor is calculated by the following formula:

[0039]

[0040] , where RPM represents the speed of the motor.

[0041] The counting effect after adopting this technical solution is that, using the above formula, the average effective

[0042] The motor speed is calculated by counting the pulse width value to obtain the real-time speed of the motor more accurately.

[0043] To achieve the second objective of the present invention, an embodiment of the present invention provides a speed measuring device for an encoder: the speed measuring device comprises: a counting module for counting the number of pulses emitted by the encoder within a fixed number of rotations of the motor and within a fixed speed measuring period; a measuring module for measuring the pulse number;

[0044] width; a storage module for storing the counting pulse width value and the effective counting pulse width value; a calculation module for calculating and obtaining the average effective counting pulse width value and the speed of the motor.

[0045] The technical effect after adopting this technical solution is that the counting function, the measuring function, the storage function and the calculating function are respectively realized through the setting of the counting module, the measuring module, the storage module and the calculating module.

[0046] To achieve the third objective of the present invention, an embodiment of the present invention provides an electronic device package

[0047] The system includes a processor, a memory, and programs or instructions stored in the memory and executable by the processor.

[0048] The electronic device of the embodiment of the present invention implements the steps of the speed measurement method of the encoder in any embodiment of the present invention, and thus has all the beneficial effects of the speed measurement method of the encoder in any embodiment of the present invention, which will not be described in detail here.

[0049] To achieve the fourth objective of the present invention, an embodiment of the present invention provides a readable storage medium on which a program or instruction is stored.

[0050] The readable storage medium of the embodiment of the present invention implements the steps of the speed measurement method of the encoder in any embodiment of the present invention, and thus has all the beneficial effects of the speed measurement method of the encoder in any embodiment of the present invention, which will not be repeated here. 20 Description of the drawings

[0052] Figure 1 A schematic diagram of the process steps of a speed measurement method of an encoder according to the present invention; Figure 2 This is a waveform diagram corresponding to the encoder in the high speed state in the present invention;

[0053] Figure 3 This is the waveform diagram corresponding to the encoder in the low speed state in the present invention. DETAILED DESCRIPTION

[0054] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0055] Due to differences in manufacturing processes and other factors, especially low-precision encoders, the same motor speed

[0056] The count pulse width measured under this condition will have a very large unevenness, so the speed measurement result of the encoder will be unstable.

[0057] [First embodiment] Reference Figure 1, a speed measurement method of an encoder, applicable to a motor, comprising the following steps: S100: counting the number of N pulses emitted by the encoder within a fixed number of rotations of the motor;

[0058] S110: Count the number of K pulses sent by the encoder within a fixed speed measurement cycle, and

[0059] Measure the pulse width of each pulse in the 10 counts to obtain K counted pulse width values;

[0060] S120: Obtain an average effective count pulse width value according to the count pulse width value, and obtain the speed of the motor according to the average effective count pulse width value;

[0061] Wherein, N is related to the encoder pole pair number and frequency and is an integer, K is an integer greater than or equal to 1, and K is an integer greater than or equal to 1.

[0062] In the above embodiment, in order to obtain the precise rotation speed of the motor and achieve the purpose of precise control, an encoder is used to detect the rotation speed of the motor. First, a counting module is used to count the number of N pulses issued by the encoder within a fixed number of rotations of the motor. The fixed number of rotations of the motor is preferably one rotation of the motor. Since different encoder lines or pole pairs are not consistent, one rotation of the motor can generate P pulses, and different frequencies used by the encoder also affect the number of pulses.

[0063] The above encoder is preferably designed with A and B phases, and can use the orthogonal method to achieve 4 times the frequency, so N=4*P counting pulses can be obtained when the motor rotates one circle. For low-precision encoders, A and B phases are used, that is, 2-wire or 2-pole encoders. P=2, so 8 counting pulses can be obtained when the motor rotates one circle. In addition, the encoder can also be designed with 4 phases and the orthogonal method can be used.

[0064] The frequency is quadrupled, that is, P=4, so 16 counting pulses can be obtained when the motor rotates one circle.

[0065] Secondly, the counting module counts the number of K pulses sent by the encoder in a fixed speed measurement period one by one, and uses the measurement module to measure the pulse width of each pulse. The above fixed speed measurement period can be, for example, 100ms. Since the motor speed will change, within the fixed speed measurement period of 100ms,

[0066] The number of revolutions that the motor may make varies due to the motor speed, so the number of K pulses obtained may be different from the number of N pulses mentioned above. It is possible that K>N,K <N,K=N。

[0067] Then, according to at most N count pulse width values, the calculation module calculates an average effective count pulse width value, and the calculation module obtains the rotation speed of the motor through the average effective count pulse width value.

[0068] In this way, averaging at most N count pulse width values ​​can minimize the error caused by the encoder body pole pair.

[0069] The uneven distribution of pulse widths causes uneven pulse widths, and when the number of N is larger, the average effective count pulse width value obtained is more accurate, and the corresponding motor speed is more accurate.

[0070] [Second embodiment] Reference Figure 1 , according to the count pulse width value, the step of obtaining the average effective count pulse width value specifically includes: S200: updating the count pulse width value in real time to obtain the effective count pulse width value;

[0071] S210: Calculate the average value of at most N valid count pulse widths to obtain an average valid count

[0072] Pulse width value.

[0073] In order to obtain the rotation speed of the motor more accurately in the above embodiment, the count pulse width value needs to be updated in real time so that the obtained average effective count pulse width value is more consistent with the motor rotation speed at that time.

[0074] [Third embodiment] Reference Figure 1 , 2 3. The step of updating the count pulse width value in real time and obtaining the effective count pulse width value specifically includes: S300: comparing the size of K and N;

[0075] S310: When K≤N, the Kth counting pulse width value is set as the Kth effective counting pulse width value;

[0076] S320: When K>N, the Kth counting pulse width value replaces the original K-1th valid counting pulse width value, and the K-1th valid counting pulse width value replaces the original K-2th valid counting pulse width value.

[0077] The effective counting pulse width value replaces the previous effective counting pulse width value in sequence, until the K-N+1th effective counting pulse width value replaces the KNth effective counting pulse width value.

[0078] In the above embodiment, since K and N are different in size within a fixed speed measurement period,

[0079] When K is less than N, the measurement module is used to count each pulse width measured into the FIFO array in turn to obtain the effective count pulse width value. Then the calculation module averages the K effective count pulse width values ​​to obtain the average effective count pulse width value.

[0080] For example, refer to Figure 3 When N=8, the fixed speed measurement period is 100ms, K=7, so only 7 pulse widths are measured in the fixed speed measurement period, and the 7 count pulse width values ​​are 7.3ms, 7.2ms, 7.3ms,

[0081] 7.1ms, 7.0ms, 7.2ms, 7.1ms. Therefore, the corresponding average effective counting pulse width value is (7.3ms+7.2ms+7.3ms+7.1ms+7.0ms+7.2ms+7.1ms) / 7=7.1714ms.

[0082] When K is greater than N, and the calculation method of the average effective count pulse width value is only to average at most N effective count pulse width values, it is necessary to replace the old effective count pulse width value with a new count pulse width value so that the data of the effective count pulse width value can be kept updated in real time to ensure the detection

[0083] The effective counting pulse width value obtained is synchronized with the rotation of the motor to obtain the real-time speed of the motor more accurately. Specifically, the pulse width is measured by a measurement module, and the first measured pulse width is stored in the FIFO array, and then the effective counting pulse width value is stored in a first-in-first-out manner, that is, the Kth counting pulse width value replaces the original K-1th effective counting pulse width value, the K-1th effective counting pulse width value replaces the original K-2th effective counting pulse width value, and the effective counting pulse width value replaces the K-2th effective counting pulse width value in turn.

[0084] The effective counting pulse width value is replaced by the previous effective counting pulse width value, until the effective counting pulse width value of K-N+1 replaces the original effective counting pulse width value of KN, so that the effective counting pulse width value can be updated in real time.

[0085] For example, refer to Figure 2 When N=8, the fixed speed measurement period is 100ms, K=10, so only 10 pulse widths are measured in the fixed speed measurement period, and the 10 counted pulse widths are 7.3ms, 7.2ms, 7.3ms, 7.1ms, 7.0ms, 7.2ms, 7.1ms, 7.3ms, 7.4ms, and 7.1ms.

[0086] When the first 8 pulse widths are detected, the effective count pulse width value is the first 8 pulse widths, and the average effective count pulse width value is (7.3ms+7.2ms+7.3ms+7.1ms+7.0ms+7.2ms+7.1ms+7.3ms) / 8=7.1875ms. When the 9th pulse width is detected, the 9th count pulse width value replaces the 8th effective count pulse width value, and the 8th effective count pulse width value replaces the 7th effective count pulse width value, until the 9th pulse width is detected.

[0087] The second effective count pulse width value replaces the first effective count pulse width value. At this time, the ninth count pulse width value replaces the eighth effective count pulse width value as the latest effective count pulse width value. At this time, the eight effective count pulse width values ​​are the second to ninth count pulse width values. The average effective count pulse width value at this time is (7.2ms+7.3ms+7.1ms+7.0ms+7.2ms+7.1ms+7.3ms+7.4ms) / 8=7.2ms. By analogy, when the tenth pulse width is detected, the tenth count pulse width value replaces the ninth effective count pulse width value.

[0088] The 9th effective counting pulse width value replaces the 8th effective counting pulse width value, until the 3rd effective counting pulse width value replaces the 2nd effective counting pulse width value. At this time, the 10th counting pulse width value is the latest effective counting pulse width value. At this time, the 8 effective counting pulse width values ​​are the 3rd to 10th counting pulse width values. The average effective counting pulse width value at this time is (7.3ms+7.1ms+7.0ms+7.2ms+7.1ms+7.3ms+7.4ms+7.1ms)) / 8=7.1875ms.

[0089] [Fourth embodiment] Referring to FIG. 1, the average value of at most N valid count pulse width values ​​is calculated.

[0090] The steps specifically include: S400: comparing the sizes of K and N;

[0091] S410: When K≤N, average the K valid count pulse width values ​​to obtain the average valid count pulse width value. If not, jump to S420 in S410;

[0092] S420: When K>N, calculate the average value of the latest N valid count pulse widths to obtain the average value.

[0093] All count pulse width values ​​are valid.

[0094] Similarly, in this embodiment, different calculation methods are used to obtain the average effective count pulse width value according to the different results of the size of K and N. When K≤N, the only K effective count pulse width values ​​obtained are averaged to obtain the effective count pulse width value. When K>N, the latest N effective count pulse width values ​​are averaged to obtain the average effective count pulse width value. The above "latest N"

[0095] Refers to the N valid count pulse width values ​​before the pulse width. For example, when the 20th pulse width is detected, N=8, then the average value of the 13th to 20th valid count pulse width values ​​detected is calculated.

[0096] [Fifth embodiment] Reference Figure 1 , 2 3. According to the comparison result of K and N, the motor speed state is obtained;

[0097] When K≤N, the number of motor revolutions is less than or equal to the fixed number of motor revolutions.

[0098] When K>N, the number of motor revolutions is greater than the fixed number of motor revolutions, and the motor is in a high speed state.

[0099] In the above embodiment, the fixed number of rotations of the motor is preferably one circle. When the motor rotates one circle, it is in a steady speed state, which is between a high speed state and a low speed state.

[0100] When in a fixed speed measurement cycle, the speed state of the motor can be determined by comparing the size relationship between K and N, wherein the high speed state means that the speed of the motor in this state is faster than that of the motor in a steady speed state, and the low speed state means that the speed of the motor in this state is faster than that of the motor in a steady speed state.

[0101] Of course, in combination with the third embodiment, when N=8, the fixed speed measurement period is 100ms, K=10, so

[0102] Only 10 pulse widths are measured in a fixed speed measurement cycle. The 10 count pulse width values ​​are 7.3ms, 7.2ms, 7.3ms, 7.1ms, 7.0ms, 7.2ms, 7.1ms, 7.3ms, 7.4ms, and 7.1ms. Therefore, when the first 8 pulse widths are detected, the effective count pulse width value is the first 8 pulse widths, and the average effective count pulse width value is (7.3ms+7.2ms+7.3ms+7.1ms+7.0ms+7.2ms+7.1ms+7.3ms)8=7.1875ms. When the 9th pulse width is detected, the 9th count pulse width value replaces the 8th effective count pulse width.

[0103] The 8th effective counting pulse width value replaces the 7th effective counting pulse width value, until the 2nd effective counting pulse width value replaces the 1st effective counting pulse width value. At this time, the 9th counting pulse width value replaces the 8th effective counting pulse width value as the latest effective counting pulse width value. At this time, the 8 effective counting pulse width values ​​are the 2nd to 9th counting pulse width values. The average effective counting pulse width value at this time is (7.2ms+7.3ms+7.1ms+7.0ms+7.2ms+7.1ms+7.3ms+7.4ms) / 8=7.2ms.

[0104] When the first 8 pulse widths are detected, the average effective count pulse width is 7.1875ms; when the first 9 pulse widths are detected, the average effective count pulse width is 7.2ms. Therefore, according to the calculation formula of the motor, the motor speed is in a reduced speed state compared with the previous state.

[0105] By analogy, when the 10th pulse width is detected, the 10th count pulse width value replaces the 9th

[0106] The 9th effective counting pulse width value replaces the 8th effective counting pulse width value, until the 3rd effective counting pulse width value replaces the 2nd effective counting pulse width value. At this time, the 10th counting pulse width value is the latest effective counting pulse width value. The 8 effective counting pulse width values ​​at this time are the 3rd to 10th counting pulse width values. The average effective counting pulse width value at this time is (7.3ms+7.1ms+7.0ms+7.2ms+7.1ms+7.3ms+7.4ms+7.1ms)) / 8=7.1875ms.

[0107] When the first 9 pulse widths are detected, the average effective count pulse width is 7.2ms; when the first 10 pulse widths are detected, the average effective count pulse width is 7.1875ms. Therefore, according to the calculation formula of the motor, the motor speed is in a speed-up state compared with the previous state.

[0108] Therefore, it can be concluded that when K is greater than N, the average effective count pulse width values ​​of two adjacent ones can be compared to reflect whether the motor is in a deceleration state, a speed increase state, or a constant speed state compared to the previous state.

[0109] It is better to grasp the precise speed of the motor in real time, so as to achieve the effect of precise control.

[0110] [Sixth embodiment] Reference Figure 1 The average effective count pulse width is calculated by the following formula:

[0111] get:

[0112] ,in represents the average effective counting pulse width value, τ1 represents the latest effective counting pulse width value, τ2 represents the previous effective counting pulse width value, τ3 represents the previous effective counting pulse width value, i

[0113] The value ranges from 1 to N.

[0114] In this embodiment, the specific calculation method for the average effective counting pulse width value is to divide the sum of each effective counting pulse width value by the number of effective counting pulse widths. The number of effective counting pulse widths is different according to the comparison result of K and N.

[0115] When K is less than or equal to N, the number of valid counting pulse widths is K. When K is greater than N, the number of valid counting pulse widths is N, and the latest N valid counting pulse width values ​​are taken.

[0116] [Seventh embodiment] Reference Figure 1 , the speed of the motor is calculated by the following formula:

[0117] , where RPM represents the speed of the motor.

[0118] In this embodiment, the specific calculation method of the motor speed is 60 divided by (the product of N and the average count pulse width value). It can be seen that the motor speed is inversely proportional to N and the average effective count pulse width value, and because N is related to the number of lines or pole pairs of the encoder, the value of N for the same encoder is certain, that is, the motor speed is directly related to the average effective count pulse width value. When the average effective count pulse width value is larger, the motor speed is slower; when the average effective count pulse width value is smaller, the motor speed is slower.

[0119] The smaller the width, the faster the motor speed.

[0120] [Eighth Embodiment] This embodiment provides a speed measuring device for an encoder: the speed measuring device includes: a counting module for counting the number of pulses emitted by the encoder within a fixed number of rotations of the motor and within a fixed speed measurement period; a measuring module for measuring the pulse width of the pulse; a storage module for storing the count pulse width value and the effective count pulse width value; a calculation module for calculating and obtaining the average effective

[0121] The effective counting pulse width value and the motor speed.

[0122] [Ninth embodiment] This embodiment provides an electronic device including a processor, a memory, and a program or instruction stored in the memory and executable by the processor. The electronic device implements the steps of the speed measurement method of the encoder as in any embodiment of the present invention.

[0123] [Tenth embodiment] This embodiment provides a readable storage medium, the readable storage medium

[0124] The program or instruction is stored on the storage medium, and the storage medium is read to implement the steps of the speed measurement method of the encoder in any embodiment of the present invention.

[0125] Although the present invention is disclosed as above, the present invention is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the scope defined by the claims.

Claims

1. A speed measurement method for an encoder, characterized in that: Applicable to the motor, the method comprises the following steps: Counting the number of N pulses emitted by the encoder within a fixed number of motor rotations; Counting the number of K pulses emitted by the encoder within a fixed speed measurement period, and measuring the pulse width of each pulse in the K pulses to obtain K counted pulse width values; According to the count pulse width value, an average effective count pulse width value is obtained, and according to the average effective count pulse width value, the speed of the motor is obtained; the step of obtaining the average effective count pulse width value according to the count pulse width value specifically includes: Real-time updating of the count pulse width value to obtain a valid count pulse width value; specifically including: Compare the size of K and N; When K≤N, the Kth counting pulse width value is set as the Kth effective counting pulse width value; When K>N, the Kth counting pulse width value replaces the original K-1th valid counting pulse width value, the K-1th valid counting pulse width value replaces the original K-2th valid counting pulse width value, and the valid counting pulse width value replaces the previous valid counting pulse width value in sequence, until the K-N+1th valid counting pulse width value replaces the original KNth valid counting pulse width value; averaging at most N of the effective count pulse width values ​​to obtain an average effective count pulse width value; Wherein, N is related to the encoder pole pair number and frequency and is an integer, and K is an integer greater than or equal to 1; The average effective count pulse width value is calculated by the following formula: , in represents the average effective counting pulse width value, τ1 represents the latest effective counting pulse width value, τ2 represents the previous effective counting pulse width value, τ3 represents the previous effective counting pulse width value, and the value of i ranges from 1 to N; The speed of the motor is calculated by the following formula: , where RPM represents the speed of the motor.

2. The speed measurement method of the encoder according to claim 1, characterized in that: The step of averaging at most N valid count pulse width values ​​specifically includes: S1: Compare the size of K and N; S2: When K≤N, average the K valid count pulse width values ​​to obtain the average valid count pulse width value. If not, jump to S3 in S2; S3: When K>N, average the latest N valid count pulse width values ​​to obtain the average valid count pulse width value.

3. The speed measurement method of the encoder according to claim 1, characterized in that: According to the comparison result of K and N, the motor speed state is obtained; When K≤N, the number of revolutions of the motor is less than or equal to the fixed number of revolutions of the motor, and the motor is in a low speed state; When K>N, the number of rotations of the motor is greater than the fixed number of rotations of the motor, and the motor is in a high speed state.

4. A speed measuring device for an encoder, characterized in that: The speed measuring device is used to implement the speed measuring method according to any one of claims 1 to 3, and the speed measuring device comprises: The counting module is used to count the number of pulses emitted by the encoder within a fixed number of motor rotations and a fixed speed measurement cycle; A measuring module, used for measuring the pulse width of a pulse; A storage module, used for storing a counting pulse width value and an effective counting pulse width value; The calculation module is used to calculate and obtain the average effective count pulse width value and the speed of the motor.

5. An electronic device, characterized in that: The method comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction implements the steps of the method according to any one of claims 1 to 3 when executed by the processor.

6. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 3 are implemented.

Citation Information

Patent Citations

  • Velocity measurement method and device

    CN104965099A

  • Speed detector based on pulse width modulation (PWM) signal, processing circuit and chip

    CN109580975A