One way to visualize how an encoder works is to think of 20 speed bumps arranged in a circle. Floating above the speed bumps is a wire. Now imagine a contact arm anchored in the center of the circle and a second contact arm 90 degrees out of phase with the first arm. As a shaft turns, the contact hits a speed bump and make contact with the wire above it. Therefore, every 18 degrees (360 / 20 = 18) a contact is made and a pulse chain is form by the two contact arms. By looking at those signals, you can determine if the shaft is rotating CCW or CW. Therefore, you will see a pulse chain of binary values coming from the encoder. A better description can be seen on YouTube:
From: Jerry Gaffke via Groups.Io <jgaffke@...> To:[email protected] Sent: Sunday, February 25, 2018 11:29 PM Subject: Re: [BITX20] Erratic tuning with my new uBitx
As you rotate the encoder shaft, the enocder alternately grounds ENC_A and then ENC_B. The timing in how it shorts one and then the other tells the Raduino which direction you are turning the shaft. So this grounding is not an error. You should see a regular pattern of 5v and 0v on those pins as you turn the shaft, and the two patterns should look very similar (just slightly shifted in time)
On Sun, Feb 25, 2018 at 07:34 pm, DrZ wrote:
It does seem weird that I would have this problem even with the original sketch. ?I'll try the test you suggest. ?Are you saying that the occasional short to ground is an error?