Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

does the KY040 work as in spec?

2 posters

Go down  Message [Page 1 of 1]

1does the KY040 work as in spec? Empty does the KY040 work as in spec? Wed Feb 16, 2022 9:16 pm

TimFisch

TimFisch

As far as I understood the spec of the KY040, I had assumed for a "constant turning speed" the output of the encoder looks like the following:

Clockwise
Code:

DT  ___/"""\___/"""\___/"""\___/"""\
CLK _/"""\___/"""\___/"""\___/"""\___

Counter clockwise
Code:

DT  _/"""\___/"""\___/"""\___/"""\___
CLK ___/"""\___/"""\___/"""\___/"""\

As far as I get it in the simulation, it looks more like:

Clockwise
Code:

DT  """""\__/"""""""""""""""""""""\__/"""
CLK  """\__/"""""""""""""""""""""\__/"""""

Counter clockwise
Code:

DT  __/""\____________________/""\____
CLK ___/""\____________________/""\__

The high parts (for CW) / low parts (for CCW) are much longer.

So, the edge sequence is right but the "duty cycle" seems strange to me. I thought this should be 50:50 be the sensor wheel.

Background:
I have seen some debouncing algorithm which do fail see any rotation. These were not based on edge or pin change detection, but used periodical probing of DT and CLK.



Last edited by arcachofo on Fri Apr 29, 2022 2:06 pm; edited 1 time in total (Reason for editing : Mark as solved (green color))

https://wiki.mexle.hs-heilbronn.de/

2does the KY040 work as in spec? Empty Re: does the KY040 work as in spec? Wed Feb 16, 2022 9:41 pm

arcachofo

arcachofo

I didn't write this component, so I don't know much about how it works.
I will have a look.

3does the KY040 work as in spec? Empty Re: does the KY040 work as in spec? Fri Feb 18, 2022 6:46 pm

arcachofo

arcachofo

I refactored this component to match the "real" timing and it's now a generic relative rotary encoder.
By now only the number of step per rotation is configurable.

Done at Rev 961.

TimFisch likes this post

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum