The invention is related to an incremental encoder, in particular, to a method for estimating a rotational speed of an incremental encoder.
Rotational encoders can be classified into two categories: absolute and incremental. The absolute type provides the absolute position (angle) of the rotating shaft, while the incremental type only outputs the relative position (angle) of the rotating shaft. Regardless of the type, both the absolute and incremental encoders can deliver information such as revolutions per minute (rpm) and rotation angle via certain devices or sensors.
There are two methods for estimating speed in incremental encoders: M-mode and T-mode. The M-mode estimation involves counting the number of the encoder pulses Pr in a fixed sampling time period Ts, combining the number of the encoder pulses Pr with the total number of pulses PT in one disc cycle, and then computing the rotational speed using the equation
While this approach works well for measuring high speeds, it's not the best fit for low-speed measurements.
The T-mode estimation calculates the time duration Tr of encoder pulses, and subsequently calculates the rotational speed using the equation
This technique is well-suited for measuring low speeds, but falls short when it comes to high-speed measurements.
Presently, there is no technology available that can accurately estimate the rotational speed of an incremental encoder at both low and high rotational speeds.
An embodiment provides a rotational speed estimation method for an incremental encoder including generating a plurality of pulse signals according to a plurality of square waves, detecting a time duration when the pulse signals reach a predetermined number, and generating a rotational speed of the incremental encoder according to the predetermined number, the time duration and a total pulse number of one rotation of a disc of the incremental encoder.
Another embodiment provides a rotational speed estimation method for an incremental encoder including generating a plurality of pulse signals according to a plurality of square waves, detecting that the pulse signals reach a predetermined number of pulse time durations, and generating a rotational speed of the incremental encoder according to the predetermined number, a sum of the pulse time durations and a total number of pulses for one rotation of a disc of the incremental encoder.
These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings.
Encoders can be classified into three types based on the principle of signal generation: mechanical, magnetic and optical. The optical type encoder, in particular, has a disc that spins in synchronization with the main shaft, and is sandwiched between light sources and light sensors. The disc has alternating transparent and opaque regions, enabling the light sensors to generate data for a microprocessor to determine the number of rotations of the disc.
The encoders can be classified into absolute encoders and incremental encoders based on the encoding methods. An incremental encoder operates by using a first signal A and a second signal B that have a 90-degree phase difference therebetween, resulting in four combinations at output terminals. The four combinations of the first signal A and the second signal B are (0, 0), (0, 1), (1, 1), (1, 0) respectively, enabling the high and low levels of the first signal A and the second signal B to be converted into pulses that correspond to the number of rotations of the disc. Assuming that a rotation of the disc corresponds to 600 pulses, then the disc performs 1/600 rotation when the first signal A and the second signal B changes from (0,0) to (0,1).
An embodiment of the invention presents a method for estimating the rotational speed of an incremental encoder.
When the microprocessor 100 measures the rotational speed of the disc 140, and the current pulse number recorded by the counter 120 is N−1, the current pulse number N−1 is stored into the DMA 110 or another memory. When the rising edge or falling edge of the first signal A or the second signal B generates the Nth pulse, the timer 130 starts to time a cycle Tc. A constant k ranging between 0.5 and 1.0 (e.g., k=0.8) is stored in the microprocessor 100. When the timer 130 starts timing, the time is reset to 0. When the time reaches kTc, the number of pulses recorded by the counter 120 is M, and the microprocessor 100 can instruct the timer 130 to stop timing when the number of pulses reaches the predetermined number of pulses
Upon the timer 130 stopping the timing, the time recorded by the timer 130 is the end time Td, and the microprocessor 100 can use the end time Td, the total number of pulses PT for one turn of the disc 140, the number of pulses N, and the predetermined number of pulses Pr to generate the rotational speed
of the disc 140.
In another embodiment of the present invention, suppose the microprocessor 100 sequentially calculates the rotational speeds of the disc 140 as ω1, ω2, . . . , ωn, if the slope of ω1, ω2, . . . , ωn obtained by linear regression
is a negative value, then the disc is decelerating, where
When the timer 130 stops timing, the time recorded by the timer 130 is the end time Td, and the microprocessor 100 can use the end time Td, the total pulse number PT for one turn of the disc 140, the pulse number N, and the predetermined pulse number Pr to generate the rotational speed
of the disc 140.
In another embodiment of the present invention, a method for estimating the rotational speed of an incremental encoder is provided. When the microprocessor 100 measures the rotational speed of the disc 140, and the current pulse number recorded by the counter 120 is N−1, the current pulse number N−1 is stored into the DMA 110 or another memory. When the rising edge or falling edge of the first signal A or the second signal B generates the Nth pulse, the timer 130 starts to time a cycle Tc, and the starting time Ta is stored into the DMA 110 or another memory. A constant k ranging between 0.5 and 1.0 (e.g., k=0.8) is stored in the microprocessor 100. When the time reaches kTc, the number of pulses recorded by the counter 120 is M, and the DMA 110 may record the end time Tb of the timer 130 in the memory when the number of pulses reaches the predetermined number of pulses
The microprocessor 100 can generate an elapsed time duration Td=Tb−Ta according to the start time Ta and the end time Tb. The microprocessor 100 can use the elapsed time duration Td, the total pulse number PT for one turn of the disc 140, the pulse number N, and the predetermined pulse number Pr to generate the rotational speed
of the disc 140.
In another embodiment of the present invention, suppose the microprocessor 100 sequentially calculates the rotational speeds of the runner 140 as ω1, ω2, . . . , ωn, if the slope of ω1, ω2, . . . , ωn obtained by linear regression
is a negative value, then the disc is decelerating, where
The microprocessor 100 can generate an elapsed time duration Td=Tb−Ta according to the start time Ta and the end time Tb. The microprocessor 100 can use the elapsed time duration Td, the total pulse number PT for one turn of the disc 140, the pulse number N, and the predetermined pulse number Pr to generate the rotational speed
of the disc 140.
In yet another embodiment, the invention presents a method for estimating the rotational speed of an incremental encoder.
The microprocessor 100 can set the first timer 420 to calculate the time duration of each pulse signal, prompting the DMA 110 to store the time durations in a loop. The length of the DMA 110 is equal to the total number of pulses PT generated by one turn of the disc 140. When the second timer 430 starts to time, the initial count value N0 is recorded in the DMA 110, followed by the ending count value N1 at the end of the timing period. The number of complete pulses during the timing period Tc is given by m=N1-N0-2. By summing all the pulse periods from N0+2 to N1 memory segments, the elapsed time duration Td of m pulses can be obtained, and the microprocessor 100 uses pulse number m, the elapsed time duration Td of the m pulses and total pulse number P1 in one turn of the disc 140 to generate the rotational speed
of the disc 140.
Consider the embodiment in
Therefore, when calculating the number of pulses m where m=N1-N0-2, the microprocessor 100 adds up the pulse time durations recorded in the access units from p3 to m+3 of the DMA 110 to obtain the elapsed time duration Td. The microprocessor 100 can then generate the rotational speed
of the disc 140 according to the pulse number m, the elapsed time duration Td, and the total pulse number PT generated by one turn of the disc 140.
of the disc 140 according to the predetermined number (Pr−N−1), elapsed time duration Td, and the total pulse number PT generated by one turn of the disc 140.
of the disc 140 according to the predetermined number m=(N1-N0-2), the elapsed time duration Td, and the total pulse number PT generated by one turn of the disc 140.
In the embodiments of the present invention, the timer is used to calculate the exact elapsed time duration Td and the number of complete pulses, thereby addressing the issues of the traditional estimation method and satisfying both high-speed and low-speed applications. The embodiment of the present invention is not only applicable to the estimation of the speed/position of the disc 140, but can also be used for measuring and recording pulses and pulse intervals. In addition to generating a plurality of pulse signals through the first signal A and the second signal B, a plurality of pulse signals can be generated using more than two square wave signals.
Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
112121917 | Jun 2023 | TW | national |