Electrical – Mouse Wheel Rotary Encoder … encoding wrong

componentsdebuggingencodermouserotary

OK, guys – I'm pretty confused here.

I bought a cheap wireless mouse to gut and use in a project. Right now I'm trying to get the rotary encoder behaving, but (while it IS behaving) it's behaving oddly. If we call the pins 1, 2, and 3, in the mouse circuit board, 1 is joined in a solder blob with the casing, and that's all tied to +3v. 2 and 3 and hooked to individual pins on the IC.

I'm trying to figure out the pattern for the encoder so I can detect which way it's spinning, but that's where I'm getting confused. If I measure the resistance between 1 and 2, it alternates every "click" of the encoder/mouse wheel. However, when I measure the resistance between 1 and 3, it toggles the exact same. The resistance between 2 and 3 toggles the exact same as well. I would I expect one of the pins to be "on" for 2 clicks and "off" for 2 clicks to provide 4 unique "addresses" on the encoder, but that's not happening.

rotary encoder circuit board

Am I missing something? Suggestions welcome.

Best Answer

Mice encoder wheels are normally quadrature encoded. The mechanical indents may or may not correspond to a change in the encoded signal.

A quadrature encoded signal normally involves 2 individual outputs. Let us arbitrarily label them A and B. When rotated in one direction A will change state followed by B. After further rotation A will again change state followed by B. If rotated in the opposite direction, B will change state followed by A. Then, after further rotation B will again change state followed by A.

enter image description here

The sensor which drives output A should be 90 degrees out of phase with the sensor which drives output B. However as long as the two sensors are at different locations (angles) this quadrature encoding scheme should work.

Knowing this, we can devise a logic circuit (or the equivalent in software) to determine in which direction the encoder wheel is rotating and how far it rotated.