0
\$\begingroup\$

I am trying to design a keyboard and have come across the realization that the datasheet for my rotary encoder asks for 5k resistors connected to terminals A and B of the encoder.

However I am having trouble understanding how the encoder should be wired.

  1. Should the terminals be connected to power as well as specific pins like this?

Terminals connected to VCC

  1. Or would the pins provide the power for the terminals and all I have to do is connect the resistors to the wire connected to the pins?

Terminals connected directly to pins

The datasheet schematic for the component is:

Datasheet schematic

The micro-controller I am using is the AT90USB646-AU in case that is some info that is needed as well.

\$\endgroup\$
  • \$\begingroup\$ I hope you have a debouncer. \$\endgroup\$ – DKNguyen Jul 13 at 4:34
  • 1
    \$\begingroup\$ if you turn on the AT90USB internal pull-ups you won't need the pull-up resistors. \$\endgroup\$ – Jasen Jul 13 at 7:44
2
\$\begingroup\$

If the schematic is to be believed, that encoder has mechanical switches. That means that it doesn't need to be powered -- you just need the pull-up resistors so that when an encoder switch is open, the corresponding pin is high.

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ No active components inside so no dedicated power terminal needed. \$\endgroup\$ – DKNguyen Jul 13 at 4:33
  • \$\begingroup\$ So it would be wired like the second image then? \$\endgroup\$ – Cisco Jul 13 at 15:08
  • \$\begingroup\$ No, like the first image. It's just a pair of switches. How would you connect a plain old switch as an input to your micro? \$\endgroup\$ – TimWescott Jul 13 at 20:05
1
\$\begingroup\$

The encoder is literally a mechanical switch (or 3 switches if you prefer- the two phased encoder switches and the independent push switch). Here is what is inside one of them:

enter image description here

The inner two fingers are connected to the center terminal. The outer bifurcated fingers go to the two outer terminals.

Not shown is a dome contact that bridges the two inner concentric contacts when the shaft is pressed.

Here is the rotating part:

enter image description here

There is a spring detent mechanism that lines up the contacts (something like 20 detents per 360° on this one).

So it needs no power, the pullup resistors give you a 0/5V signal which your MCU needs to read (and debounce, and interpret as a count).

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ So the 2 5k resistors basically function as a buffer until the encoder essentially "shoots" out the full 5V signal? \$\endgroup\$ – Cisco Jul 13 at 15:10
  • 1
    \$\begingroup\$ The resistor pulls the input to +5 when the switch is open, when the switch closes it shorts the input to ground (0V). \$\endgroup\$ – Spehro Pefhany Jul 13 at 16:50
0
\$\begingroup\$

The schematic you show from the datasheet clearly shows resistors connected from the encoder output pins to +5V. They are pull-up resistors used to ensure that the encoder outputs will be seen has a logic High by following logic inputs when the switch is open.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.