[sdiy] Rotary encoders: is there a clever way to handle many?

Carsten Toensmann carsten at analog-monster.de
Mon Aug 10 14:16:44 CEST 2015


I scan two rotary encoders in my uNet keyboard application, see http://www.analog-monster.de/un_kbd_en.html

 

I connected the two output pins of each encoder to ordinary port pins of an Amega8535 and do a cyclic read of the port. So I used four I/O port pins in total, but there is no interrupt function involved. The reading of the port, the detection of movement and the movement direction of the encoder are done by small assembler routines. I don’t recommend multiplexing the encoder pins, so you need two I/O pins per encoder.

 

Regards

 

Carsten

 

Von: synth-diy-bounces at dropmix.xs4all.nl [mailto:synth-diy-bounces at dropmix.xs4all.nl] Im Auftrag von Rick Jansen
Gesendet: Montag, 10. August 2015 13:46
An: Synth-Diy <synth-diy at dropmix.xs4all.nl>
Betreff: [sdiy] Rotary encoders: is there a clever way to handle many?

 

Well, that was fun, or was it. Handling a rotary encoder with an Arduino can be done, but there's a lot to take care of! The signals from my (simple) €1,50 encoder bounce all over the place. My current implementation uses one of the two interrupt pins of the Arduino, although a polling solution is possible as well. I'm not sure if it is because of the "quality" of this encoder, but at times there are nearly as many pulses clockwise as anti-clockwise..  I ended up counting both clockwise and anti-clockwise pulses, the greater of which determines actual direction. Even an "acceleration" is detected, if you turn the rotary fast the value will change more dramatically.

It works quite well, but at the same time I wonder how other machines work, that track 8 or 16 rotary encoders.. An Arduino Mega has many more interrupt pins than the measly Arduino Uno, but still. Is there a clever trick to track many rotary encoders that I am missing?

rick

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://synth-diy.org/pipermail/synth-diy/attachments/20150810/ac8f88a4/attachment.htm>


More information about the Synth-diy mailing list