What's causing this weird quadrature signal from my rotary encoder?

Thread Starter

Involute

Joined Mar 23, 2008
106
I'm using an ordinary, inexpensive, mechanical, incremental rotary encoder from Amazon. I'm pulling the outputs to 5V via the included resistors, so they're normally high (at the detents), and get switched to GND in between the detents. When I twist the knob, I get the signals in the attached photo. What's causing that weird half-step up and down at each transition?
 

Attachments

ebp

Joined Feb 8, 2018
2,332
It appears that the resistors are being connected in series with one end to +5V, the other to 0V and the midpoint to the output. How this could happen is beyond me. When you say the resistors are "included" what do you mean - part of the actual encoder or simply supplied with it? Can you post a link to the encoder?
 

ebp

Joined Feb 8, 2018
2,332
I don't know where the obsession with black solder mask comes from. Unfortunately, I can't even start to see how the circuit is arranged. The signal labels make no sense to me and I wonder what R1 was intended for. Typically I would expect labels like A, B, Index (index is "home" position)

I recommend looking at each pin of each resistor with your scope to make sure one end of each is properly staying at +5V (or confirm with an ohmmeter). I just can't see any way of getting output levels of half the supply voltage unless the resistors get connected as I suggested previously.
 

Thread Starter

Involute

Joined Mar 23, 2008
106
I don't know where the obsession with black solder mask comes from...
Thanks for checking it out anyway. I’ll be away from the lab for a couple of days. I’ll jump back in when I get back and post what I discover for the benefit of anyone else who uses these.
 

Thread Starter

Involute

Joined Mar 23, 2008
106
The ad does not specifically state they are quadrature output, as far as I could tell.
I was just assuming, based on the device and the waveforms, which are almost quadrature. It’s hard to see why they would want it to work the way it appears. Maybe a problem with my wiring, but I’m just connecting directly to the 5 pins.
 

philba

Joined Aug 17, 2017
959
Just a guess but the contacts may have a "no connection" state. Resistors are voltage dividers that take over when there is no connection. If you take the high and intermediate states together, it looks like traditional gray code Qencoding. I'd guess that you could use the encoder by looking for zero and not zero.

I'm not sure why unless the encoder mechanicals are super cheap. Or perhaps it's an attempt to do debounce (though how escapes me ATM).
 

Thread Starter

Involute

Joined Mar 23, 2008
106
The half step is right in the middle, 2.5V. That’s not a reliable signal, so I’m not sure how the system would interpret it.
 

LesJones

Joined Jan 8, 2017
4,174
I have found this link to the data sheet. The A phase seems to be marked CLK and the B phase is marked DT. Can you show us how you have them connected up. I don't see how they are producing the waveforms in your picture.
Edit. I see Max has beat me to it by two minutes.

Les.
 

ebp

Joined Feb 8, 2018
2,332
I've never designed with such encoders, only the "industrial" quadrature type, so I don't know what is available.
I can conceive of ways to make a low-resolution mechanical encoder such that one output is "direction" and another "clock." I wonder if perhaps the board was designed for one type and has been built with a different type.

Just looked at a datasheet for one from Alps. Going CCW the pins are A, C, B, E, D, which opens up lots of possibilities for errors.
 

Thread Starter

Involute

Joined Mar 23, 2008
106
Thanks for the data sheet links. I’ll check my wiring when I can pick this up again Tuesday. I understood CLK and DTK to be the phases but that doesn’t mean I hooked them up that way. ;-)
 

be80be

Joined Jul 5, 2008
2,072
middle, 2.5V. is where it changes from CLK to DT

It works fine using arduino encoder library

It's not a defect it's them 2 resistors theres 3 pins on a disks
the CLK and DT are pulled up with a 10 k

When one of the DT or CLK are not on the disk you'll get the 2.5 volt reading for maybe a uS or 2 in nomal use slow turning maybe longer

If they had used one resistor on the 5 volt you would not have that show up.
 
Last edited:

philba

Joined Aug 17, 2017
959
The posted waveform makes absolutely no sense when considered with the datasheet. Something is not right. If wired correctly, the A and B outputs can only have 2 states - +5V and 0V/Gnd. Is the encoder assembly exactly as represented in the datasheet?
 
Top