<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>For a single encoder I would setup the MCU to interrupt on a low
to high transition on both the A and B pins. If you get an
interrupt on the A pin first you are going clockwise, on the B pin
you are going counter clockwise. I do typically debounce the
switch transitions in software too. Basically after the interrupt
(a few milliseconds) I check to see if the state is correct before
I say the switch has changed state. If you don't you can get
multiple interrupts from a 'noisy/bouncy' switch.<br>
</p>
<p>Since this is an edge transition and not polling a steady state I
think it should work for both (don't know which Bourns encoder
you're using, so I'm assuming they it will work since most work
the same way).</p>
<p>If I use more than 2 encoders I'll usually multipex them to save
pins. To do that you have to ground pin C of the active encoder
and use diodes between the A and B pins and the pull up resistors.
Cathode of the diodes goes to the A and B pins, anode to the pull
ups.<br>
</p>
<p>Jay S.<br>
</p>
<div class="moz-cite-prefix">On 2/9/2020 2:32 AM, Spiros Makris
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAGbpyRe6wJ0igXxr-FfV3xrSN5-nbFgOO=3+UBu4K36aaPumsA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Thank you Jay, I have look at that datasheet.
Indeed what is shown is how my encoder behaves (rests at either
00 or 11when turned). My confusion stems from the fact that the
bourns encoders also have the same waveforms in the datasheet
even though they don't work in a similar fashion.
<div>Is there any algorithm that can successfully read both
types of encoders?<br>
<div>I am looking for a smooth encoder with a very light
touch. I'm guessing I need to look for no detents first.
What about the "hardness"? I suspect that's specified by the
torque, and I'm looking for the lowest one possible? <br>
</div>
</div>
<div><br>
</div>
<div>Spiros</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sun, Feb 9, 2020 at 1:19 AM
Jay Schwichtenberg <<a href="mailto:jschwich53@comcast.net"
moz-do-not-send="true">jschwich53@comcast.net</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>Shawn,</p>
<p>Thanks put I understand encoders and have all sorts of
code for encoders. Embedded HW/SW stuff was my day job for
a number of years.</p>
<p>Thanks<br>
Jay S.<br>
</p>
<div>On 2/8/2020 3:04 PM, Shawn Rakestraw wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>I don't know if this will help you or not, but I
have just assembled two projects that use Teensy
microcontrollers. This is the encoder that I used. I
can't say for sure how it outputs the signals.</div>
<div><br>
</div>
<div><a
href="https://www.mouser.com/ProductDetail/858-EN11-HSM1BF20"
target="_blank" moz-do-not-send="true">https://www.mouser.com/ProductDetail/858-EN11-HSM1BF20</a></div>
<div><br>
</div>
<div>Shawn<br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sat, Feb 8, 2020 at
5:44 PM Jay Schwichtenberg <<a
href="mailto:jschwich53@comcast.net" target="_blank"
moz-do-not-send="true">jschwich53@comcast.net</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px
0px 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div>
<p>At least for the Alps pg 267 in the data sheet on
the Mouser web site show you what's going on. This
is pretty standard for this type of encoder.<br>
</p>
<p><a
href="https://www.mouser.com/datasheet/2/15/alps_alps-s-a0008379064-1-1733314.pdf"
target="_blank" moz-do-not-send="true">https://www.mouser.com/datasheet/2/15/alps_alps-s-a0008379064-1-1733314.pdf</a></p>
<p>Jay S.<br>
</p>
<div>On 2/7/2020 5:00 AM, Spiros Makris wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hello,
<div>I am putting together a teensy application
that uses rotary encoders. I picked up two
different ones from my local shops, but they
seem to have a different output waveform
scheme.</div>
<div>One is an EC11e15204a3 alps (according to
the guy selling it) and on each detent, the
outputs switch between high and low. So,
00->11->00 and each transition from 00
to 11 and vice versa happens when you hit a
detent.</div>
<div>The other is a bourns by the looks of it,
and works differently: When resting, it
defaults to 00. When turned, it briefly
becomes 1, then returns to 00. <br>
(obviously, the turn direction is detected
during the transitions).</div>
<div>The second type detects two increments
instead of one, as a result.</div>
<div>Where in the datasheet is this specified?
Both are sold as "2 channel quadrature
outputs" but the detection code is slightly
different (unless I'm missing something?). Is
there code that can work with both? I am using
polling and shift registers and don't need any
significant accuracy- the delay so far feels
great.</div>
<div>Is there a cheaper alternative to the 5pin
arrangement of the EC11? It seems that those
without switches only have 3 pins- they will
be going on a prefboard and the extra support
would be welcome (I'm not compelled to drill
64 holes for the side supports :P ).</div>
<div><br>
</div>
<div>Regards,</div>
<div>Spiros</div>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
Synth-diy mailing list
<a href="mailto:Synth-diy@synth-diy.org" target="_blank" moz-do-not-send="true">Synth-diy@synth-diy.org</a>
<a href="http://synth-diy.org/mailman/listinfo/synth-diy" target="_blank" moz-do-not-send="true">http://synth-diy.org/mailman/listinfo/synth-diy</a>
</pre>
</blockquote>
</div>
_______________________________________________<br>
Synth-diy mailing list<br>
<a href="mailto:Synth-diy@synth-diy.org"
target="_blank" moz-do-not-send="true">Synth-diy@synth-diy.org</a><br>
<a
href="http://synth-diy.org/mailman/listinfo/synth-diy"
rel="noreferrer" target="_blank"
moz-do-not-send="true">http://synth-diy.org/mailman/listinfo/synth-diy</a><br>
</blockquote>
</div>
</blockquote>
</div>
_______________________________________________<br>
Synth-diy mailing list<br>
<a href="mailto:Synth-diy@synth-diy.org" target="_blank"
moz-do-not-send="true">Synth-diy@synth-diy.org</a><br>
<a href="http://synth-diy.org/mailman/listinfo/synth-diy"
rel="noreferrer" target="_blank" moz-do-not-send="true">http://synth-diy.org/mailman/listinfo/synth-diy</a><br>
</blockquote>
</div>
</blockquote>
</body>
</html>