Hello!
I'm using rotary encoders in my arduino project and I have some questions.
I noticed that rotary encoders have 5 pins (A B COM VCC SW) but in PC mouses there are only 3 pins (A B COM). I know that SW is for the push button so mouses don't need it. But why is there a VCC? I wired the mouse encoder as COM to GND, A and B to digital inputs and to 5V with a 10k resistances. Why is it separated on the 5 pin one?
Furthermore, in the mouse encoder, there is a physical object which is making that clicking noise, and with the proper code, 1 step is 1 click. At the 5 pin encoder which can rotate infinitly, what is defining what is 1 step exactly? Maybe, with a 3D printed knob, is it possible to make it clicky? I want it becuse the physical steps are too small for the mouse encoder.
There are many types of rotary encoders so one answer does not fit all. What exact encoder do you have? Post a link to where you got it or technical data for the encoder.
Encoders likely provide a kind of "home signal", a zero position. The mouse system doesn't use that. Look at the computer screen when it's just turned on. The cursor/mouse pointer can be just any ware. You move it into controlled areas.
That type of rotary encoder is basically 3 switches. 1 on the push switch and 1 each on the A and B outputs. Your mouse encoder uses a slotted optical encoder so is very different. So you wire the encoder as you would switches with pullup resistors on the outputs. On a bare encoder, like above, I use the internal pullups in the processor. The encoders on the small PC boards have the pullup resistors on that small board so needs to have Vcc for those pullups.
The breakout board attached to the encoder only adds 10K pull-up resistors connected from Out A, another from Out B, and a third from Switch each connected to VCC otherwise the encoder is the same without the breakout. If you provide your own "Pull-Up" power to Out A, Out B, and Switch, the encoder and Switch will short them to the ground as it rotates giving you the pulses needed.
Z