# Digital Rotart Encoder -- Broken? Or am I misunderstanding how it works?

Hi,

I apologize if this seems like a fundamental question, but I feel like I'm missing a fundamental understanding about digital rotary encoders, because none of my basic encoders are working as expected.

These are the encoders I'm working with. Link to Encoders

Based on my fundamental understanding of an encoder, it's basically like a double switch that are 1/4 cycle out of phase. At times, 1, 2, or 0 of the encoder pins will be connected to the base pin.

Given this, it seems like the resistance between pins should be either 0 or INF? Correct? Depending on the current position of the encoder?

If the multi-meter was showing 0 resistance (closed switch), and if I move the encoder two clicks, then it should show INF resistance from pin 1 and base, correct?

I'm losing my hair becuase I have several encoders all acting the same way....always showing INF resistance between pins ALL THE TIME.

Please show me what I'm doing wrong.

NOTE: I'm currently hooked up the the pins on the side with 3 pins. Pin 1 and 3 are encoder pins and Pin 2 is the base pin.

With most encoders there is a full cycle of pulses between any two "clicks" or detents of the encoder. So if you measure a certain state and then click it two clicks in any direction you should still be in the same resting state. Put a scope on it or use Arduino to give you the pin states as you turn it. You'll see them changing between the clicks.

Whoa! If this is true, I definitely have this all wrong.

So, in my own words: In a single click, the entire cycle (A HIGH, B HIGH, A LOW, B LOW) will occur. ??

Do you have any websites or videos that talk about this? I don't understand how I missed this for so long.

A great link and very interesting but it doesn’t quite confirm my question.

"So, in my own words: In a single click, the entire cycle (A HIGH, B HIGH, A LOW, B LOW) will occur. ?? "

You mention returning to HH or LL, but you also say you don’t record unless you reach HH or LL, so you may only be recording a “turn” every other click. Or twice in the same click!? (Clearly I’m confused)

cocytus:
I'm losing my hair becuase I have several encoders all acting the same way....always showing INF resistance between pins ALL THE TIME.

The really bad thing about some of these sources of information is --- they talk about switching. But what people really want to know is.... what do we need to add to make them work? Eg..... do we wire a pull-up resistor to pin A, and another pull-up resistor to pin B? And the common (C pin) gets wired to ground..... so that when the grounded C pin touches pin A or pin B, then the voltage on pin A and/or pin B will either be at a high level or a low level (which can be monitored or measured).

...it appears that all of the grey-coloured regions on the outter circle should be connected to pin A. While all the grey-coloured regions on the inner circle should be wired to pin B.

cocytus:
A great link and very interesting but it doesn't quite confirm my question.

"So, in my own words: In a single click, the entire cycle (A HIGH, B HIGH, A LOW, B LOW) will occur. ?? "

You mention returning to HH or LL, but you also say you don't record unless you reach HH or LL, so you may only be recording a "turn" every other click. Or twice in the same click!? (Clearly I'm confused)

I've used a great many encoders for human input as jog wheels and other such and just about every one I've ever dealt with was like that. Each transition gives you a quarter of a detent.

It actually makes it easier to use for human interaction like that because usually in that situation what you really want is "one click per click" if you get my meaning. So you don't have to watch both pins with an interrupt, you can interrupt on only one pin in only one direction and read the other pin only once and get the direction and update whatever variable you have by 1.

For example, look only for pinA going high to low. When it does, read pinB and if it is high then the encoder is spinning one way and if it is low it is spinning the other.

Thank you, I think we are on the same page.

Delta_G:
Each transition gives you a quarter of a detent.

^^^ As in four pin transitions per click? Or a full cycle per click?

cocytus:
Thank you, I think we are on the same page.

^^^ As in four pin transitions per click? Or a full cycle per click?

Yes, that is exactly what I've said and others have said more than once. If you still don't believe us then get out a scope and check for yourself. Or you can even use Arduino to look at it if you get creative.

Thank you guys a bunch. I'll work with this.

CHEERS!

"So, in my own words: In a single click, the entire cycle (A HIGH, B HIGH, A LOW, B LOW) will occur. ?? "

The "clicks" or detents are not the same as the 4 state quadrature cycle. There are encoders available with no clicks per cycle, 1 click per cycle, 2 clicks per cycle and 4 clicks per cycle.

The reason the detents are not once per transition is because it would be much harder
to manufacturer to that precision (guaranteeing exactly one transition per detent requires
careful alignment of contacts and detent, good concentricity of the shaft and switch, etc etc).

These days if you can use cheaper hardware and make up for it in the software/driver, you
do so - hardware incurs per-unit cost, software is a one-off cost.