Wednesday 19 November 2014

Swedish Encoder Taming

Leif, sm7mcd, has sent me some great photographs of his experiments using capacitors to tame the output of rotary encoders - and he has given given me permission to publish them here...

Leif starts by showing that the encoder is capable of generating perfectly clean output in clockwise rotation...


However, the same encoder can also generate "glitches" in its output as the switch contacts bounce, clearly seen here...


Similarly, in counter-clockwise rotation (notice how the bottom quadrature trace now lags the top trace, indicating the different sense of rotation), clean output is possible...


but the switches can also bounce with the resultant glitches...


Leif has added some (enormous) 100nF Mylar capacitors...


and this generates the sort of pulse shape I suggested in the previous post...


Leif shows how the capacitors "eliminate" the glitches caused by the contact bounce...


Notice that the switch's bouncing closure does not have chance to discharge the capacitor and pull the voltage down to zero - we would need to include a discussion of the (small) switch contact resistance and the equivalent inductance in the circuit to describe this behaviour.

Certainly, as I commented in my last post, and as Leif's photos beautifully demonstrate, the capacitors "modify switch bounce". They also add the clear exponential shape to one side of the pulse which (with the addition of the threshold operation in the logic) gives the pulse width increase. 

I remain unsure of the exact mechanism that is taming the encoders - I do not know for certain if it is about switch bounce or pulse width. But I quote from Leif: 

"I experienced the same problem with reading errors from the rotary encoder and it's nice to see that we found the same cure. I did some testing in rapid spinning of the encoder and I found 100 nF almost optimal also for real rapid spinning."

Leif is a member of den Kalmar Radio Amatör Sällskap (Kalmar Amateur Radio Society), who are using some of the m0xpd / Kanga shields in their projects this year. I'm looking forward to any excuses for collaboration with Leif and his fellow members of KRAS.

Tack så mycket, Leif 

...-.- de m0xpd




1 comment:

  1. I resolved the issues I had with PICs and rotary encoders many years ago by using the circuitry AA0ZZ used in his PIC-EL design which uses 2R and 1C on each of the 2 inputs http://cbjohn.com/aa0zz/PIC-EL-III/PIC-EL-III-Schematic.jpg

    ReplyDelete