adafruit / seesaw

I2C friend to expand capabilities of other chips.
Other
76 stars 34 forks source link

Encoder can lose counts #51

Open jepler opened 3 years ago

jepler commented 3 years ago

With the Adafruit I2C QT Rotary Encoder with NeoPixel - STEMMA QT / Qwiic and the suggested 24-detent-per-revolution encoder, run one of the sample programs which shows the accumulated encoder counts. I used CircuitPython.

Carefully rotate the encoder about 1/2 to 3/4 of the way between detents, then return it to the initial position without actually passing over to the next detent. Repeat this multiple times, always in the same direction (e.g., initially turning clockwise). The encoder count will "drift away" from the initial count, even though the position is not changing. Once you get the hang of it you'll be able to lose a count almost every time.

I suspect there's some kind of logic error in the quadrature decoder state machine, but its form was unfamiliar to me so I was not able to make sense of it.

ladyada commented 3 years ago

do you mean the trinkey or the i2c breakout?

jepler commented 3 years ago

Adafruit I2C QT Rotary Encoder with NeoPixel - STEMMA QT / Qwiic -- I updated the initial comment too

jerryneedell commented 3 years ago

I have also reproduced this with the I2C QT Rotary Encoder (PID 4991) on an QTPY RP2040 with Circuitpython and a QTPY M0 with Arduino.

I found I can induce the error by gently turning the encoder but not going to the next indent -- Sometimes it will register a count even if the position does not change. It also occurs if I rapidly turn the encoder back and forth. It appears that it sometimes triggers a count on a partial step.