Searching \ for '[EE]: Stumped by rotary encoder' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/io/sensors.htm?key=encoder
Search entire site for: 'Stumped by rotary encoder'.

Exact match. Not showing close matches.
PICList Thread
'[EE]: Stumped by rotary encoder'
2001\07\22@122744 by Roman Black

flavicon
face
Hi Jan, I think your problem might be simple, the
standard way to do this is sense ONLY the 0-1 transition
of A, then checking B tells you the direction.
You just ignore the 1-0 transition on A.

I'm sure that will fix it for you. :o)
-Roman


{Quote hidden}

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\07\22@131001 by Brian Aase

flavicon
face
I might just add that your initial 10 mS debounce delay should
not be necessary.  If you look at the rotary encoder data sheet,
you will see that when Phase A "fires", Phase B is already at
the 50% point of its (virtual) period.  My experience has been
that adding any additional delay here usually makes things less
reliable. FWIW.
Brian Aase

On 23 Jul 2001, at 2:28, Roman Black wrote:

{Quote hidden}

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\07\22@132457 by SkinTech

flavicon
face
Brian,
You may have a point here, but what about the chattering/bouncing of the
contact? Maybe I should process the change at the first indication of a
change, let the thing bounce away with maybe some delay AFTER processing
BEFORE polling again, what do you think?

Jan Didden

PS This thing has 15 detents and 30 steps over 360 deg. Even turning at 1
rev/sec (which is pretty fast for a manually operated knob) gives some 33
msec to leisurely process each change.

{Original Message removed}

2001\07\22@134409 by Brian Aase

flavicon
face
Just relating my own experience here.  In normal use, I find
that the Phase B signal has done all the bouncing that it's
likely to at the point when the Phase A transition happens.
Once I made a routine that took a sample right after the
Phase A transition, then waited a while (200 uSec? or so)
and took another sample, waited again, and took a third
sample.  Then I took the "best 2 out of 3" as the answer.
At the time it sounded elegant, but in reality didn't help
very much.

What electrical components are you using around your
encoder?  For me, a pullup of around 47K ohms to +5
and a bypass of around 680 pF from each contact to
ground works pretty well.

Brian Aase

On 22 Jul 2001, at 19:32, SkinTech wrote:

{Quote hidden}

> {Original Message removed}

2001\07\23@053359 by Alan B. Pearce

face picon face
>You just ignore the 1-0 transition on A.

except that by sensing this you can get double the number of transitions per
rotation. You just have to know that the state of the B side will be the
opposite of what it would be for the 0-1 transition when going the same
direction.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\07\23@122300 by SkinTech

flavicon
face
Brian,

Thanks for the comment. I use a 10k pullup to +5, no cap. I guess the best
way would be to use maxim's debounce chip, but this thing has 4 encoders,
each with a pushbutton, so I wanted to save on hardware cost. Reading your
and the other comments, I will try to process the input at the first change
detected, and then delay a few mS till the next polling. After all, if a
change is detected, we can be fairly sure someone is cranking the spindle.
What we don't want is that a single crank, so to speak, is interpreted as
multiple ones. By the way, I have no problems with the pushbutton which is
on the same spindle as the encoders. Just detect the release (which means a
0>1 transition), wait 5mS and check again to be sure, then process.
Bummer that I need to wait until the weekend, on my way for the boss...

Jan Didden

{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...