Answer the question
In order to leave comments, you need to log in
How to count the number of peaks with an offset?
There are signals from the rotation displacement encoder that are shifted by some amount relative to each other (signals A and B).
To determine the magnitude and direction of movement, you need to count the number of rectangles (the direction of rotation is determined by which of the rectangles is blue or red first).
The attached pictures show that when moving, for example, clockwise, the motor shaft can briefly rotate in the opposite direction.
However, due to the non-ideal uniform movement of the displacement, a "bounce" of the signal is observed.
How to implement an algorithm that will determine the amount and direction of movement of the movement shift, completely eliminating false alarms due to the "bounce" of the signal?
At the same time, again, the speed is uneven and due to this, the rectangles can be of different sizes, as shown in the attached images.
PS: initially everything was done in matlab, but solutions will work in both C++ and C#.
Answer the question
In order to leave comments, you need to log in
Look at this article, everything is much simpler
. In particular, to determine the speed, it is enough to cross A and B - you will get a meander with twice the frequency of encoder ticks.
Well, the second part of the article is about the way to determine the direction.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question