Simulating a rotary encoder

I'm trying to generate signals that simulate the output signals of a normal incremental encoder to test my encoder debouncing code without using an encoder. What's the typical rpm of an encoder that can be generated by hand?

When I was testing my own rotary encoder code I found I could get close to 1kHz output by turning the encoder with my fingers. Put another way, I found it was necessary to read the encoder at least 1000 times per second for it to be reliable.

You don't need to explicitly debounce a rotary encoder if you use a state based reading strategy.

The library NewEncoder works very reliable.
Even with the cheapest rotary-encoders with mechanical switches that are bouncing

best regards Stefan

Right. And the OP has an interesting idea, to simulate the output of an encoder to test his input routines…

@babayaga_2001 - it seems like quite a nice challenge, as you would not only have to synthesize the quadrature signals (easy), but include a model of the contact bouncing and noise that some encoders might be expected to produce.

It seems far easier to 1) just use a good encoder library or 2) if you are challenging yourself to write such code, test it IRL with a variety of encoders of various designs and quality.

a7

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.