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

Ullrich Peter Peter.Ullrich at kapsch.net
Mon Aug 10 22:22:00 CEST 2015


Hi Rick!

The most elegant solution for me for multiple encoders is to connect all A and B outputs of lets say 8 or 16 encoders
in parallel – these two signals A and B go to µC input pins.

The common pin of each encoder is connect via a diode (anode to encoder COM pins) to the 8 or 16 outputs of an 74HC138 or 74HC154.

So with the control of 4 output lines that select one of the 16 encoders at a time and 2 input lines you can scan 16 encoders.
The HC138/HC154 have active low outputs, so only one encoder is active at any time and the lines A and B represent the encoder
A and B signal status of the activated encoder.

This is at least for me optimal IO pin saving solution.

But remember that this solution only works for encoders that make a full pulse pattern on both pins per detent.
Some encoders only output half of the puls pattern and so the A and B pins of the encoders could both be activated in the
resting positions – this leads to errors while reading the other encoders!
But this is just a problem of the selection of the correct part number…

I have a sketch of such a circuit if anyone is interested but couldn't find the code on my PCs...
But its not hard to program...

Ciao
Peter

http://www.ullrich.at.tt


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
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



The information contained in this e-mail message is privileged and confidential and is for the exclusive use of the addressee. The person who receives this message and who is not the addressee, one of his employees or an agent entitled to hand it over to the addressee, is informed that he may not use, disclose or reproduce the contents thereof, and is kindly asked to notify the sender and delete the e-mail immediately.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://synth-diy.org/pipermail/synth-diy/attachments/20150810/23694f16/attachment.htm>


More information about the Synth-diy mailing list