L
L
Ledington2022-04-14 15:36:54
C++ / C#
Ledington, 2022-04-14 15:36:54

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#.

Images
62581479724bf399281964.jpeg
625814850df26466242430.jpeg
6258148a66877290201039.jpeg
6258149004fd4594948698.jpeg
62581495d5a55577268524.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Armenian Radio, 2022-04-14
@gbg

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 question

Ask a Question

731 491 924 answers to any question